diff --git a/6502/C64/Makefile b/6502/C64/Makefile index d8ca20c..f316977 100644 --- a/6502/C64/Makefile +++ b/6502/C64/Makefile @@ -27,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 @@ -129,6 +129,13 @@ test-lite-c16-.log: emulator/vf-lite-c16-.T64 "include run-lite-tests.fth\n1234567890\n" petscii2ascii cbmfiles/test.log $@ +test-lite-x16.log: cbmfiles/vf-lite-x16 emulator/sdcard.img + rm -f cbmfiles/test.log + emulator/run-in-x16emu.sh vf-lite-x16 \ + "include run-lite-tests.fth\n1234567890\n" + mcopy -i emulator/sdcard.img ::TEST.LOG cbmfiles/test.log + petscii2ascii cbmfiles/test.log $@ + test-%.result: test-%.log test-%.golden tests/evaluate-test.sh rm -f $@ tests/evaluate-test.sh $(basename $@) @@ -136,6 +143,12 @@ 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, \ prelim core coreext double block report-blk) diff --git a/6502/C64/emulator/run-in-vice.sh b/6502/C64/emulator/run-in-vice.sh index 5511aab..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" @@ -51,7 +51,7 @@ then sleep 0.5 kill9log="${basedir}/kill-9.log" - vicepid=$(jobs -p %1) + vicepid="$(jobs -p %1)" kill %1 (sleep 20; ps -q "${vicepid}" -f --no-headers && \ (kill -9 "${vicepid}" ; date)) >> "${kill9log}" 2>&1 & diff --git a/6502/C64/emulator/run-in-x16emu.sh b/6502/C64/emulator/run-in-x16emu.sh new file mode 100755 index 0000000..6912420 --- /dev/null +++ b/6502/C64/emulator/run-in-x16emu.sh @@ -0,0 +1,55 @@ +#!/bin/bash +set -e +#set -x + +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 + 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="" +if [ -n "$2" ] +then + keybuf="${2}" + mcopy -i "${sdcard}" "${emulatordir}/notdone" "::NOTDONE" + # warp="-warp" +fi + +x16emu \ + -keymap de \ + -scale 2 \ + -debug \ + -sdcard "${sdcard}" \ + $autostart \ + $warp \ + & + +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