2022-01-10 21:42:25 +00:00
|
|
|
|
|
|
|
\ *** Block No. 0, Hexblock 0
|
|
|
|
|
|
|
|
\ logging to a text file phz 03jan22
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\ *** Block No. 1, Hexblock 1
|
|
|
|
|
2022-03-01 13:02:46 +00:00
|
|
|
\ load screen phz 25feb22
|
2022-01-10 21:42:25 +00:00
|
|
|
|
2022-03-01 13:02:46 +00:00
|
|
|
Code m+! ( 16b addr -- )
|
|
|
|
D W mov W inc W inc A pop A W ) add
|
|
|
|
CS ?[ W dec W dec W ) inc ]?
|
|
|
|
D pop Next end-code
|
2022-01-10 21:42:25 +00:00
|
|
|
|
|
|
|
|
2022-03-01 13:02:46 +00:00
|
|
|
: (blk blk @ 0= IF ascii ) parse 2drop THEN ;
|
2022-01-10 21:42:25 +00:00
|
|
|
|
2022-03-01 13:02:46 +00:00
|
|
|
(blk 1 2 +thru ( )
|
2022-01-10 21:42:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\ *** Block No. 2, Hexblock 2
|
|
|
|
|
2022-03-01 13:02:46 +00:00
|
|
|
\ log-type log-emit log-cr phz 25feb22
|
2022-01-10 21:42:25 +00:00
|
|
|
context @ dos also context !
|
|
|
|
\ vocabulary log dos also log definitions
|
|
|
|
file logfile
|
|
|
|
variable logfcb
|
2022-03-01 13:02:46 +00:00
|
|
|
variable logpos 0 ,
|
2022-01-10 21:42:25 +00:00
|
|
|
|
2022-03-01 13:02:46 +00:00
|
|
|
: log-type ( addr count -- ) dup logpos m+!
|
|
|
|
2dup (type ds@ -rot logfcb @ lfputs ;
|
2022-01-10 21:42:25 +00:00
|
|
|
|
2022-03-01 13:02:46 +00:00
|
|
|
: log-emit ( char -- ) 1 logpos m+!
|
|
|
|
dup (emit logfcb @ fputc ;
|
2022-01-10 21:42:25 +00:00
|
|
|
|
2022-03-01 13:02:46 +00:00
|
|
|
: log-cr ( -- ) 2 logpos m+!
|
|
|
|
(cr #cr logfcb @ fputc #lf logfcb @ fputc ;
|
2022-01-10 21:42:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
\ *** Block No. 3, Hexblock 3
|
|
|
|
|
2022-03-01 13:02:46 +00:00
|
|
|
\ alsologtofile logopen logclose logreopen phz 25feb22
|
|
|
|
|
|
|
|
Output: alsologtofile
|
|
|
|
log-emit log-cr log-type (del (page (at (at? ;
|
2022-01-10 21:42:25 +00:00
|
|
|
|
|
|
|
: logopen ( -- )
|
2022-03-01 13:02:46 +00:00
|
|
|
isfile push logpos dup 2+ off off
|
2022-01-10 21:42:25 +00:00
|
|
|
logfile make isfile@ dup freset logfcb !
|
|
|
|
alsologtofile ;
|
|
|
|
|
|
|
|
: logclose ( -- ) display logfcb @ fclose ;
|
|
|
|
|
2022-03-01 13:02:46 +00:00
|
|
|
: logreopen ( -- )
|
|
|
|
logfcb @ freset logpos 2@ logfcb @ fseek
|
|
|
|
alsologtofile ;
|
|
|
|
|
|
|
|
|
|
|
|
\ *** Block No. 4, Hexblock 4
|
|
|
|
|
|
|
|
\ phz 25feb22
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
\ *** Block No. 5, Hexblock 5
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2022-01-10 21:42:25 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|