First build of v4th.com with compile log file written and

checked at the end of the Makefile recipe.
Also introduces a prebuilt metacompiler metafile.com with integrated fth file include
This commit is contained in:
Philip Zembrod 2022-03-01 14:02:46 +01:00
parent 5e0dafaa16
commit 64ed332b12
8 changed files with 241 additions and 22 deletions

View File

@ -17,13 +17,29 @@ clean:
*.log: emulator/run-in-dosbox.sh
# TODO: Make v4th.log contain something and check its contents
v4th.com v4th.log: volks4th.com src/kernel.fb tests/log2file.fb
metafile.com: v4thfile.com src/meta.fb src/mk-meta.fth tests/log2file.fb
rm -f METAFILE.COM OUTPUT.LOG
FORTHPATH="f:\\;f:\\src;f:\\tests" ./emulator/run-in-dosbox.sh \
v4thfile.com "include mk-meta.fth"
dos2unix -n OUTPUT.LOG metafile.log
grep -F 'Metacompiler saved as metafile.com' metafile.log
v4th.com: metafile.com src/meta.fb src/mk-v4th.fth
rm -f v4th.com V4TH.COM OUTPUT.LOG
FORTHPATH="f:\\;f:\\src;f:\\tests" ./emulator/run-in-dosbox.sh \
metafile.com "include mk-v4th.fth"
dos2unix -n OUTPUT.LOG v4th.log
mv V4TH.COM v4th.com
grep -F 'new kernel written as v4th.com' v4th.log
# o4th for old volks4th - the new v4th is built with precompiled
# metacompiler metafile.com and mk-v4th.fth which writes a compile log.
o4th.com o4th.log: volks4th.com src/kernel.fb
rm -f FORTH.COM forth.com v4th.com
FORTHPATH="f:\\;f:\\src;f:\\tests" ./emulator/run-in-dosbox.sh \
volks4th.com "include kernel.fb"
dos2unix -n OUTPUT.LOG v4th.log
mv FORTH.COM v4th.com
dos2unix -n OUTPUT.LOG o4th.log
mv FORTH.COM o4th.com
v4thfile.com: volks4th.com src/include.fb src/v4thfile.fb \
emulator/run-in-dosbox.sh
@ -36,6 +52,11 @@ logtest.log: volks4th.com tests/log2file.fb tests/logtest.fb
FORTHPATH="f:\\;f:\\src;f:\\tests" ./emulator/run-in-dosbox.sh volks4th.com "include logtest.fb"
dos2unix -n OUTPUT.LOG $@
logappendtest.log: v4thfile.com tests/logapp.fth
rm -f OUTPUT.LOG
FORTHPATH="f:\\;f:\\src;f:\\tests" ./emulator/run-in-dosbox.sh v4thfile.com "include logapp.fth"
dos2unix -n OUTPUT.LOG $@
prepsrcs = asm.fb extend.fb multi.vid dos.fb include.fb
incltest.log: \

View File

