Fix log2file.fb and get prelim test to work

This commit is contained in:
Philip Zembrod 2023-08-20 21:54:27 +02:00
parent 9c599de9a1
commit 63b507db05
5 changed files with 77 additions and 19 deletions

View File

@ -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

View File

@ -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

View File

@ -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

File diff suppressed because one or more lines are too long

View File

@ -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