diff --git a/6502/C64/Makefile b/6502/C64/Makefile index a9f39c4..6f17008 100644 --- a/6502/C64/Makefile +++ b/6502/C64/Makefile @@ -67,18 +67,18 @@ cbmfiles/c16-vf-32k: emulator/tcbase.T64 emulator/build-vf.sh \ # Core test targets -test-c64.result: emulator/c64-testbase.T64 $(test_files_petscii) \ +test-c64.result: emulator/c64-vf-latest.T64 $(test_files_petscii) \ emulator/run-in-vice.sh tests/evaluate-test.sh tests/test-c64.golden rm -f test-c64.log test-c64.result - emulator/run-in-vice.sh c64-testbase \ + emulator/run-in-vice.sh c64-vf-latest \ "include run-vf-tests.fth\n1234567890\ndos s0:notdone\n" petscii2ascii cbmfiles/test.log test-c64.log tests/evaluate-test.sh test-c64 -test-c16.result: emulator/c16-testbase.T64 $(test_files_petscii) \ +test-c16.result: emulator/c16-vf-latest.T64 $(test_files_petscii) \ emulator/run-in-vice.sh tests/evaluate-test.sh tests/test-c16.golden rm -f test-c16.log test-c16.result - VICE=xplus4 emulator/run-in-vice.sh c16-testbase \ + VICE=xplus4 emulator/run-in-vice.sh c16-vf-latest \ "include run-vf-tests.fth\n1234567890\ndos s0:notdone\n" petscii2ascii cbmfiles/test.log test-c16.log tests/evaluate-test.sh test-c16 @@ -92,13 +92,14 @@ cbmfiles/devenv: emulator/run-in-vice.sh emulator/build-devenv.sh \ disks/vforth4_1.d64 disks/vforth4_3.d64 disks/file-words.d64 emulator/build-devenv.sh -cbmfiles/c64-testbase: emulator/run-in-vice.sh emulator/build-testbase.sh \ - emulator/c64-$(VERSION).T64 disks/file-words.d64 - emulator/build-testbase.sh c64 $(VERSION) +# Deprecated +# cbmfiles/c64-testbase: emulator/run-in-vice.sh emulator/build-testbase.sh \ +# emulator/c64-$(VERSION).T64 disks/file-words.d64 +# emulator/build-testbase.sh c64 $(VERSION) -cbmfiles/c16-testbase: emulator/run-in-vice.sh emulator/build-testbase.sh \ - emulator/c16-$(VERSION).T64 disks/file-words.d64 - VICE=xplus4 emulator/build-testbase.sh c16 $(VERSION) +# cbmfiles/c16-testbase: emulator/run-in-vice.sh emulator/build-testbase.sh \ +# emulator/c16-$(VERSION).T64 disks/file-words.d64 +# VICE=xplus4 emulator/build-testbase.sh c16 $(VERSION) # Generic T64 tape image rule diff --git a/6502/C64/src/vf-c16-32k.fth b/6502/C64/src/vf-c16-32k.fth index 96acff8..19e097e 100644 --- a/6502/C64/src/vf-c16-32k.fth +++ b/6502/C64/src/vf-c16-32k.fth @@ -29,6 +29,7 @@ include vf-pr-target.fth include vf-head-c16.fth include vf-cbm-core.fth include vf-sys-c16.fth +include vf-cbm-file.fth include vf-finalize.fth include vf-pr-target.fth diff --git a/6502/C64/src/vf-c16-main.fth b/6502/C64/src/vf-c16-main.fth index 872559c..2797890 100644 --- a/6502/C64/src/vf-c16-main.fth +++ b/6502/C64/src/vf-c16-main.fth @@ -32,6 +32,7 @@ include vf-c16+jsr.fth include vf-head-c16.fth include vf-cbm-core.fth include vf-sys-c16.fth +include vf-cbm-file.fth include vf-finalize.fth include vf-pr-target.fth diff --git a/6502/C64/src/vf-c64-main.fth b/6502/C64/src/vf-c64-main.fth index e5a938a..a4689be 100644 --- a/6502/C64/src/vf-c64-main.fth +++ b/6502/C64/src/vf-c64-main.fth @@ -29,6 +29,7 @@ include vf-pr-target.fth include vf-head-c64.fth include vf-cbm-core.fth include vf-sys-c64.fth +include vf-cbm-file.fth include vf-finalize.fth include vf-pr-target.fth diff --git a/6502/C64/src/vf-cbm-bufs.fth b/6502/C64/src/vf-cbm-bufs.fth index d2c4350..ee05d04 100644 --- a/6502/C64/src/vf-cbm-bufs.fth +++ b/6502/C64/src/vf-cbm-bufs.fth @@ -287,7 +287,7 @@ Defer r/w \ Allocating buffers clv12jul87 -E400 Constant limit Variable first +\ E400 Constant limit Variable first : allotbuffer ( -- ) first @ r0 @ - b/buf 2+ u< ?exit diff --git a/6502/C64/src/vf-cbm-core.fth b/6502/C64/src/vf-cbm-core.fth index f5c5f70..359a787 100644 --- a/6502/C64/src/vf-cbm-core.fth +++ b/6502/C64/src/vf-cbm-core.fth @@ -2379,6 +2379,7 @@ end-code +E400 Constant limit Variable first include vf-cbm-bufs.fth diff --git a/6502/C64/src/vf-cbm-dos.fth b/6502/C64/src/vf-cbm-dos.fth new file mode 100644 index 0000000..61d5523 --- /dev/null +++ b/6502/C64/src/vf-cbm-dos.fth @@ -0,0 +1,27 @@ +\ dir dos cat 09jun20pz +| : dev fload-dev @ ; + +: dir ( -- ) + dev 0 busopen ascii $ bus! busoff + dev 0 busin bus@ bus@ 2drop + BEGIN cr bus@ bus@ 2drop + i/o-status? 0= WHILE + bus@ bus@ lo/hi> u. + BEGIN bus@ ?dup WHILE con! REPEAT + REPEAT busoff dev 0 busclose ; + +: dos ( -- ) + bl word count ?dup + IF dev 15 busout bustype + busoff cr ELSE drop THEN + dev dos-error ; + +: cat ( -- ) cr + dev 2 busopen bl word count bustype + busoff + \ i/o-status?abort + i/o-status? IF cr + fload-dev @ dos-error abort THEN + dev 2 busin BEGIN bus@ con! + i/o-status? UNTIL busoff + dev 2 busclose ; diff --git a/6502/C64/src/vf-cbm-file.fth b/6502/C64/src/vf-cbm-file.fth new file mode 100644 index 0000000..5f0e1ba --- /dev/null +++ b/6502/C64/src/vf-cbm-file.fth @@ -0,0 +1,89 @@ + + + : dos-error ( dev -- ) + f busin + BEGIN bus@ con! i/o-status? UNTIL + busoff ; + + : lo/hi> ( lo hi -- u ) + ff and 100 * swap ff and + ; + + +\ fload-dev freadline 25apr20pz + + create fload-dev 8 , + create fload-2nd f , +| 84 constant /fib + create fib /fib allot + variable #fib + +| : eol? ( c -- f ) + dup 0= swap #cr = or IF 0 exit THEN + i/o-status? IF 1 exit THEN -1 ; + +| : freadline ( -- eof ) + fload-dev @ fload-2nd @ busin + fib /fib bounds + DO bus@ dup eol? under + IF I c! ELSE drop THEN + dup 0< + IF drop ELSE I + fib - #fib ! UNLOOP + i/o-status? busoff exit THEN + LOOP /fib #fib ! + ." warning: line exceeds max " /fib . + cr ." extra chars ignored" cr + BEGIN bus@ eol? 1+ UNTIL + i/o-status? busoff ; + + +\ fload-open fload-close 30jun20pz + +| : i/o-status?abort i/o-status? IF cr + fload-dev @ dos-error abort THEN ; + + defer on-fload ' noop is on-fload +| : fload-open ( addr c -- ) + on-fload fload-dev @ + fload-2nd @ 1- dup fload-2nd ! + busopen bustype + " ,s,r" count bustype busoff + i/o-status?abort ; + +| : fload-close ( -- ) + fload-dev @ fload-2nd @ + dup 1+ fload-2nd ! + busclose ; + + : factive? ( -- flag ) + fload-2nd @ f < ; + + : fload-close-all ( -- ) + factive? IF f fload-2nd @ DO + fload-dev @ I busclose -1 +LOOP + f fload-2nd ! THEN ; + + +\ include 09jun20pz + + : \ ( -- ) + blk @ IF [compile] \ exit THEN + #tib @ >in ! ; immediate + + create >tib-orig >tib @ , + fib >tib ! + + : interpret-via-fib + BEGIN freadline >r >in off + #fib @ #tib ! interpret r> UNTIL ; + + : include ( -- ) + blk @ Abort" no include from blk" + bl parse fload-open + interpret-via-fib + fload-close + #tib off >in off ; + + + : .filename 2dup cr type ; + + ' .filename IS on-fload diff --git a/6502/C64/tests/run-vf-tests.fth b/6502/C64/tests/run-vf-tests.fth index 36c685f..2c012a5 100644 --- a/6502/C64/tests/run-vf-tests.fth +++ b/6502/C64/tests/run-vf-tests.fth @@ -1,4 +1,6 @@ +include vf-cbm-dos.fth + include logtofile.fth logopen" test.log"