2006-04-26 15:08:19 +00:00
|
|
|
/* tag: the main file which includes all the prim code headers
|
|
|
|
|
*
|
|
|
|
|
* Copyright (C) 2003 Patrick Mauritz, Stefan Reinauer
|
|
|
|
|
*
|
|
|
|
|
* see the file "COPYING" for further information about
|
|
|
|
|
* the copyright and warranty status of this work.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "openbios/config.h"
|
|
|
|
|
#include "openbios/sysinclude.h"
|
|
|
|
|
#include "openbios/stack.h"
|
|
|
|
|
#include "openbios/kernel.h"
|
|
|
|
|
#include "dict.h"
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* cross platform abstraction
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "cross.h"
|
|
|
|
|
|
2008-12-11 20:30:53 +00:00
|
|
|
/*
|
|
|
|
|
* Code Field Address (CFA) definitions (DOCOL and the like)
|
2006-04-26 15:08:19 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "internal.c"
|
|
|
|
|
|
|
|
|
|
/* include forth primitives needed to set up
|
|
|
|
|
* all the words described in IEEE1275-1994.
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#include "forth.c"
|
|
|
|
|
|
|
|
|
|
/* words[] is a function array of all native code functions in used by
|
2008-12-11 20:30:53 +00:00
|
|
|
* the dictionary, i.e. CFAs and primitives.
|
|
|
|
|
* Any change here needs a matching change in the primitive word's
|
2006-04-26 15:08:19 +00:00
|
|
|
* name list that is kept for bootstrapping in arch/unix/unix.c
|
|
|
|
|
*
|
2008-12-11 20:30:53 +00:00
|
|
|
* NOTE: THIS LIST SHALL NOT CHANGE (EXCEPT MANDATORY ADDITIONS AT
|
|
|
|
|
* THE END). ANY OTHER CHANGE WILL BREAK COMPATIBILITY TO OLDER
|
2006-04-26 15:08:19 +00:00
|
|
|
* BINARY DICTIONARIES.
|
|
|
|
|
*/
|
2008-12-23 10:12:09 +00:00
|
|
|
static forth_word * const words[] = {
|
2006-04-26 15:08:19 +00:00
|
|
|
/*
|
|
|
|
|
* CFAs and special words
|
|
|
|
|
*/
|
|
|
|
|
semis,
|
|
|
|
|
docol,
|
|
|
|
|
lit,
|
|
|
|
|
docon,
|
|
|
|
|
dovar,
|
|
|
|
|
dodefer,
|
|
|
|
|
dodoes,
|
|
|
|
|
dodo,
|
|
|
|
|
doisdo,
|
|
|
|
|
doloop,
|
|
|
|
|
doplusloop,
|
|
|
|
|
doival,
|
|
|
|
|
doivar,
|
|
|
|
|
doidefer,
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* primitives
|
|
|
|
|
*/
|
|
|
|
|
fdup, /* dup */
|
|
|
|
|
twodup, /* 2dup */
|
|
|
|
|
isdup, /* ?dup */
|
|
|
|
|
over, /* over */
|
|
|
|
|
twoover, /* 2over */
|
|
|
|
|
pick, /* pick */
|
|
|
|
|
drop, /* drop */
|
|
|
|
|
twodrop, /* 2drop */
|
|
|
|
|
nip, /* nip */
|
|
|
|
|
roll, /* roll */
|
|
|
|
|
rot, /* rot */
|
|
|
|
|
minusrot, /* -rot */
|
|
|
|
|
swap, /* swap */
|
|
|
|
|
twoswap, /* 2swap */
|
|
|
|
|
tor, /* >r */
|
|
|
|
|
rto, /* r> */
|
|
|
|
|
rfetch, /* r@ */
|
|
|
|
|
depth, /* depth */
|
|
|
|
|
depthwrite, /* depth! */
|
|
|
|
|
rdepth, /* rdepth */
|
|
|
|
|
rdepthwrite, /* rdepth! */
|
|
|
|
|
plus, /* + */
|
|
|
|
|
minus, /* - */
|
|
|
|
|
mult, /* * */
|
|
|
|
|
umult, /* u* */
|
|
|
|
|
mudivmod, /* mu/mod */
|
|
|
|
|
forthabs, /* abs */
|
|
|
|
|
negate, /* negate */
|
|
|
|
|
max, /* max */
|
|
|
|
|
min, /* min */
|
|
|
|
|
lshift, /* lshift */
|
|
|
|
|
rshift, /* rshift */
|
|
|
|
|
rshifta, /* >>a */
|
|
|
|
|
and, /* and */
|
|
|
|
|
or, /* or */
|
|
|
|
|
xor, /* xor */
|
|
|
|
|
invert, /* invert */
|
|
|
|
|
dplus, /* d+ */
|
|
|
|
|
dminus, /* d- */
|
|
|
|
|
mmult, /* m* */
|
|
|
|
|
ummult, /* um* */
|
|
|
|
|
fetch, /* @ */
|
|
|
|
|
cfetch, /* c@ */
|
|
|
|
|
wfetch, /* w@ */
|
|
|
|
|
lfetch, /* l@ */
|
|
|
|
|
store, /* ! */
|
|
|
|
|
plusstore, /* +! */
|
|
|
|
|
cstore, /* c! */
|
|
|
|
|
wstore, /* w! */
|
|
|
|
|
lstore, /* l! */
|
|
|
|
|
equals, /* = */
|
|
|
|
|
greater, /* > */
|
|
|
|
|
less, /* < */
|
|
|
|
|
ugreater, /* u> */
|
|
|
|
|
uless, /* u< */
|
|
|
|
|
spfetch, /* sp@ */
|
|
|
|
|
fmove, /* move */
|
|
|
|
|
ffill, /* fill */
|
|
|
|
|
emit, /* emit */
|
|
|
|
|
iskey, /* key? */
|
|
|
|
|
key, /* key */
|
|
|
|
|
execute, /* execute */
|
|
|
|
|
here, /* here */
|
|
|
|
|
herewrite, /* here! */
|
|
|
|
|
dobranch, /* dobranch */
|
|
|
|
|
docbranch, /* do?branch */
|
|
|
|
|
unalignedwordread, /* unaligned-w@ */
|
|
|
|
|
unalignedwordwrite, /* unaligned-w! */
|
2009-11-20 11:14:10 +00:00
|
|
|
unalignedlongread, /* unaligned-l@ */
|
|
|
|
|
unalignedlongwrite, /* unaligned-l! */
|
2006-04-26 15:08:19 +00:00
|
|
|
iocfetch, /* ioc@ */
|
|
|
|
|
iowfetch, /* iow@ */
|
|
|
|
|
iolfetch, /* iol@ */
|
|
|
|
|
iocstore, /* ioc! */
|
|
|
|
|
iowstore, /* iow! */
|
|
|
|
|
iolstore, /* iol! */
|
|
|
|
|
loop_i, /* i */
|
|
|
|
|
loop_j, /* j */
|
|
|
|
|
call, /* call */
|
|
|
|
|
sysdebug, /* sys-debug */
|
|
|
|
|
do_include, /* $include */
|
|
|
|
|
do_encode_file, /* $encode-file */
|
2009-11-15 21:03:51 +00:00
|
|
|
do_debug_xt, /* (debug */
|
|
|
|
|
do_debug_off, /* (debug-off) */
|
2006-04-26 15:08:19 +00:00
|
|
|
};
|