Commacode

Loading the assembler in order to define one or two words of your program in assembler takes relatively a lot of space.

COMMACODE produces 'comma code' for the most recently defined word and makes it easy to compile a low level forth word without the use of an active assembler.
\ For noForth C&V

: COMMACODE ( -- )
  created lfa>n count hx 1F and
  cr ." code " 2dup type
  3 spaces
  + aligned >body
  chere over - 2/ 0
  do @+ u. ." , "
     dup 7 and 0=
     if cr else space then
  loop drop ." end-code " cr ;

How to use it

  1. include the assembler in noForth
  2. include the COMMACODE definition
    (select and copy the code and
    paste it into your noForth terminal)
  3. define your word in assembler
  4. execute the word COMMACODE
Example:
code 2! ( lo hi a -- )
  sp )+ tos ) mov   sp )+ 2 tos x) mov
  sp )+ tos mov   next end-code
  commacode
The output will be:
code 2!   44B7 ,  0 , 44B7 ,
2 ,  4437 ,  4F00 ,  end-code
Paste the output into your program.
Another option: Use aux430asm.f, a cross assembler that produces 'comma code'.