Re: LZ: variables


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

Re: LZ: variables



On Tue, 30 Jul 1996, David Kristensen wrote:


> At 03:17 PM 7/29/96 -0400, you wrote:
>
> >You use rst 10h, which will find variables in memory.  I am working on a
> >program that uses variables, but I've been unable to get anything working.
> >I think the following code works; if it doesn't, someone please tell me
> >what's wrong.
> >
> >	ld de, (PROGRAM_ADDR)
> >	ld hl, VarStruct
> >	add hl, de		;get absolute address of VarStruct
> >	rst 20h		; move ten bytes from (hl) to search buffer
> >	rst 10h
> >	; rest of code goes here...hl should hold address of variable
> >
> >VarStruct:
> >	.db 0,7,"varname "	;real number named varname
> >
> >
> >	-Shmuel
> >--
> ><a href="mailto:shmuelp@poboxes.com">mailto:shmuelp@poboxes.com</a>     http://www.netforward.com/POBoxes/?shmuelp
> 
> 
> Ok, I have a few questions on this one. Is there a list or some help files
> on these rst instructions? I have personally never used them or even known
> what they do. They might be in ti-ram or ti-rom.txt, but if they are I don't
> think that they work with roms 9.0 or above (since I have 9.0...would it
> even work on my calc? That does bring up a portability problem if not).
> Also, what is the VarStruct format - I assume varname is the name of the
> program, 7 is the type of variable-real, string, whatever-but what's the 0
> for? Also, how would you use this address, then? Could you first define some
> data, then jump to the other program using the absolute address? If so, when
> you returned from the program, it would go back to zshell, right? (It
> should, but I don't know for sure, so...)
> 
> David Kristensen at the University of Missouri - Kansas City
> dkristensen@cctr.umkc.edu
> 
> The Mind conquers All...


The rst instructions are documented in ti-rom.txt, but they should work on
any rom version.  For example Tiles uses them, and tiles does work on my
rom 9.  Here's how ti-rom.txt explains it:
> ---- RST 10 (CALL 2715) ---- Search for variable by name 
> --------------------
> Input:  (8082) = Variable type to find
>         (8083) = Length of variable name (1-8)
>         (8084) = Actual name of variable (8 bytes long, padded with 
> anything)
> 
> Result: Success: CF clear
>                  A = (8082) = Type of the variable found
>                  C = 0
>                  DE = Address of variable
>                  HL = Address of VAT entry for variable
> 
>         Failure: CF set
> 


...


> ---- RST 20 (CALL 2151) ---- Move 10(d) bytes from (HL) to
> (8082)-----------
> Used to move string name into search buffer.


The numbers for the variable types can be found in "Hacking the TI-85
calculator" by David Boozer, and Rob Taylor's guide to variable storage,
both of which can be found on ticalc.org.


	-Shmuel
<pre>
--
<a href="mailto:shmuelp@poboxes.com">mailto:shmuelp@poboxes.com</a>     http://www.netforward.com/POBoxes/?shmuelp
</pre>


References: