/** Fetch a byte from the given location */
defcode("b@", byte_fetch, &sub_store, 0u) {
-// onward_aspush( (value_t)*((char*)onward_aspop()) );
+ onward_aspush( (value_t)*((char*)onward_aspop()) );
}
/** Store a byte in an address at the given location */
defcode("b!", byte_store, &byte_fetch, 0u) {
-// *((char*)onward_aspop()) = (char)onward_aspop();
+ char val = (char)onward_aspop();
+ char* addr = (char*)onward_aspop();
+ *(addr) = val;
}
/** Copy a block of memory to a new location */
: const word create [compile] literal 0 , ;
-: dump word find dumpw ;
-
\ Stack Manipulation Words
\ -----------------------------------------------------------------------------
: nip swap drop ;
drop \ drop the depth counter
;
+\ String Words
+\ -----------------------------------------------------------------------------
+: s" immediate
+ here @
+ here @
+ begin
+ \ while ( key != '"' )
+ key dup 34 <> while
+ over swap b!
+ 1 +
+ repeat
+ drop
+ dup 0 b!
+ here over align !
+ drop
+;
+
+: emit+
+ dup b@ dup if
+ emit 1 +
+ else
+ drop
+ then
+;
+
+: semit
+ begin
+ dup b@ dup while
+ emit
+ 1 +
+ repeat
+ drop
+;
+
+: sput semit 10 emit ;
+