A89: Re: Re: ASM to C and vice versa


[Prev][Next][Index][Thread]

A89: Re: Re: ASM to C and vice versa




thanks; I'm starting to make a platform game for the TI-89(then port to 92),
and I quickly realized that C alone isn't fast enough to get a game good. So
I'm going to make most of the generic routines in C, then do the time
consuming stuff in ASM then prototype it in C. Seems like the best way to
get the most power out of C/ASM.... I haven't seen a GREAT TI game written
purely in C, such as Street Fighter II or Mario(I mean techincally great,
everyone is entitled to how great they play), I think because alot of times
you cant beat ASM!
----- Original Message -----
From: "Olle Hedman" <oh@hem.passagen.se>
To: <assembly-89@lists.ticalc.org>
Sent: Wednesday, September 13, 2000 2:40 AM
Subject: A89: Re: ASM to C and vice versa


>
> If your routine doesn't need any parameters you could just put "xdef
> yourroutine" in the top of the asm file, and then compile it to a .o file
> with a68k, then you declare it in your C-file as  "external void
> yourroutine();" and then you can use it as any other C-routine.
> You also have to specify this .o file in the linking.
> I think that IDE that comes with new versions of ti-gcc (or if it is the
> other way around) has some feutures for makeing this easy.
> If you want to have parameters to your asm-routine, you'll have to
> communicate theese on the stack. (you declare your function as "external
> void myroutine(int param1, int param2);" or whatever, and then make your
> asmroutine read the params from the stack)
> You also _always_ have to save d0-d2 and a0-a1 if you change theese, and
> restore them before the routine returns.
>
> the other way around should work nice if you just compile the c-file as
> normal, to an .o-file and in your asm-file put "xref yourroutine" (note
the
> difference between xref and xdef)
> Then you let the linker put the programs together, just like before.
>
> you can also share variables between the asm code and the c code with xdef
> and xref.
>
> ///Olle
>
> ----- Original Message -----
> From: "Josh 'Gage'" <antgage@apk.net>
> > Anybody here know how to make C recognize an asm function? here's a
> quickie
> > example:
> >
> > line.asm
> >
> > \DrawLine:
> >         move.l         LCD_MEM,a0            ; Move LCD memory into a0
> >         move.w        #3,d0                          ;  Move #3 into d0
> >         ext.l               d0                                ; clear d0
> >         mulu.w        #30,d0                           ; multiply by 30
> for
> > offsetting
> >         add.l            d0,a0                           ; Add Offset to
> > LCD_MEM
> >         move.w        #LCD_LINE_BYTES-1,d1    ; Loop Counter == Screen
> > Length -1
> > \loop:
> >         move.b        #$FF,(a0)+                ; set byte on screen,
> > advance to next row of bytes
> >         dbra.w        d1,\loop                        ; loop until
counter
> > == -1
> >         rts                                                    ; return
> from
> > subroutine
> >
> > in C how can I do the equivalent of:
> >
> > int _main(void)
> > {
> >     DrawLine();
> > }
> >
> > also, if anyone knows how to make asm recognize a user made c
function(all
> > ive seen are tios functions), lemme know if you would ;D
>
>
>




References: