Re: A85: scoring


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

Re: A85: scoring



At 11:33 AM 10/30/97 -0500, you wrote:
>> 	Could some tell me how you store permanent variables, like for a
>> scoring option.  This is an important element that I am missing from my
>> games.
>
>  Basically, you have a location within your program which you store to.
>If you had a label hiscore, you could say 
>  ld hiscore, A
>to store it, and get it back next time with
>  ld A, hiscore
>though it's just as fast to always use the permanent location, and never
>keep it in temporary memory at all.  This is because everything on a TI
>is kept in memory; there's no disk drive that stuff is stored on when it's
>not in use.

Of course, you would want to be sure to dereference the memory:
  ld (hiscore),a
  ld a,(hiscore)

And don't forget that this will also vary slightly by OS.
For ZShell you must add the program address to the location:
  ld de,(PROGRAM_ADDR)
  ld hl,hiscore
  add hl,de

  ld (hl),a
  ld a,(hl)

For usgard you simply add an ampersand (&) to the address 
  ld (&hiscore),a
  ld a,(&hiscore)

For rigel you needn't add anything (generally)
  ld (hiscore),a
  ld a,(hiscore)

And, as mentioned before, be sure to change the ZS_BITS (or OS equivalent).

Dewey


References: