Get v4th-x16 to work with r41 of x16emu and x16 ROM.

Main change is that c64key? and getkey are implemented through new
Kernal API calls instead of direct reading the keyboard buffer.
A separate intermediate test target for r41 is introduced.
But also the main x16 target is switched to r41 now.
Also, the KEEPEMU env var is introduced to run-in-x16emu.sh
for debugging that has proved its usefulness in cc64 emulator scripts.
This commit is contained in:
Philip Zembrod 2022-07-31 21:56:33 +02:00
parent 6812352db3
commit cae5f7c94d
5 changed files with 53 additions and 40 deletions

View File

@ -34,7 +34,7 @@ clean:
binaries: $(vf_binaries) binaries: $(vf_binaries)
test: $(test_resuls) test-v4th-x16-39.result test: $(test_resuls)
test64: std64 blk64 test64: std64 blk64
@ -93,8 +93,9 @@ cbmfiles/v4th-x16:
$(test_logs): $(test_files_petscii) emulator/run-in-vice.sh $(test_logs): $(test_files_petscii) emulator/run-in-vice.sh
test-v4thblk-c64.log: emulator/v4thblk-c64.T64 disks/scratch.d64 test-v4thblk-c64.log: emulator/v4thblk-c64.T64 disks/empty.d64
rm -f cbmfiles/test.log rm -f cbmfiles/test.log disks/scratch.d64
cp disks/empty.d64 disks/scratch.d64
DISK9=scratch emulator/run-in-vice.sh v4thblk-c64 \ DISK9=scratch emulator/run-in-vice.sh v4thblk-c64 \
"include run-blk-tests.fth\n1234567890\n" "include run-blk-tests.fth\n1234567890\n"
petscii2ascii cbmfiles/test.log $@ petscii2ascii cbmfiles/test.log $@
@ -105,9 +106,10 @@ test-v4th-c64.log: emulator/v4th-c64.T64
"include run-std-tests.fth\n1234567890\n" "include run-std-tests.fth\n1234567890\n"
petscii2ascii cbmfiles/test.log $@ petscii2ascii cbmfiles/test.log $@
test-v4thblk-c16+.log: emulator/v4thblk-c16+.T64 disks/scratch.d64 test-v4thblk-c16+.log: emulator/v4thblk-c16+.T64 disks/empty.d64
rm -f cbmfiles/test.log rm -f cbmfiles/test.log disks/scratch.d64
VICE=xplus4 emulator/run-in-vice.sh v4thblk-c16+ \ cp disks/empty.d64 disks/scratch.d64
VICE=xplus4 DISK9=scratch emulator/run-in-vice.sh v4thblk-c16+ \
"include run-blk-tests.fth\n1234567890\n" "include run-blk-tests.fth\n1234567890\n"
petscii2ascii cbmfiles/test.log $@ petscii2ascii cbmfiles/test.log $@
@ -136,6 +138,8 @@ test-v4th-x16.log: cbmfiles/v4th-x16 emulator/sdcard.img
mcopy -i emulator/sdcard.img ::TEST.LOG cbmfiles/test.log mcopy -i emulator/sdcard.img ::TEST.LOG cbmfiles/test.log
petscii2ascii cbmfiles/test.log $@ petscii2ascii cbmfiles/test.log $@
test-v4th-x16-39.log: $(test_files_petscii) emulator/run-in-vice.sh
test-v4th-x16-39.log: cbmfiles/v4th-x16 emulator/sdcard.img test-v4th-x16-39.log: cbmfiles/v4th-x16 emulator/sdcard.img
rm -f cbmfiles/test.log rm -f cbmfiles/test.log
emulator/run-in-x16-39.sh v4th-x16 \ emulator/run-in-x16-39.sh v4th-x16 \
@ -146,13 +150,22 @@ test-v4th-x16-39.log: cbmfiles/v4th-x16 emulator/sdcard.img
test-v4th-x16-39.golden: test-v4th-x16.golden test-v4th-x16-39.golden: test-v4th-x16.golden
cp $< $@ cp $< $@
test-v4th-x16-41.log: $(test_files_petscii) emulator/run-in-vice.sh
test-v4th-x16-41.log: cbmfiles/v4th-x16 emulator/sdcard.img
rm -f cbmfiles/test.log
emulator/run-in-x16-41.sh v4th-x16 \
"include run-std-tests.fth\n1234567890\n"
mcopy -i emulator/sdcard.img ::TEST.LOG cbmfiles/test.log
petscii2ascii cbmfiles/test.log $@
test-v4th-x16-41.golden: test-v4th-x16.golden
cp $< $@
test-%.result: test-%.log test-%.golden tests/evaluate-test.sh test-%.result: test-%.log test-%.golden tests/evaluate-test.sh
rm -f $@ rm -f $@
tests/evaluate-test.sh $(basename $@) tests/evaluate-test.sh $(basename $@)
disks/scratch.d64: disks/empty.d64
cp $< $@
emulator/sdcard.img: emulator/sdcard.sfdisk emulator/sdcard.img: emulator/sdcard.sfdisk
rm -f $@ $@.tmp rm -f $@ $@.tmp
dd if=/dev/zero of=$@.tmp count=64 bs=1M dd if=/dev/zero of=$@.tmp count=64 bs=1M

