Re: LZ: my new prog


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

Re: LZ: my new prog



I'm gonna make a sample change for you.  I'll comment it so
you can see it.  I don't know enough about zshell to know
that that's the only problem, but it's the current problem
for sure.


CP or compare only sets flags in the flag register to indicate
that a condition is true or false.  It doesn't act on those
flags.  The JR CC,XXX is what acts on them, as do a few other
conditional opcodes.  So a compare is always (almost) followed
by a conditional jump or return that directs the flow of control.


Barry


On Mon, 23 Sep 1996, Frank  wrote:


> Hey was up i am new to zshell programming.. i tried to make a program that 
> would draw pixels corresponding to the keys pressed... (like etch a 
> sketch).... here it is... it dont work.... if someone can help let me know 
> (jblaze77@msn.com)...
> 
> > #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 ?  	; Is it a 4?
	jr nz,cknextkey	     	; No, go around
> >     CALL_(up)		; Yes, do it
	JUMP_(Start)		; Then go get another key
cknextkey:			; It only gets here if key wasnt $04
> >     cp $01         ; down?
> >     CALL_(down)
> >     cp $02           ; left?
> >     CALL_(left)
> >     cp $03        ; right
> >     CALL_(left)
> >     cp $37              ;exit
> >     CALL_(exit)
> >     JUMP_(Start)    ; loop
> > up:
> >   inc b  ; x=x+1
> >   CALL_(PlotPixel) ; draw it
> >   ret
> > down:
> >      dec b ; x=x-1
> >      CALL_(PlotPixel)
> >      ret          
> > right:
> >   inc c  ; y=y+1
> >   CALL_(PlotPixel) ; draw it
> >   ret               ; go back
> > left:
> >   dec c  ; y=y-1
> >   CALL_(PlotPixel) ; draw it
> >   ret               ; go back
> > PlotPixel:
> >     ROM_CALL(FIND_PIXEL)
> >     ld de,$FC00
> >     add hl,de
> >     or (HL)
> >     ld (HL),a
> >     ret
> > 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
> > bye: .db "BYE THANKS FOR TESTING",0
> > .end
>  
> 


References: