Re: LZ: Prog help
[Prev][Next][Index][Thread]
There are several things I noticed about your program:
> After some suggestions i revised the program now i just get my exiting message
> printed and the calc freezes...
>
> Here is the new one... :
>
> #include "ti-85.h"
> .org 0
> .db "By Frank Apap",0
>
> Init:
> ld a,4
> out (5),a
> ROM_CALL(CLEARLCD)
> ld b,40 ; x start
> ld c,30 ; y start
>
> Start:
> call GET_KEY ; get a key
> cp $04 ; up ?
> jr nz,nextkey
> CALL_Z(up)
> JUMP_(Start)
The two zero checks in a row are repetitive. If you are going
to do it this way, you should make it simply CALL_(up), but I don't
think this should affect the execution of the program. A better way
might be to just do a jr z,up. I.E.:
call GET_KEY
cp $04
jr z,up
cp $01
jr z,down
...
Then at the end of the up handling routine just do a jr or JUMP_ back
to Start. It will result in a much shorter program. If you do
decide to use the first method, you will also need to...
> nextkey:
> cp $01 ; down
> CALL_Z(down)
...repeat the jr nz,nextkey except this time use a different name
(i.e. nextkey2 or checkdown). There may be some other problems
preventing your program from running but these are the one(s) I
noticed. Also, like Eric said before, you might want to take a look
at ZTeach2 on ticalc.org.
Hope this helps!
Ben
shakal@ns.net
References: