Re: A86: Re: Re: More ASM Questions


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

Re: A86: Re: Re: More ASM Questions




looks pretty good

djnz is Decrement b and Jump if Not Zero
jr nz,... after a cp will jump if it's not equal
jr z,... will jump if it is equal

make sure you keep track of how many keys are left on the stack.  if you
don't pop off everything you push on it'll crash.  (but it might give you
a nice show first :)

-josh


On Sat, 23 Jan 1999 21:21:58 -0600 "Chris Flanigan"
<cflan@granitecity.com> writes:
>
>OK its clearer now. I was thinking of using a getky routine and
>reading a certain number of keypresses. Here's my idea. Could you 
>tell
>me if my logic's right?
>
>Start:
>    call    _clrLCD
>    call    _runindicoff
>    ld b,$04
>
>KeyLoop:
>     push bc
>     call GET_KEY
>     pop bc
>     cp K_NOKEY
>     jr z, KeyLoop
>     push af
>    djnz KeyLoop
>
>I first initialize B to 4 or $04. I push B to the stack, call the
>GET_KEY ROM Routine, pop BC from the stack, see if any keys were
>pressed, if not then loop again but save the key that was pressed 
>from
>the port by pushing it on the stack then loop over until B=0. I know
>that I should check for other keys and that there should be other 
>code
>around it.
>
>Really after that I could pop af every time to compare its value to a
>key like so
>
>    pop af
>     cp K_3
>     jr nz, Start
>
>Am I doing this right. I'm trusting that such operatives as jr nz and
>djnz are correct. I haven't tried this or compiled it yet. I just
>wrote it. What exactly does djnz do? I'm pretty sure this will work
>from looking at others source code.


___________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com/getjuno.html
or call Juno at (800) 654-JUNO [654-5866]