0 Members and 1 Guest are viewing this topic.
CALL Appvarstartcall ; These 3 lines just set HL to the Hi-Score, so that it's now at the adress of the 2-byte score. LD B, 23 ; "B" is just how many times I want to inc hl to get to the right adress. For exemple's sake I use 23 here. CALL lookup ; INC HL a couple of times to get to the right adress... ld D, (hl) ; Load the most significant bute in D inc hl ; inc HL to get to the adress of the least significant byte ld E, (hl) ; And load the least significant byte in E. ex DE, HL ; Put DE in HL so the next line works :P b_call _DispHL ; It should show the stored hiscore now, exept that it doesn't. "D" seems to be a bit off. .........rest of stuff.......Appvarstartcall: ld hl, "NameOfTheAppVar" rst 20h bcall(_chkFindSym) inc de inc de ex de, hl retlookup: inc hl djnz lookup ret
Score .equ AppBackUpScreen CALL Appvarstartcall LD B, 23 CALL lookup ld D, (hl) inc hl ld E, (hl) LD HL, (score) ; Score is the current score, to be compared to the previously stored hi-score. or a sbc hl, de add hl, de CALL p, NewHiScore ; if "Score" > Hiscore, store it. ........rest of script........NewHiScore: ; Basically store "Score" at the given adress. CALL Appvarstartcall LD B, 23 CALL lookup LD DE, (score) ; score is the "new" number to store. It can hold any value between 0-9999 LD (HL), D inc hl LD (HL), E ret
LD A, 0 LD (score), A
Hmm, I don't entirely follow your code.It would be easier to debug if you posted the entire code and a binary.