1
0
mirror of https://github.com/hsoft/collapseos.git synced 2024-11-14 14:48:08 +11:00
collapseos/blk/587
Virgil Dupras 9424770caa rc2014: add a declaration part to ACIA drivers
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.
2020-06-28 17:30:01 -04:00

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!
;