1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-08 23:58:06 +11:00
collapseos/arch/z80/sms/blk/621
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

11 lines
416 B
Plaintext

: (ps2kcB) ( for port B )
( Port B TL is bit 2 )
_D2@ 0x04 AND IF 0 EXIT ( nothing ) THEN
0 _THB! ( Port B TH output, low )
_D1@ ( bit 7:6 go in 1:0 ) 6 RSHIFT ( n )
_D2@ ( bit 1:0 go in 3:2 ) 0x03 AND 2 LSHIFT OR ( n )
1 _THB! ( Port B TH output, high )
_D1@ ( bit 7:6 go in 5:4 ) 0xc0 AND 2 RSHIFT OR ( n )
_D2@ ( bit 1:0 go in 7:6 ) 0x03 AND 6 LSHIFT OR ( n )
2 _THB! ( TH input ) ;