Browse Source

sms/kbd: PS/2 driver WIP

pull/102/head
Virgil Dupras 4 years ago
parent
commit
c86d8a74a0
3 changed files with 26 additions and 0 deletions
  1. +1
    -0
      blk/620
  2. +14
    -0
      blk/640
  3. +11
    -0
      blk/641

+ 1
- 0
blk/620 View File

@@ -1,3 +1,4 @@
Sega Master System Recipe

622 VDP 630 PAD
640 KBD

+ 14
- 0
blk/640 View File

@@ -0,0 +1,14 @@
( 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 )
0xdc PC@ 0x10 AND IF 0 EXIT ( nothing ) THEN
0x3f PC@ DROP 0b11011101 ( Port A TH output, low ) 0x3f PC!
0xdc PC@ ( bit 3:0 go in 3:0 ) 0x0f AND ( n )
0b11111101 ( Port A TH output, high ) 0x3f PC!
0xdc PC@ ( bit 3:0 go in 7:4 ) 0x0f AND 4 LSHIFT OR ( n )
( Port A/B reset ) 0xff 0x3f PC!
;


+ 11
- 0
blk/641 View File

@@ -0,0 +1,11 @@
: (ps2kcB) ( for port B )
( Port B TL is bit 2 )
0xdd PC@ 0x04 AND IF 0 EXIT ( nothing ) THEN
0x3f PC@ DROP 0b01110111 ( Port B TH output, low ) 0x3f PC!
0xdc PC@ ( bit 7:6 go in 1:0 ) 6 RSHIFT ( n )
0xdd PC@ ( bit 1:0 go in 3:2 ) 0x03 AND 2 LSHIFT OR ( n )
0b11110111 ( Port B TH output, high ) 0x3f PC!
0xdc PC@ ( bit 7:6 go in 5:4 ) 0xc0 AND 2 RSHIFT OR ( n )
0xdd PC@ ( bit 1:0 go in 7:6 ) 0x03 AND 6 LSHIFT OR ( n )
( Port A/B reset ) 0xff 0x3f PC!
;

Loading…
Cancel
Save