mcForth - Befehle

Hier eine Zusammenfassung der Befehle für mcForth:

#prgstart #prg0 #prgend
#varstart #h0 #lb #lbl #lbsize #varend
#b/c #b/a #c/a #b/w #a/w #msb
#b/cp #b/ap #c/ap #b/wp #a/wp #evp
bl true false

User-Konstanten (im ROM):
#usize #psize #p0 #ssize #s0 #t0 #tbsize #rsize #r0 #fb #fbsize
tlink trlink

tstate tnext tsp
iovec filevec
fcb fid blk source-id >in
base hld dpl
state current context

Systemvariablen (doppeltgenau):
voclink tasklink deflink veclink

Systemvariablen (einfachgenau):
var heap user task

'init => nop
'turnkey => quit (statt 'cold)
'abort => ehandler

sp! sp@ sinit depth
pick roll dup ?dup over tuck swap drop rot -rot
2dup 2over 2swap 2drop
rp! rp@ rinit rdepth
>r c>r r@ r> r>c rdrop rcdrop ?exit exit execute
2>r 2r@ 2r> 2rdrop

c@ c! @ ! 2@ 2! on off
count fill cmove cmove> >x $>h $>x
char+ chars cell+ cells aligned
c@p c!p @p !p 2@p 2!p
countp fillp cmove>p p>seg erasep p>x $p>h $p>x
charp+ charsp cellp+ cellsp alignedp
allocx xfreex
c@x c!x @x !x 2@x 2!x x+ dx+
countx fillx cmovex> $x>h

Arithmetik und Vergleich:
+ - 1- 1+
d+ d- m+
0= 0< = < > u< u>
within abs min max umin umax
D0= d0< d= d< d> du< du>
dwithin dabs dmin dmax dumin dumax
lshift rshift
2* u2/ 2/ du2* du2/ d2/
um* * m* um/mod fm/mod m/mod / mod
and or xor invert

RECURSE cs-swap
BEGIN (|) AHEAD (=>|) IF (?=>|)
ELSE (?=>, =>|) WHILE (?=>|, cs-swap)
THEN (=> oder ?=>) UNTIL (<=?) AGAIN (<=) REPEAT (<=, =>)
FOR n unnext NEXT
DO ?DO i i' j j' leave ?leave unloop LOOP +LOOP

Ein-/Ausgabe und Zahlen:
stdio ioinit
key? key accept
emit? emit space spaces cr
upc type typec ."
color@ color!
page at-max at-xy? at-xy
decimal hex
$>number? >number
<# # #s sign hold #>
. .r u. u.r 0u.r d. d.r
-parse parse word
refill source span

stdfile finit r/o w/o r/w bin
fopen fclose fsize@ fsize! fpos@ fpos! fread fwrite
fcreate frename ferase
open close include capacity load thru loadfrom

abort abort" ?abort

Vokabular und Definitionen:
unified? >ram? >ram rom? >rom
Vocabulary only forth
order vocs previous also definitions context current onlyforth
sfind (sfind ['] '
name> >name body> >body
char+ chars cell+ cells
here unused allot c, , $, align
herep unusedp allotp call,p c,p ,p $,p alignp
hereh unusedh alloth ,h $,h eraseh
Create Does> Createp Doesp> reveal
Constant 2Constant Variable 2Variable UVariable 2UVariable
: :Noname ; [ ]
Defer is Alias Vector
Literal 2Literal c" " char [char] postpone
Marker remove

Initialisierung und Ende:
save getpar bye
quit evaluate interpret

\\ \ (
\ifndef \ifdef \if \else \then
debug! .s xdump words