Re: LF: Stuck with a Mac....


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

Re: LF: Stuck with a Mac....



ngibson@postoffice.ptd.net wrote:

> I have a program called Macintosh Assembly Software, but I have been
> informed by it's author that it would not be able to be used because
> it
> does not support movable code (code the the calc could move while
> running
> the program).
> Any ideas?

   Ok, this one's simple..  you CAN write Fargo code on a Mac, but you
have to convert the files from object code into the Fargo format
yourself (or, of course, write a program to do it).

    Moveable code: this doesn't matter at all.  As long as you use one
address register to point to the beginning of your variable space, and
then access offsets from that pointer.
This is what I do for the Raven debugger, and it works for Mac programs,
Amiga programs, and the Mac OS - so I think it'll work just fine for
Fargo too.  Also, the code for the program won't move while the program
is running!  Only between executions (ie: play game, quit, delete a
variable in TI-OS, and play game again - it may have moved).

start:
    lea    myVars,A6
    move.l #$FEDCBA00,myLong(a6)
    move.w #$2700,myWord(a6)
    pea    myString(a6)
...

; Variable Frame
myLong equ 0
myWord equ myLong+4
myString equ myWord+2
...etc...

myVars:
    dc.l 0      ; Long
    dc.w 0    ; Word
    dc.b "Hello",0    ;String
...

    It doesn't matter if your code moves around between calls, as long
as you set A6 to point to your variables before accessing them, it works
great.  IT ALSO PRODCES SMALLER CODE!!  If you are planning on writing a
speed-critical program, or a large program, this method will make your
code MUCH smaller (two bytes per variable access)!!

Hope this helps fellow mac programers out there.. (I use a pc for
convienience right now, but if there's enough Mac Fargo programmers out
there, we ought to get our tools together)

--Bryan
bcturner@eos.ncsu.edu


References: