[A83] Re: Direct Input...


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

[A83] Re: Direct Input...




> Van: The one and only SUCKER ... <sucker_pvn@hotmail.com>
> 
> I don't reset the key port, and the program works fine!
>
>[..code snippet..]
> direct:
>   ld a,0feh 			;Enable group 1.
>   out (1),a
>   in a,(1) 			;'Required Syntax'
>   ld (keyvalue),a
>   ld a,1
>   ld (groupnumber),a
>   call validcheck
> 
>   ld a,0fdh 			;Enable group 2.
>   out (1),a
>   in a,(1)
>   ld (keyvalue),a
>   cp 191
>   jp z,stop
>   ld a,2
>   ld (groupnumber),a
>   call validcheck
> [etc..]

Okay, could be (haven't you tested it only on VTI?). Lets take a look at
the Direct Input group equates:

defc Group1	= $FE ;  @11111110
defc Group2	= $FD ;  @11111101
defc Group3	= $FB ;  @11111011
defc Group4	= $F7 ;  @11110111
defc Group5	= $EF ;  @11101111
defc Group6	= $DF ;  @11011111
defc Group7	= $BF ;  @10111111

So to see, a 1 disables a 'plane' and a 0 enables a 'plane'. 

Then take a look at this example-program from AsmGuru (T54):
;
;MOVE ME!!! v1.0 by Jason K.
;
[..cut..]
GetkeyLoop:
	ld a, 0FFh	;Reset Keyport
	out (1), a
	ld a, 0FDh	;Enable Key Group with 'Clear' in it.
	out (1), a
	in a, (1)
	cp 191
	jp z, Done
	ld a, 0FEh	;Enable Key Group with the Arrows in it.
	out (1), a
	in a, (1)
;All tutorials Copyright (c) James Matthews 1998, unless specified.

So as you see, he first resets the keypad and then writes to enable group2
and later on group1. Without resetting between! Kinda weird I think...

Altough I have seen programs where you could use the [Enter], [+], [-] and
[*] as if they were the arrow-keys... (they map each other when both group1
and group2 are enabled)

defc Group1	= $FE ;  @11111110
;--------------------
defc kDown	= 254 ; @11111110
defc kLeft	= 253 ; @11111101
defc kRight	= 251 ; @11111011
defc kUp	= 247 ; @11110111

defc Group2	= $FD ;  @11111101
;--------------------
defc kEnter	= 254 ; @11111110
defc kPlus	= 253 ; @11111101
defc kMinus	= 251 ; @11111011
defc kMul	= 247 ; @11110111

Hmm, I guess I just have to try out...

> >With 'Direct Input' you have to reset the keyboard (via outputting $FF
> >trough port 1), do you have to wait a little for the hardware to react?
Or
> >can you just go on with the next output (to actually switch the the
> >groups)?