LZ: Re: Program problems


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

LZ: Re: Program problems



> From: Frank  <Jblaze77@msn.com>
>
> Here is that program revised... it still aint working... now it just
prints my 
> exiting text then freezes


....


> nextkey:
>     cp $01         ; down
>     CALL_Z(down)
> 
>     cp $02           ; left?
>     CALL_Z(left)
> 
>     cp $03        ; right
>     CALL_Z(left)
> 
>     cp $37              ;exit
>     JUMP_(exit)


This has to be conditional. So, change JUMP_(exit) to JUMP_Z(exit), which
will jump to exit only if key $37 (Exit) is pressed.  Without the 'Z'
condition, it makes the jump no matter what.


....


> exit:
>      ROM_CALL(CLEARLCD)
>      ld hl,$1A1A
>      ld ($8333), hl
>      ld hl, (PROGRAM_ADDR)
>      ld de,bye
>      add hl,de
>      ROM_CALL(D_ZM_STR)
>      ret z


change this ret z to ret


You do not want a conditional ret, becaus you want to exit no mater what.
BUT, what i think you are trying to do, is wait for a key press, then exit,
right?


Well, do this instead:


exit:
   ROM_CALL(CLEARLCD)
   ld hl,$1A1A
   ld ($8333), hl
   ld hl, (PROGRAM_ADDR)
   ld de,bye
   add hl,de
   ROM_CALL(D_ZM_STR)
exitloop:	call GET_KEY
   cp  $37
   ret z
   jr  exitloop




> bye: 
>       .db "BYE THANKS FOR TESTING",0 ; this is what prints and then
freezes
> .end


; Max Mansour,       // mail : mmansour@gis.net 
; self proclaimed   // irc : Justarius
; dictator.        // web : maxwww.home.ml.org  
;
;         come visit my handheld pages 
;      (OmniGo, Windows CE (soon), TI-85/ZShell)
;                                        
;              Drugs for Doughnuts ! 
;     Crack, smack, weed, speed, you want it, 
;     I got it.  I can be found in the nearest
;     deep-fried pastry establishment.
;     I'm the one with the badge and the gun.


..end


References: