diff --git a/6502/C64/Makefile b/6502/C64/Makefile index 876f8bd..f4f00cf 100644 --- a/6502/C64/Makefile +++ b/6502/C64/Makefile @@ -14,24 +14,43 @@ test_files_petscii = $(patsubst tests/%, cbmfiles/%, $(test_files)) vf_blk_fth: $(vf_blk_fth_files) +clean: + rm -f cbmfiles/*.fr cbmfiles/*.fth cbmfiles/*.log *.log *.result + + # Convenience targets +test: test-c64.result test-c16.result + +test64: test-c64.result + run-devenv: emulator/devenv.T64 emulator/run-in-vice.sh devenv run-testbase: emulator/testbase.T64 emulator/run-in-vice.sh testbase -test: emulator/testbase.T64 $(test_files_petscii) - emulator/run-in-vice.sh testbase \ - "include run-vf-tests.fth\n" - run-testbase16: emulator/testbase16.T64 VICE=xplus4 emulator/run-in-vice.sh testbase16 -test16: emulator/testbase.T64 $(test_files_petscii) + +# Core test targets + +test-c64.result: emulator/testbase.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 testbase \ + "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/testbase16.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 testbase16 \ - "include run-vf-tests.fth\n" + "include run-vf-tests.fth\n1234567890\ndos s0:notdone\n" + petscii2ascii cbmfiles/test.log test-c16.log + tests/evaluate-test.sh test-c16 # Rules for building Forth binaries on top of the plain vanilla diff --git a/6502/C64/cbmfiles/devenv b/6502/C64/cbmfiles/devenv new file mode 100644 index 0000000..d3fed12 Binary files /dev/null and b/6502/C64/cbmfiles/devenv differ diff --git a/6502/C64/cbmfiles/testbase b/6502/C64/cbmfiles/testbase index 1af77ea..4eca2cb 100644 Binary files a/6502/C64/cbmfiles/testbase and b/6502/C64/cbmfiles/testbase differ diff --git a/6502/C64/cbmfiles/testbase16 b/6502/C64/cbmfiles/testbase16 index f2c1e31..c3a1241 100644 Binary files a/6502/C64/cbmfiles/testbase16 and b/6502/C64/cbmfiles/testbase16 differ diff --git a/6502/C64/disks/.gitignore b/6502/C64/disks/.gitignore new file mode 100644 index 0000000..73508a6 --- /dev/null +++ b/6502/C64/disks/.gitignore @@ -0,0 +1 @@ +empty.fth diff --git a/6502/C64/disks/file-words.d64 b/6502/C64/disks/file-words.d64 index 29af1f0..682dfd1 100644 Binary files a/6502/C64/disks/file-words.d64 and b/6502/C64/disks/file-words.d64 differ diff --git a/6502/C64/disks/file-words.fth b/6502/C64/disks/file-words.fth index 9c1342e..efc0dad 100644 --- a/6502/C64/disks/file-words.fth +++ b/6502/C64/disks/file-words.fth @@ -281,7 +281,7 @@ \ *** Block No. 10, Hexblock a -\ include loadscreen 14jun20pz +\ include loadscreen 30jun20pz : i/o-status? $90 c@ ; @@ -300,9 +300,9 @@ 1 4 +thru + : .filename 2dup cr type ; - - + ' .filename IS on-fload @@ -337,16 +337,16 @@ \ *** Block No. 12, Hexblock c -\ fload-open fload-close 09jun20pz +\ 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 -- ) - fload-dev @ + on-fload fload-dev @ fload-2nd @ 1- dup fload-2nd ! - busopen - 2dup cr type bustype + busopen bustype " ,s,r" count bustype busoff i/o-status?abort ; diff --git a/6502/C64/tests/evaluate-test.sh b/6502/C64/tests/evaluate-test.sh new file mode 100755 index 0000000..f76fd8e --- /dev/null +++ b/6502/C64/tests/evaluate-test.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +testsdir="$(realpath --relative-to="$PWD" "$(dirname "${BASH_SOURCE[0]}")")" +basedir="$(realpath --relative-to="$PWD" "${testsdir}/..")" + +testname="$1" + +diff "${testsdir}/${testname}.golden" "${basedir}/${testname}.log" > tmp.result +exitcode=$? +test $exitcode -eq 0 \ + && echo "PASS: ${testname}" >> tmp.result \ + || echo "FAIL: ${testname}" >> tmp.result +cat tmp.result +mv tmp.result "${basedir}/${testname}.result" +exit $exitcode diff --git a/6502/C64/tests/logtofile.fth b/6502/C64/tests/logtofile.fth new file mode 100644 index 0000000..37a5ebd --- /dev/null +++ b/6502/C64/tests/logtofile.fth @@ -0,0 +1,27 @@ + +create log-dev 8 , +create log-2nd 2 , +: log-dev-2nd@ log-dev @ log-2nd @ ; + +: log-emit + dup c64emit log-dev-2nd@ busout bus! busoff ; + +: log-cr + c64cr log-dev-2nd@ busout #cr bus! busoff ; + +: log-type + 2dup c64type log-dev-2nd@ busout bustype busoff ; + +Output: alsologtofile + log-emit log-cr log-type c64del c64page + c64at c64at? ; + +: logopen" + ascii " parse log-dev-2nd@ busopen + 2dup type + bustype " ,s,w" count bustype busoff + i/o-status? IF c64cr log-dev @ dos-error abort THEN + alsologtofile ; + +: logclose + log-dev-2nd@ busclose display ; diff --git a/6502/C64/tests/run-vf-tests.fth b/6502/C64/tests/run-vf-tests.fth index a52fa64..36c685f 100644 --- a/6502/C64/tests/run-vf-tests.fth +++ b/6502/C64/tests/run-vf-tests.fth @@ -1,4 +1,8 @@ +include logtofile.fth + +logopen" test.log" + : \vf [compile] \ ; immediate include ans-shim.fth @@ -13,11 +17,16 @@ include core.fr include coreplustest.fth -include utilities.fth -include errorreport.fth +\ The C16 VolksForth has LIMIT at $8000. +\ More tests than up to here fill the dictionary. -include coreexttest.fth +(64 include utilities.fth C) +(64 include errorreport.fth C) -include doubletest.fth +(64 include coreexttest.fth C) -REPORT-ERRORS +(64 include doubletest.fth C) + +(64 REPORT-ERRORS C) + +logclose diff --git a/6502/C64/tests/test-c16.golden b/6502/C64/tests/test-c16.golden new file mode 100644 index 0000000..09682a7 --- /dev/null +++ b/6502/C64/tests/test-c16.golden @@ -0,0 +1,74 @@ + +ans-shim.fth CHAR exists 0> exists + +prelimtest.fth + +CR CR SOURCE TYPE ( Preliminary test ) CR +SOURCE ( These lines test SOURCE, TYPE, CR and parenthetic comments ) TYPE CR +( The next line of output should be blank to test CR ) SOURCE TYPE CR CR + +( Pass #1: testing 0 >IN +! ) 0 >IN +! SOURCE TYPE CR +( Pass #2: testing 1 >IN +! ) 1 >IN +! xSOURCE TYPE CR +( Pass #3: testing 1+ ) 1 1+ >IN +! xxSOURCE TYPE CR +( Pass #4: testing @ ! BASE ) 0 1+ 1+ BASE ! BASE @ >IN +! xxSOURCE TYPE CR +( Pass #5: testing decimal BASE ) BASE @ >IN +! xxxxxxxxxxSOURCE TYPE CR +( Pass #6: testing : ; ) : .SRC SOURCE TYPE CR ; 6 >IN +! xxxxxx.SRC +( Pass #7: testing number input ) 19 >IN +! xxxxxxxxxxxxxxxxxxx.SRC +( Pass #8: testing VARIABLE ) VARIABLE Y 2 Y ! Y @ >IN +! xx.SRC +( Pass #9: testing WORD COUNT ) 5 MSG abcdef) Y ! Y ! >IN +! xxxxx.SRC +( Pass #10: testing WORD COUNT ) MSG ab) >IN +! xxY ! .SRC +Pass #11: testing WORD COUNT .MSG +Pass #12: testing = returns all 1's for true +Pass #13: testing = returns 0 for false +Pass #14: testing -1 interpreted correctly +Pass #15: testing 2* +Pass #16: testing 2* +Pass #17: testing AND +Pass #18: testing AND +Pass #19: testing AND +Pass #20: testing ?F~ ?~~ Pass Error +Pass #21: testing ?~ +Pass #22: testing EMIT +Pass #23: testing S" + +Results: + +Pass messages #1 to #23 should be displayed above +and no error messages + +0 tests failed out of 57 additional tests + + +--- End of Preliminary Tests --- + +tester.fth ERROR exists +core.fr +*********************YOU SHOULD SEE THE STANDARD GRAPHIC CHARACTERS: + !"#$%&'()*+,-./0123456789:;<=>?@ +abcdefghijklmnopqrstuvwxyz[\]^_` +ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~ +YOU SHOULD SEE 0-9 SEPARATED BY A SPACE: +0 1 2 3 4 5 6 7 8 9 +YOU SHOULD SEE 0-9 (WITH NO SPACES): +0123456789 +YOU SHOULD SEE A-G SEPARATED BY A SPACE: +A B C D E F G +YOU SHOULD SEE 0-5 SEPARATED BY TWO SPACES: +0 1 2 3 4 5 +YOU SHOULD SEE TWO SEPARATE LINES: +LINE 1 +LINE 2 +YOU SHOULD SEE THE NUMBER RANGES OF SIGNED AND UNSIGNED NUMBERS: + SIGNED: -8000 7FFF +UNSIGNED: 0 FFFF +* +PLEASE TYPE UP TO 80 CHARACTERS: +1234567890 +RECEIVED: "1234567890" +* GDX exists +End of Core word set tests + +coreplustest.fth******** +You should see 2345: 2345 +***** +End of additional Core tests diff --git a/6502/C64/tests/test-c64.golden b/6502/C64/tests/test-c64.golden new file mode 100644 index 0000000..853418a --- /dev/null +++ b/6502/C64/tests/test-c64.golden @@ -0,0 +1,150 @@ + +ans-shim.fth CHAR exists 0> exists + +prelimtest.fth + +CR CR SOURCE TYPE ( Preliminary test ) CR +SOURCE ( These lines test SOURCE, TYPE, CR and parenthetic comments ) TYPE CR +( The next line of output should be blank to test CR ) SOURCE TYPE CR CR + +( Pass #1: testing 0 >IN +! ) 0 >IN +! SOURCE TYPE CR +( Pass #2: testing 1 >IN +! ) 1 >IN +! xSOURCE TYPE CR +( Pass #3: testing 1+ ) 1 1+ >IN +! xxSOURCE TYPE CR +( Pass #4: testing @ ! BASE ) 0 1+ 1+ BASE ! BASE @ >IN +! xxSOURCE TYPE CR +( Pass #5: testing decimal BASE ) BASE @ >IN +! xxxxxxxxxxSOURCE TYPE CR +( Pass #6: testing : ; ) : .SRC SOURCE TYPE CR ; 6 >IN +! xxxxxx.SRC +( Pass #7: testing number input ) 19 >IN +! xxxxxxxxxxxxxxxxxxx.SRC +( Pass #8: testing VARIABLE ) VARIABLE Y 2 Y ! Y @ >IN +! xx.SRC +( Pass #9: testing WORD COUNT ) 5 MSG abcdef) Y ! Y ! >IN +! xxxxx.SRC +( Pass #10: testing WORD COUNT ) MSG ab) >IN +! xxY ! .SRC +Pass #11: testing WORD COUNT .MSG +Pass #12: testing = returns all 1's for true +Pass #13: testing = returns 0 for false +Pass #14: testing -1 interpreted correctly +Pass #15: testing 2* +Pass #16: testing 2* +Pass #17: testing AND +Pass #18: testing AND +Pass #19: testing AND +Pass #20: testing ?F~ ?~~ Pass Error +Pass #21: testing ?~ +Pass #22: testing EMIT +Pass #23: testing S" + +Results: + +Pass messages #1 to #23 should be displayed above +and no error messages + +0 tests failed out of 57 additional tests + + +--- End of Preliminary Tests --- + +tester.fth ERROR exists +core.fr +*********************YOU SHOULD SEE THE STANDARD GRAPHIC CHARACTERS: + !"#$%&'()*+,-./0123456789:;<=>?@ +abcdefghijklmnopqrstuvwxyz[\]^_` +ABCDEFGHIJKLMNOPQRSTUVWXYZ{|}~ +YOU SHOULD SEE 0-9 SEPARATED BY A SPACE: +0 1 2 3 4 5 6 7 8 9 +YOU SHOULD SEE 0-9 (WITH NO SPACES): +0123456789 +YOU SHOULD SEE A-G SEPARATED BY A SPACE: +A B C D E F G +YOU SHOULD SEE 0-5 SEPARATED BY TWO SPACES: +0 1 2 3 4 5 +YOU SHOULD SEE TWO SEPARATE LINES: +LINE 1 +LINE 2 +YOU SHOULD SEE THE NUMBER RANGES OF SIGNED AND UNSIGNED NUMBERS: + SIGNED: -8000 7FFF +UNSIGNED: 0 FFFF +* +PLEASE TYPE UP TO 80 CHARACTERS: +1234567890 +RECEIVED: "1234567890" +* GDX exists +End of Core word set tests + +coreplustest.fth******** +You should see 2345: 2345 +***** +End of additional Core tests + +utilities.fth ?DEFTEST1 exists +Test utilities loaded + +errorreport.fth +coreexttest.fth************** + +Output from .( +You should see -9876: -9876 +and again: -9876 + + +On the next 2 lines you should see First then Second messages: +First message via .( +Second message via ." + +* + +Output from .R and U.R +You should see lines duplicated: +indented by 0 spaces +30278 +30278 +-31871 +-31871 +30278 +30278 +33665 +33665 + +indented by 0 spaces +30278 +30278 +-31871 +-31871 +30278 +30278 +33665 +33665 + +indented by 5 spaces + 30278 + 30278 + -31871 + -31871 + 30278 + 30278 + 33665 + 33665 + +*** +End of Core Extension word tests + +doubletest.fth***************** +End of Double-Number word tests + +--------------------------- + Error Report +Word Set Errors +--------------------------- +Core 0 +Core extension 0 +Block - +Double number 0 +Exception - +Facility - +File-access - +Locals - +Memory-allocation - +Programming-tools - +Search-order - +String - +--------------------------- +Total 0 +--------------------------- +