mirror of https://github.com/mgcaret/of816.git
start docgen automation
This commit is contained in:
parent
c9a4b81466
commit
a02e14e375
|
@ -28,7 +28,7 @@ bad: ONLIT -49
|
||||||
.dword THROW
|
.dword THROW
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( widn ... wid1 n -- ) set dictionary search order
|
; H: ( widn ... wid1 n -- ) Set dictionary search order.
|
||||||
dword SET_ORDER,"SET-ORDER"
|
dword SET_ORDER,"SET-ORDER"
|
||||||
ENTER
|
ENTER
|
||||||
.dword DUP
|
.dword DUP
|
||||||
|
@ -73,7 +73,7 @@ eword
|
||||||
.endif
|
.endif
|
||||||
|
|
||||||
.if max_search_order > 0
|
.if max_search_order > 0
|
||||||
; H: ( -- wid ) return wordlist containing system words
|
; H: ( -- wid ) Return the WID of the wordlist containing system words.
|
||||||
dword FORTH_WORDLIST,"FORTH-WORDLIST"
|
dword FORTH_WORDLIST,"FORTH-WORDLIST"
|
||||||
.else
|
.else
|
||||||
hword FORTH_WORDLIST,"FORTH-WORDLIST"
|
hword FORTH_WORDLIST,"FORTH-WORDLIST"
|
||||||
|
@ -81,7 +81,7 @@ hword FORTH_WORDLIST,"FORTH-WORDLIST"
|
||||||
SYSVAR SV_FORTH_WL
|
SYSVAR SV_FORTH_WL
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- ) set the first wordlist in the search order to the system words
|
; H: ( -- ) Set the first wordlist in the search order to the system words
|
||||||
dword FORTH,"FORTH"
|
dword FORTH,"FORTH"
|
||||||
.if max_search_order > 0
|
.if max_search_order > 0
|
||||||
ENTER
|
ENTER
|
||||||
|
@ -95,7 +95,7 @@ dword FORTH,"FORTH"
|
||||||
eword
|
eword
|
||||||
|
|
||||||
.if max_search_order > 0
|
.if max_search_order > 0
|
||||||
; H: ( -- wid ) return the wordlist for environmental queries
|
; H: ( -- wid ) Return the WID of the wordlist for environmental queries.
|
||||||
dword dENVQ_WL,"$ENV?-WL"
|
dword dENVQ_WL,"$ENV?-WL"
|
||||||
.else
|
.else
|
||||||
hword dENVQ_WL,"$ENV?-WL"
|
hword dENVQ_WL,"$ENV?-WL"
|
||||||
|
@ -121,13 +121,13 @@ hword dORDER,"$ORDER"
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; ( -- a-addr ) variable containing current compiler wordlist
|
; ( -- a-addr ) Variable containing current compiler wordlist.
|
||||||
hword dCURRENT,"$CURRENT"
|
hword dCURRENT,"$CURRENT"
|
||||||
SYSVAR SV_CURRENT
|
SYSVAR SV_CURRENT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
.if max_search_order > 0
|
.if max_search_order > 0
|
||||||
; H: ( -- wid ) return first wordlist in search order
|
; H: ( -- wid ) Return first wordlist in search order.
|
||||||
dword CONTEXT,"CONTEXT"
|
dword CONTEXT,"CONTEXT"
|
||||||
.else
|
.else
|
||||||
hword CONTEXT,"CONTEXT"
|
hword CONTEXT,"CONTEXT"
|
||||||
|
@ -150,7 +150,7 @@ empty: .dword dCURRENT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
.if max_search_order > 0
|
.if max_search_order > 0
|
||||||
; H: ( -- wid ) get current compiler wordlist
|
; H: ( -- wid ) Get WID current compiler wordlist.
|
||||||
dword GET_CURRENT,"GET-CURRENT"
|
dword GET_CURRENT,"GET-CURRENT"
|
||||||
.else
|
.else
|
||||||
hword GET_CURRENT,"GET-CURRENT"
|
hword GET_CURRENT,"GET-CURRENT"
|
||||||
|
@ -162,7 +162,7 @@ hword GET_CURRENT,"GET-CURRENT"
|
||||||
eword
|
eword
|
||||||
|
|
||||||
.if max_search_order > 0
|
.if max_search_order > 0
|
||||||
; H: ( -- widn ... wid1 u ) get dictionary search order
|
; H: ( -- widn ... wid1 u ) Get dictionary search order.
|
||||||
dword GET_ORDER,"GET-ORDER"
|
dword GET_ORDER,"GET-ORDER"
|
||||||
ENTER
|
ENTER
|
||||||
.dword dORDER
|
.dword dORDER
|
||||||
|
@ -182,7 +182,7 @@ lpdone: .dword UNLOOP
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; ( wid -- ) set the first wordlist in the search order
|
; ( wid -- ) Set the first wordlist in the search order.
|
||||||
hword TOP_OF_ORDER,"TOP-OF-ORDER"
|
hword TOP_OF_ORDER,"TOP-OF-ORDER"
|
||||||
ENTER
|
ENTER
|
||||||
.dword PtoR
|
.dword PtoR
|
||||||
|
@ -201,7 +201,7 @@ default: .dword RtoP
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- ) duplicate the first wordlist in the search order
|
; H: ( -- ) Fuplicate the first wordlist in the search order.
|
||||||
dword ALSO,"ALSO"
|
dword ALSO,"ALSO"
|
||||||
ENTER
|
ENTER
|
||||||
.dword GET_ORDER
|
.dword GET_ORDER
|
||||||
|
@ -217,7 +217,7 @@ dword ALSO,"ALSO"
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- ) remove the first wordlist in the search order
|
; H: ( -- ) Remove the first wordlist in the search order.
|
||||||
dword PREVIOUS,"PREVIOUS"
|
dword PREVIOUS,"PREVIOUS"
|
||||||
ENTER
|
ENTER
|
||||||
.dword GET_ORDER
|
.dword GET_ORDER
|
||||||
|
@ -232,7 +232,7 @@ noorder: ONLIT -50
|
||||||
.dword THROW
|
.dword THROW
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( wid -- ) set the compiler wordlist
|
; H: ( wid -- ) Set the compiler wordlist.
|
||||||
dword SET_CURRENT,"SET-CURRENT"
|
dword SET_CURRENT,"SET-CURRENT"
|
||||||
ENTER
|
ENTER
|
||||||
.dword dCURRENT
|
.dword dCURRENT
|
||||||
|
@ -240,7 +240,7 @@ dword SET_CURRENT,"SET-CURRENT"
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- ) set the search order to contain only the system wordlist
|
; H: ( -- ) Set the search order to contain only the system wordlist.
|
||||||
dword ONLY,"ONLY"
|
dword ONLY,"ONLY"
|
||||||
ENTER
|
ENTER
|
||||||
.dword FORTH_WORDLIST
|
.dword FORTH_WORDLIST
|
||||||
|
@ -249,7 +249,7 @@ dword ONLY,"ONLY"
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- ) set the search order to contain only the current top of the order
|
; H: ( -- ) Set the search order to contain only the current top of the order.
|
||||||
dword SEAL,"SEAL"
|
dword SEAL,"SEAL"
|
||||||
ENTER
|
ENTER
|
||||||
.dword CONTEXT
|
.dword CONTEXT
|
||||||
|
@ -258,7 +258,7 @@ dword SEAL,"SEAL"
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( wid -- c-addr u ) return the name of a wordlist, or ^address if no name
|
; H: ( wid -- c-addr u ) Return the name of a wordlist, or ^address if no name.
|
||||||
hword WL_NAME,"WL-NAME"
|
hword WL_NAME,"WL-NAME"
|
||||||
ENTER
|
ENTER
|
||||||
.dword DUP
|
.dword DUP
|
||||||
|
@ -274,7 +274,7 @@ noname: JUMP rNAME_noname1
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- ) display the current search order and compiler wordlist
|
; H: ( -- ) Display the current search order and compiler wordlist.
|
||||||
dword ORDER,"ORDER"
|
dword ORDER,"ORDER"
|
||||||
ENTER
|
ENTER
|
||||||
SLIT "Compiling to: "
|
SLIT "Compiling to: "
|
||||||
|
@ -300,7 +300,7 @@ lpdone: .dword UNLOOP
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- ) set the compiler wordlist to the first wordlist in the search order
|
; H: ( -- ) Set the compiler wordlist to the first wordlist in the search order.
|
||||||
dword DEFINITIONS,"DEFINITIONS"
|
dword DEFINITIONS,"DEFINITIONS"
|
||||||
ENTER
|
ENTER
|
||||||
.dword CONTEXT
|
.dword CONTEXT
|
||||||
|
@ -445,7 +445,7 @@ hword TMPBASE,"TMPBASE"
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- ) display version information
|
; H: ( -- ) Display version information.
|
||||||
dword DOTVERSION,".VERSION"
|
dword DOTVERSION,".VERSION"
|
||||||
ENTER
|
ENTER
|
||||||
SLIT .concat("OF816 v",VERSION,"/")
|
SLIT .concat("OF816 v",VERSION,"/")
|
||||||
|
@ -469,7 +469,7 @@ dword DOTVERSION,".VERSION"
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- ) reset the system
|
; H: ( -- ) Reset the system.
|
||||||
dword RESET_ALL,"RESET-ALL"
|
dword RESET_ALL,"RESET-ALL"
|
||||||
lda #SI_RESET_ALL
|
lda #SI_RESET_ALL
|
||||||
jsl _call_sysif
|
jsl _call_sysif
|
||||||
|
@ -478,7 +478,7 @@ dword RESET_ALL,"RESET-ALL"
|
||||||
: NEXT
|
: NEXT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- ) restore system stack pointer and return to caller
|
; H: ( -- ) Restore system stack pointer and exit Forth.
|
||||||
dword BYE,"BYE"
|
dword BYE,"BYE"
|
||||||
lda SYS_RSTK
|
lda SYS_RSTK
|
||||||
tcs
|
tcs
|
||||||
|
@ -528,7 +528,7 @@ dotype: .dword TYPE
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( xt -- xi ... xj n ) call xt, trap exception and return in n
|
; H: ( xt -- xi ... xj n|0 ) Call xt, trap exception, and return it in n.
|
||||||
; catch return stack frame is:
|
; catch return stack frame is:
|
||||||
; IP (4), old RSTK_SAVE (2), data SP (2, first out)
|
; IP (4), old RSTK_SAVE (2), data SP (2, first out)
|
||||||
dword CATCH,"CATCH"
|
dword CATCH,"CATCH"
|
||||||
|
@ -566,7 +566,7 @@ fixup: pla ; get old RSTK_SAVE
|
||||||
PUSHNEXT
|
PUSHNEXT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( n -- ) throw exception n if n <> 0
|
; H: ( n -- ) Throw exception n if n <> 0.
|
||||||
dword THROW,"THROW"
|
dword THROW,"THROW"
|
||||||
jsr _popay ; get exception # from stack
|
jsr _popay ; get exception # from stack
|
||||||
throway: .if trace
|
throway: .if trace
|
||||||
|
@ -635,7 +635,8 @@ noabort: .dword TWODROP
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( f -- ) parse string ending in " from input stream, execute -2 THROW if f is true
|
; H: Compilation/Interpretation: ( [text<">] -- ) Execution: ( f -- )
|
||||||
|
; H: If f is true, display text and execute -2 THROW.
|
||||||
dwordq ABORTQ,"ABORT'",F_IMMED
|
dwordq ABORTQ,"ABORT'",F_IMMED
|
||||||
ENTER
|
ENTER
|
||||||
.dword SQ
|
.dword SQ
|
||||||
|
@ -646,7 +647,7 @@ interp: .dword _ABORTQ
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- ) execute -1 THROW
|
; H: ( -- ) Execute -1 THROW.
|
||||||
dword ABORT,"ABORT"
|
dword ABORT,"ABORT"
|
||||||
ENTER
|
ENTER
|
||||||
ONLIT -1
|
ONLIT -1
|
||||||
|
@ -654,7 +655,7 @@ dword ABORT,"ABORT"
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- u ) u = address of the CPU direct page
|
; H: ( -- addr ) addr = address of the CPU direct page
|
||||||
dword dDIRECT,"$DIRECT"
|
dword dDIRECT,"$DIRECT"
|
||||||
tdc
|
tdc
|
||||||
tay
|
tay
|
||||||
|
@ -662,7 +663,7 @@ dword dDIRECT,"$DIRECT"
|
||||||
PUSHNEXT
|
PUSHNEXT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- u ) u = top of usable data space
|
; H: ( -- addr ) addr = top of usable data space
|
||||||
dword dMEMTOP,"$MEMTOP"
|
dword dMEMTOP,"$MEMTOP"
|
||||||
ENTER
|
ENTER
|
||||||
.dword dDIRECT
|
.dword dDIRECT
|
||||||
|
@ -689,32 +690,32 @@ dword UNUSED,"UNUSED"
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- ) do nothing
|
; H: ( -- ) Do nothing.
|
||||||
dword NOOP,"NOOP"
|
dword NOOP,"NOOP"
|
||||||
NEXT
|
NEXT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- u ) u = size of char in bytes
|
; H: ( -- u ) u = size of char in bytes.
|
||||||
dword SCHAR,"/C"
|
dword SCHAR,"/C"
|
||||||
FCONSTANT 1
|
FCONSTANT 1
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- u ) u = size of word in bytes
|
; H: ( -- u ) u = size of word in bytes.
|
||||||
dword SWORD,"/W"
|
dword SWORD,"/W"
|
||||||
FCONSTANT 2
|
FCONSTANT 2
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- u ) u = size of long in bytes
|
; H: ( -- u ) u = size of long in bytes.
|
||||||
dword SLONG,"/L"
|
dword SLONG,"/L"
|
||||||
FCONSTANT 4
|
FCONSTANT 4
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- u ) u = size of cell in bytes
|
; H: ( -- u ) u = size of cell in bytes.
|
||||||
dword SCELL,"/N"
|
dword SCELL,"/N"
|
||||||
FCONSTANT 4
|
FCONSTANT 4
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( u1 n -- u2 ) u2 = u1 + n * size of char in bytes
|
; H: ( u1 n -- u2 ) u2 = u1 + n * size of char in bytes.
|
||||||
dword CAPLUS,"CA+"
|
dword CAPLUS,"CA+"
|
||||||
ENTER
|
ENTER
|
||||||
.dword SCHAR
|
.dword SCHAR
|
||||||
|
@ -723,28 +724,28 @@ domath: .dword UMULT
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( u1 n -- u2 ) u2 = u1 + n * size of word in bytes
|
; H: ( u1 n -- u2 ) u2 = u1 + n * size of word in bytes.
|
||||||
dword WAPLUS,"WA+"
|
dword WAPLUS,"WA+"
|
||||||
ENTER
|
ENTER
|
||||||
.dword SWORD
|
.dword SWORD
|
||||||
JUMP CAPLUS::domath
|
JUMP CAPLUS::domath
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( u1 n -- u2 ) u2 = u1 + n * size of long in bytes
|
; H: ( u1 n -- u2 ) u2 = u1 + n * size of long in bytes.
|
||||||
dword LAPLUS,"LA+"
|
dword LAPLUS,"LA+"
|
||||||
ENTER
|
ENTER
|
||||||
.dword SLONG
|
.dword SLONG
|
||||||
JUMP CAPLUS::domath
|
JUMP CAPLUS::domath
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( u1 n -- u2 ) u2 = u1 + n * size of cell in bytes
|
; H: ( u1 n -- u2 ) u2 = u1 + n * size of cell in bytes.
|
||||||
dword NAPLUS,"NA+"
|
dword NAPLUS,"NA+"
|
||||||
ENTER
|
ENTER
|
||||||
.dword SCELL
|
.dword SCELL
|
||||||
JUMP CAPLUS::domath
|
JUMP CAPLUS::domath
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( u1 -- u2 ) u2 = u1 + size of char in bytes
|
; H: ( u1 -- u2 ) u2 = u1 + size of char in bytes.
|
||||||
dword CHARPLUS,"CHAR+"
|
dword CHARPLUS,"CHAR+"
|
||||||
ENTER
|
ENTER
|
||||||
.dword SCHAR
|
.dword SCHAR
|
||||||
|
@ -752,7 +753,7 @@ dword CHARPLUS,"CHAR+"
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( u1 -- u2 ) u2 = u1 + size of cell in bytes
|
; H: ( u1 -- u2 ) u2 = u1 + size of cell in bytes.
|
||||||
dword CELLPLUS,"CELL+"
|
dword CELLPLUS,"CELL+"
|
||||||
ENTER
|
ENTER
|
||||||
.dword SCELL
|
.dword SCELL
|
||||||
|
@ -760,7 +761,7 @@ dword CELLPLUS,"CELL+"
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( n1 -- n2 ) n2 = n1 * size of char
|
; H: ( n1 -- n2 ) n2 = n1 * size of char.
|
||||||
dword CHARS,"CHARS"
|
dword CHARS,"CHARS"
|
||||||
ENTER
|
ENTER
|
||||||
.dword SCHAR
|
.dword SCHAR
|
||||||
|
@ -768,7 +769,7 @@ dword CHARS,"CHARS"
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( n1 -- n2 ) n2 = n1 * size of cell
|
; H: ( n1 -- n2 ) n2 = n1 * size of cell.
|
||||||
dword CELLS,"CELLS"
|
dword CELLS,"CELLS"
|
||||||
ENTER
|
ENTER
|
||||||
.dword SCELL
|
.dword SCELL
|
||||||
|
@ -776,17 +777,17 @@ dword CELLS,"CELLS"
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( u1 -- u2 ) u2 = next aligned address after u1
|
; H: ( u1 -- u2 ) u2 = next aligned address after u1.
|
||||||
dword ALIGNED,"ALIGNED"
|
dword ALIGNED,"ALIGNED"
|
||||||
NEXT
|
NEXT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( n1 -- n2 ) n2 = n1 + size of char
|
; H: ( n1 -- n2 ) n2 = n1 + size of char.
|
||||||
dword CAINCR,"CA1+"
|
dword CAINCR,"CA1+"
|
||||||
jmp CHARPLUS::code
|
jmp CHARPLUS::code
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( n1 -- n2 ) n2 = n1 + size of word
|
; H: ( n1 -- n2 ) n2 = n1 + size of word.
|
||||||
dword WAINCR,"WA1+"
|
dword WAINCR,"WA1+"
|
||||||
ENTER
|
ENTER
|
||||||
.dword SWORD
|
.dword SWORD
|
||||||
|
@ -794,7 +795,7 @@ dword WAINCR,"WA1+"
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( n1 -- n2 ) n2 = n1 + size of long
|
; H: ( n1 -- n2 ) n2 = n1 + size of long.
|
||||||
dword LAINCR,"LA1+"
|
dword LAINCR,"LA1+"
|
||||||
ENTER
|
ENTER
|
||||||
.dword SLONG
|
.dword SLONG
|
||||||
|
@ -802,17 +803,17 @@ dword LAINCR,"LA1+"
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( n1 -- n2 ) n2 = n1 + size of cell
|
; H: ( n1 -- n2 ) n2 = n1 + size of cell.
|
||||||
dword NAINCR,"NA1+"
|
dword NAINCR,"NA1+"
|
||||||
jmp CELLPLUS::code
|
jmp CELLPLUS::code
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( n1 -- n2 ) n2 = n1 * size of char
|
; H: ( n1 -- n2 ) n2 = n1 * size of char.
|
||||||
dword SCHARMULT,"/C*"
|
dword SCHARMULT,"/C*"
|
||||||
jmp CHARS::code
|
jmp CHARS::code
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( n1 -- n2 ) n2 = n1 * size of word
|
; H: ( n1 -- n2 ) n2 = n1 * size of word.
|
||||||
dword SWORDMULT,"/W*"
|
dword SWORDMULT,"/W*"
|
||||||
ENTER
|
ENTER
|
||||||
.dword SWORD
|
.dword SWORD
|
||||||
|
@ -820,7 +821,7 @@ dword SWORDMULT,"/W*"
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( n1 -- n2 ) n2 = n1 * size of long
|
; H: ( n1 -- n2 ) n2 = n1 * size of long.
|
||||||
dword SLONGMULT,"/L*"
|
dword SLONGMULT,"/L*"
|
||||||
ENTER
|
ENTER
|
||||||
.dword SLONG
|
.dword SLONG
|
||||||
|
@ -828,12 +829,12 @@ dword SLONGMULT,"/L*"
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( n1 -- n2 ) n2 = n1 * size of cell
|
; H: ( n1 -- n2 ) n2 = n1 * size of cell.
|
||||||
dword SCELLMULT,"/N*"
|
dword SCELLMULT,"/N*"
|
||||||
jmp CELLS::code
|
jmp CELLS::code
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( u -- u1 ... u4 ) u1 ... u4 = bytes of u
|
; H: ( u -- u1 ... u4 ) u1 ... u4 = bytes of u.
|
||||||
dword LBSPLIT,"LBSPLIT"
|
dword LBSPLIT,"LBSPLIT"
|
||||||
jsr _1parm
|
jsr _1parm
|
||||||
lda STACKBASE+0,x
|
lda STACKBASE+0,x
|
||||||
|
@ -857,7 +858,7 @@ dword LBSPLIT,"LBSPLIT"
|
||||||
PUSHNEXT
|
PUSHNEXT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( u -- u1 ... u2 ) u1 ... u2 = words of u
|
; H: ( u -- u1 ... u2 ) u1 ... u2 = words of u.
|
||||||
dword LWSPLIT,"LWSPLIT"
|
dword LWSPLIT,"LWSPLIT"
|
||||||
jsr _1parm
|
jsr _1parm
|
||||||
ldy STACKBASE+2,x
|
ldy STACKBASE+2,x
|
||||||
|
@ -866,7 +867,7 @@ dword LWSPLIT,"LWSPLIT"
|
||||||
PUSHNEXT
|
PUSHNEXT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( u -- u1 .. u2 ) u1 .. u2 = bytes of word u
|
; H: ( u -- u1 .. u2 ) u1 .. u2 = bytes of word u.
|
||||||
dword WBSPLIT,"WBSPLIT"
|
dword WBSPLIT,"WBSPLIT"
|
||||||
jsr _1parm
|
jsr _1parm
|
||||||
stz STACKBASE+2,x
|
stz STACKBASE+2,x
|
||||||
|
@ -882,7 +883,7 @@ dword WBSPLIT,"WBSPLIT"
|
||||||
PUSHNEXT
|
PUSHNEXT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( b.l b2 b3 b.h -- q ) join bytes into quad
|
; H: ( b.l b2 b3 b.h -- q ) Join bytes into quad.
|
||||||
dword BLJOIN,"BLJOIN"
|
dword BLJOIN,"BLJOIN"
|
||||||
jsr _4parm
|
jsr _4parm
|
||||||
lda STACKBASE+12,x
|
lda STACKBASE+12,x
|
||||||
|
@ -916,7 +917,7 @@ _1drop: inx
|
||||||
NEXT
|
NEXT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( b.l b.h -- w ) join bytes into word
|
; H: ( b.l b.h -- w ) Join bytes into word.
|
||||||
dword BWJOIN,"BWJOIN"
|
dword BWJOIN,"BWJOIN"
|
||||||
jsr _2parm
|
jsr _2parm
|
||||||
stz STACKBASE+6,x
|
stz STACKBASE+6,x
|
||||||
|
@ -931,7 +932,7 @@ dword BWJOIN,"BWJOIN"
|
||||||
bra BLJOIN::_1drop
|
bra BLJOIN::_1drop
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( w.l w.h -- q ) join words into quad
|
; H: ( w.l w.h -- q ) Join words into quad.
|
||||||
dword WLJOIN,"WLJOIN"
|
dword WLJOIN,"WLJOIN"
|
||||||
jsr _2parm
|
jsr _2parm
|
||||||
lda STACKBASE+0,x
|
lda STACKBASE+0,x
|
||||||
|
@ -939,7 +940,7 @@ dword WLJOIN,"WLJOIN"
|
||||||
bra BLJOIN::_1drop
|
bra BLJOIN::_1drop
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( w -- w' ) flip the byte order of word
|
; H: ( w -- w' ) Flip the byte order of w.
|
||||||
dword WBFLIP,"WBFLIP"
|
dword WBFLIP,"WBFLIP"
|
||||||
jsr _1parm
|
jsr _1parm
|
||||||
lda STACKBASE+0,x
|
lda STACKBASE+0,x
|
||||||
|
@ -951,7 +952,7 @@ dword WBFLIP,"WBFLIP"
|
||||||
NEXT
|
NEXT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( q -- q' ) flip the byte order of quad
|
; H: ( q -- q' ) Flip the byte order of quad.
|
||||||
dword LBFLIP,"LBFLIP"
|
dword LBFLIP,"LBFLIP"
|
||||||
jsr _1parm
|
jsr _1parm
|
||||||
ldy STACKBASE+0,x
|
ldy STACKBASE+0,x
|
||||||
|
@ -964,7 +965,7 @@ dword LBFLIP,"LBFLIP"
|
||||||
NEXT
|
NEXT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( q -- q ) flip the word order of quad
|
; H: ( q -- q ) Flip the word order of quad.
|
||||||
dword LWFLIP,"LWFLIP"
|
dword LWFLIP,"LWFLIP"
|
||||||
jsr _1parm
|
jsr _1parm
|
||||||
ldy STACKBASE+0,x
|
ldy STACKBASE+0,x
|
||||||
|
@ -974,7 +975,7 @@ dword LWFLIP,"LWFLIP"
|
||||||
NEXT
|
NEXT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; ( word -- sign-extended-long )
|
; H: ( word -- sign-extended )
|
||||||
dword WSX,"WSX"
|
dword WSX,"WSX"
|
||||||
jsr _1parm
|
jsr _1parm
|
||||||
ldy #$0000
|
ldy #$0000
|
||||||
|
@ -986,7 +987,7 @@ dword WSX,"WSX"
|
||||||
NEXT
|
NEXT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; ( byte -- sign-extended-long )
|
; H: ( byte -- sign-extended )
|
||||||
dword BSX,"BSX"
|
dword BSX,"BSX"
|
||||||
jsr _1parm
|
jsr _1parm
|
||||||
ldy #$0000
|
ldy #$0000
|
||||||
|
@ -1007,7 +1008,7 @@ hword dHIMEM,"$HIMEM"
|
||||||
SYSVAR SV_HIMEM
|
SYSVAR SV_HIMEM
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( u -- c-addr ) allocate memory from heap
|
; H: ( u -- c-addr ) Allocate memory from heap.
|
||||||
dword ALLOC,"ALLOC-MEM"
|
dword ALLOC,"ALLOC-MEM"
|
||||||
jsr _popxr ; size into XR
|
jsr _popxr ; size into XR
|
||||||
jsr _alloc
|
jsr _alloc
|
||||||
|
@ -1018,7 +1019,7 @@ dword ALLOC,"ALLOC-MEM"
|
||||||
: PUSHNEXT
|
: PUSHNEXT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( c-addr u -- ) release memory to heap
|
; H: ( c-addr u -- ) Release memory to heap, u is currently ignored.
|
||||||
dword FREE,"FREE-MEM"
|
dword FREE,"FREE-MEM"
|
||||||
jsr _stackincr ; we should really check this (len)
|
jsr _stackincr ; we should really check this (len)
|
||||||
jsr _popwr
|
jsr _popwr
|
||||||
|
@ -1030,7 +1031,7 @@ dword FREE,"FREE-MEM"
|
||||||
: NEXT
|
: NEXT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- ) display heap and temporary string information
|
; H: ( -- ) Display heap and temporary string information.
|
||||||
dword DBGMEM,"DEBUG-MEM"
|
dword DBGMEM,"DEBUG-MEM"
|
||||||
ENTER
|
ENTER
|
||||||
.dword CR
|
.dword CR
|
||||||
|
@ -1099,7 +1100,7 @@ eom: .dword UDOT
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- c-addr ) STATE variable, zero if interpreting
|
; H: ( -- a-addr ) STATE variable, zero if interpreting.
|
||||||
dword STATE,"STATE"
|
dword STATE,"STATE"
|
||||||
SYSVAR SV_STATE
|
SYSVAR SV_STATE
|
||||||
eword
|
eword
|
||||||
|
@ -1119,7 +1120,7 @@ hword dTMPDEF,"$>TMPDEF"
|
||||||
SYSVAR SV_pTMPDEF ; pointer to memory allocated for temp def
|
SYSVAR SV_pTMPDEF ; pointer to memory allocated for temp def
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- ) enter interpretation state
|
; H: ( -- ) Enter interpretation state.
|
||||||
dword STATEI,"[",F_IMMED|F_CONLY
|
dword STATEI,"[",F_IMMED|F_CONLY
|
||||||
ENTER
|
ENTER
|
||||||
.dword STATE
|
.dword STATE
|
||||||
|
@ -1127,7 +1128,7 @@ dword STATEI,"[",F_IMMED|F_CONLY
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- ) enter compilation state
|
; H: ( -- ) Enter compilation state.
|
||||||
; immediacy called out in IEEE 1275-1994
|
; immediacy called out in IEEE 1275-1994
|
||||||
dword STATEC,"]",F_IMMED
|
dword STATEC,"]",F_IMMED
|
||||||
ENTER
|
ENTER
|
||||||
|
@ -1136,7 +1137,7 @@ dword STATEC,"]",F_IMMED
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- c-addr ) system BASE varaible
|
; H: ( -- a-addr ) System BASE variable.
|
||||||
dword BASE,"BASE"
|
dword BASE,"BASE"
|
||||||
SYSVAR SV_BASE
|
SYSVAR SV_BASE
|
||||||
eword
|
eword
|
||||||
|
@ -1160,7 +1161,7 @@ do_emit: lda #SI_EMIT
|
||||||
: rts
|
: rts
|
||||||
.endproc
|
.endproc
|
||||||
|
|
||||||
; H: ( char -- ) output char
|
; H: ( char -- ) Output char.
|
||||||
dword EMIT,"EMIT"
|
dword EMIT,"EMIT"
|
||||||
jsr _peekay
|
jsr _peekay
|
||||||
tya
|
tya
|
||||||
|
@ -1181,7 +1182,7 @@ do_emit: jsr _emit
|
||||||
NEXT
|
NEXT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( c-addr u -- ) output string
|
; H: ( addr u -- ) Output string.
|
||||||
dword TYPE,"TYPE"
|
dword TYPE,"TYPE"
|
||||||
jsr _popxr
|
jsr _popxr
|
||||||
jsr _popwr
|
jsr _popwr
|
||||||
|
@ -1197,7 +1198,7 @@ do_emit: jsr _pusha
|
||||||
rtl
|
rtl
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- f ) if #LINE >= 20, prompt user to continue and return false if they want to
|
; H: ( -- f ) If #LINE >= 20, prompt user to continue and return false if they want to.
|
||||||
dword EXITQ,"EXIT?"
|
dword EXITQ,"EXIT?"
|
||||||
ENTER
|
ENTER
|
||||||
.dword NLINE
|
.dword NLINE
|
||||||
|
@ -1221,22 +1222,22 @@ nopage: .dword FALSE
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- c-addr ) variable containing the number of lines output
|
; H: ( -- addr ) Variable containing the number of lines output.
|
||||||
dword NLINE,"#LINE"
|
dword NLINE,"#LINE"
|
||||||
SYSVAR SV_NLINE
|
SYSVAR SV_NLINE
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- c-addr ) variable containing the number of chars output on the current line
|
; H: ( -- addr ) variable containing the number of chars output on the current line.
|
||||||
dword NOUT,"#OUT"
|
dword NOUT,"#OUT"
|
||||||
SYSVAR SV_NOUT
|
SYSVAR SV_NOUT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- c-addr ) variable containing offset to the current parsing area of input buffer
|
; H: ( -- addr ) Variable containing offset to the current parsing area of input buffer.
|
||||||
dword PIN,">IN"
|
dword PIN,">IN"
|
||||||
SYSVAR SV_PIN
|
SYSVAR SV_PIN
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- c-addr ) variable containing number of chars in the current input buffer
|
; H: ( -- addr ) Variable containing number of chars in the current input buffer.
|
||||||
dword NIN,"#IN"
|
dword NIN,"#IN"
|
||||||
SYSVAR SV_NIN
|
SYSVAR SV_NIN
|
||||||
eword
|
eword
|
||||||
|
@ -6365,7 +6366,7 @@ hword dCREATE_WL,"$CREATE-WL"
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( -- wid ) create a new wordlist
|
; H: ( -- wid ) Create a new wordlist.
|
||||||
; wordlists are allocated from the dictionary space, containing two cells
|
; wordlists are allocated from the dictionary space, containing two cells
|
||||||
; the first being the last word defined in the wordlist, and the second containing
|
; the first being the last word defined in the wordlist, and the second containing
|
||||||
; an xt to an associated vocabulary definition if one has been defined
|
; an xt to an associated vocabulary definition if one has been defined
|
||||||
|
@ -6388,9 +6389,9 @@ dword dEMPTY_WL,"$EMPTY-WL"
|
||||||
EXIT
|
EXIT
|
||||||
eword
|
eword
|
||||||
|
|
||||||
; H: ( "name"<> -- ) create a new named wordlist definition, when name is executed
|
; H: ( "name"<> -- ) Create a new named wordlist definition. When name is executed,
|
||||||
; H: put the WID of the wordlist at the top of the search order
|
; H: put the WID of the wordlist at the top of the search order.
|
||||||
; H: the address of the body of the definition is the wid of the wordlist
|
; H: The WID is the address of teh body of the named wordlist definition.
|
||||||
dword VOCABULARY,"VOCABULARY"
|
dword VOCABULARY,"VOCABULARY"
|
||||||
ENTER
|
ENTER
|
||||||
.dword CREATE
|
.dword CREATE
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,76 @@
|
||||||
|
# OF816 Utilities
|
||||||
|
|
||||||
|
## index.rb
|
||||||
|
|
||||||
|
Usage: index.rb <file.s> \[coverage.yml]
|
||||||
|
|
||||||
|
This will index the words appearing in an assembly source file
|
||||||
|
and output YAML on STDOUT containing entries for each word along
|
||||||
|
with the help text derived from comments preceding the word.
|
||||||
|
|
||||||
|
Help text is derived from comments of the form:
|
||||||
|
```
|
||||||
|
; H: ( -- ) example help text
|
||||||
|
; H: a second line
|
||||||
|
```
|
||||||
|
|
||||||
|
A word can be excluded from indexing if the word noindex
|
||||||
|
is found on the line containing the dword or dwordq macro
|
||||||
|
for the word:
|
||||||
|
```
|
||||||
|
dword MY_WORD,"MY-WORD" ; noindex
|
||||||
|
```
|
||||||
|
|
||||||
|
Test coverage data (see platforms/GoSXB) can be merged into
|
||||||
|
the output in order to be used by the covrep.rb utility and
|
||||||
|
a future documentation generator.
|
||||||
|
|
||||||
|
## index2md.rb
|
||||||
|
|
||||||
|
Usage: index2md.rb index.yml
|
||||||
|
|
||||||
|
Convert index.yml to markdown on stdout for word documentation.
|
||||||
|
|
||||||
|
Efforts are made to add emphasis to stack effects and intelligently
|
||||||
|
split separate semantics.
|
||||||
|
|
||||||
|
## covrep.rb
|
||||||
|
|
||||||
|
Usage: covrep.rb index.yml
|
||||||
|
|
||||||
|
This takes the output (redirected to a file) from index.rb
|
||||||
|
and produces a test coverage report, listing the covered and
|
||||||
|
uncovered word counts, the words that are not covered, and the
|
||||||
|
percentage of words that are covered.
|
||||||
|
|
||||||
|
Example:
|
||||||
|
|
||||||
|
```
|
||||||
|
Total words: 402
|
||||||
|
Covered words: 292
|
||||||
|
Uncovered words: 110
|
||||||
|
SET-ORDER FORTH-WORDLIST CONTEXT GET-CURRENT GET-ORDER
|
||||||
|
ALSO PREVIOUS SET-CURRENT ONLY SEAL
|
||||||
|
ORDER DEFINITIONS .VERSION RESET-ALL BYE
|
||||||
|
ABORT" ABORT UNUSED #IN COMPILE,
|
||||||
|
UNALIGNED-L@ UNALIGNED-W@ UNALIGNED-L! UNALIGNED-W! 2>R
|
||||||
|
N>R 2R> NR> 2R@ 2ROT
|
||||||
|
<> U<= U> U>= <=
|
||||||
|
AHEAD AGAIN WITHIN BETWEEN ?DO
|
||||||
|
DNEGATE DABS D>S 2S>D (CR
|
||||||
|
PAGE AT-XY SIGNUM U/MOD UD/MOD
|
||||||
|
U* U# D.R D. U.0
|
||||||
|
CMOVE CMOVE> COMPARE /STRING SEARCH
|
||||||
|
WBFLIPS LBFLIPS LWFLIPS CPEEK WPEEK
|
||||||
|
LPEEK CPOKE WPOKE LPOKE FCODE-REVISION
|
||||||
|
FERROR SET-TOKEN GET-TOKEN RB@ RW@
|
||||||
|
RL@ RB! RW! RL! $BYTE-EXEC
|
||||||
|
BYTE-LOAD DUMP LEFT-PARSE-STRING PARSE-2INT SEARCH-WORDLIST
|
||||||
|
$SEARCH $SOURCE-ID SOURCE-ID REFILL SHOWSTACK
|
||||||
|
NOSHOWSTACK PARSE-NAME SLITERAL " COMPILE
|
||||||
|
[COMPILE] WORDS (SEE) SEE (IS-USER-WORD)
|
||||||
|
$VALUE :NONAME ;CODE WORDLIST VOCABULARY
|
||||||
|
\ SAVE-INPUT $RESTORE-INPUT RESTORE-INPUT $FORGET
|
||||||
|
Coverage: 72%
|
||||||
|
```
|
||||||
|
|
|
@ -0,0 +1,53 @@
|
||||||
|
#!/usr/bin/ruby
|
||||||
|
require 'yaml'
|
||||||
|
require 'date'
|
||||||
|
|
||||||
|
def usage
|
||||||
|
puts <<EOF
|
||||||
|
Usage: #{$0} index-file|- [dictionary-title]
|
||||||
|
|
||||||
|
reads index file (- for stdin) and produces markdown-
|
||||||
|
formatted output for documentation purposes.
|
||||||
|
|
||||||
|
if dictionary-title is specified, it is used as the top
|
||||||
|
level heading instead of the file name.
|
||||||
|
EOF
|
||||||
|
exit 1
|
||||||
|
end
|
||||||
|
|
||||||
|
index_file = ARGV.shift || usage
|
||||||
|
|
||||||
|
if index_file == '-'
|
||||||
|
index = YAML.load(STDIN.read)
|
||||||
|
else
|
||||||
|
File.readable?(index_file) || abort("#{index_file} not found!")
|
||||||
|
index = YAML.load(File.read(index_file))
|
||||||
|
end
|
||||||
|
|
||||||
|
dname = ARGV.shift || File.basename(index_file, File.extname(index_file))
|
||||||
|
|
||||||
|
puts "# #{dname}"
|
||||||
|
puts
|
||||||
|
puts "Updated: #{Time.new}"
|
||||||
|
puts
|
||||||
|
|
||||||
|
index.keys.sort.each do |word|
|
||||||
|
word_info = index[word]
|
||||||
|
puts "## #{word}"
|
||||||
|
puts
|
||||||
|
if word_info['help']
|
||||||
|
word_info['help'].each_with_index do |line, i|
|
||||||
|
if line.start_with?('(')
|
||||||
|
line.gsub!(/[(](.+?)[)]/, '_(\1)_') # emphasize stack effects
|
||||||
|
else
|
||||||
|
if line =~ /^\s*\S+:/
|
||||||
|
# space for separating interpretation/compilation/etc.
|
||||||
|
puts if i > 0
|
||||||
|
end
|
||||||
|
line.gsub!(/:\s+[(](.+?)[)]/, ': _(\1)_') # emphasize stack effects
|
||||||
|
end
|
||||||
|
puts line
|
||||||
|
end
|
||||||
|
puts
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,3 @@
|
||||||
|
#!/bin/bash
|
||||||
|
cd `dirname $0`
|
||||||
|
./index.rb ../asm/forth-dictionary.s | ./index2md.rb - "Forth Dictionary" > ../docs/forth_dictionary.md
|
Loading…
Reference in New Issue