add start of block: words (setting block file, reading a block) [for compatibility w/ilo&napia]

FossilOrigin-Name: af86e484b6b65cfbf4acfce347d3c468f70d718a3b085c7a64ffd96147355cc6
This commit is contained in:
crc 2022-06-02 17:49:17 +00:00
parent f1238819b2
commit cb66c677f1
4 changed files with 120 additions and 75 deletions

View file

@ -75,6 +75,7 @@ DEVICES += interface/multicore.retro
DEVICES += interface/unsigned.retro
DEVICES += interface/ffi.retro
DEVICES += interface/retro-napia.retro
DEVICES += interface/block.retro
DEVICES += interface/deprecated.retro
# -------------------------------------------------------------

View file

@ -60,6 +60,7 @@ DEVICES += interface/multicore.retro
DEVICES += interface/ffi.retro
DEVICES += interface/unsigned.retro
DEVICES += interface/retro-napia.retro
DEVICES += interface/block.retro
DEVICES += interface/deprecated.retro
# -------------------------------------------------------------

32
interface/block.retro Normal file
View file

@ -0,0 +1,32 @@
The related ilo & napia virtual machines make use of blocks
for data storage. This implements a set of words for interacting
with the blocks from within RetroForth/Nga.
The exposed word set is compact:
block:set-file (s-)
block:read (na-)
block:write (na-)
~~~
{{
'Blocks var
'BlockFile var
:open (n-) @BlockFile swap file:open !Blocks ;
:close (-) @Blocks file:close ;
:seek (n-) #4096 n:mul @Blocks file:seek ;
:read (-n) #4 [ @Blocks file:read ] times pack ;
:store (an-a) swap store-next ;
:write (n-) unpack #4 [ @Blocks file:write ] times ;
---reveal---
:block:set-file (s-) s:keep !BlockFile ;
:block:read (na-)
file:R open swap seek #1024 [ read store ] times drop close ;
}}
~~~
'ilo.blocks block:set-file
#10 here block:read
here s:put nl

View file

