Re: A83: Alan J: Highscores.


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

Re: A83: Alan J: Highscores.




Sure!  This might be a little hard to understand because I suck at
explaining things.

...Begining code...

DisplayHiScr:			; Displaying the high score
	ld	hl,XXXX		; Load HL with the place to
display the
	ld	(CURROW),hl	; highscore
	ld	hl,HighScore	; Load current high score in HL
	call	_dispHL		; Display high score

...More Code...

ChckHiScr:			; See if current score is high score
	ld	a,(Score)		; Load A with current score
	ld	hl,HighScore	; Load HL with current high score

...Checking code...			; Do something here like
subtract
				; and if the result is negative then
				; jump to ChngHiScr.  There 

	sub	hl
	jp	n?,ChngHiScr	; Replace ? with negative bit and
	jp	?,????		; ???? with Label

ChngHiScr:			; For changing the High score
	ld	a,(Score)		; Load A with current score
var
	ld	hl,(HighScore)	; Load HL with high score pointer
	ld	(hl),a		; Load current score into High
score

...More Code...

HighScore:
	.db	0		; Keep this 0 or replace with
whatever 				; you want to be the original
high 				; score when the game is first
played

...End Code...

This uses program write back to store the high score back into the
location in the program.  The high score will actually be saved to the
program changeing the actual program.  This is for a 1 byte high score
without initials.  If you want names, initials, multiple high scores, or
2 byte high scores, you will have to modify my code.


On Wed, 29 Jul 1998 23:07:03 +0900 "James Matthews"
<matthews@tkb.att.ne.jp> writes:
>
>Alan (or anyone else):
>
>As you can see, I'm sifting through the old mail, to look for 
>potential
>tutorial material.  I just need a little clarification about 
>this...could
>you perhaps make a small program, or code fragments that show a 
>program
>storing a number to itself, and recalling it...I'm getting confused.
>
>Thanks.
>
>> I can only help you out with one thing, highscores (program 
>writeback). 
>> Just define a byte or word and change it.   For example for a high 
>score
>> from 0-255 do
>> 
>> If you don't understand the below, basiacally, you create a byte 
>using
>> .db or a word using .dw, load that to hl, and use (hl) to store 
>something
>> to the location.  Seeing how difficult it for me to express my 
>ideas, you
>> can see why I'm not making any tutorials. : )
>
>Hehe, that's ok, thats my job :)...
>
>> ; For storing the high score
>> 
>> StoreHS:
>> 	ld	a,(currentscore)
>>	ld	hl,HighScore
>> 	ld	(hl),a
>> 
>> ; This area of the prog would acctually change after you got the
>> highscore
>> 
>> HighScore:
>> 	.db	0		; Or you could use .dw for a 
>higher
>> high 					; score capacity
>
>

_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]


References: