A92: How to show EXPR variables...
[Prev][Next][Index][Thread]
A92: How to show EXPR variables...
Hello,
I endly had time to write a text file which explains
how we can show the contents of EXPR files
on a TI-92+/TI-89.
I will put it on ticalc I soon as I can.
I also send a new and better exprview plugin for PCT98.
Bye
Benoit SCHERRER
--------------------------------------------------------------------
HOW TO SHOW EXPR VARIABLES
on a ti-92+/ti-89
--------------------------------------------------------------------
by Benoit SCHERRER, NeXO Software
e-mail : p.c.scherrer@wanadoo.fr
--------------------------------------------------------------------
I am proud of announcing that I found how to show the contents
of EXPR variables from an assembly program on a TI-92+ (It
should also work on a TI-89).
I. THE TI-92+ ROM :
-------------------
I found in the TI-92+ ROM the following code :
( in a 1.01 ROM )
515A92 move.w d5,(a7) ;push the handle of the file
515A94 jsr $49BBCC ;Call a ROM function 1
515A9A move.l a4,(a7) ;a4 was already the end of the EXPR
;var, pointing to the EXPR signatur
515A9C jsr $4CCE36 ;Call a ROM function 2
515AA2 move.w #$0,(a7) ; ?
515AA6 move.w #$1,-(a7) ; ?
515AAA move.l $76FC,-(a7) ;At $76FC there is the address of
;memory where the EXPR file has been
;duplicated by the previous ROM function
;(in a stack frame ?)
515AAE jsr $466A70 ;Call the most important ROM function
515AB4 addq.l #6,a7
The $466A70 ROM call creates a buffer where it put the decoded
contents of the EXPR file. The handle of the buffer is returned
in d0.w ( null if it failed ). The function also returns in a1.l
the address of the buffer -2.
Don't forget that the buffer MUST be deleted after its use with
HeapFree.
II. HOW TO IMPLEMENT OUR FUNCTION
---------------------------------
For compatibility reasons between ROM versions, we can't make an
assembly program with static ROM addresses.
Hopefully the TI-92+ and the TI-89 have a ROM functions table
which is filled with the addresses of most important ROM functions
offers by those calculators. To get the address of the table,
just read the long-word at $0000C8.
For our use, we need 3 ROM functions : the $49BBCC function (on
my calc) seems to be the 154th of the table, and the $466A70
function the 79th of the table. The problem is that the
$4CCE36 function is not in the ROM table. But don't worry, it can
be solve : If you disassemble the $4CCE36 function, you see:
4CCE36: movea.l $4(a7),a1
move.l a1,-(a7)
move.l a1,-(a7)
jsr $4CC910 ;the 266th function of the table
addq.l #4,a7
move.l a0,-(a7)
jsr $4CC7E6 ;the 744th function of the table 479754
addq.l #8,a7
rts
Consequently this function can be made without any static ROM addresses.
The second thing to change is the a4 register. When in the ROM I found :
515A9A move.l a4,(a7)
515A9C jsr $4CCE36 ;Call a ROM function 2
a4 was already the end of the EXPR file for a long time. Therefore we
have to set ourself the register. Since the previous ROM function
called ($49BBCC) returns a1 = beginning of EXPR file -2, we could
write :
move.w 2(a1),d0 ;get size of file
ext.l d0 ;make d0 a long-word
lea 1+2(a1,d0.l),a1 ;address of end of the file
move.l a1,-(a7)
jsr $4CCE36 ;Call a ROM function 2
addq.l #4,a7
Well, If you didn't really understood the previous things,
here is an example of a function which returns in a1 the address
of the decoded EXPR datas :
GetEXPRFile:
move.l $C8,a4 ;get ROM functions table addr
;a4 and a5 are never modified
move.w d0,-(a7) ;Push handle of the file
move.l 154*4(a4),a5 ;154th function of the table
jsr (a5) ;Call ROM function
addq.l #2,a7 ;Pop the stack
move.w 2(a1),d0 ;get size of file
ext.l d0 ;make d0 a long-word
lea 1+2(a1,d0.l),a1 ;address of end of the file
move.l a1,-(a7) ;copy of the $4CCE36 function
move.l a1,-(a7)
move.l 266*4(a4),a5 ;266th function of the table
jsr (a5) ;Call ROM function
addq.l #4,a7
move.l a0,-(a7)
move.l 744*4(a4),a5 ;154th function of the table
jsr (a5) ;Call ROM function
addq.l #8,a7
move.w #0,-(a7) ;?
move.w #1,-(a7) ;?
move.l $76FC,-(a7) ;
move.l 79*4(a4),a5 ;79th function of the table
jsr (a5) ;call function
addq.l #8,a7
;NOW : d0.w = the handle of the created buffer
; null if failed
; a1.l = address of decoded EXPR datas
rts
III. Contact Me
---------------
If you have any question, mail me at :
p.c.scherrer@wanadoo.fr
I will try to answer to all you emails.
You can use all piece of information explain in this text file
totally freely.
I spent a lot of time to discover that. So if you use my method
to show EXPR files, I would be glad that you mention me.
Thanks
Benoit SCHERRER
NeXO Software
exprview.9xz