Re: A85: score


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

Re: A85: score




i think your problem might be with how the z80 stores words in memory.
the z80 uses the little endian convention, meaning that the low byte
goes in the lower address, the high byte goes in the high address.  so
if you do this:

Score = $80EF		;2 byte text mem variable

  ld hl,$0123		;h = $01, l = $23
  ld (Score),hl		;(Score) = $23
			;(Score+1) = $01
;low byte in reg. l goes in low address
;high byte in reg. h goes in high address

  ld a,(Score)
  ld l,a
  ld a,(Score+1)
  ld h,a			;hl now has original score

-mike pearce

On Mon, 27 Apr 1998 22:32:34 -0500, you wrote:

>
>Greetings,
>        I am having a problems trying to implement a score feature that
>keeps track of scores 0-65536.  So far all that I have suceeded in doing
>is 0-255, and that's no fun.  I think that I have isolated the problem.
>Whenever I start the game and it displays the high score (stored in perm.
>memory at (hiscore) ) it says that the high score is something like 48000
>something.  Everything else works like the score incrementing 0-65536.
>        Is there a way to reset what is at this memory to 0 without
>reseting
>the high score to 0 every time it is ran?  Or am I just displaying it
>wrong
>with D_HL_DECI ?  Please help me.  BTW: It's zshell not usgard
>                                                - Mike
>                                        


References: