A82: Re:


[Prev][Index][Thread]

A82: Re:




The Weilers wrote:
> 
> I decided to test my program that I was writing, and ran into several bugs.  One I just got rid of the whole thing because it was unimportant, but I need this one.  Here is is:
> money = TEXT_MEM
> GetMoney:
>   ROM_CALL(CLEARLCD)
>   ld a,0
>   ld (CURSOR_ROW),a
>   ld (CURSOR_COL(ma
um, your prob is right here!
ld (CURSOR_COL),a
is what it should be!
>   ld hl,Level
>   ROM_CALL(D_ZT_STR)
>   ld hl,10000
>   ld (money),hl
>   ld b,1
> 
> DisplayMoney:
>    ld a,1
>    ld (CURSOR_ROW),a
>    ld hl,(money)
>    call GET_KEY
>    cp G_UP
>    call z,MoreMoney
>    cp G_DOWN
>    call z,LessMoney
> 
>    jr z,Next
>    jr Display Money
> 
> MoreMoney:
>   ld de,1000
>   add hl,de
>   ret
> 
> LessMoney:
>   ld de,1000
>   call CP_HL_DE
>   call z,NoLower
>   ld bc,1000
>   or a
>   sbc hl,bc
>   ret
> 
> NoLower:
>   ROM_CALL(CLEARLCD)
>   ld hl,$0000
>   ld (CURSOR_ROW),hl
>   ld hl,Cant
>   ROM_CALL(D_ZT_STR)
>   call GET_KEY
>   ret z
>   jr NoLower
> 
> Sorry about the length.  Now, what I wanted it to do was display the line of text to ask for the money, and on the next line print 10000 for starters.  Then after you press up, it was supposed to add 1000 to it, and subtract 1000 if you press down.  However, what it really does is display 1*10^19 and displays some strange numbers, like 285 and a lot of zeros or something like that.  What's going wrong?!?!


References: