diff --git a/6502/C64/Makefile b/6502/C64/Makefile index 0fb31c6..7280c81 100644 --- a/6502/C64/Makefile +++ b/6502/C64/Makefile @@ -8,6 +8,8 @@ VERSION=vf-latest vf_blk_d64_files = $(wildcard disks/*.d64) vf_blk_fth_files = $(patsubst %.d64, %.fth, $(vf_blk_d64_files)) +vf_fth_files = $(wildcard src/vf-*.fth) +vf_fth_files_petscii = $(patsubst src/%, cbmfiles/%, $(vf_fth_files)) test_files = $(wildcard tests/*.f*) test_files_petscii = $(patsubst tests/%, cbmfiles/%, $(test_files)) @@ -28,6 +30,12 @@ test: test-c64.result test-c16.result test64: test-c64.result +# Temporary bincmp target while the old and the new binaries are still +# expected to be binary identical. +bincmp: cbmfiles/c64-vf-latest cbmfiles/c16-vf-latest + cmp cbmfiles/c64-vf-latest cbmfiles/c64-volksforth83 + cmp cbmfiles/c16-vf-latest cbmfiles/c16-volksforth83 + run-devenv: emulator/devenv.T64 emulator/run-in-vice.sh devenv @@ -40,20 +48,24 @@ run-testbase16: emulator/testbase16.T64 # Targetcompiler targets -cbmfiles/tcbase: emulator/c64-testbase.T64 emulator/build-tcbase.sh \ - disks/vforth4_2.d64 disks/tc38q.d64 cbmfiles/mk-tcbase.fth +cbmfiles/tcbase: emulator/c64-volksforth83.T64 emulator/build-tcbase.sh \ + disks/tc38q.d64 disks/file-words.d64 cbmfiles/tc-base.fth emulator/build-tcbase.sh -cbmfiles/c64-vf-latest: emulator/tcbase.T64 emulator/build-c64forth.sh \ - disks/vforth4_2.d64 disks/tc38q.d64 cbmfiles/mk-c64forth.fth - emulator/build-c64forth.sh +cbmfiles/c64-vf-latest: emulator/tcbase.T64 emulator/build-vf.sh \ + disks/vforth4_2.d64 disks/tc38q.d64 $(vf_fth_files_petscii) + emulator/build-vf.sh vf-c64-main.fth c64-vf-latest + +# C16 with 64 kB RAM or Plus4 - called (C16+ in the sources. +cbmfiles/c16-vf-latest: emulator/tcbase.T64 emulator/build-vf.sh \ + disks/vforth4_2.d64 disks/tc38q.d64 $(vf_fth_files_petscii) + emulator/build-vf.sh vf-c16-main.fth c16-vf-latest + +# C16 with 32 kB RAM - called (C16- in the sources. +cbmfiles/c16-vf-32k: emulator/tcbase.T64 emulator/build-vf.sh \ + disks/vforth4_2.d64 disks/tc38q.d64 $(vf_fth_files_petscii) + emulator/build-vf.sh vf-c16-32k.fth c16-vf-32k -# Temp stopgap to fit c16 into default use of VERSION=vf-latest -# until we have a proper c16 targetcompiler rule. -# Missing part: Moving the target machine definition from vforth4_2.d64 -# screen 9 to somewhere more flexible. Likely two .fth files. -cbmfiles/c16-vf-latest: cbmfiles/c16-volksforth83 - cp $< $@ # Core test targets diff --git a/6502/C64/cbmfiles/.gitignore b/6502/C64/cbmfiles/.gitignore index fbf7330..a36d65a 100644 --- a/6502/C64/cbmfiles/.gitignore +++ b/6502/C64/cbmfiles/.gitignore @@ -1,3 +1,5 @@ *.fth core.fr notdone +c64-testbase +c16-testbase diff --git a/6502/C64/cbmfiles/c16-vf-latest b/6502/C64/cbmfiles/c16-vf-latest new file mode 100644 index 0000000..0b38587 Binary files /dev/null and b/6502/C64/cbmfiles/c16-vf-latest differ diff --git a/6502/C64/cbmfiles/tcbase b/6502/C64/cbmfiles/tcbase index 0ff1c57..cdbdb8d 100644 Binary files a/6502/C64/cbmfiles/tcbase and b/6502/C64/cbmfiles/tcbase differ diff --git a/6502/C64/emulator/build-c64forth.sh b/6502/C64/emulator/build-c64forth.sh deleted file mode 100755 index cc0a10a..0000000 --- a/6502/C64/emulator/build-c64forth.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/bin/bash -set -e - -emulatordir="$(dirname "${BASH_SOURCE[0]}")" -basedir="$(realpath --relative-to="$PWD" "${emulatordir}/..")" - -rm -f "${basedir}/cbmfiles/c64-vf-latest" - -keybuf="include mk-c64forth.fth\n\ -save-target c64-vf-latest\ndos s0:notdone\n" - -DISK9=vforth4_2 DISK10=tc38q "${emulatordir}/run-in-vice.sh" \ - "tcbase" "${keybuf}" diff --git a/6502/C64/emulator/build-tcbase.sh b/6502/C64/emulator/build-tcbase.sh index 01cac95..9bdc6f4 100755 --- a/6502/C64/emulator/build-tcbase.sh +++ b/6502/C64/emulator/build-tcbase.sh @@ -1,4 +1,7 @@ #!/bin/bash +# build script for the resident part of the target compiler running +# on the C64. + set -e emulatordir="$(dirname "${BASH_SOURCE[0]}")" @@ -6,8 +9,9 @@ basedir="$(realpath --relative-to="$PWD" "${emulatordir}/..")" rm -f "${basedir}/cbmfiles/tcbase" -keybuf="2 drive 4 load\ninclude mk-tcbase.fth\n\ +keybuf="3 drive 20 load\n3 drive 10 load\nsave\n\ +2 drive 4 load\ninclude tc-base.fth\n\ savesystem tcbase\ndos s0:notdone\n" -DISK9=vforth4_2 DISK10=tc38q "${emulatordir}/run-in-vice.sh" \ - "c64-testbase" "${keybuf}" +DISK10=tc38q DISK11=file-words "${emulatordir}/run-in-vice.sh" \ + "c64-volksforth83" "${keybuf}" diff --git a/6502/C64/emulator/build-testbase16.sh b/6502/C64/emulator/build-testbase16.sh deleted file mode 100755 index bbf3660..0000000 --- a/6502/C64/emulator/build-testbase16.sh +++ /dev/null @@ -1,16 +0,0 @@ -#!/bin/bash -set -e - -emulatordir="$(dirname "${BASH_SOURCE[0]}")" -basedir="$(realpath --relative-to="$PWD" "${emulatordir}/..")" - -rm -f "${basedir}/cbmfiles/testbase" - -# load savesystem w/o editor from file-words.d64 block 20. -# load include and dos from file-words.d64 block 10. -# savesystem and then scratch file notdone to exit emulator. -keybuf="3 drive 20 load\n3 drive 10 load\n\ -savesystem testbase16\ndos s0:notdone\n" - -VICE=xplus4 DISK11=file-words "${emulatordir}/run-in-vice.sh" \ - "c16-volksforth83" "${keybuf}" diff --git a/6502/C64/emulator/build-vf.sh b/6502/C64/emulator/build-vf.sh new file mode 100755 index 0000000..cf4d611 --- /dev/null +++ b/6502/C64/emulator/build-vf.sh @@ -0,0 +1,21 @@ +#!/bin/bash + +# Script for target-compiling the CBM versions of VolksForth. +# It uses the tcbase binary, i.e. the resident part of the target +# compiler, adds the transient part of the target compiler, then +# loads the VolksForth sources, and saves the target. + +set -e + +emulatordir="$(dirname "${BASH_SOURCE[0]}")" +basedir="$(realpath --relative-to="$PWD" "${emulatordir}/..")" + +source="$1" +target="$2" + +rm -f "${basedir}/cbmfiles/${target}" + +keybuf="include ${source}\nsave-target ${target}\ndos s0:notdone\n" + +DISK9=vforth4_2 DISK10=tc38q "${emulatordir}/run-in-vice.sh" \ + "tcbase" "${keybuf}" diff --git a/6502/C64/src/mk-c64forth.fth b/6502/C64/src/mk-c64forth.fth deleted file mode 100644 index 50b473f..0000000 --- a/6502/C64/src/mk-c64forth.fth +++ /dev/null @@ -1,6 +0,0 @@ - -hex - -2 drive 27 30 thru - -1 drive f load diff --git a/6502/C64/src/mk-tcbase.fth b/6502/C64/src/tc-base.fth similarity index 56% rename from 6502/C64/src/mk-tcbase.fth rename to 6502/C64/src/tc-base.fth index 54a605f..ba4e7e2 100644 --- a/6502/C64/src/mk-tcbase.fth +++ b/6502/C64/src/tc-base.fth @@ -1,5 +1,7 @@ -: edit list ; +\ loadfile for the resident part of the target compiler. + +' list alias edit : .blk ( -) blk @ ?dup IF ." Blk " u. ?cr THEN ; diff --git a/6502/C64/src/vf-c16-32k.fth b/6502/C64/src/vf-c16-32k.fth new file mode 100644 index 0000000..075599e --- /dev/null +++ b/6502/C64/src/vf-c16-32k.fth @@ -0,0 +1,34 @@ + +hex + +2 drive 27 30 thru + +1 drive + +Onlyforth hex + c load \ clear memory and + d e thru \ clr labels .status + +\ *** Block No. 9, Hexblock 9 + +\ Target-Machine clv06dec88 + +cr .( Host is: ) + (64 .( C64) C) + (16 .( C16) C) + + : ) ; immediate + : (C ; immediate + +\ : (C64 ; immediate + : (C16 ; immediate +\ : (C16+ ; immediate + : (C16- ; immediate + + : (C64 [compile] ( ; immediate +\ : (C16 [compile] ( ; immediate + : (C16+ [compile] ( ; immediate +\ : (C16- [compile] ( ; immediate + + +include vf-main.fth diff --git a/6502/C64/src/vf-c16-main.fth b/6502/C64/src/vf-c16-main.fth new file mode 100644 index 0000000..2bb8569 --- /dev/null +++ b/6502/C64/src/vf-c16-main.fth @@ -0,0 +1,43 @@ + +hex + +2 drive 27 30 thru + +1 drive + +Onlyforth hex + c load \ clear memory and + d e thru \ clr labels .status + +\ *** Block No. 9, Hexblock 9 + +\ Target-Machine clv06dec88 + +cr .( Host is: ) + (64 .( C64) C) + (16 .( C16) C) + + : ) ; immediate + : (C ; immediate + +\ : (C64 ; immediate + : (C16 ; immediate + : (C16+ ; immediate +\ : (C16- ; immediate + + : (C64 [compile] ( ; immediate +\ : (C16 [compile] ( ; immediate +\ : (C16+ [compile] ( ; immediate + : (C16- [compile] ( ; immediate + +\ *** Block No. 10, Hexblock a + +\ load/remove JSR-Macros clv14.4.87) + +Assembler also definitions + +\needs C16+Jsr 8 load +' C16+Jsr Is Jsr .( JSR Is:C16+ ) + + +include vf-main.fth diff --git a/6502/C64/src/vf-c64-main.fth b/6502/C64/src/vf-c64-main.fth new file mode 100644 index 0000000..1ee019a --- /dev/null +++ b/6502/C64/src/vf-c64-main.fth @@ -0,0 +1,34 @@ + +hex + +2 drive 27 30 thru + +1 drive + +Onlyforth hex + c load \ clear memory and + d e thru \ clr labels .status + +\ *** Block No. 9, Hexblock 9 + +\ Target-Machine clv06dec88 + +cr .( Host is: ) + (64 .( C64) C) + (16 .( C16) C) + + : ) ; immediate + : (C ; immediate + + : (C64 ; immediate +\ : (C16 ; immediate +\ : (C16+ ; immediate +\ : (C16- ; immediate + +\ : (C64 [compile] ( ; immediate + : (C16 [compile] ( ; immediate + : (C16+ [compile] ( ; immediate + : (C16- [compile] ( ; immediate + + +include vf-main.fth diff --git a/6502/C64/src/vf-main.fth b/6502/C64/src/vf-main.fth new file mode 100644 index 0000000..7430516 --- /dev/null +++ b/6502/C64/src/vf-main.fth @@ -0,0 +1,24 @@ + + +include vf-pr-target.fth + +Onlyforth + +(C64 $801 ) (C16 $1001 ) dup displace ! + +Target definitions here! + +$10 $7D thru + +Assembler nonrelocate + +.unresolved + +' .blk is .status + +include vf-pr-target.fth + +cr .( for manual saving:) +cr .( save-target volksforth83) +cr +quit diff --git a/6502/C64/src/vf-pr-target.fth b/6502/C64/src/vf-pr-target.fth new file mode 100644 index 0000000..c14648e --- /dev/null +++ b/6502/C64/src/vf-pr-target.fth @@ -0,0 +1,18 @@ +\ *** Block No. 11, Hexblock b + +cr .( Target is: ) \ clv14.4.87) + + +(C .( CBM ) +(C64 .( C64 ) +(C16 .( C16 with ) +(C16+ .( 64kb ) +(C16- .( 32kb ) + +cr .( Target is not: ) + +(C \ ) .( CBM, ) +(C64 \ ) .( C64, ) +(C16 \ ) .( C16, ) +(C16+ \ ) .( C16+64kb, ) +(C16- \ ) .( C16-32kb, )