Make x16input-tsk.fth directly loadable by v4th-x16, and rename the

native input implementations for X16 c64key? -> x16key? etc.
This commit is contained in:
Philip Zembrod 2024-06-10 03:06:02 +02:00
parent 322025842a
commit ab0abf1f8e
4 changed files with 41 additions and 77 deletions

View File

@ -126,7 +126,7 @@ cbmfiles/v4th-x16e:
# Core test targets
$(test_logs): $(test_files_petscii) emulator/run-in-vice.sh
$(test_logs): $(test_files_petscii) $(wildcard emulator/run-in-*.sh)
test-v4thblk-c64.log: emulator/v4thblk-c64.T64 disks/empty.d64
rm -f cbmfiles/test.log disks/scratch.d64
@ -192,45 +192,61 @@ emulator/sdcard.img: emulator/sdcard.sfdisk
mv $@.tmp $@
test-v4thblk-c64.golden: $(patsubst %, tests/golden/%.golden, \
prelim mycore coreext double block report-blk)
prelim mycore-echo coreext double block report-blk)
cat $^ > $@
test-v4th-c64.golden: $(patsubst %, tests/golden/%.golden, \
prelim mycore coreext double report-noblk)
prelim mycore-echo coreext double report-noblk)
cat $^ > $@
test-v4thblk-c16+.golden: $(patsubst %, tests/golden/%.golden, \
prelim mycore coreext double block report-blk)
prelim mycore-echo coreext double block report-blk)
cat $^ > $@
test-v4th-c16+.golden: $(patsubst %, tests/golden/%.golden, \
prelim mycore coreext double report-noblk)
prelim mycore-echo coreext double report-noblk)
cat $^ > $@
test-v4thblk-c16-.golden: $(patsubst %, tests/golden/%.golden, \
prelim mycore)
prelim mycore-echo)
cat $^ > $@
test-v4th-c16-.golden: $(patsubst %, tests/golden/%.golden, \
prelim mycore coreext double report-noblk)
prelim mycore-echo coreext double report-noblk)
cat $^ > $@
test-v4th-x16.golden: $(patsubst %, tests/golden/%.golden, \
prelim mycore-x16 coreext double report-noblk)
prelim mycore-noecho coreext double report-noblk)
cat $^ > $@
test-v4th-x16e.golden: $(patsubst %, tests/golden/%.golden, \
prelim mycore-x16 coreext double report-noblk)
prelim mycore-noecho coreext double report-noblk)
cat $^ > $@
tests/golden/mycore.golden: tests/golden/core-template.golden
tests/golden/mycore-echo.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
tests/golden/mycore-noecho.golden: tests/golden/core-template.golden
sed -e 's/TMPL_KEYS_ECHO_TMPL//' \
-e 's/TMPL_KEYS_RECEIVED_TMPL/$(test_keyboard_input)/' $< >$@
# Sample test with a changed input that would run the tasker
# even while waiting for keyboard input:
test-v4th-x16-tsk.log: cbmfiles/v4th-x16 emulator/sdcard.img \
$(test_files_petscii) $(wildcard emulator/run-in-*.sh) \
cbmfiles/6502asm.fth cbmfiles/trns6502asm.fth \
cbmfiles/vf-lbls-cbm.fth cbmfiles/x16input-tsk.fth
rm -f cbmfiles/test.log
emulator/run-in-x16emu.sh v4th-x16 \
"include x16input-tsk.fth\ninclude run-min-tests.fth\n$(test_keyboard_input)"
mcopy -i emulator/sdcard.img ::TEST.LOG cbmfiles/test.log
petscii2ascii cbmfiles/test.log $@
test-v4th-x16-tsk.golden: $(patsubst %, tests/golden/%.golden, \
prelim mycore-echo)
cat $^ > $@
# Rules for building Forth binaries on top of the plain vanilla
# c64-volksforth83.

View File

@ -1,7 +1,4 @@
\ *** Block No. 126, Hexblock 7e
7e fthpage
\ CBM-Labels 05nov87re
$FFA5 >label ACPTR

View File

@ -19,9 +19,9 @@ include vf-lbls-cbm.fth
\ *** Block No. 129, Hexblock 81
81 fthpage
\ X16 c64key? getkey
\ X16 x16key? getkey
Code c64key? ( -- flag)
Code x16key? ( -- flag)
KbdbufPeek jsr
txa pha
Push jmp end-code
@ -37,7 +37,7 @@ Code getkey ( -- 8b)
( #bs #cr ..keyboard clv12.4.87)
: x16key ( -- 8b)
BEGIN pause c64key? UNTIL getkey ;
BEGIN pause x16key? UNTIL getkey ;
14 Constant #bs 0D Constant #cr
@ -57,7 +57,7 @@ Code basin ( -- 8b)
REPEAT 2drop space ;
Input: keyboard [ here input ! ]
x16key c64key? x16decode x16expect ;
x16key x16key? x16decode x16expect ;
include vf-sys-cbm.fth

View File

@ -1,51 +1,12 @@
\ Sample: a changed input that would run the tasker
\ even while waiting for keyboard input, similar to
\ the keyboard input on C16 and C64:
include vf-lbls-cbm.fth
7f fthpage
include trns6502asm.fth
\ X16 labels
0ffd2 >label ConOut
0febd >label KbdbufPeek
0feab >label ExtApi
09f2c >label BrdCol
0376 >label BkgPenCol \ aka color
0381 >label CurFlg \ aka qtsw
0385 >label InsCnt \ aka insrt
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
\ X16 c64key? getkey
Code c64key? ( -- flag)
KbdbufPeek jsr
txa pha
Push jmp end-code
Code getkey ( -- 8b)
GETIN jsr
Push0A jmp end-code
\ *** Block No. 130, Hexblock 82
82 fthpage
$037B >label blnsw \ C64: $cc
\ X16 curon curoff
@ -55,18 +16,6 @@ Code curon ( --)
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 ;
14 Constant #bs 0D Constant #cr
: c64decode
( addr cnt1 key -- addr cnt2)
#bs case? IF dup IF del 1- THEN
@ -77,8 +26,10 @@ Code curoff ( --)
: c64expect ( addr len1 -- )
span ! 0
BEGIN dup span @ u<
WHILE key decode
WHILE curon key curoff decode
REPEAT 2drop space ;
Input: keyboard-pause [ here input ! ]
c64key c64key? c64decode c64expect ;
Input: keyboard-tasker [ here input ! ]
x16key x16key? c64decode c64expect ;
keyboard-tasker