@ -0,0 +1,24 @@
include log2file.fth
logopen output.log
Onlyforth \ \needs Assembler 2 loadfrom asm.fb
: c+! ( 8b addr -- ) dup c@ rot + swap c! ;
' find $22 + @ Alias found
: search ( string 'vocab -- acf n / string ff )
dup @ [ ' Forth @ ] Literal - Abort" no vocabulary"
>body (find IF found exit THEN false ;
use meta.fb
3 &27 thru Onlyforth
logclose
savesystem metafile.com
logreopen
cr .( Metacompiler saved as metafile.com) cr
logclose

View File

@ -0,0 +1,19 @@
logopen output.log
Onlyforth
2 loadfrom META.fb
use kernel.fb
new v4th.com Onlyforth Target definitions
4 &111 thru \ Standard 8088-System
logclose
flush \ close n4th.com
logreopen
cr .( new kernel written as v4th.com) cr
logclose

File diff suppressed because one or more lines are too long

View File

@ -20,7 +20,13 @@
\ *** Block No. 1, Hexblock 1
\ load screen phz 16jan22
\ load screen phz 25feb22
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
: (blk blk @ 0= IF ascii ) parse 2drop THEN ;
@ -31,42 +37,74 @@
\ *** Block No. 2, Hexblock 2
\ log-type log-emit log-cr alsologtofile phz 04jan22
\ log-type log-emit log-cr phz 25feb22
context @ dos also context !
\ vocabulary log dos also log definitions
file logfile
variable logfcb
variable logpos 0 ,
: log-type 2dup (type ds@ -rot logfcb @ lfputs ;
: log-type ( addr count -- ) dup logpos m+!
2dup (type ds@ -rot logfcb @ lfputs ;
: log-emit dup (emit logfcb @ fputc ;
: log-cr (cr #cr logfcb @ fputc #lf logfcb @ fputc ;
Output: alsologtofile
log-emit log-cr log-type (del (page (at (at? ;
: log-emit ( char -- ) 1 logpos m+!
dup (emit logfcb @ fputc ;
: log-cr ( -- ) 2 logpos m+!
(cr #cr logfcb @ fputc #lf logfcb @ fputc ;
\ *** Block No. 3, Hexblock 3
\ logopen logclose phz 11jan22
\ alsologtofile logopen logclose logreopen phz 25feb22
Output: alsologtofile
log-emit log-cr log-type (del (page (at (at? ;
: logopen ( -- )
isfile push
isfile push logpos dup 2+ off off
logfile make isfile@ dup freset logfcb !
alsologtofile ;
: logclose ( -- ) display logfcb @ fclose ;
: logreopen ( -- )
logfcb @ freset logpos 2@ logfcb @ fseek
alsologtofile ;
\ *** Block No. 4, Hexblock 4
\ phz 25feb22
\ *** Block No. 5, Hexblock 5

View File

@ -0,0 +1,78 @@
\ Experimental code and test for text logs that can be closed
\ and reopened for appending.
\ Already integrated into log2file.fb/.fth
\ Yet to be done: A more permanent test for m+!
\ and an extension of logtest.fb/.fth to also cover the reopen feature.
\ Code +! ( 16b addr -- )
\ D W mov A pop A W ) add D pop Next end-code
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
\ *** Block No. 2, Hexblock 2
\ log-type log-emit log-cr alsologtofile phz 04jan22
context @ dos also context !
\ vocabulary log dos also log definitions
file logfile
variable logfcb
variable logpos 0 ,
: log-type
dup logpos m+!
2dup (type ds@ -rot logfcb @ lfputs ;
: log-emit
1 logpos m+!
dup (emit logfcb @ fputc ;
: log-cr
2 logpos m+!
(cr #cr logfcb @ fputc #lf logfcb @ fputc ;
Output: alsologtofile
log-emit log-cr log-type (del (page (at (at? ;
\ *** Block No. 3, Hexblock 3
\ logopen logclose phz 11jan22
: logopen ( -- )
isfile push logpos dup 2+ off off
logfile make isfile@ dup freset logfcb !
alsologtofile ;
: logclose ( -- ) display logfcb @ fclose ;
: logreopen ( -- )
logfcb @ freset logpos 2@ logfcb @ fseek
alsologtofile ;
logopen output.log
.( logtest started) cr
logpos @ cr u. cr
.( logtest interrupted) cr
logclose
logreopen
create 2v 4 allot
hex
12345. 2v 2!
1 2v m+!
2v 2@ d. cr
1ffff. 2v 2!
1 2v m+!
2v 2@ d. cr
.( logtest done) cr
logclose

View File

@ -0,0 +1 @@
\ include file to bundle what test-*.fth need phz 30jan22\ on top of kernel.com \ loadscreen to prepare kernel.com for test-*.fth phz 31jan22 include multi.vid \ include asm.fb \ include extend.fb : arguments ( n -- ) depth 1- > Error" too few params" ; : blank ( addr count -- ) bl fill ; include dos.fb include include.fb include log2file.fb

View File

@ -0,0 +1,38 @@
\ *** Block No. 0, Hexblock 0
\ include file to bundle what test-*.fth need phz 30jan22
\ on top of kernel.com
\ *** Block No. 1, Hexblock 1
\ loadscreen to prepare kernel.com for test-*.fth phz 31jan22
include multi.vid
\ include asm.fb
\ include extend.fb
: arguments ( n -- )
depth 1- > Error" too few params" ;
: blank ( addr count -- ) bl fill ;
include dos.fb
include include.fb
include log2file.fb