mirror of
https://github.com/hsoft/collapseos.git
synced 2024-11-06 02:31:01 +11:00
9424770caa
Driver configuration don't need their own words at runtime, we only need to compile them as literals when compiling words. Now that we have this "declaration blocks" pattern emerging, it seems like a good idea to take advantage of this in drivers, both for simplifying the xcomp unit and to make final binary slimmer.
17 lines
451 B
Plaintext
17 lines
451 B
Plaintext
: (key)
|
|
( inc then fetch )
|
|
[ ACIAR> LITN ] @ 1+ DUP [ ACIA) LITN ] @ = IF
|
|
DROP [ ACIA( LITN ] @
|
|
THEN
|
|
( As long as R> == W>-1, it means that buffer is empty )
|
|
BEGIN DUP [ ACIAW> LITN ] @ = NOT UNTIL
|
|
[ ACIAR> LITN ] !
|
|
[ ACIAR> LITN ] @ C@
|
|
;
|
|
: (emit)
|
|
( As long at CTL bit 1 is low, we are transmitting. wait )
|
|
BEGIN [ ACIA_CTL LITN ] PC@ 0x02 AND UNTIL
|
|
( The way is clear, go! )
|
|
[ ACIA_IO LITN ] PC!
|
|
;
|