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:
> 
> In light of the discussion of plotting pixels and Jimmy Mardell's new
> tutorial on the same, I figured I would see what I could do.  I am new
> to asm programming, but I kind of like seeing how things work on my own
> (yes I am aware of FIND_PIXEL, but I want to make it work without, first
> so that I understand the inner workings of how the pixels are plotted).
>  Anyway, I quickly whipped together the following code and my pixel got
> plotted right where I expected it too.  Unfortunately, when I press a
> key, I get 2 1/2 rows of boxes and the TI 85 freezes up.  Can anyone
> point out what I am doing wrong?  For what it is worth, I have ROM v.10.
> 
> #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
> 
> I really would appreciate any input.


Well, there's a ret z at the end, the program returns to zshell only if 
the z flag is set, which stands for zero.  If the last command created a 
zero, it would return.  In your case, it doesn't, so it keeps on going to 
who knows where.  **Put a ret instead**
Also, at the beginning, you said bit 7, when actually it is bit 0, 
reverse order, look at it like 2^(bit number), which is the value of that 
bit.
Another thing, you don't need 
ld a,4
out (5),a
That is only if you use FIND-PIXEL, which is in the ROM, page 4


> 
> TIA
> 
> Mark
> --
> 
> "No hay mal que por bien no venga"
>  - Spanish proverb
> 
> Mark and Esmeralda Lybrand
> 1330 West 10th Avenue #51
> Kennewick WA 99336-6070
> USA
> 
> Tel: (509) 586-1807


<pre>
-- 
Compliments of:
_-_-_-_-_-_-_-_
  Alan Bailey
  mailto:bailala@mw.sisna.com
  IRC:Abalone
  Web:http://www.mw.sisna.com/users/bailala/home.htm
</pre>


References: