collapseos/arch/z80/sms/blk/620
Virgil Dupras 7d568bd782 sms: simplify and solidify ports-related drivers
Add _TRA!, _THA!, _TRB!, _THB! routines to easily handle those pins'
value without stepping on other pins like the drivers previously
did. For SDC driver, it's going to be important soon because it turns
out that I can't get away with "always on" CS, so I'll need a scheme
where it's important that TH/TR pins have stable values.
2020-11-02 18:53:57 -05:00

13 lines
570 B
Plaintext

( kbd - implement (ps2kc) for SMS PS/2 adapter )
: (ps2kcA) ( for port A )
( Before reading a character, we must first verify that there
is something to read. When the adapter is finished filling its
'164 up, it resets the latch, which output's is connected to
TL. When the '164 is full, TL is low. Port A TL is bit 4 )
_D1@ 0x10 AND IF 0 EXIT ( nothing ) THEN
0 _THA! ( Port A TH output, low )
_D1@ ( bit 3:0 go in 3:0 ) 0x0f AND ( n )
1 _THA! ( Port A TH output, high )
_D1@ ( bit 3:0 go in 7:4 ) 0x0f AND 4 LSHIFT OR ( n )
2 _THA! ( TH input ) ;