A82: ASM source file


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

A82: ASM source file




>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

**You should use XOR A to clear A

>  ld (CURSOR_ROW),a
>  ld (CURSOR_COL(ma

**I think this is a "ld (CURSOR_COL),a", so instead maybe you should do:
  ld  hl, 0
  ld  (CURSOR_POS), hl

This would do the exact same thing

>  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

**Here is your biggest problem...  "call GET_KEY" will set HL to $8000...  To fix
this, you should place the "ld hl, (money)" after the "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

**This should be "ld (CURSOR_POS), 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?!?!

Fix those problems and it should be fine!

                                     -- CrASHman



Free web-based email, Forever, From anywhere!
http://www.mailexcite.com