7001446212
Recipes contain bits and pieces of hardware-related knowledge, but these bits feel sparse. I've been wanting to consolidate hardware- related documentation for a while, but always fell at odds with the recipes organisation. We don't have recipes anymore, just a /doc/hw section that contains hardware-related documentation which often translate to precise instructions to run Collapse OS on a specific machine. With this new organisation, I hope to end up with a better, more solid documentation.
13 lines
528 B
Plaintext
13 lines
528 B
Plaintext
: (spie) DROP ; ( always enabled )
|
|
: (spix) ( x -- x, for port B )
|
|
0 SWAP ( rx tx ) 8 0 DO
|
|
( send bit 7 to bit 6, TR's output bit )
|
|
DUP 1 RSHIFT 0x40 AND ( rx tx bits ) 0x80 OR ( CLK hi )
|
|
0x3f PC@ OR 0xf3 AND ( TH and TR output )
|
|
DUP 0x3f PC! ( rx tx bits )
|
|
( CLK low ) 0x7f AND 0x3f PC! ( rx tx )
|
|
( shift tx ) 1 LSHIFT ( rx tx<< )
|
|
( read into rx ) SWAP 1 LSHIFT 0xdc PC@ ( tx<< rx<< x )
|
|
( out bit is the 6th ) 6 RSHIFT 1 AND OR
|
|
SWAP LOOP ( rx tx ) DROP ;
|