7.6.2.2280 THRU BLOCK EXT

( i * x u1 u2 -- j * x )

LOAD the mass storage blocks numbered u1 through u2 in sequence. Other stack effects are due to the words LOADed.

ContributeContributions

JimPetersonavatar of JimPeterson [278] Possible Reference ImplementationSuggested reference implementation2023-02-11 15:56:14

: THRU  1+ SWAP  DO I LOAD LOOP ;

(simple, but it's good to have a reference)

Also, there's this for a possible test case:

\ \ \ \ WARNING!  This could corrupt your "mass storage" accessible through BLOCK:
: GT1 
  1 BLOCK 1024 BLANK
  S" 1 2 3" 1 BLOCK SWAP CMOVE
  UPDATE

  2 BLOCK 1024 BLANK
  S" 4 5 6" 2 BLOCK SWAP CMOVE
  UPDATE
;
: GT2  1 1 THRU + - ;

T{ GT1      ->             }T ( TEST THRU IN INTERP. STATE )
T{ 1 2 THRU -> 1 2 3 4 5 6 }T

T{ GT2      -> -4          }T ( TEST THRU IN EXECUTE STATE )

UlrichHoffmannavatar of UlrichHoffmann

Hello @JimPetersen

your contribution has been discussed in the the Forth Standards Committee interim Meeting von 2024-02-16.

Thanks for the reference implementation of thru that seems to work fine given u1 is less or equal to u2. if u1 is greater than u2 it will load blocks in a huge sequence... Your reference implementation might check that and load no block at all as is implied by the standard text numbered u1 through u2 in sequence. The sequence is empty if u1 is greater than u2.

Thanks also for the test case. The comments regarding the test case for contribution #280 hold for this test case as well.

Reply New Version