Switch X16 keyboard input to use Kernal CHRIN instead of GETKEY.

This further reduces the use of undocumented Kernal variables and
fixes the residue of inverted blanks when backspacing on the X16.
It also now makes use of the CBM/X16 screen editor for Forth input.
Downside is that during EXPECT now no background tasks of the tasker
will be run, as no PAUSE is performed during CHRIN input until
the return key is pressed.
Test golden file generating had to be enhanced because with CHRIN
the typed characters aren't echoed into the test logfile anymore.
So X16 needs a slightly different core.golden file.
This commit is contained in:
Philip Zembrod 2024-05-29 23:39:15 +02:00
parent 611fbf1782
commit 1d659853a7
3 changed files with 39 additions and 53 deletions

View File

@ -19,6 +19,7 @@ test_files = $(wildcard tests/*.f*)
test_files_petscii = $(patsubst tests/%, cbmfiles/%, $(test_files))
test_logs = $(patsubst %, test-%.log, $(vf_flavours))
test_resuls = $(patsubst %, test-%.result, $(vf_flavours))
test_keyboard_input = some 12345 keys
release_zipfile = volksforth-6502-c64-release.zip
@ -35,6 +36,7 @@ clean:
rm -f *.log *.result *.golden
rm -f cbmfiles/c??-testbase
rm -f disks/scratch.d64 emulator/sdcard.img
rm -f tests/golden/mycore*.golden
# Convenience targets
@ -130,51 +132,51 @@ test-v4thblk-c64.log: emulator/v4thblk-c64.T64 disks/empty.d64
rm -f cbmfiles/test.log disks/scratch.d64
cp disks/empty.d64 disks/scratch.d64
DISK9=scratch emulator/run-in-vice.sh v4thblk-c64 \
"include run-blk-tests.fth\n1234567890"
"include run-blk-tests.fth\n$(test_keyboard_input)"
petscii2ascii cbmfiles/test.log $@
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"
"include run-std-tests.fth\n$(test_keyboard_input)"
petscii2ascii cbmfiles/test.log $@
test-v4thblk-c16+.log: emulator/v4thblk-c16+.T64 disks/empty.d64
rm -f cbmfiles/test.log disks/scratch.d64
cp disks/empty.d64 disks/scratch.d64
VICE=xplus4 DISK9=scratch emulator/run-in-vice.sh v4thblk-c16+ \
"include run-blk-tests.fth\n1234567890"
"include run-blk-tests.fth\n$(test_keyboard_input)"
petscii2ascii cbmfiles/test.log $@
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"
"include run-std-tests.fth\n$(test_keyboard_input)"
petscii2ascii cbmfiles/test.log $@
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"
"include run-min-tests.fth\n$(test_keyboard_input)"
petscii2ascii cbmfiles/test.log $@
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"
"include run-std-tests.fth\n$(test_keyboard_input)"
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\n1234567890"
"include run-std-tests.fth\n$(test_keyboard_input)"
mcopy -i emulator/sdcard.img ::TEST.LOG cbmfiles/test.log
petscii2ascii cbmfiles/test.log $@
test-v4th-x16e.log: cbmfiles/v4th-x16e emulator/sdcard.img
rm -f cbmfiles/test.log
emulator/run-in-x16emu.sh v4th-x16e \
"include run-std-tests.fth\n1234567890"
"include run-std-tests.fth\n$(test_keyboard_input)"
mcopy -i emulator/sdcard.img ::TEST.LOG cbmfiles/test.log
petscii2ascii cbmfiles/test.log $@
@ -190,37 +192,45 @@ emulator/sdcard.img: emulator/sdcard.sfdisk
mv $@.tmp $@
test-v4thblk-c64.golden: $(patsubst %, tests/golden/%.golden, \
prelim core coreext double block report-blk)
prelim mycore coreext double block report-blk)
cat $^ > $@
test-v4th-c64.golden: $(patsubst %, tests/golden/%.golden, \
prelim core coreext double report-noblk)
prelim mycore coreext double report-noblk)
cat $^ > $@
test-v4thblk-c16+.golden: $(patsubst %, tests/golden/%.golden, \
prelim core coreext double block report-blk)
prelim mycore coreext double block report-blk)
cat $^ > $@
test-v4th-c16+.golden: $(patsubst %, tests/golden/%.golden, \
prelim core coreext double report-noblk)
prelim mycore coreext double report-noblk)
cat $^ > $@
test-v4thblk-c16-.golden: $(patsubst %, tests/golden/%.golden, \
prelim core)
prelim mycore)
cat $^ > $@
test-v4th-c16-.golden: $(patsubst %, tests/golden/%.golden, \
prelim core coreext double report-noblk)
prelim mycore coreext double report-noblk)
cat $^ > $@
test-v4th-x16.golden: $(patsubst %, tests/golden/%.golden, \
prelim core coreext double report-noblk)
prelim mycore-x16 coreext double report-noblk)
cat $^ > $@
test-v4th-x16e.golden: $(patsubst %, tests/golden/%.golden, \
prelim core coreext double report-noblk)
prelim mycore-x16 coreext double report-noblk)
cat $^ > $@
tests/golden/mycore.golden: tests/golden/core-template.golden
sed -e 's/TMPL_KEYS_ECHO_TMPL/$(test_keyboard_input)/' \
-e 's/TMPL_KEYS_RECEIVED_TMPL/$(test_keyboard_input)/' $< >$@
tests/golden/mycore-x16.golden: tests/golden/core-template.golden
sed -e 's/TMPL_KEYS_ECHO_TMPL//' \
-e 's/TMPL_KEYS_RECEIVED_TMPL/$(test_keyboard_input)/' $< >$@
# Rules for building Forth binaries on top of the plain vanilla
# c64-volksforth83.

View File

@ -16,19 +16,6 @@ include vf-lbls-cbm.fth
1 >label RomBank
0 >label RamBank
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
\ C64 labels that X16 doesn't have:
\ 028a >label KeyRep \ aka rptflg
\ *** Block No. 129, Hexblock 81
81 fthpage
@ -44,44 +31,33 @@ Code getkey ( -- 8b)
Push0A jmp end-code
\ *** Block No. 130, Hexblock 82
82 fthpage
\ X16 curon curoff
Code curon ( --)
blnsw stx Next jmp end-code
Code curoff ( --)
blnsw sty Next jmp end-code
\ *** Block No. 131, Hexblock 83
83 fthpage
( #bs #cr ..keyboard clv12.4.87)
: c64key ( -- 8b)
curon BEGIN pause c64key? UNTIL
curoff getkey ;
: x16key ( -- 8b)
BEGIN pause c64key? UNTIL getkey ;
14 Constant #bs 0D Constant #cr
: c64decode
: x16decode
( addr cnt1 key -- addr cnt2)
#bs case? IF dup IF del 1- THEN
exit THEN
#cr case? IF dup span ! exit THEN
>r 2dup + r@ swap c! r> emit 1+ ;
>r 2dup + r> swap c! 1+ ;
: c64expect ( addr len1 -- )
Code basin ( -- 8b)
CHRIN jsr
Push0A jmp end-code
: x16expect ( addr len1 -- )
span ! 0
BEGIN dup span @ u<
WHILE key decode
WHILE basin x16decode
REPEAT 2drop space ;
Input: keyboard [ here input ! ]
c64key c64key? c64decode c64expect ;
x16key c64key? x16decode x16expect ;
include vf-sys-cbm.fth

View File

@ -21,8 +21,8 @@ YOU SHOULD SEE THE NUMBER RANGES OF SIGNED AND UNSIGNED NUMBERS:
UNSIGNED: 0 FFFF
*
PLEASE TYPE UP TO 80 CHARACTERS:
1234567890
RECEIVED: "1234567890"
TMPL_KEYS_ECHO_TMPL
RECEIVED: "TMPL_KEYS_RECEIVED_TMPL"
* GDX exists
End of Core word set tests