View File

@ -0,0 +1,9 @@
#!/bin/bash
set -e
emulatordir="$(realpath --relative-to="$PWD" "$(dirname "${BASH_SOURCE[0]}")")"
export PATH="${HOME}/x16-r41:${PATH}"
echo "PATH = ${PATH}"
"${emulatordir}/run-in-x16emu.sh" "$@"

View File

@ -1,6 +1,9 @@
#!/bin/bash #!/bin/bash
set -e set -e
executable="${1}"
keybuf="${2}"
emulatordir="$(realpath --relative-to="$PWD" "$(dirname "${BASH_SOURCE[0]}")")" emulatordir="$(realpath --relative-to="$PWD" "$(dirname "${BASH_SOURCE[0]}")")"
basedir="$(realpath --relative-to="$PWD" "${emulatordir}/..")" basedir="$(realpath --relative-to="$PWD" "${emulatordir}/..")"
cbmfilesdir="${basedir}/cbmfiles" cbmfilesdir="${basedir}/cbmfiles"
@ -16,20 +19,27 @@ do
done done
autostart="" autostart=""
if [ -n "$1" ] if [ -n "${executable}" ]
then then
autostart="-prg ${cbmfilesdir}/${1} -run" autostart="-prg ${cbmfilesdir}/${executable} -run"
fi fi
script="" script=""
warp="" warp=""
scale="" scale=""
debug="" debug=""
if [ -n "$2" ] if [ -n "${keybuf}" ]
then then
test -d tmp || mkdir tmp test -d tmp || mkdir tmp
rm -f "${x16script}".* rm -f "${x16script}".*
echo "load\"${1}\"\nrun\n${2}" | sed 's/\\n/\n/g' > "${x16script}".ascii # Magic env variable KEEPEMU: If set, remove the final CR.
if [ -n "${KEEPEMU}" ]; then
tr_remove='\n'
else
tr_remove=''
fi
echo "load\"${executable}\"\nrun\n${keybuf}" | tr -d "${tr_remove}" \
| sed 's/\\n/\n/g' > "${x16script}".ascii
ascii2petscii "${x16script}.ascii" "${x16script}.petscii" ascii2petscii "${x16script}.ascii" "${x16script}.petscii"
script="-bas ${x16script}.petscii" script="-bas ${x16script}.petscii"
autostart="" autostart=""

View File

@ -18,6 +18,7 @@ $FF84 >label IOINIT
$FFB1 >label LISTEN $FFB1 >label LISTEN
$FFC0 >label OPEN $FFC0 >label OPEN
$FFF0 >label PLOT $FFF0 >label PLOT
$FFB7 >label READST
$FF8A >label RESTOR $FF8A >label RESTOR
$FF93 >label SECOND $FF93 >label SECOND
$FFE1 >label STOP $FFE1 >label STOP

View File

@ -6,10 +6,11 @@ include vf-lbls-cbm.fth
\ X16 labels \ X16 labels
0ffd2 >label ConOut 0ffd2 >label ConOut
0286 >label IOStatus 0febd >label KbdbufPeek
0289 >label IOStatus
028c >label MsgFlg 028c >label MsgFlg
028b >label OutDev 028e >label OutDev
028a >label InDev 028d >label InDev
09f2c >label BrdCol 09f2c >label BrdCol
0266 >label BkgCol 0266 >label BkgCol
0284 >label PenCol 0284 >label PenCol
@ -46,33 +47,12 @@ include vf-lbls-cbm.fth
\ X16 c64key? getkey \ X16 c64key? getkey
Code c64key? ( -- flag) Code c64key? ( -- flag)
RamBank ldx KbdbufPeek jsr
\ TODO(issues/33): Remove the lines accessing RamBank38. txa pha
RamBank38 ldy
0 # lda RamBank sta
RamBank38 sta
Ndx lda
0<> ?[ 0FF # lda ]? pha
RamBank stx
RamBank38 sty
Push jmp end-code Push jmp end-code
Code getkey ( -- 8b) Code getkey ( -- 8b)
RamBank lda N sta GETIN jsr
\ TODO(issues/33): Remove the lines accessing RamBank38.
RamBank38 lda N 1+ sta
0 # lda RamBank sta
RamBank38 sta
Ndx lda 0<>
?[ sei KeyD ldy
[[ KeyD 1+ ,X lda KeyD ,X sta inx
Ndx cpx 0= ?]
Ndx dec
N lda RamBank sta
N 1+ lda RamBank38 sta
tya cli 0A0 # cmp
0= ?[ bl # lda ]?
]?
Push0A jmp end-code Push0A jmp end-code