Hello world/Line printer: Difference between revisions
Content deleted Content added
Line 275: | Line 275: | ||
<lang Forth>\ No operating system, embedded device, printer output example |
<lang Forth>\ No operating system, embedded device, printer output example |
||
defer emit \ |
defer emit \ deferred words in Forth are like virtual functions but easier to use |
||
: type ( addr count -- ) \ type a string uses emit |
: type ( addr count -- ) \ type a string uses emit |
||
bounds ?do i c@ emit loop ; \ type is used by ." (see usage examples below) |
bounds ?do i c@ emit loop ; \ type is used by ." (see usage examples below) |
||
⚫ | |||
: CR ( -- ) 0A emit 0D emit ; \ send a carriage return, linefeed pair with emit |
: CR ( -- ) 0A emit 0D emit ; \ send a carriage return, linefeed pair with emit |
||
\ memory mapped I/O addresses for the printer port |
\ memory mapped I/O addresses for the printer port |
||
⚫ | |||
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 |