retroforth/nga-c/extend.retro

22 lines
404 B
Forth
Raw Normal View History

~~~
{{
'FID var
:write-byte (n-) @FID file:write ;
:mask (n-) #255 and ;
:write-cell (n-)
dup mask write-byte
#8 shift dup mask write-byte
#8 shift dup mask write-byte
#8 shift mask write-byte ;
---reveal---
:image:save (s-)
file:open-for-writing !FID
#0 here [ fetch-next write-cell ] times drop
@FID file:close ;
}}
'retro.nga image:save
~~~