Re: A85: scoring


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

Re: A85: scoring



Depends what OS you are using.

For Usgard, the premire OS (heh gotta put that in somewhere, don't I):

; this is for 2 byte score, 0-65535
GetScore:
ld	hl, &score
call	LD_HL_MHL
; hl has your score in it

; have your score in bc
WriteScore:
ld	hl, &score
ld	(hl), bc
; it's saved

; the following are for 1 byters
ReadScore:
ld	hl, &score
ld	a, (hl)
; a has your score

; to write, have score in a
WriteScore:
ld	hl, &score
ld	(hl), a
; score written

With PhatOS, Rigel, and anything with automatic relocation, just lose the
'&' sign.  For Z-Shell, replace the:	ld	hl, &score	with	ld	hl, &score / ld
de, (PROGRAM_ADDR) / add	hl, de

Those should all work, if they don't, I can get them to work for ya.  You
may also want to check out USUL if you want an easier way to program
quicker, in a higher level language.  It supports permenant variables you
can use exactly like normal variables.

At 09:38 AM 10/30/97 -0600, 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.



References: