A89: Programming techniques for AMS 2.01


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

A89: Programming techniques for AMS 2.01




I have written a small text file describing what you have to do in order to 
create working assembly-language programs for AMS 2.01 . Modifying existing 
programs sould be fairly simple.

------------------

Creating working programs for AMS2.01 by lexlugger:

I will now present a few techniques that are required to create assembly 
language programs that work with AMS 2.01 . I have noticed that there are 3 
changes that TI made which cause most programs to fail:

1) kbvars was changed again. That means that idle_loop() or any other 
function that uses that variable will fail. Use ngetchx() instead.

2) The _DEREF macro seems to be broken since the location of the 
handle-table changed. Use the HeapDeref() function.

It's C prototype is:

void *HeapDeref(WORD Handle);

3) The VAT changed. Therefore all programs that use it will fail. If you 
have to access variables use the functions SymFindFirst() and SymFindNext(). 
I havent quite figured everything out about these functions but I know 
enough about them to access variables (as LexOS shows when loading 
libraries). I don't know how to create variables using these functions.

The C prototypes are:

SYMBOL *SymFindFirst(LONG, WORD);
SYMBOL *SymFindNext(void);

SymFindFirst() finds the first variable. It returnes a pointer to the 
variable entry which has the following format:

Address		Length		Name

$00		$08		Name
$08		$04		Flags
$0C		$02		Handle

To find more variables you must call SymFindNext(). If it returns NULL there 
are no more variables. In order to find out whether you have a folder you 
must check the flags. If the returned symbol is a variable it is in the last 
folder that was returned.

The arguments for SymFindFirst() are:

SymFindFirst(0x00000000, 0x00A0);

I don't know what these numbers mean so I consider them as magic numbers. 
You must pass these numbers as parameters for the function to work. 
SymFindNext() takes no arguments.

I hope this information helps in writing programs that work with all rom 
versions. Please remember that you should not assume to find things at 
specific memory addresses. Because of that most programs don't work with 
AMS2.01 anymore. If you follow the guidelines above averything should be 
fine.

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com


Follow-Ups: