Add words "pc!" and "pc@" which allow to manipulate I/O ports. This can
be helpful when directly fiddling with PC hardware. Also, define "arch-i386" appropriately, as suggested by Daniel C. Sobral.
This commit is contained in:
parent
b8f96520e5
commit
c82de3cb3f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=42634
@ -13,6 +13,9 @@
|
||||
#else
|
||||
#include <stand.h>
|
||||
#endif
|
||||
#ifdef __i386__
|
||||
#include <machine/cpufunc.h>
|
||||
#endif
|
||||
#include "ficl.h"
|
||||
|
||||
/*
|
||||
@ -68,6 +71,38 @@ void ficlFree (void *p)
|
||||
free(p);
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
/*
|
||||
* pc! ( port# c -- )
|
||||
* Store a byte to I/O port number port#
|
||||
*/
|
||||
void
|
||||
pc_store(FICL_VM *pVM)
|
||||
{
|
||||
u_char c;
|
||||
u_int32_t port;
|
||||
|
||||
port=stackPopUNS32(pVM->pStack);
|
||||
c=(u_char)stackPopINT32(pVM->pStack);
|
||||
outb(port,c);
|
||||
}
|
||||
|
||||
/*
|
||||
* pc@ ( port# -- c )
|
||||
* Fetch a byte from I/O port number port#
|
||||
*/
|
||||
void
|
||||
pc_fetch(FICL_VM *pVM)
|
||||
{
|
||||
u_char c;
|
||||
u_int32_t port;
|
||||
|
||||
port=stackPopUNS32(pVM->pStack);
|
||||
c=inb(port);
|
||||
stackPushINT32(pVM->pStack,c);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Stub function for dictionary access control - does nothing
|
||||
** by default, user can redefine to guarantee exclusive dict
|
||||
|
@ -761,6 +761,11 @@ void ficlCompileSoftCore(FICL_VM *pVM);
|
||||
void constantParen(FICL_VM *pVM);
|
||||
void twoConstParen(FICL_VM *pVM);
|
||||
|
||||
#ifdef __i386__
|
||||
extern void pc_fetch(FICL_VM *pVM);
|
||||
extern void pc_store(FICL_VM *pVM);
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
@ -13,6 +13,9 @@
|
||||
#else
|
||||
#include <stand.h>
|
||||
#endif
|
||||
#ifdef __i386__
|
||||
#include <machine/cpufunc.h>
|
||||
#endif
|
||||
#include "ficl.h"
|
||||
|
||||
/*
|
||||
@ -68,6 +71,38 @@ void ficlFree (void *p)
|
||||
free(p);
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
/*
|
||||
* pc! ( port# c -- )
|
||||
* Store a byte to I/O port number port#
|
||||
*/
|
||||
void
|
||||
pc_store(FICL_VM *pVM)
|
||||
{
|
||||
u_char c;
|
||||
u_int32_t port;
|
||||
|
||||
port=stackPopUNS32(pVM->pStack);
|
||||
c=(u_char)stackPopINT32(pVM->pStack);
|
||||
outb(port,c);
|
||||
}
|
||||
|
||||
/*
|
||||
* pc@ ( port# -- c )
|
||||
* Fetch a byte from I/O port number port#
|
||||
*/
|
||||
void
|
||||
pc_fetch(FICL_VM *pVM)
|
||||
{
|
||||
u_char c;
|
||||
u_int32_t port;
|
||||
|
||||
port=stackPopUNS32(pVM->pStack);
|
||||
c=inb(port);
|
||||
stackPushINT32(pVM->pStack,c);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Stub function for dictionary access control - does nothing
|
||||
** by default, user can redefine to guarantee exclusive dict
|
||||
|
@ -13,6 +13,9 @@
|
||||
#else
|
||||
#include <stand.h>
|
||||
#endif
|
||||
#ifdef __i386__
|
||||
#include <machine/cpufunc.h>
|
||||
#endif
|
||||
#include "ficl.h"
|
||||
|
||||
/*
|
||||
@ -68,6 +71,38 @@ void ficlFree (void *p)
|
||||
free(p);
|
||||
}
|
||||
|
||||
#ifdef __i386__
|
||||
/*
|
||||
* pc! ( port# c -- )
|
||||
* Store a byte to I/O port number port#
|
||||
*/
|
||||
void
|
||||
pc_store(FICL_VM *pVM)
|
||||
{
|
||||
u_char c;
|
||||
u_int32_t port;
|
||||
|
||||
port=stackPopUNS32(pVM->pStack);
|
||||
c=(u_char)stackPopINT32(pVM->pStack);
|
||||
outb(port,c);
|
||||
}
|
||||
|
||||
/*
|
||||
* pc@ ( port# -- c )
|
||||
* Fetch a byte from I/O port number port#
|
||||
*/
|
||||
void
|
||||
pc_fetch(FICL_VM *pVM)
|
||||
{
|
||||
u_char c;
|
||||
u_int32_t port;
|
||||
|
||||
port=stackPopUNS32(pVM->pStack);
|
||||
c=inb(port);
|
||||
stackPushINT32(pVM->pStack,c);
|
||||
}
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Stub function for dictionary access control - does nothing
|
||||
** by default, user can redefine to guarantee exclusive dict
|
||||
|
@ -2758,6 +2758,9 @@ static void type(FICL_VM *pVM)
|
||||
** (oops), make sure the string is null terminated. If not, copy
|
||||
** and terminate it.
|
||||
*/
|
||||
/* XXX Uses free space on top of dictionary. Is it guaranteed
|
||||
* XXX to always fit? (abial)
|
||||
*/
|
||||
if (cp[count] != '\0')
|
||||
{
|
||||
char *pDest = (char *)ficlGetDict()->here;
|
||||
@ -4382,6 +4385,13 @@ void ficlCompileCore(FICL_DICT *dp)
|
||||
dictAppendWord(dp, "key?", keyQuestion, FW_DEFAULT);
|
||||
dictAppendWord(dp, "ms", ms, FW_DEFAULT);
|
||||
dictAppendWord(dp, "seconds", pseconds, FW_DEFAULT);
|
||||
#ifdef __i386__
|
||||
dictAppendWord(dp, "pc!", pc_store, FW_DEFAULT);
|
||||
dictAppendWord(dp, "pc@", pc_fetch, FW_DEFAULT);
|
||||
ficlSetEnv("arch-i386", FICL_TRUE);
|
||||
#else
|
||||
ficlSetEnv("arch-i386", FICL_FALSE);
|
||||
#endif
|
||||
|
||||
/*
|
||||
** Set CORE environment query values
|
||||
|
Loading…
Reference in New Issue
Block a user