TIP: Click on subject to list as thread! ANSI
echo: aust_c_here
to: Paul Edwards
from: Ian Binnie
date: 1996-04-29 13:21:26
subject: C Compiler

PE> Is it possible to use assembler and pacific c?
 
 Pacific has an inbuild assembler. It can be used direct, but it is much
easier to use it through the command line compiler or integrated
environment (just include the .as file in project).

The bad news is that the assembler uses a custom syntax, and the object
format is also proprietary. This enables the compiler to produce very
fast compact code but...

I have written a program ASMTOAS which does most of the hard work in
converting .ASM to .as. I can download a copy to your BBS if you like.
I have put your code through this and included it below.

There are a few things needed to complete the conversion, mainly the
signature. The easiest way to do this is to generate some prototype C
code then use the "Compile to AS" option to get the needed code e.g.

void delall(char * direct)
    {
    ...
    }
    
produces the following:-

	.globl	small_data
	.globl	small_code
    ...
	.psect	_TEXT,class=CODE
	.globl	_delall
	.signat	_delall,4152
_delall:
    ...


Parameter passing can also be a little different (as some are passed in
registers) but this doesn't look like a problem with the following code.

PS I haven't looked at what this code does, but I would have used
intdos() etc as it is much more portable.
____________________________________________________________________
; Written by Paul Edwards and either John Dennis or Jim Nutt or both
; Released to the public domain

;	.model	large

	.psect	text	;

	.globl	_dospause,_dvpause,_winpause,_dvcheck,_kbdhit,_obtkey,_dosavmem


_dospause:	; proc

	int	#28h
	retf	#0	;

; _dospause	endp


_dvpause:	; proc

	mov	ax,#101ah
	int	#15h
	mov	ax,#1000h
	int	#15h
	mov	ax,#1025h
	int	#15h
	retf	#0	;

; _dvpause	endp


_winpause:	; proc

	mov	ax,#1680h
	int	#2fh
	retf	#0	;

; _winpause	endp


_dvcheck:	; proc

	mov	cx,#4445h
	mov	dx,#5351h
	mov	ax,#2b01h
	int	#21h
	mov	dx,#0
	cmp	al,#0ffh
	je	No_Dv
	mov	dx,#1
No_Dv:	
	mov	ax,dx
	retf	#0	;

; _dvcheck	endp


_kbdhit:	; proc

	mov	ah,#1
	int	#16h
	jz	No_Key
	mov	ax,#1
	jmp	kbdfin
No_Key:	
	mov	ax,#0
kbdfin:	
	retf	#0	;

; _kbdhit	endp


_obtkey:	; proc

	mov	ah,#0h
	int	#16h
	cmp	al,#0h
	je	endkey
	mov	ah,#0h	; must use fossil keymap, no scan code if have char
endkey:	
	retf	#0	;

; _obtkey	endp


_dosavmem:	; proc

	push	bp
	mov	bp,sp
	push	es
	push	bx

	mov	ah,#48h
	mov	bx,#0ffffh
	int	#21h
	jc	nomem
	mov	es,ax
	mov	ah,#49h
	int	#21h
	mov	bx,#0ffffh
nomem:	

	mov	ax,bx

	pop	bx
	pop	es
	pop	bp
	retf	#0	;
; _dosavmem	endp

end:	

--- Blue Wave/386 v2.30
* Origin: Sydney PC Users Group Mail Exchange (3:712/505)
SEEN-BY: 50/99 78/0 620/243 623/630 711/401 409 410 413 430 808 809 932 934
SEEN-BY: 712/311 390 407 411 505 506 515 517 535 617 624 704 820 713/306 888
SEEN-BY: 714/906 800/1 7877/2809
@PATH: 712/505 517 515 711/808 809 934

SOURCE: echomail via fidonet.ozzmosis.com

Email questions or comments to sysop@ipingthereforeiam.com
All parts of this website painstakingly hand-crafted in the U.S.A.!
IPTIA BBS/MUD/Terminal/Game Server List, © 2025 IPTIA Consulting™.