First make-controlled loading of an fb file in CPM VolksForth with logfile output.

Also make rules to convert .fb files to .fth and to run the msdos editor
This commit is contained in:
Philip Zembrod 2022-04-30 23:07:46 +02:00
parent 2cd270b1ef
commit 0062c769c7
4 changed files with 86 additions and 23 deletions

View File

@ -1,7 +1,19 @@
fth: include.fth
fbfiles = $(wildcard *.fb)
fthfiles = $(patsubst %.fb, %.fth, $(fbfiles))
run-editor: msdos
whitch_runcpm = $(shell which RunCPM)
runcpmdir = runcpm
cpmfilesdir = cpmfiles
fth: $(fthfiles)
clean:
rm -f *.log
rm -rf $(runcpmdir)
rm -f msdos
run-editor: | msdos
FORTHPATH="f:\\;f:\\msdos" ../../8086/msdos/emulator/run-in-dosbox.sh f:\\msdos\\volks4th.com
msdos:
@ -9,3 +21,22 @@ msdos:
%.fth: %.fb ../../tools/fb2fth.py
../../tools/fb2fth.py $< $@
inctest.log: $(patsubst %, $(cpmfilesdir)/%, volks4th.com include.fb) \
| emu
echo "volks4th" > $(runcpmdir)/input.script
echo "include include.fb" >> $(runcpmdir)/input.script
echo "bye" >> $(runcpmdir)/input.script
echo "exit" >> $(runcpmdir)/input.script
./emulator/run-in-runcpm.sh volks4th
cp $(runcpmdir)/output.log $@
emu: $(runcpmdir)/RunCPM
$(runcpmdir)/RunCPM: $(whitch_runcpm)
test -d $(runcpmdir) || mkdir -p $(runcpmdir)
cp $< $@
$(cpmfilesdir)/%: %
test -d $(cpmfilesdir) || mkdir -p $(cpmfilesdir)
cp $< $@

View File

@ -0,0 +1,32 @@
#!/bin/bash
set -e
emulatordir="$(realpath --relative-to="$PWD" "$(dirname "${BASH_SOURCE[0]}")")"
basedir="$(realpath --relative-to="$PWD" "${emulatordir}/..")"
cpmfilesdir="${basedir}/cpmfiles"
runcpmdir="${basedir}/runcpm"
runcpm_a0="${runcpmdir}/A/0"
toolsdir="${basedir}/../../tools"
logfile="${runcpmdir}/output.log"
scriptfile="${runcpmdir}/input.script"
rm -f "${logfile}"
test -d "${runcpm_a0}" || mkdir -p "${runcpm_a0}"
for pathname in ${cpmfilesdir}/*
do
echo $pathname
filename="$(realpath --relative-to="${cpmfilesdir}" "${pathname}")"
echo $filename
uppercase_filename="$("${toolsdir}/echo-toupper.py" "${filename}")"
echo $uppercase_filename
cp "${pathname}" "${runcpm_a0}/${uppercase_filename}"
done
if [[ -f "${scriptfile}" ]]; then
"${runcpmdir}/RunCPM" -i "${scriptfile}" -o "${logfile}"
else
"${runcpmdir}/RunCPM" -o "${logfile}"
fi

File diff suppressed because one or more lines are too long

View File

@ -39,12 +39,12 @@
\ *** Block No. 2, Hexblock 2
\ fib /fib #fib eolf? phz 06feb22
\ fib /fib #fib eolf? phz 05apr22
context @ dos also context !
$50 constant /tib
variable tibeof tibeof off
\\
: eolf? ( c -- f )
\ f=-1: not yet eol; store c and continue
\ f=0: eol but not yet eof; return line and flag continue
@ -58,11 +58,11 @@
\ *** Block No. 3, Hexblock 3
\ incfile incpos inc-fgetc phz 06feb22
\ incfile incpos inc-fgetc phz 05apr22
variable incfile
variable incpos 2 allot
\\
: inc-fgetc ( -- c )
incfile @ f.handle @ 0= IF
incpos 2@ incfile @ fseek THEN
@ -77,27 +77,27 @@
\ *** Block No. 4, Hexblock 4
\ freadline probe-for-fb phz 06feb22
\ freadline probe-for-fb phz 05apr22
: freadline ( -- eof )
tib /tib bounds DO
( tib /tib bounds DO
inc-fgetc dup eolf? under 0< IF I c! ELSE drop THEN
0< 0= IF I tib - #tib ! ENDLOOP tibeof @ exit THEN
LOOP /tib #tib !
." warning: line exteeds max " /tib . cr
." extra chars ignored" cr
BEGIN inc-fgetc eolf? 1+ UNTIL tibeof @ ;
) ;
| : probe-for-fb ( -- flag )
\ probes whether current file looks like a block file
/tib 2+ 0 DO isfile@ fgetc #lf = IF ENDLOOP false exit THEN
LOOP true ;
\ probes whether current file name has no .FTH extension
isfile@ extension dup @ $5446 = swap 2+ c@ $48 = and not ;
\ *** Block No. 5, Hexblock 5
\ save/restoretib phz 16jan22
\ save/restoretib phz 05apr22
\\
$50 constant /stash
create stash[ /stash allot here constant ]stash
variable stash> stash[ stash> !
@ -115,16 +115,16 @@
\ *** Block No. 6, Hexblock 6
\ interpret-via-tib include phz 06feb22
\ interpret-via-tib include phz 05apr22
: interpret-via-tib
( : interpret-via-tib
BEGIN freadline >r .status >in off interpret
r> UNTIL ;
r> UNTIL ; )
: pushfile r> isfile push fromfile push >r ; restrict
: include ( -- )
pushfile use cr file?
probe-for-fb isfile@ freset IF 1 load close exit THEN
incfile push isfile@ incfile !
probe-for-fb IF 1 load exit THEN
incfile push isfile@ incfile ! ; \\
incpos push incpos off incpos 2+ dup push off
savetib >r interpret-via-tib close r> restoretib ;
@ -134,8 +134,8 @@
\ *** Block No. 7, Hexblock 7
\ \ phz 25feb22
\ \ phz 05apr22
\\
: \ blk @ IF >in @ negate c/l mod >in +!
ELSE #tib @ >in ! THEN ; immediate