Re: A83: Multiple Keypresses?


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

Re: A83: Multiple Keypresses?




sure..  even though I should go to sleep now :)
the idéa behind multiple keypress, from multiple groups is something like
 this (in unspecified highlevel language;)

if (key1 == true) then
	if (key2 == true) then
		....
		if (keyn == true) then
			call action

in asm that would be something like

	;code to retrive 1st key from directinput to 'a'
	cp	_kode-key1
	jp	nz,not_fullfilled
	;code to retrive 2nd key from directinput to 'a'
	cp	_kode-key2
	jp	nz,not_fullfilled
	.....
	;code to retrive n'th key from directinput to 'a'
	cp	_kode-keyn
	jp	nz,not_fullfilled
	call	action

not_fulfilled
	;rest of code


If you should happen to have multiple keys in the same group, then calulate (by
hand before compilation)
a value to check for that corresponds to th keys pressed..  (ehh.. ok..)
hmm.. maybe we need to rehears how this direct-input is done technically :)

first you reset the keypad by writing $FF to the keypad-port.
then you write a mask to this port witch lines (or groups of keys) should be
checked for
1 maskaway that group and 0 makes us check on this group..  så if we want to
check on group 2 we should write

%11111011  to the keypad-port. ($FB)

then we can read from the port and find what keys in this group (or groups)  is
pressed down..

let say key 4 and key 5 was pressed.. (not the _number_ '5' and '4', but the 5th
and 4th key in the group)
then the read value should be:

%11100111  ($E7)

and this is what to check for in the cp-line..



hmm...   I hope someone understod at least _something_ from this....   I am
_very_ tired now (no sleep this night)
and any errors in this are blamed on that fact :) (any errors should just be
typos or misscalculations in bin <-> hex..  the teory is right ;)

//Olle

Jkhum98@aol.com wrote:
> 
> Hey, how do you look for two keypresses at the same time, again? I remember
> there was a small thread of mails about this not too long ago, but can someone
> just clarify it for me real fast, thanks... It has a lot to do with individual
> bits of the getkey numbers, and I remember its like "cp kDown+kUp" for those
> two, and the adding should do it, right?  This is for Direct Input, by the
> way, and with that how would I go about looking for two keys together that are
> Not of the same Group of keys...?  Oh ya, not that im goin got use it, but it
> is possible to detect even more than one or two keys at once? Just
> wondering... =P  Well, someone explain on all that please, thanks... =)
>                                                                                                                                 --Jason K.


References: