From 461116744c722e70f8fcb2194c7d299f49e5076a Mon Sep 17 00:00:00 2001 From: Philip Zembrod Date: Thu, 25 Jun 2020 22:45:17 +0200 Subject: [PATCH] Make coreplustest.fth pass on VolksForth --- 6502/C64/tests/ans-shim.fth | 4 +++ 6502/C64/tests/coreplustest.fth | 43 +++++++++++++++++---------------- 6502/C64/tests/run-vf-tests.fth | 2 ++ 3 files changed, 28 insertions(+), 21 deletions(-) diff --git a/6502/C64/tests/ans-shim.fth b/6502/C64/tests/ans-shim.fth index 19018ee..8dceb75 100644 --- a/6502/C64/tests/ans-shim.fth +++ b/6502/C64/tests/ans-shim.fth @@ -43,3 +43,7 @@ >r count digit? WHILE accumulate r> 1- REPEAT 1- r> ; : accept expect span @ ; + +: tuck under ; + +: :noname here ['] tuck @ , 0 ] ; diff --git a/6502/C64/tests/coreplustest.fth b/6502/C64/tests/coreplustest.fth index d47e2b2..82b1be2 100644 --- a/6502/C64/tests/coreplustest.fth +++ b/6502/C64/tests/coreplustest.fth @@ -173,12 +173,12 @@ T{ 3 0 ACK -> 5 }T T{ 2 4 ACK -> 11 }T \ ------------------------------------------------------------------------------ -TESTING multiple ELSE's in an IF statement +\vf TESTING multiple ELSE's in an IF statement \ Discussed on comp.lang.forth and accepted as valid ANS Forth -: MELSE IF 1 ELSE 2 ELSE 3 ELSE 4 ELSE 5 THEN ; -T{ 0 MELSE -> 2 4 }T -T{ -1 MELSE -> 1 3 5 }T +\vf : MELSE IF 1 ELSE 2 ELSE 3 ELSE 4 ELSE 5 THEN ; +\vf T{ 0 MELSE -> 2 4 }T +\vf T{ -1 MELSE -> 1 3 5 }T \ ------------------------------------------------------------------------------ TESTING manipulation of >IN in interpreter mode @@ -225,33 +225,34 @@ TESTING number prefixes # $ % and 'c' character input VARIABLE OLD-BASE DECIMAL BASE @ OLD-BASE ! -T{ #1289 -> 1289 }T -T{ #-1289 -> -1289 }T +T{ &1289 -> 1289 }T \ vf: s/#/&/ +T{ -&1289 -> -1289 }T \ vf: s/#-/-&/ T{ $12eF -> 4847 }T -T{ $-12eF -> -4847 }T +T{ -$12eF -> -4847 }T \ vf: s/$-/-$/ T{ %10010110 -> 150 }T -T{ %-10010110 -> -150 }T -T{ 'z' -> 122 }T -T{ 'Z' -> 90 }T +T{ -%10010110 -> -150 }T \ vf: s/%-/-%/ +\vf T{ 'z' -> 122 }T +\vf T{ 'Z' -> 90 }T \ Check BASE is unchanged T{ BASE @ OLD-BASE @ = -> }T \ Repeat in Hex mode 16 OLD-BASE ! 16 BASE ! -T{ #1289 -> 509 }T -T{ #-1289 -> -509 }T +T{ &1289 -> 509 }T \ vf: s/#/&/ +T{ -&1289 -> -509 }T \ vf: s/#/&/ T{ $12eF -> 12EF }T -T{ $-12eF -> -12EF }T +T{ -$12eF -> -12EF }T \ vf: s/$-/-$/ T{ %10010110 -> 96 }T -T{ %-10010110 -> -96 }T -T{ 'z' -> 7a }T -T{ 'Z' -> 5a }T +T{ -%10010110 -> -96 }T \ vf: s/%-/-%/ +\vf T{ 'z' -> 7a }T +\vf T{ 'Z' -> 5a }T \ Check BASE is unchanged T{ BASE @ OLD-BASE @ = -> }T \ 2 DECIMAL \ Check number prefixes in compile mode -T{ : nmp #8327 $-2cbe %011010111 ''' ; nmp -> 8327 -11454 215 39 }T +\ vf: s/#/&/ s/$-/-$/ s/'''/ascii '/ +T{ : nmp &8327 -$2cbe %011010111 ascii ' ; nmp -> 8327 -11454 215 39 }T \ ------------------------------------------------------------------------------ TESTING definition names @@ -282,11 +283,11 @@ CREATE NON-EXISTENT-WORD \ Same as in exceptiontest.fth T{ NON-EXISTENT-WORD FIND -> NON-EXISTENT-WORD 0 }T \ ------------------------------------------------------------------------------ -TESTING IF ... BEGIN ... REPEAT (unstructured) +\vf TESTING IF ... BEGIN ... REPEAT (unstructured) -T{ : UNS1 DUP 0 > IF 9 SWAP BEGIN 1+ DUP 3 > IF EXIT THEN REPEAT ; -> }T -T{ -6 UNS1 -> -6 }T -T{ 1 UNS1 -> 9 4 }T +\vf T{ : UNS1 DUP 0 > IF 9 SWAP BEGIN 1+ DUP 3 > IF EXIT THEN REPEAT ; -> }T +\vf T{ -6 UNS1 -> -6 }T +\vf T{ 1 UNS1 -> 9 4 }T \ ------------------------------------------------------------------------------ TESTING DOES> doesn't cause a problem with a CREATEd address diff --git a/6502/C64/tests/run-vf-tests.fth b/6502/C64/tests/run-vf-tests.fth index 303f061..905c7a4 100644 --- a/6502/C64/tests/run-vf-tests.fth +++ b/6502/C64/tests/run-vf-tests.fth @@ -8,3 +8,5 @@ include tester.fth \ 1 verbose ! include core.fr + +include coreplustest.fth