Hello world/Line printer: Difference between revisions

Content added Content deleted
Line 284: Line 284:
\ memory mapped I/O addresses for the printer port
\ memory mapped I/O addresses for the printer port
HEX
HEX
B02E CONSTANT SCSR \ serial control status register
B02E constant scsr \ serial control status register
B02F CONSTANT SCDR \ serial control data register
B02F constant scdr \ serial control data register
DECIMAL
DECIMAL


: printer-emit ( char -- ) \ output 'char' to the printer serial port
: printer-emit ( char -- ) \ output 'char' to the printer serial port
BEGIN SCSR C@ 80 AND UNTIL \ loop until the port shows a ready bit
begin scsr C@ 80 and until \ loop until the port shows a ready bit
SCDR C! \ C! (char store) writes a byte to an address
scdr C! \ C! (char store) writes a byte to an address
20 ms ; \ delay to prevent over-runs
20 ms ; \ delay to prevent over-runs