Re: LZ-Adv: Help with zshell program and crashing


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

Re: LZ-Adv: Help with zshell program and crashing



Mark and/or Esmeralda Lybrand wrote:


> #include "TI-85.H"      ;this is the most current version - I think
> 
> .org 0                  ;Does this tell the calc where the prgm starts?
> 
> .db "Graph a point",0
> 
>         ld a,4
>         out (5),a
> 
>         ROM_CALL(CLEARLCD)
> 
>         ld a,1                  ;these two put a pixel at bit 7
>         ld ($FC00), a           ;of byte 1 of the video mem
> 
> Wait:
> 
>         call GET_KEY    ;I wanted to check the keypad
>         cp 0            ;compare the a reg with 0
>         JUMP_Z(Wait)    ;if zero flag gets set, loop back (no keypress)
> 
>         ret z           ;return to zshell;  (I think my problem is here,
>                         ;but I took this command from another prgm)
> .end
The problem with your program is when you check for a keypress. The
JUMP_Z
jumps if the zero flag is set, if it is not set it continues to the next
instruction. ret z returns if the zero flag is set, but you only reach
this 
place if it is not because of the jump instruction. Try replacing ret z
with
ret. If you do this your program will return every time you reach that
line.


The reason you got all the stuff on your display when you pressed a key
is 
that the program did not exit at the ret z instrunction, and therefore
just 
continued executing random instructions.


The .org 0 tells the assembler to start adress 0. 


<pre>
-- 
_______________________________________


Dines Justesen
Email: dines@post1.com or
       c958362@student.dtu.dk
WWW  : http://www.gbar.dtu.dk/~c958362/
_______________________________________
</pre>


References: