From 63b507db05ce65e50003ec1736652e86084516a6 Mon Sep 17 00:00:00 2001 From: Philip Zembrod Date: Sun, 20 Aug 2023 21:54:27 +0200 Subject: [PATCH] Fix log2file.fb and get prelim test to work --- 8080/CPM/Makefile | 12 ++++--- 8080/CPM/tests/golden/logtest.golden | 8 +++++ 8080/CPM/tests/golden/test-std.golden | 46 +++++++++++++++++++++++++++ 8080/CPM/tests/log2file.fb | 2 +- 8080/CPM/tests/log2file.fth | 28 ++++++++-------- 5 files changed, 77 insertions(+), 19 deletions(-) create mode 100644 8080/CPM/tests/golden/test-std.golden diff --git a/8080/CPM/Makefile b/8080/CPM/Makefile index 739cf27..1a73de8 100644 --- a/8080/CPM/Makefile +++ b/8080/CPM/Makefile @@ -16,7 +16,7 @@ clean: rm -rf $(runcpmdir) rm -f msdos -test: logtest.result inctest.log +test: logtest.result inctest.result test-std.result run-editor: | msdos FORTHPATH="f:\\src;f:\\tests;f:\\msdos" \ @@ -40,6 +40,10 @@ logtest.log: \ "include log2file.fb" \ "logopen" \ ".( hello world) cr" \ + ".( 0123456789abcdef0123456789abcdef) cr" \ + ".( 1123456789abcdef0123456789abcdef) cr" \ + ".( 2123456789abcdef0123456789abcdef) cr" \ + ".( 3123456789abcdef0123456789abcdef) cr" \ "logclose" \ "bye" \ "exit" @@ -77,9 +81,9 @@ test-std.log: \ "include ans-shim.fth" \ ": \\vf [compile] \\ ; immediate" \ "include prelim.fth" \ - "" \ - "" \ - "" + "logclose" \ + "bye" \ + "exit" dos2unix -n $(runcpmdir)/logfile.txt $@ emu: $(runcpmdir)/RunCPM diff --git a/8080/CPM/tests/golden/logtest.golden b/8080/CPM/tests/golden/logtest.golden index 6319d26..cc77904 100644 --- a/8080/CPM/tests/golden/logtest.golden +++ b/8080/CPM/tests/golden/logtest.golden @@ -1,4 +1,12 @@ ok .( hello world) cr hello world ok +.( 0123456789abcdef0123456789abcdef) cr 0123456789abcdef0123456789abcdef + ok +.( 1123456789abcdef0123456789abcdef) cr 1123456789abcdef0123456789abcdef + ok +.( 2123456789abcdef0123456789abcdef) cr 2123456789abcdef0123456789abcdef + ok +.( 3123456789abcdef0123456789abcdef) cr 3123456789abcdef0123456789abcdef + ok logclose diff --git a/8080/CPM/tests/golden/test-std.golden b/8080/CPM/tests/golden/test-std.golden new file mode 100644 index 0000000..eb0e171 --- /dev/null +++ b/8080/CPM/tests/golden/test-std.golden @@ -0,0 +1,46 @@ + ok +include ans-shim.fth +ANS-SHIM.FTH ok +: \vf [compile] \ ; immediate ok +include prelim.fth +PRELIM.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 --- + ok +logclose diff --git a/8080/CPM/tests/log2file.fb b/8080/CPM/tests/log2file.fb index f9d3fef..cbabf45 100644 --- a/8080/CPM/tests/log2file.fb +++ b/8080/CPM/tests/log2file.fb @@ -1 +1 @@ - \ log2file loadscreen phz 01jun23 1 3 +thru \ logfile phz 01jul23 Dos also Forth definitions $18 constant fcb\nam create logfile ," LOGFILE TXT" fcb\nam allot 1 logfile c! create logdma b/rec allot variable logoffset 0 logoffset ! : logflush logdma dma! logfile write-seq ; : logc! ( c -- ) logoffset @ dup >r logdma + c! r> 1+ dup logoffset ! b/rec = IF logflush 0 logoffset ! THEN ; \ log-emit log-type log-cr alsologtofile pphz 01jul23 : log-emit ( char -- ) dup (emit logc! ; : log-type ( addr count -- ) 2dup (type 0 ?DO count logc! LOOP drop ; : log-cr ( -- ) (cr #cr logc! #lf logc! ; Output: alsologtofile log-emit log-cr log-type (del (page (at (at? ; \ logopen phz 01jul23 : logopen ( -- ) logfile filenamelen + 1+ fcb\nam erase logfile killfile logfile createfile alsologtofile ; : logclose ( -- ) cr display &26 logc! logflush logfile closefile ; \ No newline at end of file + \ log2file loadscreen phz 20aug23 1 3 +thru \\ : .1x ( n -- ) $30 + dup $39 > IF 7 + THEN (emit ; : .4x ( n -- ) ascii $ (emit 4 0 DO $10 u/mod LOOP drop .1x .1x .1x .1x $20 (emit ; : .2x ( n -- ) ascii $ (emit 2 0 DO $10 u/mod LOOP drop .1x .1x $20 (emit ; \ logfile phz 20aug23 Dos also Forth definitions $18 constant fcb\nam create logfile ," LOGFILE TXT" fcb\nam allot 1 logfile c! create logdma b/rec allot variable logoffset 0 logoffset ! : logflush logdma dma! logfile $15 bdos $80 dma! ; : logc! ( c -- ) logoffset @ dup >r logdma + c! r> 1+ dup logoffset ! b/rec = IF logflush 0 logoffset ! THEN ; \ log-emit log-type log-cr alsologtofile pphz 01jul23 : log-emit ( char -- ) dup (emit logc! ; : log-type ( addr count -- ) 2dup (type 0 ?DO count logc! LOOP drop ; : log-cr ( -- ) (cr #cr logc! #lf logc! ; Output: alsologtofile log-emit log-cr log-type (del (page (at (at? ; \ logopen phz 20aug23 : logopen ( -- ) logfile filenamelen + 1+ fcb\nam erase 0 logoffset ! logfile killfile logfile createfile alsologtofile ; : logclose ( -- ) cr display &26 logc! logflush logfile closefile ; \ No newline at end of file diff --git a/8080/CPM/tests/log2file.fth b/8080/CPM/tests/log2file.fth index fa6886c..9cc2295 100644 --- a/8080/CPM/tests/log2file.fth +++ b/8080/CPM/tests/log2file.fth @@ -20,26 +20,26 @@ \ *** Block No. 1, Hexblock 1 -\ log2file loadscreen phz 01jun23 +\ log2file loadscreen phz 20aug23 1 3 +thru +\\ + : .1x ( n -- ) $30 + dup $39 > IF 7 + THEN (emit ; + : .4x ( n -- ) + ascii $ (emit 4 0 DO $10 u/mod LOOP drop .1x .1x .1x .1x + $20 (emit ; - - - - - - - - + : .2x ( n -- ) + ascii $ (emit 2 0 DO $10 u/mod LOOP drop .1x .1x + $20 (emit ; \ *** Block No. 2, Hexblock 2 -\ logfile phz 01jul23 +\ logfile phz 20aug23 Dos also Forth definitions @@ -48,10 +48,10 @@ create logdma b/rec allot variable logoffset 0 logoffset ! - : logflush logdma dma! logfile write-seq ; + : logflush logdma dma! logfile $15 bdos $80 dma! ; : logc! ( c -- ) - logoffset @ dup >r logdma + c! r> 1+ + logoffset @ dup >r logdma + c! r> 1+ dup logoffset ! b/rec = IF logflush 0 logoffset ! THEN ; @@ -77,10 +77,11 @@ Output: alsologtofile \ *** Block No. 4, Hexblock 4 -\ logopen phz 01jul23 +\ logopen phz 20aug23 : logopen ( -- ) logfile filenamelen + 1+ fcb\nam erase + 0 logoffset ! logfile killfile logfile createfile alsologtofile ; @@ -92,4 +93,3 @@ Output: alsologtofile -