VolksForth

6502-anonword
Login

Anonymous inline words

VolksForth 3.8.x does not have "DOCOL" to execute a colon definition without head. DOCOL will be moved into the VolksForth kernel with version 3.9

DOCOL 6502 Version:

Requires: 6502 Assembler

\needs code    INCLUDE" D1:TAS65.FS"

CODE DOCOL
  RP 2DEC  IP LDA  RP X) STA
  IP 1+ LDA  RP )Y STA
  W LDA  CLC  2 # ADC  IP STA
  TXA  W 1+ ADC  IP 1+ STA
  NEXT JMP  END-CODE

Anonymous Words

: [: COMPILE BRANCH >MARK 
  [ ' DOCOL >BODY ] LITERAL , ;
  IMMEDIATE RESTRICT

: ;] COMPILE EXIT
     DUP HERE OVER - SWAP !
     2+ COMPILE LIT , ; 
  IMMEDIATE RESTRICT

[: starts an anonymous inline word and compiles a forward branch to ";]"

;] terminates the anonymous word and compiles a LITERAL that will place the XT (execution token) of the anonymous word onto the stack during runtime.