Re: A83: asm - very perplexing problem
[Prev][Next][Index][Thread]
Re: A83: asm - very perplexing problem
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: