( Here is a list of well known Forth words and their implementations in "Generic Forth" ) hex : BOUNDS ( addr1 u -- addr2 addr1 ) over + swap ; : CHAR+ ( addr1 -- addr2 ) 1+ ; \ In this case CHAR is a byte : CHARS ( n1 -- n2 ) ; \ Here too! : COUNT ( addr1 -- addr2 x ) dup 1+ swap c@ ; : C@+ ( addr1 -- addr2 x ) dup 1+ swap c@ ; \ Pseudonym for COUNT : @+ ( addr1 -- addr2 x ) dup cell+ swap @ ; : TUCK ( x1 x2 -- x2 x1 ) swap over ; : NIP ( x1 x2 -- x2 ) swap drop ; : -ROT ( x1 x2 x3 -- x3 x1 x2 ) rot rot ; : 2DROP ( d -- ) drop drop ; : ?DUP ( x1 -- x1 x1 ) dup if dup then ; : ABORT ( flag -- ) -1 throw ; : ABORT" ( flag ccc -- ) postpone if postpone ." postpone abort postpone then ; immediate : ABS ( n -- u ) dup 0< if negate then ; : +! ( n a -- ) >r r@ @ + r> ! ; : MS ( u -- ) ?dup if 0 do 190 0 do loop loop then ; \ The number 190 is system dependent! : WITHIN ( x a b -- flag ) over - >r - r> u< ; \ x-a u< b-a ? : <> ( x1 x2 -- flag ) = 0= ; : U> ( u1 u2 -- flag ) swap u< ; : 0< ( n -- flag ) 0 < ; : CELL- ( a1 -- a2 ) 1 cells - ; : 1+ ( n1 -- n2 ) 1 + ; : 1- ( n1 -- n2 ) 1 - ; : MIN ( n1 n2 -- n3 ) 2dup > if swap then drop ; : MAX ( n1 n2 -- n3 ) 2dup < if swap then drop ; : UMIN ( n1 n2 -- n3 ) 2dup u< if drop exit then swap drop ; : UMAX ( n1 n2 -- n3 ) 2dup u< if swap then drop ; : */ ( n1 n2 n3 -- n4 ) */mod swap drop ; : ARSHIFT ( n1 +n -- n2 ) dup if 0 do 2/ loop else drop then ; : [ ( -- ) false state ! ; immediate : ] ( -- ) true state ! ; : .BYTE ( byte -- ) base @ >r hex 0 <# # # #> type space r> base ! ; \ Print 8-bits in hex : .HEX ( u -- ) base @ >r hex 0 <# # # # # #> type space r> base ! ; \ Print 16-bits in hex : UPC ( ch1 -- ch2 ) dup [char] a [char] z 1+ within if DF and then ;