A82: Re:
[Prev][Next][Index][Thread]
A82: Re:
At 01:53 AM 12/31/97 PST, you 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:
#include "ti82.h"
.ORG START_ADDR
>money = TEXT_MEM
>GetMoney:
> ROM_CALL(CLEARLCD)
> ld a,0
> ld (CURSOR_ROW),a
> ld (CURSOR_COL(ma
ld (CURSOR_COL),a is what I think you meant to put here
> ld hl,Level
Where is this in your program or did you not put it in?
> ROM_CALL(D_ZT_STR)
> ld hl,10000
> ld (money),hl
> ld b,1
>
>DisplayMoney:
> ld a,1
> ld (CURSOR_ROW),a
WARNING: Update CURSOR_COL also or the screen will get screwed up.
> ld hl,(money)
> call GET_KEY
> cp G_UP
> call z,MoreMoney
> cp G_DOWN
> call z,LessMoney
>
> jr z,Next
> jr Display Money
jr DisplayMoney ; NOT jr Display Money
WARNING: DisplayMoney function doesn't display anything!
>
>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
WARNING: Compiler error on this line...can't use less than 5 letters
WARNING: Internal variable/location "Cant" doesn't exist
> ROM_CALL(D_ZT_STR)
> call GET_KEY
> ret z
> jr NoLower
ERROR: Infinite loop! No flags are set/reset from a call to GET_KEY!
NOTE: Create a smaller loop or you will have a ton of flicker/snow
>
>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?!?!
You need to send us the whole source for us to successfully debug it. I
can tell by just skimming it that you didn't send major sections of code.
I have shown you several possible errors that exist from what you have
shown us. Send the entire source and we can debug it or else you are
pretty much on your own.
Thomas J. Hruska -- thruska@tir.com
Shining Light Productions -- "Meeting the needs of fellow programmers"
http://www.geocities.com/SiliconValley/Heights/8504
http://shinelight.home.ml.org
Spam-Fighter code is: 14806560 (New technique to fighting spam)
Enter "Spam-Fighter: XXXXXXXX" in the body of a personal message
to thruska@tir.com. Otherwise the message will be filtered as spam.
References: