Compare commits

...

3 Commits

Author SHA1 Message Date
Virgil Dupras
058b85686f core: add word "MOVE" 2020-04-05 21:02:38 -04:00
Virgil Dupras
6f9d0a98c4 fmt: fix stack leak in DUMP 2020-04-05 20:19:58 -04:00
Virgil Dupras
67d732c4be cmp: add tests 2020-04-05 19:52:12 -04:00
4 changed files with 16 additions and 1 deletions

View File

@ -98,6 +98,8 @@ C! c a -- Store byte c in address a
CURRENT -- a Set a to wordref of last added entry.
HERE -- a Push HERE's address
H@ -- a HERE @
MOVE a1 a2 u -- Copy u bytes from a1 to a2, starting with a1, going
up.
*** Arithmetic / Bits ***

View File

@ -118,3 +118,12 @@
( Set up initial SYSVNXT value, which is 2 bytes after its
own address )
46 RAM+ DUP 2 + SWAP !
( a1 a2 u -- )
: MOVE
( u ) 0 DO
SWAP DUP I + @ ( a2 a1 x )
ROT SWAP OVER I + ( a1 a2 x a2 )
! ( a1 a2 )
LOOP
;

View File

@ -69,7 +69,7 @@
: DUMP
LF
BEGIN
OVER 1 < IF DROP EXIT THEN
OVER 1 < IF 2DROP EXIT THEN
_
SWAP 8 - SWAP
AGAIN

4
tests/forth/test_cmp.fs Normal file
View File

@ -0,0 +1,4 @@
0x70 <>{ 0x70 &= 0x58 |= 0x20 |= <>} #
0x71 <>{ 0x70 &= 0x58 |= 0x20 |= <>} NOT #
0x42 <>{ 0x40 &> 0x44 &< <>} #
0x44 <>{ 0x40 &> 0x44 &< <>} NOT #