diff --git a/6502/C64/Makefile b/6502/C64/Makefile index bd29ec8..685cee4 100644 --- a/6502/C64/Makefile +++ b/6502/C64/Makefile @@ -5,10 +5,12 @@ 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 = $(wildcard src/vf-*.fth src/v4th*.fth) vf_fth_files_petscii = $(patsubst src/%, cbmfiles/%, $(vf_fth_files)) -vf_flavours = full-c64 full-c16+ full-c16- lite-c64 lite-c16+ lite-c16- -vf_binaries = $(patsubst %, cbmfiles/vf-%, $(vf_flavours)) +vf_flavours = \ + v4thblk-c64 v4thblk-c16+ v4thblk-c16- \ + v4th-c64 v4th-c16+ v4th-c16- v4th-x16 +vf_binaries = $(patsubst %, cbmfiles/%, $(vf_flavours)) test_files = $(wildcard tests/*.f*) test_files_petscii = $(patsubst tests/%, cbmfiles/%, $(test_files)) @@ -25,7 +27,7 @@ clean: rm -f cbmfiles/*.fr cbmfiles/*.fth cbmfiles/*.log rm -f *.log *.result *.golden rm -f cbmfiles/c??-testbase - rm -f disks/scratch.d64 + rm -f disks/scratch.d64 emulator/sdcard.img # Convenience targets @@ -34,15 +36,15 @@ binaries: $(vf_binaries) test: $(test_resuls) -test64: full64 lite64 +test64: std64 blk64 -full64: test-full-c64.result +blk64: test-v4thblk-c64.result -lite64: test-lite-c64.result +std64: test-v4th-c64.result debug-64: 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 + emulator/build-vf.sh v4th-c64 nosave run-devenv: emulator/devenv.T64 emulator/run-in-vice.sh devenv @@ -63,57 +65,75 @@ cbmfiles/tcbase: emulator/c64-vf-390.T64 emulator/build-tcbase.sh \ $(vf_binaries): emulator/tcbase.T64 emulator/build-vf.sh \ disks/tc38q.d64 $(vf_fth_files_petscii) -cbmfiles/vf-full-c64: - emulator/build-vf.sh vf-full-c64.fth vf-full-c64 +$(vf_binaries): cbmfiles/logtofile.fth -cbmfiles/vf-full-c16+: - emulator/build-vf.sh vf-full-c16+.fth vf-full-c16+ +cbmfiles/v4thblk-c64: + emulator/build-vf.sh v4thblk-c64 -cbmfiles/vf-full-c16-: - emulator/build-vf.sh vf-full-c16-.fth vf-full-c16- +cbmfiles/v4thblk-c16+: + emulator/build-vf.sh v4thblk-c16+ -cbmfiles/vf-lite-c64: - emulator/build-vf.sh vf-lite-c64.fth vf-lite-c64 +cbmfiles/v4thblk-c16-: + emulator/build-vf.sh v4thblk-c16- -cbmfiles/vf-lite-c16+: - emulator/build-vf.sh vf-lite-c16+.fth vf-lite-c16+ +cbmfiles/v4th-c64: + emulator/build-vf.sh v4th-c64 -cbmfiles/vf-lite-c16-: - emulator/build-vf.sh vf-lite-c16-.fth vf-lite-c16- +cbmfiles/v4th-c16+: + emulator/build-vf.sh v4th-c16+ + +cbmfiles/v4th-c16-: + emulator/build-vf.sh v4th-c16- + +cbmfiles/v4th-x16: + emulator/build-vf.sh v4th-x16 # Core test targets $(test_logs): $(test_files_petscii) emulator/run-in-vice.sh -test-full-c64.log: emulator/vf-full-c64.T64 disks/scratch.d64 - DISK9=scratch emulator/run-in-vice.sh vf-full-c64 \ - "include run-full-tests.fth\n1234567890\n" +test-v4thblk-c64.log: emulator/v4thblk-c64.T64 disks/scratch.d64 + rm -f cbmfiles/test.log + DISK9=scratch emulator/run-in-vice.sh v4thblk-c64 \ + "include run-blk-tests.fth\n1234567890\n" petscii2ascii cbmfiles/test.log $@ -test-lite-c64.log: emulator/vf-lite-c64.T64 - emulator/run-in-vice.sh vf-lite-c64 \ - "include run-lite-tests.fth\n1234567890\n" +test-v4th-c64.log: emulator/v4th-c64.T64 + rm -f cbmfiles/test.log + emulator/run-in-vice.sh v4th-c64 \ + "include run-std-tests.fth\n1234567890\n" petscii2ascii cbmfiles/test.log $@ -test-full-c16+.log: emulator/vf-full-c16+.T64 disks/scratch.d64 - VICE=xplus4 emulator/run-in-vice.sh vf-full-c16+ \ - "include run-full-tests.fth\n1234567890\n" +test-v4thblk-c16+.log: emulator/v4thblk-c16+.T64 disks/scratch.d64 + rm -f cbmfiles/test.log + VICE=xplus4 emulator/run-in-vice.sh v4thblk-c16+ \ + "include run-blk-tests.fth\n1234567890\n" petscii2ascii cbmfiles/test.log $@ -test-lite-c16+.log: emulator/vf-lite-c16+.T64 - VICE=xplus4 emulator/run-in-vice.sh vf-lite-c16+ \ - "include run-lite-tests.fth\n1234567890\n" +test-v4th-c16+.log: emulator/v4th-c16+.T64 + rm -f cbmfiles/test.log + VICE=xplus4 emulator/run-in-vice.sh v4th-c16+ \ + "include run-std-tests.fth\n1234567890\n" petscii2ascii cbmfiles/test.log $@ -test-full-c16-.log: emulator/vf-full-c16-.T64 - VICE=xplus4 emulator/run-in-vice.sh vf-full-c16- \ +test-v4thblk-c16-.log: emulator/v4thblk-c16-.T64 + rm -f cbmfiles/test.log + VICE=xplus4 emulator/run-in-vice.sh v4thblk-c16- \ "include run-min-tests.fth\n1234567890\n" petscii2ascii cbmfiles/test.log $@ -test-lite-c16-.log: emulator/vf-lite-c16-.T64 - VICE=xplus4 emulator/run-in-vice.sh vf-lite-c16- \ - "include run-lite-tests.fth\n1234567890\n" +test-v4th-c16-.log: emulator/v4th-c16-.T64 + rm -f cbmfiles/test.log + VICE=xplus4 emulator/run-in-vice.sh v4th-c16- \ + "include run-std-tests.fth\n1234567890\n" + petscii2ascii cbmfiles/test.log $@ + +test-v4th-x16.log: cbmfiles/v4th-x16 emulator/sdcard.img + rm -f cbmfiles/test.log + emulator/run-in-x16emu.sh v4th-x16 \ + "INCLUDE RUN-STD-TESTS.FTH\\X0D1234567890\\X0D" + mcopy -i emulator/sdcard.img ::TEST.LOG cbmfiles/test.log petscii2ascii cbmfiles/test.log $@ test-%.result: test-%.log test-%.golden tests/evaluate-test.sh @@ -123,28 +143,38 @@ test-%.result: test-%.log test-%.golden tests/evaluate-test.sh disks/scratch.d64: disks/empty.d64 cp $< $@ +emulator/sdcard.img: emulator/sdcard.sfdisk + rm -f $@ $@.tmp + dd if=/dev/zero of=$@.tmp count=64 bs=1M + sfdisk -w always -W always $@.tmp < $< + mformat -i $@.tmp -F + mv $@.tmp $@ -test-full-c64.golden: $(patsubst %, tests/golden/%.golden, \ +test-v4thblk-c64.golden: $(patsubst %, tests/golden/%.golden, \ prelim core coreext double block report-blk) cat $? > $@ -test-lite-c64.golden: $(patsubst %, tests/golden/%.golden, \ +test-v4th-c64.golden: $(patsubst %, tests/golden/%.golden, \ prelim core coreext double report-noblk) cat $? > $@ -test-full-c16+.golden: $(patsubst %, tests/golden/%.golden, \ +test-v4thblk-c16+.golden: $(patsubst %, tests/golden/%.golden, \ prelim core coreext double block report-blk) cat $? > $@ -test-lite-c16+.golden: $(patsubst %, tests/golden/%.golden, \ +test-v4th-c16+.golden: $(patsubst %, tests/golden/%.golden, \ prelim core coreext double report-noblk) cat $? > $@ -test-full-c16-.golden: $(patsubst %, tests/golden/%.golden, \ +test-v4thblk-c16-.golden: $(patsubst %, tests/golden/%.golden, \ prelim core) cat $? > $@ -test-lite-c16-.golden: $(patsubst %, tests/golden/%.golden, \ +test-v4th-c16-.golden: $(patsubst %, tests/golden/%.golden, \ + prelim core coreext double report-noblk) + cat $? > $@ + +test-v4th-x16.golden: $(patsubst %, tests/golden/%.golden, \ prelim core coreext double report-noblk) cat $? > $@ diff --git a/6502/C64/cbmfiles/c64-vf-390 b/6502/C64/cbmfiles/c64-vf-390 deleted file mode 100644 index b407c1b..0000000 Binary files a/6502/C64/cbmfiles/c64-vf-390 and /dev/null differ diff --git a/6502/C64/cbmfiles/tcbase b/6502/C64/cbmfiles/tcbase index 7c7ca15..a243b0d 100644 Binary files a/6502/C64/cbmfiles/tcbase and b/6502/C64/cbmfiles/tcbase differ diff --git a/6502/C64/cbmfiles/vf-lite-c16+ b/6502/C64/cbmfiles/v4th-c16+ similarity index 87% rename from 6502/C64/cbmfiles/vf-lite-c16+ rename to 6502/C64/cbmfiles/v4th-c16+ index 9fd1e60..fd10bdb 100644 Binary files a/6502/C64/cbmfiles/vf-lite-c16+ and b/6502/C64/cbmfiles/v4th-c16+ differ diff --git a/6502/C64/cbmfiles/vf-lite-c16- b/6502/C64/cbmfiles/v4th-c16- similarity index 87% rename from 6502/C64/cbmfiles/vf-lite-c16- rename to 6502/C64/cbmfiles/v4th-c16- index dd4f9f3..6ca1c4d 100644 Binary files a/6502/C64/cbmfiles/vf-lite-c16- and b/6502/C64/cbmfiles/v4th-c16- differ diff --git a/6502/C64/cbmfiles/vf-lite-c64 b/6502/C64/cbmfiles/v4th-c64 similarity index 87% rename from 6502/C64/cbmfiles/vf-lite-c64 rename to 6502/C64/cbmfiles/v4th-c64 index 56cc5e7..ffa7748 100644 Binary files a/6502/C64/cbmfiles/vf-lite-c64 and b/6502/C64/cbmfiles/v4th-c64 differ diff --git a/6502/C64/cbmfiles/v4th-x16 b/6502/C64/cbmfiles/v4th-x16 new file mode 100644 index 0000000..72e70f0 Binary files /dev/null and b/6502/C64/cbmfiles/v4th-x16 differ diff --git a/6502/C64/cbmfiles/vf-full-c16+ b/6502/C64/cbmfiles/v4thblk-c16+ similarity index 86% rename from 6502/C64/cbmfiles/vf-full-c16+ rename to 6502/C64/cbmfiles/v4thblk-c16+ index 9129208..3206c94 100644 Binary files a/6502/C64/cbmfiles/vf-full-c16+ and b/6502/C64/cbmfiles/v4thblk-c16+ differ diff --git a/6502/C64/cbmfiles/vf-full-c16- b/6502/C64/cbmfiles/v4thblk-c16- similarity index 86% rename from 6502/C64/cbmfiles/vf-full-c16- rename to 6502/C64/cbmfiles/v4thblk-c16- index 076a2ef..045df50 100644 Binary files a/6502/C64/cbmfiles/vf-full-c16- and b/6502/C64/cbmfiles/v4thblk-c16- differ diff --git a/6502/C64/cbmfiles/vf-full-c64 b/6502/C64/cbmfiles/v4thblk-c64 similarity index 86% rename from 6502/C64/cbmfiles/vf-full-c64 rename to 6502/C64/cbmfiles/v4thblk-c64 index fbb7dd8..923d7bb 100644 Binary files a/6502/C64/cbmfiles/vf-full-c64 and b/6502/C64/cbmfiles/v4thblk-c64 differ diff --git a/6502/C64/emulator/build-vf.sh b/6502/C64/emulator/build-vf.sh index 9f8ef01..f7fed6c 100755 --- a/6502/C64/emulator/build-vf.sh +++ b/6502/C64/emulator/build-vf.sh @@ -10,13 +10,20 @@ set -e emulatordir="$(dirname "${BASH_SOURCE[0]}")" basedir="$(realpath --relative-to="$PWD" "${emulatordir}/..")" -source="$1" -target="$2" +target="${1}" +source="${target}.fth" +logfile="${target}.log" +nosave="${2}" -test -n "$target" && rm -f "${basedir}/cbmfiles/${target}" +test -z "${nosave}" && rm -f "${basedir}/cbmfiles/${target}" +rm -f "${basedir}/cbmfiles/${logfile}" keybuf="include ${source}\nsave-target ${target}\ndos s0:notdone\n" -test -z "$target" && keybuf="include ${source}\n" +test -n "${nosave}" && keybuf="include ${source}\n" DISK10=tc38q "${emulatordir}/run-in-vice.sh" \ "tcbase" "${keybuf}" + +petscii2ascii "${basedir}/cbmfiles/${logfile}" | \ + grep -F 'target compile complete' || \ + (echo "check logfile ${basedir}/cbmfiles/${logfile}" && exit 1) diff --git a/6502/C64/emulator/run-in-vice.sh b/6502/C64/emulator/run-in-vice.sh index 6ef9ee8..683ce36 100755 --- a/6502/C64/emulator/run-in-vice.sh +++ b/6502/C64/emulator/run-in-vice.sh @@ -18,7 +18,7 @@ keybuf="" warp="" if [ -n "$2" ] then - keybuf="${2}" # dos s0:notdone\n" + keybuf="${2}" # The following could also just be a cp. ascii2petscii "${emulatordir}/notdone" "${basedir}/cbmfiles/notdone" warp="-warp" @@ -50,7 +50,11 @@ then done sleep 0.5 + kill9log="${basedir}/kill-9.log" + vicepid="$(jobs -p %1)" kill %1 + (sleep 20; ps -q "${vicepid}" -f --no-headers && \ + (kill -9 "${vicepid}" ; date)) >> "${kill9log}" 2>&1 & fi wait %1 || echo "x64 returned $?" diff --git a/6502/C64/emulator/run-in-x16emu.sh b/6502/C64/emulator/run-in-x16emu.sh new file mode 100755 index 0000000..d228b37 --- /dev/null +++ b/6502/C64/emulator/run-in-x16emu.sh @@ -0,0 +1,62 @@ +#!/bin/bash +set -e + +emulatordir="$(realpath --relative-to="$PWD" "$(dirname "${BASH_SOURCE[0]}")")" +basedir="$(realpath --relative-to="$PWD" "${emulatordir}/..")" +cbmfilesdir="${basedir}/cbmfiles" +sdcard="${emulatordir}/sdcard.img" + +mformat -i "${sdcard}" -F +for asciifile in $(cd "${cbmfilesdir}" && ls *.fth *fr) +do + # Convert filename to PETSCII, remove trailing CR. + petsciifile="$(echo ${asciifile} | ascii2petscii - |tr -d '\r')" + mcopy -i "${sdcard}" "${cbmfilesdir}/$asciifile" "::${petsciifile}" +done + +autostart="" +if [ -n "$1" ] +then + autostart="-prg ${cbmfilesdir}/${1} -run" +fi + +keybuf="" +warp="" +scale="" +debug="" +if [ -n "$2" ] +then + keybuf="${2}" + mcopy -i "${sdcard}" "${emulatordir}/notdone" "::NOTDONE" + warp="-warp" +else + scale="-scale 2" + debug="-debug" +fi + +# The -keybuf flag is added in https://github.com/pzembrod/x16-emulator +x16emu \ + -keymap de \ + -sdcard "${sdcard}" \ + $autostart \ + -keybuf "$keybuf" \ + $warp \ + $scale \ + $debug \ + & + +if [ -n "$keybuf" ] +then + while mtype -i "${sdcard}" "::NOTDONE" > /dev/null + do sleep 1 + done + sleep 0.5 + + kill9log="${basedir}/kill-9.log" + x16emupid="$(jobs -p %1)" + kill %1 + (sleep 20; ps -q "${x16emupid}" -f --no-headers && \ + (kill -9 "${x16emupid}" ; date)) >> "${kill9log}" 2>&1 & +fi + +wait %1 || echo "x16emu returned $?" diff --git a/6502/C64/emulator/sdcard.sfdisk b/6502/C64/emulator/sdcard.sfdisk new file mode 100644 index 0000000..8a8c814 --- /dev/null +++ b/6502/C64/emulator/sdcard.sfdisk @@ -0,0 +1,6 @@ +label: dos +label-id: 0x00000000 +device: emulator/my-image.fat +unit: sectors + +emulator/my-image.fat1 : start= 1, size= 131040, type=c, bootable diff --git a/6502/C64/src/vf-lite-c16+.fth b/6502/C64/src/v4th-c16+.fth similarity index 62% rename from 6502/C64/src/vf-lite-c16+.fth rename to 6502/C64/src/v4th-c16+.fth index bd3d436..a73da67 100644 --- a/6502/C64/src/vf-lite-c16+.fth +++ b/6502/C64/src/v4th-c16+.fth @@ -1,6 +1,15 @@ +\ with build log: +' noop alias \log +\ without build log: +\ ' \ alias \log + +\log include logtofile.fth + include vf-tc-prep.fth +\log logopen" v4th-c16+.log" + include vf-trg-c16+.fth \ The actual volksForth sources @@ -14,4 +23,7 @@ include vf-finalize.fth include vf-memsetup.fth include vf-pr-target.fth +.( target compile complete) cr +\log logclose + quit diff --git a/6502/C64/src/vf-lite-c16-.fth b/6502/C64/src/v4th-c16-.fth similarity index 62% rename from 6502/C64/src/vf-lite-c16-.fth rename to 6502/C64/src/v4th-c16-.fth index 1f2f6fe..aa179e2 100644 --- a/6502/C64/src/vf-lite-c16-.fth +++ b/6502/C64/src/v4th-c16-.fth @@ -1,6 +1,15 @@ +\ with build log: +' noop alias \log +\ without build log: +\ ' \ alias \log + +\log include logtofile.fth + include vf-tc-prep.fth +\log logopen" v4th-c16-.log" + include vf-trg-c16-.fth \ The actual volksForth sources @@ -14,4 +23,7 @@ include vf-finalize.fth include vf-memsetup.fth include vf-pr-target.fth +.( target compile complete) cr +\log logclose + quit diff --git a/6502/C64/src/vf-lite-c64.fth b/6502/C64/src/v4th-c64.fth similarity index 62% rename from 6502/C64/src/vf-lite-c64.fth rename to 6502/C64/src/v4th-c64.fth index 4a956d8..2d26f81 100644 --- a/6502/C64/src/vf-lite-c64.fth +++ b/6502/C64/src/v4th-c64.fth @@ -1,6 +1,15 @@ +\ with build log: +' noop alias \log +\ without build log: +\ ' \ alias \log + +\log include logtofile.fth + include vf-tc-prep.fth +\log logopen" v4th-c64.log" + include vf-trg-c64.fth \ The actual volksForth sources @@ -14,4 +23,7 @@ include vf-finalize.fth include vf-memsetup.fth include vf-pr-target.fth +.( target compile complete) cr +\log logclose + quit diff --git a/6502/C64/src/v4th-x16.fth b/6502/C64/src/v4th-x16.fth new file mode 100644 index 0000000..4b656c9 --- /dev/null +++ b/6502/C64/src/v4th-x16.fth @@ -0,0 +1,29 @@ + +\ with build log: +' noop alias \log +\ without build log: +\ ' \ alias \log + +\log include logtofile.fth + +include vf-tc-prep.fth + +\log logopen" v4th-x16.log" + +include vf-trg-x16.fth + +\ The actual volksForth sources + +include vf-head-x16.fth +include vf-cbm-core.fth +include vf-sys-x16.fth +include vf-cbm-file.fth +include vf-finalize.fth + 9f00 ' limit >body ! 9b00 s0 ! 9f00 r0 ! +include vf-memsetup.fth + +include vf-pr-target.fth +.( target compile complete) cr +\log logclose + +quit diff --git a/6502/C64/src/vf-full-c16+.fth b/6502/C64/src/v4thblk-c16+.fth similarity index 64% rename from 6502/C64/src/vf-full-c16+.fth rename to 6502/C64/src/v4thblk-c16+.fth index 8419bb9..1a512b2 100644 --- a/6502/C64/src/vf-full-c16+.fth +++ b/6502/C64/src/v4thblk-c16+.fth @@ -1,6 +1,15 @@ +\ with build log: +' noop alias \log +\ without build log: +\ ' \ alias \log + +\log include logtofile.fth + include vf-tc-prep.fth +\log logopen" v4thblk-c16+.log" + include vf-trg-c16+.fth \ The actual volksForth sources @@ -15,4 +24,7 @@ include vf-finalize.fth include vf-memsetup.fth include vf-pr-target.fth +.( target compile complete) cr +\log logclose + quit diff --git a/6502/C64/src/vf-full-c16-.fth b/6502/C64/src/v4thblk-c16-.fth similarity index 64% rename from 6502/C64/src/vf-full-c16-.fth rename to 6502/C64/src/v4thblk-c16-.fth index 6bc240e..b4a958a 100644 --- a/6502/C64/src/vf-full-c16-.fth +++ b/6502/C64/src/v4thblk-c16-.fth @@ -1,6 +1,15 @@ +\ with build log: +' noop alias \log +\ without build log: +\ ' \ alias \log + +\log include logtofile.fth + include vf-tc-prep.fth +\log logopen" v4thblk-c16-.log" + include vf-trg-c16-.fth \ The actual volksForth sources @@ -15,4 +24,7 @@ include vf-finalize.fth include vf-memsetup.fth include vf-pr-target.fth +.( target compile complete) cr +\log logclose + quit diff --git a/6502/C64/src/vf-full-c64.fth b/6502/C64/src/v4thblk-c64.fth similarity index 64% rename from 6502/C64/src/vf-full-c64.fth rename to 6502/C64/src/v4thblk-c64.fth index ff6dce3..b645129 100644 --- a/6502/C64/src/vf-full-c64.fth +++ b/6502/C64/src/v4thblk-c64.fth @@ -1,6 +1,15 @@ +\ with build log: +' noop alias \log +\ without build log: +\ ' \ alias \log + +\log include logtofile.fth + include vf-tc-prep.fth +\log logopen" v4thblk-c64.log" + include vf-trg-c64.fth \ The actual volksForth sources @@ -15,4 +24,7 @@ include vf-finalize.fth include vf-memsetup.fth include vf-pr-target.fth +.( target compile complete) cr +\log logclose + quit diff --git a/6502/C64/src/vf-cbm-core.fth b/6502/C64/src/vf-cbm-core.fth index ceb533a..77e7876 100644 --- a/6502/C64/src/vf-cbm-core.fth +++ b/6502/C64/src/vf-cbm-core.fth @@ -5,7 +5,10 @@ ( Zero page Variables & Next 03apr85bp) -02 dup >label RP 2+ +(C64 02 ) +(C16 02 ) +(X16 $30 ) + dup >label RP 2+ dup >label UP 2+ dup >label Puta 1+ diff --git a/6502/C64/src/vf-finalize.fth b/6502/C64/src/vf-finalize.fth index 0b37fa3..e9c659e 100644 --- a/6502/C64/src/vf-finalize.fth +++ b/6502/C64/src/vf-finalize.fth @@ -13,6 +13,7 @@ Forth also definitions (C16 : (64 ) \ jumps belhind C) (C64 : (16 ) +(X16 : (CX ) BEGIN name count dup 0= abort" C) missing" 2 = >r @ [ Ascii C Ascii ) $100 * + ] Literal @@ -20,7 +21,7 @@ Forth also definitions : C) ; immediate -(C16 : (16 ) (C64 : (64 ) ; immediate +(C16 : (16 ) (C64 : (64 ) (X16 : (CX ) ; immediate : forth-83 ; \ last word in Dictionary diff --git a/6502/C64/src/vf-head-c16.fth b/6502/C64/src/vf-head-c16.fth index 5dc0cd6..2542313 100644 --- a/6502/C64/src/vf-head-c16.fth +++ b/6502/C64/src/vf-head-c16.fth @@ -28,5 +28,5 @@ here dup origin! $100 allot Create logo - (C16+ ," volksFORTH-83 3.90-C16+ " ) - (C16- ," volksFORTH-83 3.90-C16- " ) + (C16+ ," volksFORTH-83 3.91-C16+ " ) + (C16- ," volksFORTH-83 3.91-C16- " ) diff --git a/6502/C64/src/vf-head-c64.fth b/6502/C64/src/vf-head-c64.fth index 89d2cc1..45159b6 100644 --- a/6502/C64/src/vf-head-c64.fth +++ b/6502/C64/src/vf-head-c64.fth @@ -28,4 +28,4 @@ here dup origin! $100 allot Create logo - ," volksFORTH-83 3.90-C64 " + ," volksFORTH-83 3.91-C64 " diff --git a/6502/C64/src/vf-head-x16.fth b/6502/C64/src/vf-head-x16.fth new file mode 100644 index 0000000..9503a1d --- /dev/null +++ b/6502/C64/src/vf-head-x16.fth @@ -0,0 +1,30 @@ +\ The head of Commander X16 VolkForth + +\ Initial part of load file + +Onlyforth + +$801 dup displace ! +Target definitions here! + + +10 fthpage + +\ FORTH Preamble and ID + +$D c, $8 c, $A c, 00 c, 9E c, 28 c, 32 c, 30 c, +36 c, 34 c, 29 c, 00 c, 00 c, 00 c, 00 c, \ SYS(2064) + +Assembler + nop 0 jmp here 2- >label >cold + nop 0 jmp here 2- >label >restart + +here dup origin! +\ Here are coldstart- and Uservariables +\ +0 jmp 0 jsr here 2- >label >wake + end-code +$100 allot + +Create logo + ," volksFORTH-83 3.91-X16 " diff --git a/6502/C64/src/vf-pr-target.fth b/6502/C64/src/vf-pr-target.fth index c14648e..b5449cb 100644 --- a/6502/C64/src/vf-pr-target.fth +++ b/6502/C64/src/vf-pr-target.fth @@ -8,6 +8,7 @@ cr .( Target is: ) \ clv14.4.87) (C16 .( C16 with ) (C16+ .( 64kb ) (C16- .( 32kb ) +(X16 .( Cmdr X16 ) cr .( Target is not: ) @@ -16,3 +17,5 @@ cr .( Target is not: ) (C16 \ ) .( C16, ) (C16+ \ ) .( C16+64kb, ) (C16- \ ) .( C16-32kb, ) +(X16 \ ) .( Cmdr X16, ) +cr diff --git a/6502/C64/src/vf-sys-c16.fth b/6502/C64/src/vf-sys-c16.fth index 72caeaf..ce4e0c6 100644 --- a/6502/C64/src/vf-sys-c16.fth +++ b/6502/C64/src/vf-sys-c16.fth @@ -13,8 +13,8 @@ include vf-lbls-cbm.fth 0ff19 >label BrdCol 0ff15 >label BkgCol 053b >label PenCol - 09d >label PrgEnd - 0b2 >label IOBeg + 09d >label PrgEnd \ aka eal; seems unused + 0b2 >label IOBeg \ aka stal; seems unused 0cb >label CurFlg 0cf >label InsCnt 0540 >label KeyRep @@ -55,6 +55,8 @@ end-code include vf-sys-cbm.fth +: i/o-status? $90 c@ ; + \ *** Block No. 143, Hexblock 8f \ ... continued @@ -126,3 +128,7 @@ Code C64fkeys \ Pushkeys a la C64 [[ dex 0>= ?[[ InitPKs ,X lda PKeys ,x sta ]]? xyNext jmp end-code + +(C16- | Create (bye $FFF6 here 2- ! ) + +(C16+ | CODE (bye rom $FFF6 jmp end-code ) diff --git a/6502/C64/src/vf-sys-c64.fth b/6502/C64/src/vf-sys-c64.fth index a7bf6d1..92fcb10 100644 --- a/6502/C64/src/vf-sys-c64.fth +++ b/6502/C64/src/vf-sys-c64.fth @@ -13,8 +13,8 @@ include vf-lbls-cbm.fth 0d020 >label BrdCol 0d021 >label BkgCol 0286 >label PenCol - 0ae >label PrgEnd - 0c1 >label IOBeg + 0ae >label PrgEnd \ aka eal; seems unused + 0c1 >label IOBeg \ aka stal; seems unused 0d4 >label CurFlg 0d8 >label InsCnt 028a >label KeyRep @@ -58,6 +58,8 @@ Code curoff ( --) include vf-sys-cbm.fth +: i/o-status? $90 c@ ; + \ *** Block No. 143, Hexblock 8f \ ... continued @@ -121,3 +123,5 @@ first-init dup bootsystem 1+ ! warmboot 1+ ! Code c64init first-init jsr xyNext jmp end-code + +| Create (bye $FCE2 here 2- ! diff --git a/6502/C64/src/vf-sys-cbm.fth b/6502/C64/src/vf-sys-cbm.fth index d5babd4..d0a4dde 100644 --- a/6502/C64/src/vf-sys-cbm.fth +++ b/6502/C64/src/vf-sys-cbm.fth @@ -95,12 +95,6 @@ Output: display [ here output ! ] c64emit c64cr c64type c64del c64page c64at c64at? ; -(C64 | Create (bye $FCE2 here 2- ! ) - -(C16- | Create (bye $FFF6 here 2- ! ) - -(C16+ | CODE (bye rom $FFF6 jmp end-code ) - \ *** Block No. 135, Hexblock 87 87 fthpage @@ -217,8 +211,6 @@ Code bus@ ( -- 8b) : businput ( adr n --) bounds ?DO bus@ I c! LOOP pause ; -: i/o-status? $90 c@ ; - : derror? ( -- flag ) disk $F busin bus@ dup Ascii 0 - IF BEGIN emit bus@ dup #cr = UNTIL diff --git a/6502/C64/src/vf-sys-x16.fth b/6502/C64/src/vf-sys-x16.fth new file mode 100644 index 0000000..3e5062a --- /dev/null +++ b/6502/C64/src/vf-sys-x16.fth @@ -0,0 +1,120 @@ + +include vf-lbls-cbm.fth + +7f fthpage + +\ X16 labels + +0c28c >label ConOut + 028c >label MsgFlg + 028b >label OutDev + 028a >label InDev +09f2c >label BrdCol + 0266 >label BkgCol + 0284 >label PenCol + 8a >label PrgEnd \ aka eal; seems unused + 0292 >label IOBeg \ aka stal; seems unused + 0381 >label CurFlg \ aka qtsw + 0385 >label InsCnt \ aka insrt + + +\ C64 labels that X16 doesn't have: + +\ 028a >label KeyRep \ aka rptflg + + +\ *** Block No. 129, Hexblock 81 +81 fthpage + +\ X16 c64key? getkey + +Code c64key? ( -- flag) + 0 # lda 9f61 sta + 0a00a lda + 0<> ?[ 0FF # lda ]? pha + Push jmp end-code + +Code getkey ( -- 8b) + 0 # lda 9f61 sta + 0a00a lda 0<> + ?[ sei 0a000 ldy + [[ 0a000 1+ ,X lda 0a000 ,X sta inx + 0a00a cpx 0= ?] + 0a00a dec tya cli 0A0 # cmp + 0= ?[ bl # lda ]? + ]? + Push0A jmp end-code + + +\ *** Block No. 130, Hexblock 82 +82 fthpage + +\ X16 curon curoff + + 037B >label blnsw \ C64: $cc +\ 037C >label blnct \ C64: $cd +\ 037D >label gdbln \ C64: $ce +\ 037E >label blnon \ C64: $cf +\ 0262 >label pnt \ C64: $d1 +\ 0380 >label pntr \ C64: $d3 +\ 0373 >label gdcol + +09f60 >label via1pb + +Code curon ( --) + blnsw stx Next jmp end-code + +Code curoff ( --) + blnsw sty Next jmp end-code + + +include vf-sys-cbm.fth + +: i/o-status? $0286 c@ ; + + +\ *** Block No. 143, Hexblock 8f +\ ... continued +8f fthpage + +Create ink-pot +\ border bkgnd pen 0 + 6 c, 6 c, 3 c, 0 c, \ Forth + 0E c, 6 c, 3 c, 0 c, \ Edi + 6 c, 6 c, 3 c, 0 c, \ User + + +\ *** Block No. 144, Hexblock 90 +90 fthpage + +\ X16 restore + +Label restore pha txa pha tya pha cld +\ TODO: Replace with phx phy once 65c02 asm is available + $ffe1 jsr ( stop ) 0<> ?[ $e01f jmp ( prend ) ]? +' restart @ jmp end-code + + +\ *** Block No. 145, Hexblock 91 +91 fthpage + +\ X16:Init + +: init-system \ TODO(pzembrod): Check if this works and is needed + [ restore ] Literal $318 ! ; \ NMI-Vector + +Label first-init + sei cld + via1pb lda $f8 # and via1pb sta \ map in KERNAL ROM + IOINIT jsr CINT jsr RESTOR jsr \ init. and set I/O-Vectors + ink-pot lda BrdCol sta \ border + ink-pot 1+ lda BkgCol sta \ backgrnd + ink-pot 2+ lda PenCol sta \ pen + $0e # lda ConOut jsr \ lower/uppercase + cli rts end-code +first-init dup bootsystem 1+ ! + warmboot 1+ ! +Code c64init first-init jsr + xyNext jmp end-code + +| CODE (bye $FFFC ) jmp end-code diff --git a/6502/C64/src/vf-trg-c16+.fth b/6502/C64/src/vf-trg-c16+.fth index 842b483..3dd0b04 100644 --- a/6502/C64/src/vf-trg-c16+.fth +++ b/6502/C64/src/vf-trg-c16+.fth @@ -6,6 +6,7 @@ : (C16+ ; immediate : (C64 [compile] ( ; immediate : (C16- [compile] ( ; immediate +: (X16 [compile] ( ; immediate include vf-pr-target.fth diff --git a/6502/C64/src/vf-trg-c16-.fth b/6502/C64/src/vf-trg-c16-.fth index 6127f23..7282abe 100644 --- a/6502/C64/src/vf-trg-c16-.fth +++ b/6502/C64/src/vf-trg-c16-.fth @@ -6,6 +6,7 @@ : (C16- ; immediate : (C64 [compile] ( ; immediate : (C16+ [compile] ( ; immediate +: (X16 [compile] ( ; immediate include vf-pr-target.fth diff --git a/6502/C64/src/vf-trg-c64.fth b/6502/C64/src/vf-trg-c64.fth index b190a52..8c880d2 100644 --- a/6502/C64/src/vf-trg-c64.fth +++ b/6502/C64/src/vf-trg-c64.fth @@ -6,5 +6,6 @@ : (C16 [compile] ( ; immediate : (C16+ [compile] ( ; immediate : (C16- [compile] ( ; immediate +: (X16 [compile] ( ; immediate include vf-pr-target.fth diff --git a/6502/C64/src/vf-trg-x16.fth b/6502/C64/src/vf-trg-x16.fth new file mode 100644 index 0000000..38b2e0c --- /dev/null +++ b/6502/C64/src/vf-trg-x16.fth @@ -0,0 +1,11 @@ + +: ) ; immediate +: (C ; immediate + +: (X16 ; immediate +: (C64 [compile] ( ; immediate +: (C16 [compile] ( ; immediate +: (C16+ [compile] ( ; immediate +: (C16- [compile] ( ; immediate + +include vf-pr-target.fth diff --git a/6502/C64/tests/run-full-tests.fth b/6502/C64/tests/run-blk-tests.fth similarity index 100% rename from 6502/C64/tests/run-full-tests.fth rename to 6502/C64/tests/run-blk-tests.fth diff --git a/6502/C64/tests/run-lite-tests.fth b/6502/C64/tests/run-std-tests.fth similarity index 100% rename from 6502/C64/tests/run-lite-tests.fth rename to 6502/C64/tests/run-std-tests.fth