Re: A85: permanent variables


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

Re: A85: permanent variables




>This is the third time that I am writing here about permanent 
variables,
>or storing a number in the memory.  I have looked at Jimmy M's lessons
>and some parts are pretty mind boggling, dispite the fact that is is 
the
>best lessons out there.  Could some one please tell me how you would
>write to the memory for things like score.  Please explain how you 
would
>store a varible and recall it later.  This would be for Z-Shell, not
>USGARD. I would really appricate it.  Thanks.
>						- Mike


In order to make a permanent variable, you should declare it at the end 
of your program.  Then, to access the variable, you would need to get 
the address the same way you do a string, ie. adding the program address 
to the label. Then, you need to set the appropriate ZShell bit to tell 
it to re-calculate the checksum in your program. I really should write 
you an example, but my 85 asm is very rusty. Perhaps someone else could 
do this for me?

The ZShell bit setting is described in the documentation that comes with 
ZShell, and the other part would go something like this...

LD HL,program_addr
LD DE,HiScore
ADD HL,DE

;HL now points to the high score.
;Write or read to the location contained in HL to change the high
;score. For instance, to read the high score...

ROM_CALL(LD_HL_MHL) ; something like this, should LD HL,(HL)
;now HL contains the high score.

;At the bottom of your program, you should have this:
HiScore:
 .db 0,0 ;or .dw $0000


That assumes you have a max hiscore of 65535 ($FFFF). As to saving the 
initials of the person with the hiscore...there are examples on 
ticalc.org of programs that do this. Download them, and examine the 
source code (thats what they're there for :) )

Good luck!

Anyone else, feel free to correct me, and add anything I missed.

--Retupmoc7


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


Follow-Ups: