First working Forth log2file.fb for CPM VolksForth

This commit is contained in:
Philip Zembrod 2023-07-01 20:15:57 +02:00
parent 78b1e4bff2
commit 415fd869e1
3 changed files with 125 additions and 3 deletions

View File

@ -1,6 +1,9 @@
fbfiles = $(wildcard src/*.fb)
fthfiles = $(patsubst src/%.fb, src/%.fth, $(fbfiles))
srcfbfiles = $(wildcard src/*.fb)
srcfthfiles = $(patsubst src/%.fb, src/%.fth, $(srcfbfiles))
testsfbfiles = $(wildcard tests/*.fb)
testsfthfiles = $(patsubst tests/%.fb, tests/%.fth, $(testsfbfiles))
fthfiles = $(srcfthfiles) $(testsfthfiles)
whitch_runcpm = $(shell which RunCPM)
runcpmdir = runcpm
@ -14,7 +17,8 @@ clean:
rm -f msdos
run-editor: | msdos
FORTHPATH="f:\\src;f:\\msdos" ../../8086/msdos/emulator/run-in-dosbox.sh f:\\msdos\\volks4th.com
FORTHPATH="f:\\src;f:\\tests;f:\\msdos" \
../../8086/msdos/emulator/run-in-dosbox.sh f:\\msdos\\volks4th.com
msdos:
ln -s ../../8086/msdos msdos
@ -22,6 +26,9 @@ msdos:
src/%.fth: src/%.fb ../../tools/fb2fth.py
../../tools/fb2fth.py $< $@
tests/%.fth: tests/%.fb ../../tools/fb2fth.py
../../tools/fb2fth.py $< $@
inctest.log: $(patsubst %, $(cpmfilesdir)/%, volks4th.com) \
$(patsubst src/%, $(cpmfilesdir)/%, \
src/include.fb src/inctest.fth) \
@ -34,6 +41,21 @@ inctest.log: $(patsubst %, $(cpmfilesdir)/%, volks4th.com) \
./emulator/run-in-runcpm.sh volks4th
cp $(runcpmdir)/output.log $@
logtest.log: $(patsubst %, $(cpmfilesdir)/%, volks4th.com) \
$(patsubst tests/%, $(cpmfilesdir)/%, \
tests/log2file.fb) \
| emu
echo "volks4th" > $(runcpmdir)/input.script
echo "include log2file.fb" >> $(runcpmdir)/input.script
echo "logopen" >> $(runcpmdir)/input.script
echo ".( hello world) cr" >> $(runcpmdir)/input.script
echo "logclose" >> $(runcpmdir)/input.script
echo "bye" >> $(runcpmdir)/input.script
echo "exit" >> $(runcpmdir)/input.script
./emulator/run-in-runcpm.sh volks4th
cp $(runcpmdir)/output.log output.log
cp $(runcpmdir)/A/0/LOGFILE.TXT $@
emu: $(runcpmdir)/RunCPM
$(runcpmdir)/RunCPM: $(whitch_runcpm)
@ -44,6 +66,10 @@ $(cpmfilesdir)/%: src/%
test -d $(cpmfilesdir) || mkdir -p $(cpmfilesdir)
cp $< $@
$(cpmfilesdir)/%: tests/%
test -d $(cpmfilesdir) || mkdir -p $(cpmfilesdir)
cp $< $@
$(cpmfilesdir)/%: %
test -d $(cpmfilesdir) || mkdir -p $(cpmfilesdir)
cp $< $@

File diff suppressed because one or more lines are too long

View File

@ -0,0 +1,95 @@
\ *** Block No. 0, Hexblock 0
\ *** Block No. 1, Hexblock 1
\ log2file loadscreen phz 01jun23
1 3 +thru
\ *** Block No. 2, Hexblock 2
\ logfile phz 01jul23
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 write-seq ;
: logc! ( c -- )
logoffset @ dup >r logdma + c! r> 1+
dup logoffset ! b/rec =
IF logflush 0 logoffset ! THEN ;
\ *** Block No. 3, Hexblock 3
\ log-emit log-type log-cr alsologtofile pphz 01jul23
: log-emit ( char -- )
dup (emit logc! ;
: log-type ( addr count -- )
2dup (type 0 ?DO count logc! LOOP drop ;
: log-cr ( -- )
(cr #cr logc! #lf logc! ;
Output: alsologtofile
log-emit log-cr log-type (del (page (at (at? ;
\ *** Block No. 4, Hexblock 4
\ logopen phz 01jul23
: logopen ( -- )
logfile filenamelen + 1+ fcb\nam erase
logfile killfile
logfile createfile
alsologtofile ;
: logclose ( -- )
cr display logflush logfile closefile ;