mirror of
https://git.sr.ht/~crc_/retroforth
synced 2024-11-16 19:48:56 +01:00
86191b4e12
FossilOrigin-Name: 5aeba86e15c05847c2cac75fd2606439826d8394a0d06b92cfccc4c5d9d336d5
32 lines
731 B
Forth
32 lines
731 B
Forth
Blocks allow for a simple storage subsystem. In the smaller ilo
|
|
and napia based systems, they are mandatory and are the primary
|
|
means of data and code storage
|
|
|
|
Under RetroForth/nga, this is optional, but is enabled by
|
|
default.
|
|
|
|
The exposed word set is compact:
|
|
|
|
block:set-file (s-)
|
|
block:read (na-)
|
|
block:write (na-)
|
|
|
|
~~~
|
|
{{
|
|
:block:invoke DEVICE:BLOCKS io:scan-for io:invoke ;
|
|
---reveal---
|
|
:block:read (:na-) #0 block:invoke ;
|
|
:block:write (:na-) #1 block:invoke ;
|
|
:block:set-file (:s-) #2 block:invoke ;
|
|
}}
|
|
~~~
|
|
|
|
# Source Data
|
|
|
|
~~~
|
|
'interface/blocks.retro s:dedup
|
|
dup 'block:read d:lookup d:source store
|
|
dup 'block:write d:lookup d:source store
|
|
dup 'block:set-file d:lookup d:source store
|
|
drop
|
|
~~~
|