Re: A86: Key checking...


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

Re: A86: Key checking...




This would check for the exit key...

	ld a,%10111111
	out (1),a
	nop			;these are really optional
	nop
	in a,(1)
	bit 6,a
	jp z,exit_was_pressed

In the first line, whichever bit is left 0 corresponds to a group of
keys to check (bit 7 doesn't do anything).  The bit 6,a line checks for
a single key out of that group.  The file 86ports.txt on ticalc.org has
a chart of all the keys...

Eric Greening wrote:
> 
> I'm fairly new to assembly for z80.  I know 68k good though.  I was
> wondering how I would make the program check keys like this:
> 
> Loop:
>         ld      a,%01111110
>         out     (1),a
>         nop
>         nop
>         in      a,(1)
>         bit     3,a
>         jr      z,Up
>         bit     2,a
>         jr      z,Right
>         bit     1,a
>         jr      z,Left
>         bit     0,a
>         jr      z,Exit
>         jr      nz,Loop
> 
> I was wondering, how would I check for the exit key using this method?
> I appreciate any help you can give me.
> 
> Eric Greening


References: