[A89] Re: a68k vs as (linking problems)


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

[A89] Re: a68k vs as (linking problems)




Out of curiosity, which version of TIGCC Linux do you use? Are you using
the most recent version (0.94 beta 18 r5) from
tigcc.ticalc.org/linux.html?

Also, how do you compile and link the program, because I did it on a
Linux box and it worked fine once I made the changes.

If you had the file random.asm

   xdef    _ti89
   xdef    _nostub

AMS_jumptable  equ $C8
memcpy         equ $26a
ScreenClear    equ $19e
DrawStr        equ $1a9
ngetchx        equ $51
sprintf        equ $53

   movem.l    d3-d7/a2-a6,-(sp)
   move.l     AMS_jumptable,a5

   lea        -3840(sp),sp  ; buffer
   pea        3840    ; 2 bytes
   pea        $4C00    ; 4 bytes (address)
   pea        8(sp)    ; 4 bytes (address)
   move.l     4*memcpy(a5),a4 ;
   jsr        (a4)    ; memcpy(buffer,$4C00,3840)
   jsr        _main
   pea        3840    ; 2 bytes
   pea        16(sp)    ; 4 bytes
   pea        $4C00    ; 4 bytes
   move.l     4*memcpy(a5),a4 ;
   jsr        (a4)    ; memcpy($4C00,buffer,3840)
   lea        3864(sp),sp
   movem.l    (sp)+,d3-d7/a2-a6
   rts

_main:
   link.w     a6,#0

   move.l     4*ScreenClear(a5),a4 ;
   jsr        (a4)    ; ClrScr()

   bsr        rand
   lea        -30(sp),sp
   move.w     d0,-(sp)  ; 2 bytes (word)
   pea        string    ; 4 bytes (address)
   pea        6(sp)    ; 4 bytes (address)
   move.l     4*sprintf(a5),a4
   jsr        (a4)

   move.w     #1,-(sp)  ; 2 bytes (word)
   pea        12(sp)
   move.w     #0,-(sp)  ; 2 bytes (word)
   move.w     #0,-(sp)  ; 2 bytes (word)
   move.l     4*DrawStr(a5),a4
   jsr        (a4)

   move.l     4*ngetchx(a5),a4
   jsr        (a4)

   unlk       a6
   rts

string:
   dc.b       "random: %i",0

_ti89
_nostub

and did 'tigcc random.asm', it links into random.89z and runs for me.

Are you using tigcc front-end, or are you doing
a68k -g -t random.asm
... something else....

??


John David Ratliff
jdratlif@cs.indiana.edu


-----Original Message-----
From: assembly-89-bounce@lists.ticalc.org
[mailto:assembly-89-bounce@lists.ticalc.org] On Behalf Of R.A.
Sent: Wednesday, August 21, 2002 6:45 PM
To: assembly-89@lists.ticalc.org
Subject: [A89] Re: a68k vs as (linking problems)


At 23:59 -0500 20/8/02, John David Ratliff wrote:
>I noticed you often replace jbsr on as with bsr. This is not always
>possible. I changed bsr's to rom calls to jsr, and included OS.h and
the
>program compiled and ran. Here is my changes...

[snip]

>Although, I would just learn GNU as syntax. It's not that different,
and
>it's much more advanced in optimizing your code than a68k is. Just a
>suggestion though...
>
>Hope this helps,
>
>John David Ratliff
>jdratlif@cs.indiana.edu

thanks for the info, but it did the same: crash the calc. I think the 
problem is the linking step.
I know GNU as is more advanced in optimizing, but the syntax is 
really dumb (I don't see why you have to put '%' in front of each 
register, when the context says it all, besides, a68k syntax is 
cleaner and looks much nicer ^_^)... but apparently is the only 
option I have. I'm getting really close to the deadline of my 
assignment. Looking it again, GNU as has some benefits, like those 
jxx pseudo-ops, but I still hate the % stuff... :P
thanks,
ra.-






Follow-Ups: References: