Files
ueforth/attic/jotblk/static/myforth.fs
Brad Nelson 3a5daad8af Adding jotblk sample.
A web editor that embeds uEforth.
2025-05-10 12:41:18 -07:00

44 lines
1.2 KiB
Forth

\ Copyright 2021 Bradley D. Nelson
\
\ Licensed under the Apache License, Version 2.0 (the "License");
\ you may not use this file except in compliance with the License.
\ You may obtain a copy of the License at
\
\ http://www.apache.org/licenses/LICENSE-2.0
\
\ Unless required by applicable law or agreed to in writing, software
\ distributed under the License is distributed on an "AS IS" BASIS,
\ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\ See the License for the specific language governing permissions and
\ limitations under the License.
web definitions
JSWORD: block-read { n a -- }
for (var i = 0; i < 1024; i++) {
u8[a + i] = blocks[n * 1024 + i];
}
~
also internals
create block-buffer 1024 allot
also forth definitions
variable scr
: block ( n -- a ) block-buffer block-read block-buffer ;
: buffer ( n -- a ) block ;
only forth definitions
( Loading )
: load ( n -- ) block 1024 evaluate ;
: thru ( a b -- ) over - 1+ for aft dup >r load r> 1+ then next drop ;
( Listing )
: list ( n -- ) scr ! ." Block " scr @ . cr scr @ block
15 for dup 63 type [char] | emit space 15 r@ - . cr 64 + next drop ;
only forth definitions