Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!uunet!tut.cis.ohio-state.edu!uc!cs.umn.edu!thelake!steve From: steve@thelake.mn.org (Steve Yelvington) Newsgroups: comp.sys.atari.st.tech Subject: Re: Re: Sozobon asm Message-ID: Date: 13 Sep 90 14:12:42 GMT References: <18420003@hpsad.HP.COM> Lines: 61 [In article <18420003@hpsad.HP.COM>, randyh@hpsad.HP.COM (Randy Hosler) writes ... ] > I need some help with a problem. The following source fragment is for > MEGAMAX C. I'm trying to compile it with Sozobon and it barfs on this > asm code. Could some kind soul show me how to get Sozobon to accept > this code. The var 'program' is a pointer to char. > > thanks alot, Randy > > ------------------------------------------------------------------------ > asm { > movem.l A6-A4,-(A7) > move.l program,-(A7) > jsr 0x32(program) > move.l (A7),program > jsr 0x88(program) > move.l (A7)+,program > movem.l (A7)+,A4-A6 > } > ------------------------------------------------------------------------ I'm not sure what this fragment does, but.... Embedded assembly isn't a defined feature of the C language -- it's implementation-dependent. Sozobon was written to be compatible with Alcyon C, which uses this syntax: asm("mnemonic arg1,arg2"); Sozobon & Alcyon also prepend an underscore to C identifiers to avoid collisions with labels used in pure assembly modules. Thus your asm fragment would look like this, assuming "program" is defined in your C code as "char *program" or the equivalent: asm("movem.l A6-A4,-(A7)"); asm("move.l program,-(A7)"); asm("jsr 0x32(_program)"); asm("move.l (A7),_program"); asm("jsr 0x88(_program)"); asm("move.l (A7)+,_program"); asm("movem.l (A7)+,A4-A6"); A7 also may be referred to as "sp" (for stack pointer). Beware that some code prepared for Megamax/Laser C may contain capitalized asm mnemonics, etc., that Sozobon won't like. Another way to port this code would be to write the function in assembly and include the .S file in the command line to CC.TTP. Also, Tony's optimizer chokes on some weird assembly language, notably anything having to do with Line A. Such modules have to be assembled separately into .O files, then linked, as in: cc -o test.tos test.c fubar.c linea.o -- Steve Yelvington up at the lake in Minnesota (moving soon to Marine on St. Croix) steve@thelake.mn.org plains!umn-cs!thelake!steve