Add extra words WIPED? and FREEBLKS?

This commit is contained in:
Virgil Dupras 2020-06-23 07:21:33 -04:00
parent 9ab5cda397
commit 7eeec67ff5
2 changed files with 9 additions and 17 deletions

View File

@ -5,6 +5,7 @@ BLK( -- a Beginning addr of blk buf.
BLK) -- a Ending addr of blk buf.
COPY s d -- Copy contents of s block to d block.
FLUSH -- Write current block to disk if dirty.
FREEBLKS? a b -- List free blocks between blocks a and b.
LIST n -- Prints the contents of the block n on screen
in the form of 16 lines of 64 columns.
LOAD n -- Interprets Forth code from block n
@ -12,5 +13,4 @@ LOAD+ n -- Relative load. Loads active block + n.
LOADR n1 n2 -- Load block range between n1 and n2, inclusive.
LOADR+ n1 n2 -- Relative ranged load.
WIPE -- Empties current block
WIPED? -- f Whether current block is empty

22
blk/157
View File

@ -1,16 +1,8 @@
: WIPE BLK( 1024 0 FILL BLK!! ;
( src dst -- )
: COPY FLUSH SWAP BLK@ BLK> ! BLK! ;
: WIPED? ( -- f )
1 ( f ) BLK) BLK( DO
I C@ IF DROP 0 ( f ) LEAVE THEN LOOP ;
: COPY ( src dst -- )
FLUSH SWAP BLK@ BLK> ! BLK! ;
: FREEBLKS? ( b1 b2 -- )
1+ SWAP DO I BLK@ WIPED? IF I . SPC THEN LOOP ;