VolksForth/8080/CPM/tests/log2file.fb

1 line
5.0 KiB
Plaintext
Raw Normal View History

\ log2file loadscreen phz 20aug23 1 3 +thru \\ : .1x ( n -- ) $30 + dup $39 > IF 7 + THEN (emit ; : .4x ( n -- ) ascii $ (emit 4 0 DO $10 u/mod LOOP drop .1x .1x .1x .1x $20 (emit ; : .2x ( n -- ) ascii $ (emit 2 0 DO $10 u/mod LOOP drop .1x .1x $20 (emit ; \ logfile phz 20aug23 Dos also Forth definitions $18 constant fcb\nam create logfile ," LOGFILE TXT" fcb\nam allot 1 logfile c! create logdma b/rec allot variable logoffset 0 logoffset ! : logflush logdma dma! logfile $15 bdos $80 dma! ; : logc! ( c -- ) logoffset @ dup >r logdma + c! r> 1+ dup logoffset ! b/rec = IF logflush 0 logoffset ! THEN ; \ log-emit log-type log-cr alsologtofile pphz 03sep23 : log-emit ( char -- ) dup (emit logc! ; : log-type ( addr count -- ) 0 ?DO count log-emit LOOP drop ; : log-cr ( -- ) (cr #cr logc! #lf logc! ; Output: alsologtofile log-emit log-cr log-type (del noop 2drop (at? ;