Sv: A83: asm - very perplexing problem


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

Sv: A83: asm - very perplexing problem




cp    left    &    up    &    right
jr    z,some_thing
.end

the keys have to be in the same group.


maby this pice of code could also be to some use

move_loop:
 ld a,0ffh
 out (1),a
 dec a
 out (1),a
 in a,(1)

 rrca
 jr nc,down
 rrca
 jr nc,left
 rrca
 jr nc,right
 rrca
 jr nc,up

 ld a,0fdh
 out (1),a
 in a,(1)
 bit 6,a
 ret z
 jr move_loop


hope that some of this was usefull,


Andreas Hjordt



----- Original Message ----- 
From: Olle Hedman <oh@hem.passagen.se>
To: <assembly-83@lists.ticalc.org>
Sent: Thursday, June 29, 2000 4:32 PM
Subject: Re: A83: asm - very perplexing problem


> 
> If they keys are in the same group you can also check them both in the same
> bit-test. just and the two bitmasks together. I don't remember how to doo that
> in tasm, since it was 1½ year since I touched a z80 calc last time, but you can
> do it so it is calculated at compile time. NOT useing the and instruction that
> is.
> I think there is a passage in asmguru about this, since I have some memory of me
> explaining this to Matthew :)
> 
> file://Olle
> 
> Jkhum98@aol.com wrote:
> > 
> > In a message dated 6/28/00 10:02:03 PM Central Daylight Time,
> > VVeakling@aol.com writes:
> > 
> > > Okay, I am trying to write a tennis game and i came to this little
> > challenge
> > >  that i cant solve... it helps if anyone is aquainted with TENNIS for the
> > >  gameboy
> > >
> > >  I need to be able to check if up to three keys are pressed, one button for
> > >  swinging (there is [2nd] which is a faster hit, and [alpha] which is a
> > >  slower, lob-like hit), and two directional keys at a time.  This is
> > because
> > > a
> > >  player could be running using one or two directional keys (combining for
> > >  eight way movement), swinging straight (no directional keys), or swinging
> > in
> > >
> > >  a direction, by pressing the swing button and one or two directional keys
> > >  (for 9 places to hit the ball on the other side).  You could see how all
> > of
> > >  this can get very confusing...hope i havent lost you yet.  Now, when i
> > >  started this project i assumed all of this would be possible because in
> > > other
> > >  games you can move diagonally, ( i.e. Airhawk).  I have been able to
> > achieve
> > >
> > >  the combining of [2nd]+direction and [alpha]+direction..... but
> > >  direction+direction and ([2nd] or [alpha])+direction+direction have been
> > > more
> > >  complicated because the directions are in the same group.  please help if
> > > you
> > >  know how i can do this... the only theoretical wayi came up with would be
> > >  checking for singular keys in direct input and i know that isnt possible.
> > >  thank you very much, i know this is a very long email
> > >
> > >  Jared Verdi
> > 
> > Why would that not be possible? You just read the keyport, and do bit tests
> > for the keys you want, and goto one label, and then under that label you
> > check the same keyport but with a different bit test, and goto another label
> > if so. Here is an example...
> > 
> > loop:
> >      ld a, $FF
> >      out (1), a
> >      ld a, $FE
> >      out (1), a
> >      in a, (1)
> >      BIT 0, a
> >      jr z, down
> >      BIT 1, a
> >      jr z, left
> >      BIT 2, a
> >      jr z, right
> >      BIT 3, a
> >      jr z, up
> >      ld a, $FF
> >      out (1), a
> >      ld a, $BF
> >      out (1), a
> >      in a, (1)
> >      cp $DF
> >      jr z, second
> >      etc
> >      jr loop
> > down:
> >      BIT 1, a
> >      jr z, downleft
> >      BIT 2, a
> >      jr z, downright
> >      ld a, $FF
> >      out (1), a
> >      ld a, $BF
> >      in a, (1)
> >      cp $DF
> >      jr z, downsecond
> > justdown:
> >      etc
> > 
> > I hope you get the idea. This should work for your purposes. It's a long
> > process though if you have many combinations like "down-left-second", but
> > this method will work alright, despite how large it is. Let me know if you
> > have any other questions. cya...
> > 
> > Jason_K
> 





Follow-Ups: References: