From 7eeec67ff5ab5122ce53aeda1ae6195cbfb80f18 Mon Sep 17 00:00:00 2001 From: Virgil Dupras Date: Tue, 23 Jun 2020 07:21:33 -0400 Subject: [PATCH] Add extra words WIPED? and FREEBLKS? --- blk/064 | 4 ++-- blk/157 | 22 +++++++--------------- 2 files changed, 9 insertions(+), 17 deletions(-) diff --git a/blk/064 b/blk/064 index ef739d0..462d935 100644 --- a/blk/064 +++ b/blk/064 @@ -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 diff --git a/blk/157 b/blk/157 index a9e14d2..972a8e5 100644 --- a/blk/157 +++ b/blk/157 @@ -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 ;