@ -10,8 +10,8 @@
#define CELL_MAX LLONG_MAX - 1
#endif
#endif
CELL ngaImageCells = 18317;
CELL ngaImage[] = { 1793,17826,18272,18316,202207,410,382,1242,1535,0,10,1,10,2,10,3,10,4,10,
CELL ngaImageCells = 18532;
CELL ngaImage[] = { 1793,18041,18487,18531,202207,410,382,1242,1535,0,10,1,10,2,10,3,10,4,10,
5,10,6,10,7,10,8,10,11,10,12,10,13,10,14,10,15,10,16,10,
17,10,18,10,19,10,20,10,21,10,22,10,23,10,24,10,25,68223234,1,2575,
85000450,1,656912,161,178,268505089,63,62,285281281,0,63,2063,10,101384453,0,9,10,68485378,255,18350338,
@ -20,8 +20,8 @@ CELL ngaImage[] = { 1793,17826,18272,18316,202207,410,382,1242,1535,0,10,1,10,2,
101777669,1,17565186,107,524545,111,64,167838467,-1,134287105,3,59,659457,3,459023,128,2049,56,25,2049,
128,1793,135,2049,135,117506307,0,128,0,524545,26,133,168820993,0,147,1642241,147,134283523,11,133,
1793,128,524545,2049,128,1793,128,16846593,147,161,178,1793,64,16846593,147,133,178,1793,64,7,
10,659713,1,659713,2,659713,3,659713,4,659713,5,1793,18081,17108737,3,2,524559,128,2049,128,
2049,128,524545,0,128,524545,0,128,2049,142,168820998,2,17062,1242,167841793,211,9,17826049,0,211,
10,659713,1,659713,2,659713,3,659713,4,659713,5,1793,18296,17108737,3,2,524559,128,2049,128,
2049,128,524545,0,128,524545,0,128,2049,142,168820998,2,17277,1242,167841793,211,9,17826049,0,211,
2,15,25,524546,188,134287105,212,116,2305,213,459023,221,134287361,212,216,659201,211,10,659969,7,
2049,56,25,17694978,58,237,9,84152833,48,319750404,236,117507601,239,184618754,45,25,16974851,-1,168886532,1,
134284289,1,252,134284289,0,239,660227,32,0,0,115,105,103,105,108,58,105,0,285278479,269,
@ -170,7 +170,7 @@ CELL ngaImage[] = { 1793,17826,18272,18316,202207,410,382,1242,1535,0,10,1,10,2,
110,58,105,110,99,0,659713,1,10,3114,3139,166,16050,0,110,58,100,101,99,0,
659969,1,10,3128,3158,166,16050,0,110,58,98,101,116,119,101,101,110,63,0,67503109,
1793,3166,67503109,67503109,2049,3106,10,1,3161,2049,2241,11,10,3142,3187,166,16050,0,83,99,
111,112,101,76,105,115,116,0,18174,18228,10,3172,3198,166,16050,0,123,123,0,2049,
111,112,101,76,105,115,116,0,18389,18443,10,3172,3198,166,16050,0,123,123,0,2049,
1576,2,1,3187,2049,59,16,10,3190,3225,166,16050,0,45,45,45,114,101,118,101,
97,108,45,45,45,0,2049,1576,1,3187,2049,3125,16,10,3207,3241,166,16050,0,125,
125,0,1,3187,2049,56,4,15,11,1793,3255,3841,3187,4097,2,10,1,3250,1793,3281,
@ -228,7 +228,7 @@ CELL ngaImage[] = { 1793,17826,18272,18316,202207,410,382,1242,1535,0,10,1,10,2,
10,4239,4297,154,16050,0,84,101,109,112,83,116,114,105,110,103,115,0,32,4280,
4317,154,16050,0,84,101,109,112,83,116,114,105,110,103,77,97,120,0,512,4298,
4331,166,16050,0,83,84,82,73,78,71,83,0,2049,1545,3841,4297,3841,4317,19,18,
10,4318,4353,154,0,0,67,117,114,114,101,110,116,0,24,10,4340,4370,166,0,
10,4318,4353,154,0,0,67,117,114,114,101,110,116,0,28,10,4340,4370,166,0,
0,115,58,112,111,105,110,116,101,114,0,3841,4353,3841,4317,19,2049,4331,17,10,
4355,4391,166,0,0,115,58,110,101,120,116,0,1,4353,2049,3864,3841,4353,3841,4297,
11,1793,4407,1,0,4097,4353,10,1,4402,9,10,4318,4423,166,16050,0,115,58,116,
@ -853,77 +853,88 @@ CELL ngaImage[] = { 1793,17826,18272,18316,202207,410,382,1242,1535,0,10,1,10,2,
98,0,18,10,16770,16794,166,507904,0,110,58,109,117,108,0,19,10,16783,16807,166,
507904,0,110,58,100,105,118,0,197652,10,16796,16820,166,507904,0,110,58,109,111,100,
0,788,10,16809,16836,166,507904,0,110,58,100,105,118,109,111,100,0,20,10,16822,
16851,166,0,0,115,58,115,112,108,105,116,0,2049,7184,10,16838,16877,166,0,0,
115,58,115,112,108,105,116,45,111,110,45,115,116,114,105,110,103,0,2049,7218,
10,16854,16902,166,0,0,115,58,99,111,110,116,97,105,110,115,45,99,104,97,
114,63,0,2049,4857,10,16880,16929,166,0,0,115,58,99,111,110,116,97,105,110,
115,45,115,116,114,105,110,103,63,0,2049,5286,10,16905,16956,166,0,0,97,58,
99,111,110,116,97,105,110,115,45,115,116,114,105,110,103,63,0,2049,9003,10,
16932,16975,166,0,0,97,58,105,110,100,101,120,45,111,102,0,2049,9195,10,16959,
17001,166,0,0,97,58,105,110,100,101,120,45,111,102,45,115,116,114,105,110,
103,0,2049,9320,10,16978,17020,166,0,0,115,58,105,110,100,101,120,45,111,102,
0,2049,4779,10,17004,17046,166,0,0,115,58,105,110,100,101,120,45,111,102,45,
115,116,114,105,110,103,0,2049,5069,10,17023,17058,166,17845,0,84,73,66,0,1,
7,15,10,17049,17078,166,17845,0,105,109,97,103,101,58,115,97,118,101,0,1,
1000,2049,10628,2049,10609,10,17062,17096,166,0,0,101,100,105,116,63,0,2,1793,17103,
1,8,11,10,1,17099,1793,17111,1,127,11,10,1,17107,2049,2255,22,10,17085,17129,
166,0,0,103,97,116,104,101,114,0,2049,17096,1,15,1,4134,2049,64,10,17117,
17149,166,0,0,99,121,99,108,101,0,2049,10958,2049,2217,4,8,2049,2644,25,3,
2049,17129,1,17149,7,10,17062,17182,166,17845,0,112,97,114,115,101,45,117,110,116,
105,108,0,1793,17194,2049,4451,2049,4234,2049,17149,771,2049,4096,10,1,17184,2049,4260,10,
17165,17210,166,17845,0,115,58,103,101,116,0,1793,17232,1793,17218,1,13,11,10,1,
17214,1793,17226,1,10,11,10,1,17222,2049,2255,22,10,1,17212,2049,17182,10,17199,17248,
166,17845,0,99,108,101,97,114,0,2049,4472,92,94,91,50,74,92,94,91,48,
59,48,72,0,1,17250,2049,8246,2049,10734,10,17237,17282,154,17845,0,78,111,69,99,
104,111,0,0,17270,17292,154,0,0,69,79,84,0,0,17283,17307,154,0,0,73,
103,110,111,114,105,110,103,0,0,17293,17323,166,0,0,105,103,110,111,114,105,
110,103,63,0,3841,17307,10,17308,17339,166,0,0,118,101,114,115,105,111,110,0,
3841,4,1,100,20,10,17326,17356,166,0,0,100,111,110,101,63,0,2,4097,17292,
1793,17365,1,13,11,10,1,17361,1793,17373,1,10,11,10,1,17369,1793,17381,1,32,
11,10,1,17377,2049,2298,22,22,10,17345,17398,166,0,0,101,111,108,63,0,3841,
17292,1793,17406,1,13,11,10,1,17402,1793,17414,1,10,11,10,1,17410,2049,2255,22,
10,17388,17432,166,0,0,118,97,108,105,100,63,0,2,2049,102,2049,2812,10,17420,
17453,166,0,0,99,104,101,99,107,45,101,111,102,0,2,1793,17460,1,-1,11,
10,1,17456,1793,17468,1,4,11,10,1,17464,2049,2255,22,1793,17478,2049,11025,10,1,
17475,9,10,17438,17490,166,0,0,98,115,0,2049,4212,1,2,2049,2675,1793,17502,2049,
4160,3,10,1,17498,9,2049,4160,3,10,17482,17523,166,0,0,99,104,101,99,107,
45,98,115,0,2,1793,17530,1,8,11,10,1,17526,1793,17538,1,127,11,10,1,
17534,2049,2255,22,1793,17548,2049,17490,10,1,17545,9,10,17509,17563,166,0,0,99,104,
101,99,107,0,2049,17453,2049,17523,10,17552,17583,166,0,0,99,104,97,114,97,99,
116,101,114,0,2049,10958,2,2049,4134,10,17568,17601,166,0,0,98,117,102,102,101,
114,0,1793,17611,2049,17058,2049,4234,8,2049,4096,10,1,17603,2049,4260,10,17589,17632,166,
0,0,114,101,97,100,45,116,111,107,101,110,0,1793,17648,1793,17643,2049,17583,2049,
17563,2049,17356,10,1,17636,2049,2397,10,1,17634,2049,17601,2049,4587,10,17616,17666,166,0,
0,105,110,112,117,116,0,2049,17632,2049,17432,10,17655,17684,166,0,0,112,114,111,
99,101,115,115,0,2049,17323,1793,17702,771,2049,17398,1793,17698,1,17307,2049,3931,10,1,
17693,9,10,1,17688,2049,2862,1,410,1,15,2049,64,10,17270,17721,178,17845,0,47,
47,0,2049,15538,1,17307,2049,3916,10,17713,17740,166,17845,0,98,97,110,110,101,114,
0,2049,17339,2049,4472,82,69,84,82,79,32,49,50,32,40,37,110,46,37,110,
41,92,110,0,1,17744,2049,8246,2049,10734,2049,10810,2049,1545,2049,10810,18,2049,1545,2049,
4472,37,110,32,77,97,120,44,32,37,110,32,85,115,101,100,44,32,37,110,
32,70,114,101,101,92,110,0,1,17780,2049,8246,2049,10734,10,17728,17826,166,17845,0,
108,105,115,116,101,110,0,3841,17282,1793,17833,2049,17740,10,1,17830,2049,72,2049,17666,
2049,17684,1,17837,7,10,105,110,116,101,114,102,97,99,101,47,114,101,116,114,
111,45,117,110,105,120,46,114,101,116,114,111,0,17814,17885,154,0,0,83,111,
117,114,99,101,115,0,1,18122,0,0,0,0,0,0,0,0,0,0,0,0,
16850,154,0,0,66,108,111,99,107,115,0,0,16838,16866,154,0,0,66,108,111,
99,107,70,105,108,101,0,0,16851,16877,166,0,0,111,112,101,110,0,3841,16866,
4,2049,13355,4097,16850,10,16867,16896,166,0,0,99,108,111,115,101,0,3841,16850,2049,
13376,10,16885,16911,166,0,0,115,101,101,107,0,1,4096,2049,16794,3841,16850,2049,13457,
10,16901,16930,166,0,0,114,101,97,100,0,1,4,1793,16939,3841,16850,2049,13396,10,
1,16934,2049,2449,2049,90,10,16920,16957,166,0,0,115,116,111,114,101,0,4,2049,
59,10,16946,16972,166,0,0,119,114,105,116,101,0,2049,76,1,4,1793,16983,3841,
16850,2049,13417,10,1,16978,2049,2449,10,16822,17008,166,0,0,98,108,111,99,107,58,
115,101,116,45,102,105,108,101,0,2049,4500,4097,16866,10,16988,17029,166,0,0,98,
108,111,99,107,58,114,101,97,100,0,1,0,2049,16877,4,2049,16911,1,1024,1793,
17045,2049,16930,2049,16957,10,1,17040,2049,2449,3,2049,16896,10,17013,17066,166,0,0,115,
58,115,112,108,105,116,0,2049,7184,10,17053,17092,166,0,0,115,58,115,112,108,
105,116,45,111,110,45,115,116,114,105,110,103,0,2049,7218,10,17069,17117,166,0,
0,115,58,99,111,110,116,97,105,110,115,45,99,104,97,114,63,0,2049,4857,
10,17095,17144,166,0,0,115,58,99,111,110,116,97,105,110,115,45,115,116,114,
105,110,103,63,0,2049,5286,10,17120,17171,166,0,0,97,58,99,111,110,116,97,
105,110,115,45,115,116,114,105,110,103,63,0,2049,9003,10,17147,17190,166,0,0,
97,58,105,110,100,101,120,45,111,102,0,2049,9195,10,17174,17216,166,0,0,97,
58,105,110,100,101,120,45,111,102,45,115,116,114,105,110,103,0,2049,9320,10,
17193,17235,166,0,0,115,58,105,110,100,101,120,45,111,102,0,2049,4779,10,17219,
17261,166,0,0,115,58,105,110,100,101,120,45,111,102,45,115,116,114,105,110,
103,0,2049,5069,10,17238,17273,166,18060,0,84,73,66,0,1,7,15,10,17264,17293,
166,18060,0,105,109,97,103,101,58,115,97,118,101,0,1,1000,2049,10628,2049,10609,
10,17277,17311,166,0,0,101,100,105,116,63,0,2,1793,17318,1,8,11,10,1,
17314,1793,17326,1,127,11,10,1,17322,2049,2255,22,10,17300,17344,166,0,0,103,97,
116,104,101,114,0,2049,17311,1,15,1,4134,2049,64,10,17332,17364,166,0,0,99,
121,99,108,101,0,2049,10958,2049,2217,4,8,2049,2644,25,3,2049,17344,1,17364,7,
10,17277,17397,166,18060,0,112,97,114,115,101,45,117,110,116,105,108,0,1793,17409,
2049,4451,2049,4234,2049,17364,771,2049,4096,10,1,17399,2049,4260,10,17380,17425,166,18060,0,
115,58,103,101,116,0,1793,17447,1793,17433,1,13,11,10,1,17429,1793,17441,1,10,
11,10,1,17437,2049,2255,22,10,1,17427,2049,17397,10,17414,17463,166,18060,0,99,108,
101,97,114,0,2049,4472,92,94,91,50,74,92,94,91,48,59,48,72,0,1,
17465,2049,8246,2049,10734,10,17452,17497,154,18060,0,78,111,69,99,104,111,0,0,17485,
17507,154,0,0,69,79,84,0,0,17498,17522,154,0,0,73,103,110,111,114,105,
110,103,0,0,17508,17538,166,0,0,105,103,110,111,114,105,110,103,63,0,3841,
17522,10,17523,17554,166,0,0,118,101,114,115,105,111,110,0,3841,4,1,100,20,
10,17541,17571,166,0,0,100,111,110,101,63,0,2,4097,17507,1793,17580,1,13,11,
10,1,17576,1793,17588,1,10,11,10,1,17584,1793,17596,1,32,11,10,1,17592,2049,
2298,22,22,10,17560,17613,166,0,0,101,111,108,63,0,3841,17507,1793,17621,1,13,
11,10,1,17617,1793,17629,1,10,11,10,1,17625,2049,2255,22,10,17603,17647,166,0,
0,118,97,108,105,100,63,0,2,2049,102,2049,2812,10,17635,17668,166,0,0,99,
104,101,99,107,45,101,111,102,0,2,1793,17675,1,-1,11,10,1,17671,1793,17683,
1,4,11,10,1,17679,2049,2255,22,1793,17693,2049,11025,10,1,17690,9,10,17653,17705,
166,0,0,98,115,0,2049,4212,1,2,2049,2675,1793,17717,2049,4160,3,10,1,17713,
9,2049,4160,3,10,17697,17738,166,0,0,99,104,101,99,107,45,98,115,0,2,
1793,17745,1,8,11,10,1,17741,1793,17753,1,127,11,10,1,17749,2049,2255,22,1793,
17763,2049,17705,10,1,17760,9,10,17724,17778,166,0,0,99,104,101,99,107,0,2049,
17668,2049,17738,10,17767,17798,166,0,0,99,104,97,114,97,99,116,101,114,0,2049,
10958,2,2049,4134,10,17783,17816,166,0,0,98,117,102,102,101,114,0,1793,17826,2049,
17273,2049,4234,8,2049,4096,10,1,17818,2049,4260,10,17804,17847,166,0,0,114,101,97,
100,45,116,111,107,101,110,0,1793,17863,1793,17858,2049,17798,2049,17778,2049,17571,10,1,
17851,2049,2397,10,1,17849,2049,17816,2049,4587,10,17831,17881,166,0,0,105,110,112,117,
116,0,2049,17847,2049,17647,10,17870,17899,166,0,0,112,114,111,99,101,115,115,0,
2049,17538,1793,17917,771,2049,17613,1793,17913,1,17522,2049,3931,10,1,17908,9,10,1,17903,
2049,2862,1,410,1,15,2049,64,10,17485,17936,178,18060,0,47,47,0,2049,15538,1,
17522,2049,3916,10,17928,17955,166,18060,0,98,97,110,110,101,114,0,2049,17554,2049,4472,
82,69,84,82,79,32,49,50,32,40,37,110,46,37,110,41,92,110,0,1,
17959,2049,8246,2049,10734,2049,10810,2049,1545,2049,10810,18,2049,1545,2049,4472,37,110,32,77,
97,120,44,32,37,110,32,85,115,101,100,44,32,37,110,32,70,114,101,101,
92,110,0,1,17995,2049,8246,2049,10734,10,17943,18041,166,18060,0,108,105,115,116,101,
110,0,3841,17497,1793,18048,2049,17955,10,1,18045,2049,72,2049,17881,2049,17899,1,18052,7,
10,105,110,116,101,114,102,97,99,101,47,114,101,116,114,111,45,117,110,105,
120,46,114,101,116,114,111,0,18029,18100,154,0,0,83,111,117,114,99,101,115,
0,1,18337,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,
0,0,0,0,0,0,0,0,0,0,0,0,0,0,17872,18025,166,0,0,107,
110,111,119,110,63,0,2,1,17885,2049,9003,10,18013,18042,166,0,0,105,110,100,
101,120,0,1,17885,4,2049,9320,1,17885,4,2049,9140,10,18031,18065,166,0,0,114,
101,99,111,114,100,0,2049,4500,2,1,17885,2049,3864,3841,17885,1,17885,17,16,10,
1793,18120,2049,15473,2049,18025,1793,18090,2049,18042,10,1,18087,1793,18097,2049,18065,10,1,18094,
2049,64,1793,18110,1,190,1,2,17,8,10,1,18103,2049,2229,2049,1576,2049,184,16,
10,1,18081,100,105,99,116,45,119,111,114,100,115,45,108,105,115,116,105,110,
103,46,102,111,114,116,104,0,17814,18160,166,18122,0,100,58,119,111,114,100,115,
0,1793,18169,2049,188,2049,10734,2049,10704,10,1,18162,2049,8491,10,18147,18192,166,18122,0,
100,58,119,111,114,100,115,45,119,105,116,104,0,2049,1977,2049,5573,1793,18223,2049,
188,2,2049,1977,2049,5286,1793,18212,2049,10734,2049,10704,10,1,18207,1793,18218,3,10,1,
18216,2049,64,10,1,18198,2049,8491,10,18174,18249,166,18122,0,100,105,115,112,108,97,
121,45,105,102,45,108,101,102,116,0,2,2049,1977,2049,5519,1793,18261,2049,10734,2049,
10704,10,1,18256,1793,18267,3,10,1,18265,2049,64,10,18174,18300,166,18122,0,100,58,
119,111,114,100,115,45,98,101,103,105,110,110,105,110,103,45,119,105,116,104,
0,2049,1977,2049,5573,1793,18311,2049,188,2049,18249,10,1,18306,2049,8491,10,0 };
0,0,0,0,0,0,0,0,0,18087,18240,166,0,0,107,110,111,119,110,63,
0,2,1,18100,2049,9003,10,18228,18257,166,0,0,105,110,100,101,120,0,1,18100,
4,2049,9320,1,18100,4,2049,9140,10,18246,18280,166,0,0,114,101,99,111,114,100,
0,2049,4500,2,1,18100,2049,3864,3841,18100,1,18100,17,16,10,1793,18335,2049,15473,2049,
18240,1793,18305,2049,18257,10,1,18302,1793,18312,2049,18280,10,1,18309,2049,64,1793,18325,1,
190,1,2,17,8,10,1,18318,2049,2229,2049,1576,2049,184,16,10,1,18296,100,105,
99,116,45,119,111,114,100,115,45,108,105,115,116,105,110,103,46,102,111,114,
116,104,0,18029,18375,166,18337,0,100,58,119,111,114,100,115,0,1793,18384,2049,188,
2049,10734,2049,10704,10,1,18377,2049,8491,10,18362,18407,166,18337,0,100,58,119,111,114,
100,115,45,119,105,116,104,0,2049,1977,2049,5573,1793,18438,2049,188,2,2049,1977,2049,
5286,1793,18427,2049,10734,2049,10704,10,1,18422,1793,18433,3,10,1,18431,2049,64,10,1,
18413,2049,8491,10,18389,18464,166,18337,0,100,105,115,112,108,97,121,45,105,102,45,
108,101,102,116,0,2,2049,1977,2049,5519,1793,18476,2049,10734,2049,10704,10,1,18471,1793,
18482,3,10,1,18480,2049,64,10,18389,18515,166,18337,0,100,58,119,111,114,100,115,
45,98,101,103,105,110,110,105,110,103,45,119,105,116,104,0,2049,1977,2049,5573,
1793,18526,2049,188,2049,18464,10,1,18521,2049,8491,10,0 };