I learned how to spell PSEUDO
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@5010 7fd9a85b-ad96-42d3-883c-3090e2eb8679keypad
parent
ffd511a6a7
commit
9fc3bfb88d
|
@ -30,5 +30,5 @@ device.c
|
|||
|
||||
device.c implements a simple device driver. Reads from this device
|
||||
will access the in-memory copy of hello.pex This device driver is
|
||||
registered as /dev/pashello in the psuedo filesystem.
|
||||
registered as /dev/pashello in the pseudo filesystem.
|
||||
|
||||
|
|
|
@ -505,14 +505,14 @@ o mkfatfs <path>
|
|||
|
||||
Format a fat file system on the block device specified by path.
|
||||
NSH provides this command to access the mkfatfs() NuttX API.
|
||||
This block device must reside in the NuttX psuedo filesystem and
|
||||
This block device must reside in the NuttX pseudo filesystem and
|
||||
must have been created by some call to register_blockdriver() (see
|
||||
include/nuttx/fs/fs.h).
|
||||
|
||||
o mkfifo <path>
|
||||
|
||||
Creates a FIFO character device anywhere in the pseudo file system,
|
||||
creating whatever psuedo directories that may be needed to complete
|
||||
creating whatever pseudo directories that may be needed to complete
|
||||
the full path. By convention, however, device drivers are place in
|
||||
the standard /dev directory. After it is created, the FIFO device
|
||||
may be used as any other device driver. NSH provides this command
|
||||
|
@ -584,7 +584,7 @@ o mount [-t <fstype> <block-device> <dir-path>]
|
|||
|
||||
If the mount parameters are provied on the command after the 'mount'
|
||||
command, then the 'mount' command will mount a file system in the
|
||||
NuttX psuedo-file system. 'mount' performs a three way association,
|
||||
NuttX pseudo-file system. 'mount' performs a three way association,
|
||||
binding:
|
||||
|
||||
File system. The '-t <fstype>' option identifies the type of
|
||||
|
@ -592,19 +592,19 @@ o mount [-t <fstype> <block-device> <dir-path>]
|
|||
of this writing, vfat is the only supported value for <fstype>
|
||||
|
||||
Block Device. The <block-device> argument is the full or relative
|
||||
path to a block driver inode in the psuedo filesystem. By convention,
|
||||
path to a block driver inode in the pseudo filesystem. By convention,
|
||||
this is a name under the /dev sub-directory. This <block-device>
|
||||
must have been previously formatted with the same file system
|
||||
type as specified by <fstype>
|
||||
|
||||
Mount Point. The mount point is the location in the psuedo file
|
||||
Mount Point. The mount point is the location in the pseudo file
|
||||
system where the mounted volume will appear. This mount point
|
||||
can only reside in the NuttX psuedo filesystem. By convention, this
|
||||
can only reside in the NuttX pseudo filesystem. By convention, this
|
||||
mount point is a subdirectory under /mnt. The mount command will
|
||||
create whatever psuedo directories that may be needed to complete
|
||||
create whatever pseudo directories that may be needed to complete
|
||||
the full path but the full path must not already exist.
|
||||
|
||||
After the volume has been mounted in the NuttX psuedo file
|
||||
After the volume has been mounted in the NuttX pseudo file
|
||||
system, it may be access in the same way as other objects in the
|
||||
file system.
|
||||
|
||||
|
|
|
@ -88,12 +88,12 @@
|
|||
# define MAX_ARGV_ENTRIES (NSH_MAX_ARGUMENTS+4)
|
||||
#endif
|
||||
|
||||
/* Help layout */
|
||||
/* Help command summary layout */
|
||||
|
||||
#define MAX_CMDLEN 12
|
||||
#define CMDS_PER_LINE 5
|
||||
#define CMDS_PER_LINE 6
|
||||
|
||||
#define NUM_CMDS (sizeof(g_cmdmap)/sizeof(struct cmdmap_s))
|
||||
#define NUM_CMDS ((sizeof(g_cmdmap)/sizeof(struct cmdmap_s)) - 1)
|
||||
#define NUM_CMD_ROWS ((NUM_CMDS + (CMDS_PER_LINE-1)) / CMDS_PER_LINE)
|
||||
|
||||
/****************************************************************************
|
||||
|
@ -443,7 +443,7 @@ static inline void help_cmdlist(FAR struct nsh_vtbl_s *vtbl)
|
|||
for (i = 0; i < NUM_CMD_ROWS; i++)
|
||||
{
|
||||
nsh_output(vtbl, " ");
|
||||
for (j = 0, k = i; j < CMDS_PER_LINE && k < NUM_CMDS; j++, k += CMDS_PER_LINE)
|
||||
for (j = 0, k = i; j < CMDS_PER_LINE && k < NUM_CMDS; j++, k += NUM_CMD_ROWS)
|
||||
{
|
||||
nsh_output(vtbl, "%-12s", g_cmdmap[k].cmd);
|
||||
}
|
||||
|
@ -516,6 +516,7 @@ static int help_cmd(FAR struct nsh_vtbl_s *vtbl, FAR const char *cmd)
|
|||
{
|
||||
/* Yes... show it */
|
||||
|
||||
nsh_output(vtbl, "%s usage:", cmd);
|
||||
help_showcmd(vtbl, cmdmap);
|
||||
return OK;
|
||||
}
|
||||
|
@ -574,14 +575,14 @@ static inline void help_builtins(FAR struct nsh_vtbl_s *vtbl)
|
|||
static int cmd_help(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
||||
{
|
||||
FAR const char *cmd = NULL;
|
||||
#ifdef CONFIG_NSH_HELP_TERSE
|
||||
#ifndef CONFIG_NSH_HELP_TERSE
|
||||
bool verbose = false;
|
||||
int i;
|
||||
#endif
|
||||
|
||||
/* The command may be followed by a verbose option */
|
||||
|
||||
#ifdef CONFIG_NSH_HELP_TERSE
|
||||
#ifndef CONFIG_NSH_HELP_TERSE
|
||||
i = 1;
|
||||
if (argc > i)
|
||||
{
|
||||
|
@ -618,14 +619,13 @@ static int cmd_help(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||
{
|
||||
/* Yes.. show the single command */
|
||||
|
||||
nsh_output(vtbl, "%s usage:", cmd);
|
||||
help_cmd(vtbl, cmd);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* In verbose mode, show detailed help for all commands */
|
||||
|
||||
#ifdef CONFIG_NSH_HELP_TERSE
|
||||
#ifndef CONFIG_NSH_HELP_TERSE
|
||||
if (verbose)
|
||||
{
|
||||
nsh_output(vtbl, "Where <cmd> is one of:\n");
|
||||
|
@ -637,7 +637,6 @@ static int cmd_help(FAR struct nsh_vtbl_s *vtbl, int argc, char **argv)
|
|||
else
|
||||
#endif
|
||||
{
|
||||
nsh_output(vtbl, "help usage:");
|
||||
help_cmd(vtbl, "help");
|
||||
nsh_output(vtbl, "\n");
|
||||
help_cmdlist(vtbl);
|
||||
|
|
|
@ -1,204 +1,204 @@
|
|||
/***********************************************************************
|
||||
* podefs.h
|
||||
* Logical P-code operation code definitions
|
||||
*
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
#ifndef __PODEFS_H
|
||||
#define __PODEFS_H
|
||||
|
||||
/* These definitions represent logical operations as needed by the
|
||||
* the compiler. The specific INSN generation layer must interpret
|
||||
* these requests as is appropriate to the supported INSNS.
|
||||
*/
|
||||
|
||||
enum pcode_e
|
||||
{
|
||||
|
||||
/**-------------------------------------------------------------------
|
||||
* OPCODES WITH NO ARGUMENTS
|
||||
**-------------------------------------------------------------------**/
|
||||
|
||||
/* Program control (No stack arguments) */
|
||||
|
||||
opNOP = 0,
|
||||
|
||||
/* Arithmetic & logical & and integer conversions (One stack argument) */
|
||||
|
||||
opNEG, opABS, opINC, opDEC, opNOT,
|
||||
|
||||
/* Arithmetic & logical (Two stack arguments) */
|
||||
|
||||
opADD, opSUB, opMUL, opDIV, opMOD, opSLL, opSRL, opSRA, opOR, opAND,
|
||||
|
||||
/* Comparisons (One stack argument) */
|
||||
|
||||
opEQUZ, opNEQZ, opLTZ, opGTEZ, opGTZ, opLTEZ,
|
||||
|
||||
/* Comparisons (Two stack arguments) */
|
||||
|
||||
opEQU, opNEQ, opLT, opGTE, opGT, opLTE,
|
||||
opBIT,
|
||||
|
||||
/* Load Immediate */
|
||||
|
||||
opLDI, opLDIB, opLDIM,
|
||||
|
||||
/* Store Immediate */
|
||||
|
||||
opSTI, opSTIB, opSTIM,
|
||||
|
||||
/* Data stack */
|
||||
|
||||
opDUP, opPUSHS, opPOPS,
|
||||
|
||||
/* Program control (No stack arguments)
|
||||
* Behavior:
|
||||
* Pop return address
|
||||
* Pop saved base register (BR)
|
||||
* Discard saved base address
|
||||
* Set program counter (PC) to return address
|
||||
*/
|
||||
|
||||
opRET,
|
||||
|
||||
/* System Functions (No stack arguments) */
|
||||
|
||||
opEND,
|
||||
|
||||
/**-------------------------------------------------------------------
|
||||
** OPCODES WITH ONE ARGUMENT
|
||||
**-------------------------------------------------------------------**/
|
||||
|
||||
/* Floating point operations: arg = FP op-code */
|
||||
|
||||
opFLOAT,
|
||||
|
||||
/* Program control: arg = unsigned label (One stack argument) */
|
||||
|
||||
opJEQUZ, opJNEQZ,
|
||||
|
||||
/* Program control: arg = unsigned label (no stack arguments) */
|
||||
|
||||
opJMP,
|
||||
|
||||
/* Program control: arg = unsigned label (One stack argument) */
|
||||
|
||||
opJEQU, opJNEQ, opJLT, opJGTE, opJGT, opJLTE,
|
||||
|
||||
/* Load: arg = unsigned base offset */
|
||||
|
||||
opLD, opLDH, opLDB, opLDM,
|
||||
|
||||
/* Store: arg = unsigned base offset */
|
||||
|
||||
opST, opSTB, opSTM,
|
||||
|
||||
/* Load Indexed: arg = unsigned base offset */
|
||||
|
||||
opLDX, opLDXB, opLDXM,
|
||||
|
||||
/* Store Indexed: arg16 = unsigned base offset */
|
||||
|
||||
opSTX, opSTXB, opSTXM,
|
||||
|
||||
/* Load address relative to stack base: arg = unsigned offset */
|
||||
|
||||
opLA,
|
||||
|
||||
/* Load absolute stack address: arg = RODATA offset (No stack arguments) */
|
||||
|
||||
opLAC,
|
||||
|
||||
/* Data stack: arg = 16 bit signed data (no stack arguments) */
|
||||
|
||||
opPUSH, opINDS,
|
||||
|
||||
/* Load address relative to stack base: arg1 = unsigned offset, TOS=index */
|
||||
|
||||
opLAX,
|
||||
|
||||
/* System functions: arg = 16-bit library call identifier */
|
||||
|
||||
opLIB,
|
||||
|
||||
/* Program control: arg = unsigned label (no stack arguments) */
|
||||
|
||||
opLABEL,
|
||||
|
||||
/**-------------------------------------------------------------------
|
||||
** OPCODES WITH TWO ARGUMENTS
|
||||
**-------------------------------------------------------------------**/
|
||||
|
||||
/* Program Control: arg1 = level; arg2 = unsigned label */
|
||||
|
||||
opPCAL,
|
||||
|
||||
/* Load: arg1 = level; arg2 = signed frame offset */
|
||||
|
||||
opLDS, opLDSH, opLDSB, opLDSM,
|
||||
|
||||
/* Store: arg1 = level; arg2 = signed frame offset */
|
||||
|
||||
opSTS, opSTSB, opSTSM,
|
||||
|
||||
/* Load Indexed: arg1 = level; arg2 = signed frame offset */
|
||||
|
||||
opLDSX, opLDSXB, opLDSXM,
|
||||
|
||||
/* Store Indexed: arg1 = level; arg2 = signed frame offset */
|
||||
|
||||
opSTSX, opSTSXB, opSTSXM,
|
||||
|
||||
/* FOR LAS/LASX arg1 = level; arg2 = signed frame offset
|
||||
* (no stack arguments)
|
||||
*/
|
||||
|
||||
opLAS, opLASX,
|
||||
|
||||
/* System calls:
|
||||
* For SYSIO: arg1 = file number; arg2 = sub-function code
|
||||
*/
|
||||
|
||||
opSYSIO,
|
||||
|
||||
/* Psuedo-operations:
|
||||
* For LINE: arg1 = file number; arg2 = line number
|
||||
*/
|
||||
|
||||
opLINE,
|
||||
|
||||
NUM_OPCODES
|
||||
};
|
||||
|
||||
#endif /* __PODEFS_H */
|
||||
/***********************************************************************
|
||||
* podefs.h
|
||||
* Logical P-code operation code definitions
|
||||
*
|
||||
* Copyright (C) 2008-2009 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
***********************************************************************/
|
||||
|
||||
#ifndef __PODEFS_H
|
||||
#define __PODEFS_H
|
||||
|
||||
/* These definitions represent logical operations as needed by the
|
||||
* the compiler. The specific INSN generation layer must interpret
|
||||
* these requests as is appropriate to the supported INSNS.
|
||||
*/
|
||||
|
||||
enum pcode_e
|
||||
{
|
||||
|
||||
/**-------------------------------------------------------------------
|
||||
* OPCODES WITH NO ARGUMENTS
|
||||
**-------------------------------------------------------------------**/
|
||||
|
||||
/* Program control (No stack arguments) */
|
||||
|
||||
opNOP = 0,
|
||||
|
||||
/* Arithmetic & logical & and integer conversions (One stack argument) */
|
||||
|
||||
opNEG, opABS, opINC, opDEC, opNOT,
|
||||
|
||||
/* Arithmetic & logical (Two stack arguments) */
|
||||
|
||||
opADD, opSUB, opMUL, opDIV, opMOD, opSLL, opSRL, opSRA, opOR, opAND,
|
||||
|
||||
/* Comparisons (One stack argument) */
|
||||
|
||||
opEQUZ, opNEQZ, opLTZ, opGTEZ, opGTZ, opLTEZ,
|
||||
|
||||
/* Comparisons (Two stack arguments) */
|
||||
|
||||
opEQU, opNEQ, opLT, opGTE, opGT, opLTE,
|
||||
opBIT,
|
||||
|
||||
/* Load Immediate */
|
||||
|
||||
opLDI, opLDIB, opLDIM,
|
||||
|
||||
/* Store Immediate */
|
||||
|
||||
opSTI, opSTIB, opSTIM,
|
||||
|
||||
/* Data stack */
|
||||
|
||||
opDUP, opPUSHS, opPOPS,
|
||||
|
||||
/* Program control (No stack arguments)
|
||||
* Behavior:
|
||||
* Pop return address
|
||||
* Pop saved base register (BR)
|
||||
* Discard saved base address
|
||||
* Set program counter (PC) to return address
|
||||
*/
|
||||
|
||||
opRET,
|
||||
|
||||
/* System Functions (No stack arguments) */
|
||||
|
||||
opEND,
|
||||
|
||||
/**-------------------------------------------------------------------
|
||||
** OPCODES WITH ONE ARGUMENT
|
||||
**-------------------------------------------------------------------**/
|
||||
|
||||
/* Floating point operations: arg = FP op-code */
|
||||
|
||||
opFLOAT,
|
||||
|
||||
/* Program control: arg = unsigned label (One stack argument) */
|
||||
|
||||
opJEQUZ, opJNEQZ,
|
||||
|
||||
/* Program control: arg = unsigned label (no stack arguments) */
|
||||
|
||||
opJMP,
|
||||
|
||||
/* Program control: arg = unsigned label (One stack argument) */
|
||||
|
||||
opJEQU, opJNEQ, opJLT, opJGTE, opJGT, opJLTE,
|
||||
|
||||
/* Load: arg = unsigned base offset */
|
||||
|
||||
opLD, opLDH, opLDB, opLDM,
|
||||
|
||||
/* Store: arg = unsigned base offset */
|
||||
|
||||
opST, opSTB, opSTM,
|
||||
|
||||
/* Load Indexed: arg = unsigned base offset */
|
||||
|
||||
opLDX, opLDXB, opLDXM,
|
||||
|
||||
/* Store Indexed: arg16 = unsigned base offset */
|
||||
|
||||
opSTX, opSTXB, opSTXM,
|
||||
|
||||
/* Load address relative to stack base: arg = unsigned offset */
|
||||
|
||||
opLA,
|
||||
|
||||
/* Load absolute stack address: arg = RODATA offset (No stack arguments) */
|
||||
|
||||
opLAC,
|
||||
|
||||
/* Data stack: arg = 16 bit signed data (no stack arguments) */
|
||||
|
||||
opPUSH, opINDS,
|
||||
|
||||
/* Load address relative to stack base: arg1 = unsigned offset, TOS=index */
|
||||
|
||||
opLAX,
|
||||
|
||||
/* System functions: arg = 16-bit library call identifier */
|
||||
|
||||
opLIB,
|
||||
|
||||
/* Program control: arg = unsigned label (no stack arguments) */
|
||||
|
||||
opLABEL,
|
||||
|
||||
/**-------------------------------------------------------------------
|
||||
** OPCODES WITH TWO ARGUMENTS
|
||||
**-------------------------------------------------------------------**/
|
||||
|
||||
/* Program Control: arg1 = level; arg2 = unsigned label */
|
||||
|
||||
opPCAL,
|
||||
|
||||
/* Load: arg1 = level; arg2 = signed frame offset */
|
||||
|
||||
opLDS, opLDSH, opLDSB, opLDSM,
|
||||
|
||||
/* Store: arg1 = level; arg2 = signed frame offset */
|
||||
|
||||
opSTS, opSTSB, opSTSM,
|
||||
|
||||
/* Load Indexed: arg1 = level; arg2 = signed frame offset */
|
||||
|
||||
opLDSX, opLDSXB, opLDSXM,
|
||||
|
||||
/* Store Indexed: arg1 = level; arg2 = signed frame offset */
|
||||
|
||||
opSTSX, opSTSXB, opSTSXM,
|
||||
|
||||
/* FOR LAS/LASX arg1 = level; arg2 = signed frame offset
|
||||
* (no stack arguments)
|
||||
*/
|
||||
|
||||
opLAS, opLASX,
|
||||
|
||||
/* System calls:
|
||||
* For SYSIO: arg1 = file number; arg2 = sub-function code
|
||||
*/
|
||||
|
||||
opSYSIO,
|
||||
|
||||
/* Pseudo-operations:
|
||||
* For LINE: arg1 = file number; arg2 = line number
|
||||
*/
|
||||
|
||||
opLINE,
|
||||
|
||||
NUM_OPCODES
|
||||
};
|
||||
|
||||
#endif /* __PODEFS_H */
|
||||
|
|
|
@ -1,408 +1,408 @@
|
|||
/****************************************************************************
|
||||
* pinsn16.h
|
||||
* 16-bit P-code operation code definitions
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __PINSN16_H
|
||||
#define __PINSN16_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Op-code bit definitions */
|
||||
|
||||
#define o16 (0x80)
|
||||
#define o8 (0x40)
|
||||
|
||||
/* Opcode Encoding Summary:
|
||||
*
|
||||
* NO ARGS arg8 ONLY arg16 ONLY BOTH
|
||||
* 00xx xxxx 01xx xxxx 10xx xxxx 11xx xxxx
|
||||
* xx00 0000 NOP --- --- ---
|
||||
* xx00 0001 NEG --- --- ---
|
||||
* xx00 0010 ABS --- --- ---
|
||||
* xx00 0011 INC --- --- ---
|
||||
* xx00 0100 DEC --- --- ---
|
||||
* xx00 0101 NOT --- --- ---
|
||||
* xx00 0110 ADD --- --- ---
|
||||
* xx00 0111 SUB --- --- ---
|
||||
* xx00 1000 MUL --- --- PCAL l,ilbl
|
||||
* xx00 1001 DIV --- --- ---
|
||||
* xx00 1010 MOD --- --- ---
|
||||
* xx00 1011 SLL --- --- ---
|
||||
* xx00 1100 SRL --- --- ---
|
||||
* xx00 1101 SRA --- --- ---
|
||||
* xx00 1110 OR --- --- ---
|
||||
* xx00 1111 AND --- --- ---
|
||||
*
|
||||
* xx01 0000 EQUZ --- JEQUZ ilbl ---
|
||||
* xx01 0001 NEQZ --- JNEQZ ilbl ---
|
||||
* xx01 0010 LTZ --- JLTZ ilbl ---
|
||||
* xx01 0011 GTEZ --- JGTEZ ilbl ---
|
||||
* xx01 0100 GTZ --- JGTZ ilbl ---
|
||||
* xx01 0101 LTEZ --- JLTEZ ilbl ---
|
||||
* xx01 0110 --- --- JMP ilbl ---
|
||||
* xx01 0111 --- --- --- ---
|
||||
* xx01 1000 EQU --- JEQU ilbl ---
|
||||
* xx01 1001 NEQ --- JNEQ ilbl ---
|
||||
* xx01 1010 LT --- JLT ilbl ---
|
||||
* xx01 1011 GTE --- JGTE ilbl ---
|
||||
* xx01 1100 GT --- JGT ilbl ---
|
||||
* xx01 1101 LTE --- JLTE ilbl ---
|
||||
* xx01 1110 --- --- --- ---
|
||||
* xx01 1111 BIT --- --- ---
|
||||
*
|
||||
* xx10 0000 LDI --- LD uoffs LDS lvl,offs
|
||||
* xx10 0001 LDIH --- LDH uoffs LDSH lvl,offs
|
||||
* xx10 0010 LDIB --- LDB uoffs LDSB lvl,offs
|
||||
* xx10 0011 LDIM --- LDM uoffs LDSM lvl,offs
|
||||
* xx10 0100 STI --- ST uoffs STS lvl,offs
|
||||
* xx10 0101 STIH --- STH uoffs STSH lvl,offs
|
||||
* xx10 0110 STIB --- STB uoffs STSB lvl,offs
|
||||
* xx10 0111 STIM --- STM uoffs STSM lvl,offs
|
||||
* xx10 1000 DUP --- LDX uoffs LDSX lvl,offs
|
||||
* xx10 1001 DUPH --- LDXH uoffs LDSXH lvl,offs
|
||||
* xx10 1010 PUSHS --- LDXB uoffs LDSXB lvl,offs
|
||||
* xx10 1011 POPS --- LDXM uoffs LDSXM lvl,offs
|
||||
* xx10 1100 --- --- STX uoffs STSX lvl,offs
|
||||
* xx10 1101 --- --- STXH uoffs STSXH lvl,offs
|
||||
* xx10 1110 --- --- STXB uoffs STSXB lvl,offs
|
||||
* xx10 1111 RET --- STXM uoffs STSXM lvl,offs
|
||||
*
|
||||
* xx11 0000 --- FLOAT fop LA uoffs LAS lvl,offs
|
||||
* xx11 0001 --- --- LAC dlbl ---
|
||||
* xx11 0010 --- --- --- ---
|
||||
* xx11 0011 --- --- --- ---
|
||||
* xx11 0100 --- PUSHB n PUSH nn ---
|
||||
* xx11 0101 --- --- INDS nn ---
|
||||
* xx11 0110 --- --- --- ---
|
||||
* xx11 0111 --- --- --- ---
|
||||
* xx11 1000 --- --- LAX uoffs LASX lvl,offs
|
||||
* xx11 1001 --- --- LIB lop SYSIO fn,sop
|
||||
* xx11 1010 --- --- --- ---
|
||||
* xx11 1011 --- --- --- ---
|
||||
* xx11 1100 --- --- --- ---
|
||||
* xx11 1101 --- --- --- ---
|
||||
* xx11 1110 --- --- --- ---
|
||||
* xx11 1111 END --- *LABEL ilbl *LINE fn,lineno
|
||||
*
|
||||
* KEY:
|
||||
* n = 8-bit value (unsigned)
|
||||
* lvl = 8-bit static nesting level offset (unsigned)
|
||||
* vt = 8-bit type code (unsigned)
|
||||
* nn = 16-bit value (signed)
|
||||
* fop = 8-bit floating point operation
|
||||
* sop = 16-bit sysio operation
|
||||
* lop = 16-bit library call identifier
|
||||
* fn = 8-bit file number
|
||||
* ilbl = instruction space label
|
||||
* dlbl = stack data label
|
||||
* offs = 16-bit frame offset (signed)
|
||||
* uoffs = 16-bit base offset (unsigned)
|
||||
* c = string follows psuedo-operation
|
||||
* * = Indicates pseudo-operations (these are removed
|
||||
* after final fixup of the object file).
|
||||
*/
|
||||
|
||||
/** OPCODES WITH NO ARGUMENTS ***********************************************/
|
||||
|
||||
/* Program control (No stack arguments) */
|
||||
|
||||
#define oNOP (0x00)
|
||||
|
||||
/* Arithmetic & logical & and integer conversions (One 16-bit stack argument) */
|
||||
|
||||
#define oNEG (0x01)
|
||||
#define oABS (0x02)
|
||||
#define oINC (0x03)
|
||||
#define oDEC (0x04)
|
||||
#define oNOT (0x05)
|
||||
|
||||
/* Arithmetic & logical (Two 16-bit stack arguments) */
|
||||
|
||||
#define oADD (0x06)
|
||||
#define oSUB (0x07)
|
||||
#define oMUL (0x08)
|
||||
#define oDIV (0x09)
|
||||
#define oMOD (0x0a)
|
||||
#define oSLL (0x0b)
|
||||
#define oSRL (0x0c)
|
||||
#define oSRA (0x0d)
|
||||
#define oOR (0x0e)
|
||||
#define oAND (0x0f)
|
||||
|
||||
/* Comparisons (One 16-bit stack argument) */
|
||||
|
||||
#define oEQUZ (0x10)
|
||||
#define oNEQZ (0x11)
|
||||
#define oLTZ (0x12)
|
||||
#define oGTEZ (0x13)
|
||||
#define oGTZ (0x14)
|
||||
#define oLTEZ (0x15)
|
||||
|
||||
/* 0x16-0x17 -- unassigned */
|
||||
|
||||
/* Comparisons (Two 16-bit stack arguments) */
|
||||
|
||||
#define oEQU (0x18)
|
||||
#define oNEQ (0x19)
|
||||
#define oLT (0x1a)
|
||||
#define oGTE (0x1b)
|
||||
#define oGT (0x1c)
|
||||
#define oLTE (0x1d)
|
||||
|
||||
/* 0x1e -- unassigned */
|
||||
|
||||
#define oBIT (0x1f)
|
||||
|
||||
/* Load Immediate */
|
||||
|
||||
#define oLDI (0x20) /* (One 16-bit stack argument) */
|
||||
#define oLDIH (0x21) /* (One 16-bit stack argument) */
|
||||
#define oLDIB (0x22) /* (One 16-bit stack argument) */
|
||||
#define oLDIM (0x23) /* (Two 16-bit stack arguments) */
|
||||
|
||||
/* Store Immediate */
|
||||
|
||||
#define oSTI (0x24) /* (One 32-bit and one 16-bit stack arguments) */
|
||||
#define oSTIH (0x25) /* (Two 16-bit stack arguments) */
|
||||
#define oSTIB (0x26) /* (Two 16-bit stack arguments) */
|
||||
#define oSTIM (0x27) /* (Two + n 16-bit stack arguments) */
|
||||
|
||||
/* Data stack */
|
||||
|
||||
#define oDUP (0x28) /* (One 32-bit stack argument */
|
||||
#define oDUPH (0x29) /* (One 16-bit stack argument) */
|
||||
|
||||
/* 0x2a - 0x2b -- unassigned */
|
||||
|
||||
#define oPUSHS (0x2a) /* No arguments */
|
||||
#define oPOPS (0x2b) /* (One 16-bit stack argument) */
|
||||
|
||||
/* 0x2c - 0x2e -- unassigned */
|
||||
|
||||
/* Program control (No stack arguments)
|
||||
* Behavior:
|
||||
* Pop return address
|
||||
* Pop saved base register (BR)
|
||||
* Discard saved base address
|
||||
* Set program counter (PC) to return address
|
||||
*/
|
||||
|
||||
#define oRET (0x2f)
|
||||
|
||||
/* 0x30 - 0x3e -- unassigned */
|
||||
|
||||
/* System Functions (No stack arguments) */
|
||||
|
||||
#define oEND (0x3f)
|
||||
|
||||
/** OPCODES WITH SINGLE BYTE ARGUMENT (arg8) ********************************/
|
||||
|
||||
/* (o8|0x00)-(o8|0x2f) -- unassigned */
|
||||
|
||||
/* Floating point operations: arg8 = FP op-code */
|
||||
|
||||
#define oFLOAT (o8|0x30)
|
||||
|
||||
/* (o8|0x31)-(o8|0x33) -- unassigned */
|
||||
|
||||
/* Data stack: arg8 = 8 bit unsigned data (no stack arguments) */
|
||||
|
||||
#define oPUSHB (o8|0x34)
|
||||
|
||||
/* (o8|0x35)-(o8|0x3f) -- unassigned */
|
||||
|
||||
/** OPCODES WITH SINGLE 16-BIT ARGUMENT (arg16) *****************************/
|
||||
|
||||
/* (o16|0x00)-(o16|0x0f) -- unassigned */
|
||||
|
||||
/* Program control: arg16 = unsigned label (One 16-bit stack argument) */
|
||||
|
||||
#define oJEQUZ (o16|0x10)
|
||||
#define oJNEQZ (o16|0x11)
|
||||
#define oJLTZ (o16|0x12)
|
||||
#define oJGTEZ (o16|0x13)
|
||||
#define oJGTZ (o16|0x14)
|
||||
#define oJLTEZ (o16|0x15)
|
||||
|
||||
/* Program control: arg16 = unsigned label (no stack arguments) */
|
||||
|
||||
#define oJMP (o16|0x16)
|
||||
|
||||
/* (o16|0x17) -- unassigned */
|
||||
|
||||
/* Program control: arg16 = unsigned label (One 16-bit stack argument) */
|
||||
|
||||
#define oJEQU (o16|0x18)
|
||||
#define oJNEQ (o16|0x19)
|
||||
#define oJLT (o16|0x1a)
|
||||
#define oJGTE (o16|0x1b)
|
||||
#define oJGT (o16|0x1c)
|
||||
#define oJLTE (o16|0x1d)
|
||||
|
||||
/* (o16|0x1e)-(o16|0x1f) -- unassigned */
|
||||
|
||||
/* Load: arg16 = unsigned base offset */
|
||||
|
||||
#define oLD (o16|0x20) /* (no stack arguments) */
|
||||
#define oLDH (o16|0x21) /* (no stack arguments) */
|
||||
#define oLDB (o16|0x22) /* (no stack arguments) */
|
||||
#define oLDM (o16|0x23) /* (One 16-bit stack argument) */
|
||||
|
||||
/* Store: arg16 = unsigned base offset */
|
||||
|
||||
#define oST (o16|0x24) /* (One 32-bit stack argument) */
|
||||
#define oSTH (o16|0x25) /* (One 16-bit stack argument) */
|
||||
#define oSTB (o16|0x26) /* (One 16-bit stack argument) */
|
||||
#define oSTM (o16|0x27) /* (One+n 16-bit stack arguments) */
|
||||
|
||||
/* Load Indexed: arg16 = unsigned base offset */
|
||||
|
||||
#define oLDX (o16|0x28) /* (One 16-bit stack argument) */
|
||||
#define oLDXH (o16|0x29) /* (One 16-bit stack argument) */
|
||||
#define oLDXB (o16|0x2a) /* (One 16-bit stack argument) */
|
||||
#define oLDXM (o16|0x2b) /* (Two 16-bit stack arguments) */
|
||||
|
||||
/* Store Indexed: arg16 = unsigned base offset */
|
||||
|
||||
#define oSTX (o16|0x2c) /* (One 32-bit + one 16-bit stack arguments) */
|
||||
#define oSTXH (o16|0x2d) /* (Two 16-bit stack arguments) */
|
||||
#define oSTXB (o16|0x2e) /* (Two 16-bit stack arguments) */
|
||||
#define oSTXM (o16|0x2f) /* (Two+n 16-bit stack arguments) */
|
||||
|
||||
/* Load address relative to stack base: arg16 = unsigned offset */
|
||||
|
||||
#define oLA (o16|0x30)
|
||||
|
||||
/* Load absolute stack address: arg16 = RODATA offset (No stack arguments) */
|
||||
|
||||
#define oLAC (o16|0x31)
|
||||
|
||||
/* (o16|0x32)-(o16|0x33) -- unassigned */
|
||||
|
||||
/* Data stack: arg16 = 16 bit signed data (no stack arguments) */
|
||||
|
||||
#define oPUSH (o16|0x34)
|
||||
#define oINDS (o16|0x35)
|
||||
|
||||
/* (o16|0x34)-(o16|0x37) -- unassigned */
|
||||
|
||||
/* Load address relative to stack base: arg16 = unsigned offset, TOS=index */
|
||||
|
||||
#define oLAX (o16|0x38)
|
||||
|
||||
/* System functions: arg16 = 16-bit library call identifier */
|
||||
|
||||
#define oLIB (o16|0x39)
|
||||
|
||||
/* (o16|0x3a)-(o16|0x3e) -- unassigned */
|
||||
|
||||
/* Program control: arg16 = unsigned label (no stack arguments) */
|
||||
|
||||
#define oLABEL (o16|0x3f)
|
||||
|
||||
/** OPCODES WITH 24-BITS OF ARGUMENET (arg8 + arg16) ************************/
|
||||
|
||||
/* (o16|o8|0x00)-(o8|o16|0x07) -- unassigned */
|
||||
|
||||
/* Program Control: arg8 = level; arg16 = unsigned label
|
||||
* (No stack arguments)
|
||||
* Behavior:
|
||||
* Push base address of level
|
||||
* Push base register (BR) value
|
||||
* Set new base register value (BR) as top of stack
|
||||
* Push return address
|
||||
* Set program counter (PC) for address associated with label
|
||||
*/
|
||||
|
||||
#define oPCAL (o16|o8|0x08)
|
||||
|
||||
/* (o16|o8|0x09)-(o8|o16|0x1f) -- unassigned */
|
||||
|
||||
/* Load: arg8 = level; arg16 = signed frame offset */
|
||||
|
||||
#define oLDS (o16|o8|0x20) /* (no stack arguments) */
|
||||
#define oLDSH (o16|o8|0x21) /* (no stack arguments) */
|
||||
#define oLDSB (o16|o8|0x22) /* (no stack arguments) */
|
||||
#define oLDSM (o16|o8|0x23) /* (One 16-bit stack argument) */
|
||||
|
||||
/* Store: arg8 = level; arg16 = signed frame offset */
|
||||
|
||||
#define oSTS (o16|o8|0x24) /* (One 32-bit stack argument) */
|
||||
#define oSTSH (o16|o8|0x25) /* (One 16-bit stack argument) */
|
||||
#define oSTSB (o16|o8|0x26) /* (One 16-bit stack argument) */
|
||||
#define oSTSM (o16|o8|0x27) /* (One+n 16-bit stack arguments) */
|
||||
|
||||
/* Load Indexed: arg8 = level; arg16 = signed frame offset */
|
||||
|
||||
#define oLDSX (o16|o8|0x28) /* (One 16-bit stack argument) */
|
||||
#define oLDSXH (o16|o8|0x29) /* (One 16-bit stack argument) */
|
||||
#define oLDSXB (o16|o8|0x2a) /* (One 16-bit stack argument) */
|
||||
#define oLDSXM (o16|o8|0x2b) /* (Two 16-bit stack arguments) */
|
||||
|
||||
/* Store Indexed: arg8 = level; arg16 = signed frame offset */
|
||||
|
||||
#define oSTSX (o16|o8|0x2c) /* (One 32-bit + one 16-bit stack arguments) */
|
||||
#define oSTSXH (o16|o8|0x2d) /* (Two 16-bit stack arguments) */
|
||||
#define oSTSXB (o16|o8|0x2e) /* (Two 16-bit stack arguments) */
|
||||
#define oSTSXM (o16|o8|0x2f) /* (Two+n 16-bit stack arguments) */
|
||||
|
||||
/* FOR LAS/LASX arg8 = level; arg16 = signed frame offset
|
||||
* (no stack arguments)
|
||||
*/
|
||||
|
||||
#define oLAS (o16|o8|0x30)
|
||||
#define oLASX (o16|o8|0x38)
|
||||
|
||||
/* System calls:
|
||||
* For SYSIO: arg8 = file number; arg16 = sub-function code
|
||||
*/
|
||||
|
||||
#define oSYSIO (o16|o8|0x39)
|
||||
|
||||
/* (o16|o8|0x3a)-(o8|o16|0x3e) -- unassigned */
|
||||
|
||||
/* Psuedo-operations:
|
||||
* For LINE: arg8 = file number; arg16 = line number
|
||||
*/
|
||||
|
||||
#define oLINE (o16|o8|0x3f)
|
||||
|
||||
#endif /* __PINSN16_H */
|
||||
/****************************************************************************
|
||||
* pinsn16.h
|
||||
* 16-bit P-code operation code definitions
|
||||
*
|
||||
* Copyright (C) 2008 Gregory Nutt. All rights reserved.
|
||||
* Author: Gregory Nutt <spudmonkey@racsa.co.cr>
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
*
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in
|
||||
* the documentation and/or other materials provided with the
|
||||
* distribution.
|
||||
* 3. Neither the name NuttX nor the names of its contributors may be
|
||||
* used to endorse or promote products derived from this software
|
||||
* without specific prior written permission.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
|
||||
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
|
||||
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
|
||||
* FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
|
||||
* COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
|
||||
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
|
||||
* BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
|
||||
* OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
|
||||
* AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
|
||||
* LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
|
||||
* ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*
|
||||
****************************************************************************/
|
||||
|
||||
#ifndef __PINSN16_H
|
||||
#define __PINSN16_H
|
||||
|
||||
/****************************************************************************
|
||||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Definitions
|
||||
****************************************************************************/
|
||||
|
||||
/* Op-code bit definitions */
|
||||
|
||||
#define o16 (0x80)
|
||||
#define o8 (0x40)
|
||||
|
||||
/* Opcode Encoding Summary:
|
||||
*
|
||||
* NO ARGS arg8 ONLY arg16 ONLY BOTH
|
||||
* 00xx xxxx 01xx xxxx 10xx xxxx 11xx xxxx
|
||||
* xx00 0000 NOP --- --- ---
|
||||
* xx00 0001 NEG --- --- ---
|
||||
* xx00 0010 ABS --- --- ---
|
||||
* xx00 0011 INC --- --- ---
|
||||
* xx00 0100 DEC --- --- ---
|
||||
* xx00 0101 NOT --- --- ---
|
||||
* xx00 0110 ADD --- --- ---
|
||||
* xx00 0111 SUB --- --- ---
|
||||
* xx00 1000 MUL --- --- PCAL l,ilbl
|
||||
* xx00 1001 DIV --- --- ---
|
||||
* xx00 1010 MOD --- --- ---
|
||||
* xx00 1011 SLL --- --- ---
|
||||
* xx00 1100 SRL --- --- ---
|
||||
* xx00 1101 SRA --- --- ---
|
||||
* xx00 1110 OR --- --- ---
|
||||
* xx00 1111 AND --- --- ---
|
||||
*
|
||||
* xx01 0000 EQUZ --- JEQUZ ilbl ---
|
||||
* xx01 0001 NEQZ --- JNEQZ ilbl ---
|
||||
* xx01 0010 LTZ --- JLTZ ilbl ---
|
||||
* xx01 0011 GTEZ --- JGTEZ ilbl ---
|
||||
* xx01 0100 GTZ --- JGTZ ilbl ---
|
||||
* xx01 0101 LTEZ --- JLTEZ ilbl ---
|
||||
* xx01 0110 --- --- JMP ilbl ---
|
||||
* xx01 0111 --- --- --- ---
|
||||
* xx01 1000 EQU --- JEQU ilbl ---
|
||||
* xx01 1001 NEQ --- JNEQ ilbl ---
|
||||
* xx01 1010 LT --- JLT ilbl ---
|
||||
* xx01 1011 GTE --- JGTE ilbl ---
|
||||
* xx01 1100 GT --- JGT ilbl ---
|
||||
* xx01 1101 LTE --- JLTE ilbl ---
|
||||
* xx01 1110 --- --- --- ---
|
||||
* xx01 1111 BIT --- --- ---
|
||||
*
|
||||
* xx10 0000 LDI --- LD uoffs LDS lvl,offs
|
||||
* xx10 0001 LDIH --- LDH uoffs LDSH lvl,offs
|
||||
* xx10 0010 LDIB --- LDB uoffs LDSB lvl,offs
|
||||
* xx10 0011 LDIM --- LDM uoffs LDSM lvl,offs
|
||||
* xx10 0100 STI --- ST uoffs STS lvl,offs
|
||||
* xx10 0101 STIH --- STH uoffs STSH lvl,offs
|
||||
* xx10 0110 STIB --- STB uoffs STSB lvl,offs
|
||||
* xx10 0111 STIM --- STM uoffs STSM lvl,offs
|
||||
* xx10 1000 DUP --- LDX uoffs LDSX lvl,offs
|
||||
* xx10 1001 DUPH --- LDXH uoffs LDSXH lvl,offs
|
||||
* xx10 1010 PUSHS --- LDXB uoffs LDSXB lvl,offs
|
||||
* xx10 1011 POPS --- LDXM uoffs LDSXM lvl,offs
|
||||
* xx10 1100 --- --- STX uoffs STSX lvl,offs
|
||||
* xx10 1101 --- --- STXH uoffs STSXH lvl,offs
|
||||
* xx10 1110 --- --- STXB uoffs STSXB lvl,offs
|
||||
* xx10 1111 RET --- STXM uoffs STSXM lvl,offs
|
||||
*
|
||||
* xx11 0000 --- FLOAT fop LA uoffs LAS lvl,offs
|
||||
* xx11 0001 --- --- LAC dlbl ---
|
||||
* xx11 0010 --- --- --- ---
|
||||
* xx11 0011 --- --- --- ---
|
||||
* xx11 0100 --- PUSHB n PUSH nn ---
|
||||
* xx11 0101 --- --- INDS nn ---
|
||||
* xx11 0110 --- --- --- ---
|
||||
* xx11 0111 --- --- --- ---
|
||||
* xx11 1000 --- --- LAX uoffs LASX lvl,offs
|
||||
* xx11 1001 --- --- LIB lop SYSIO fn,sop
|
||||
* xx11 1010 --- --- --- ---
|
||||
* xx11 1011 --- --- --- ---
|
||||
* xx11 1100 --- --- --- ---
|
||||
* xx11 1101 --- --- --- ---
|
||||
* xx11 1110 --- --- --- ---
|
||||
* xx11 1111 END --- *LABEL ilbl *LINE fn,lineno
|
||||
*
|
||||
* KEY:
|
||||
* n = 8-bit value (unsigned)
|
||||
* lvl = 8-bit static nesting level offset (unsigned)
|
||||
* vt = 8-bit type code (unsigned)
|
||||
* nn = 16-bit value (signed)
|
||||
* fop = 8-bit floating point operation
|
||||
* sop = 16-bit sysio operation
|
||||
* lop = 16-bit library call identifier
|
||||
* fn = 8-bit file number
|
||||
* ilbl = instruction space label
|
||||
* dlbl = stack data label
|
||||
* offs = 16-bit frame offset (signed)
|
||||
* uoffs = 16-bit base offset (unsigned)
|
||||
* c = string follows pseudo-operation
|
||||
* * = Indicates pseudo-operations (these are removed
|
||||
* after final fixup of the object file).
|
||||
*/
|
||||
|
||||
/** OPCODES WITH NO ARGUMENTS ***********************************************/
|
||||
|
||||
/* Program control (No stack arguments) */
|
||||
|
||||
#define oNOP (0x00)
|
||||
|
||||
/* Arithmetic & logical & and integer conversions (One 16-bit stack argument) */
|
||||
|
||||
#define oNEG (0x01)
|
||||
#define oABS (0x02)
|
||||
#define oINC (0x03)
|
||||
#define oDEC (0x04)
|
||||
#define oNOT (0x05)
|
||||
|
||||
/* Arithmetic & logical (Two 16-bit stack arguments) */
|
||||
|
||||
#define oADD (0x06)
|
||||
#define oSUB (0x07)
|
||||
#define oMUL (0x08)
|
||||
#define oDIV (0x09)
|
||||
#define oMOD (0x0a)
|
||||
#define oSLL (0x0b)
|
||||
#define oSRL (0x0c)
|
||||
#define oSRA (0x0d)
|
||||
#define oOR (0x0e)
|
||||
#define oAND (0x0f)
|
||||
|
||||
/* Comparisons (One 16-bit stack argument) */
|
||||
|
||||
#define oEQUZ (0x10)
|
||||
#define oNEQZ (0x11)
|
||||
#define oLTZ (0x12)
|
||||
#define oGTEZ (0x13)
|
||||
#define oGTZ (0x14)
|
||||
#define oLTEZ (0x15)
|
||||
|
||||
/* 0x16-0x17 -- unassigned */
|
||||
|
||||
/* Comparisons (Two 16-bit stack arguments) */
|
||||
|
||||
#define oEQU (0x18)
|
||||
#define oNEQ (0x19)
|
||||
#define oLT (0x1a)
|
||||
#define oGTE (0x1b)
|
||||
#define oGT (0x1c)
|
||||
#define oLTE (0x1d)
|
||||
|
||||
/* 0x1e -- unassigned */
|
||||
|
||||
#define oBIT (0x1f)
|
||||
|
||||
/* Load Immediate */
|
||||
|
||||
#define oLDI (0x20) /* (One 16-bit stack argument) */
|
||||
#define oLDIH (0x21) /* (One 16-bit stack argument) */
|
||||
#define oLDIB (0x22) /* (One 16-bit stack argument) */
|
||||
#define oLDIM (0x23) /* (Two 16-bit stack arguments) */
|
||||
|
||||
/* Store Immediate */
|
||||
|
||||
#define oSTI (0x24) /* (One 32-bit and one 16-bit stack arguments) */
|
||||
#define oSTIH (0x25) /* (Two 16-bit stack arguments) */
|
||||
#define oSTIB (0x26) /* (Two 16-bit stack arguments) */
|
||||
#define oSTIM (0x27) /* (Two + n 16-bit stack arguments) */
|
||||
|
||||
/* Data stack */
|
||||
|
||||
#define oDUP (0x28) /* (One 32-bit stack argument */
|
||||
#define oDUPH (0x29) /* (One 16-bit stack argument) */
|
||||
|
||||
/* 0x2a - 0x2b -- unassigned */
|
||||
|
||||
#define oPUSHS (0x2a) /* No arguments */
|
||||
#define oPOPS (0x2b) /* (One 16-bit stack argument) */
|
||||
|
||||
/* 0x2c - 0x2e -- unassigned */
|
||||
|
||||
/* Program control (No stack arguments)
|
||||
* Behavior:
|
||||
* Pop return address
|
||||
* Pop saved base register (BR)
|
||||
* Discard saved base address
|
||||
* Set program counter (PC) to return address
|
||||
*/
|
||||
|
||||
#define oRET (0x2f)
|
||||
|
||||
/* 0x30 - 0x3e -- unassigned */
|
||||
|
||||
/* System Functions (No stack arguments) */
|
||||
|
||||
#define oEND (0x3f)
|
||||
|
||||
/** OPCODES WITH SINGLE BYTE ARGUMENT (arg8) ********************************/
|
||||
|
||||
/* (o8|0x00)-(o8|0x2f) -- unassigned */
|
||||
|
||||
/* Floating point operations: arg8 = FP op-code */
|
||||
|
||||
#define oFLOAT (o8|0x30)
|
||||
|
||||
/* (o8|0x31)-(o8|0x33) -- unassigned */
|
||||
|
||||
/* Data stack: arg8 = 8 bit unsigned data (no stack arguments) */
|
||||
|
||||
#define oPUSHB (o8|0x34)
|
||||
|
||||
/* (o8|0x35)-(o8|0x3f) -- unassigned */
|
||||
|
||||
/** OPCODES WITH SINGLE 16-BIT ARGUMENT (arg16) *****************************/
|
||||
|
||||
/* (o16|0x00)-(o16|0x0f) -- unassigned */
|
||||
|
||||
/* Program control: arg16 = unsigned label (One 16-bit stack argument) */
|
||||
|
||||
#define oJEQUZ (o16|0x10)
|
||||
#define oJNEQZ (o16|0x11)
|
||||
#define oJLTZ (o16|0x12)
|
||||
#define oJGTEZ (o16|0x13)
|
||||
#define oJGTZ (o16|0x14)
|
||||
#define oJLTEZ (o16|0x15)
|
||||
|
||||
/* Program control: arg16 = unsigned label (no stack arguments) */
|
||||
|
||||
#define oJMP (o16|0x16)
|
||||
|
||||
/* (o16|0x17) -- unassigned */
|
||||
|
||||
/* Program control: arg16 = unsigned label (One 16-bit stack argument) */
|
||||
|
||||
#define oJEQU (o16|0x18)
|
||||
#define oJNEQ (o16|0x19)
|
||||
#define oJLT (o16|0x1a)
|
||||
#define oJGTE (o16|0x1b)
|
||||
#define oJGT (o16|0x1c)
|
||||
#define oJLTE (o16|0x1d)
|
||||
|
||||
/* (o16|0x1e)-(o16|0x1f) -- unassigned */
|
||||
|
||||
/* Load: arg16 = unsigned base offset */
|
||||
|
||||
#define oLD (o16|0x20) /* (no stack arguments) */
|
||||
#define oLDH (o16|0x21) /* (no stack arguments) */
|
||||
#define oLDB (o16|0x22) /* (no stack arguments) */
|
||||
#define oLDM (o16|0x23) /* (One 16-bit stack argument) */
|
||||
|
||||
/* Store: arg16 = unsigned base offset */
|
||||
|
||||
#define oST (o16|0x24) /* (One 32-bit stack argument) */
|
||||
#define oSTH (o16|0x25) /* (One 16-bit stack argument) */
|
||||
#define oSTB (o16|0x26) /* (One 16-bit stack argument) */
|
||||
#define oSTM (o16|0x27) /* (One+n 16-bit stack arguments) */
|
||||
|
||||
/* Load Indexed: arg16 = unsigned base offset */
|
||||
|
||||
#define oLDX (o16|0x28) /* (One 16-bit stack argument) */
|
||||
#define oLDXH (o16|0x29) /* (One 16-bit stack argument) */
|
||||
#define oLDXB (o16|0x2a) /* (One 16-bit stack argument) */
|
||||
#define oLDXM (o16|0x2b) /* (Two 16-bit stack arguments) */
|
||||
|
||||
/* Store Indexed: arg16 = unsigned base offset */
|
||||
|
||||
#define oSTX (o16|0x2c) /* (One 32-bit + one 16-bit stack arguments) */
|
||||
#define oSTXH (o16|0x2d) /* (Two 16-bit stack arguments) */
|
||||
#define oSTXB (o16|0x2e) /* (Two 16-bit stack arguments) */
|
||||
#define oSTXM (o16|0x2f) /* (Two+n 16-bit stack arguments) */
|
||||
|
||||
/* Load address relative to stack base: arg16 = unsigned offset */
|
||||
|
||||
#define oLA (o16|0x30)
|
||||
|
||||
/* Load absolute stack address: arg16 = RODATA offset (No stack arguments) */
|
||||
|
||||
#define oLAC (o16|0x31)
|
||||
|
||||
/* (o16|0x32)-(o16|0x33) -- unassigned */
|
||||
|
||||
/* Data stack: arg16 = 16 bit signed data (no stack arguments) */
|
||||
|
||||
#define oPUSH (o16|0x34)
|
||||
#define oINDS (o16|0x35)
|
||||
|
||||
/* (o16|0x34)-(o16|0x37) -- unassigned */
|
||||
|
||||
/* Load address relative to stack base: arg16 = unsigned offset, TOS=index */
|
||||
|
||||
#define oLAX (o16|0x38)
|
||||
|
||||
/* System functions: arg16 = 16-bit library call identifier */
|
||||
|
||||
#define oLIB (o16|0x39)
|
||||
|
||||
/* (o16|0x3a)-(o16|0x3e) -- unassigned */
|
||||
|
||||
/* Program control: arg16 = unsigned label (no stack arguments) */
|
||||
|
||||
#define oLABEL (o16|0x3f)
|
||||
|
||||
/** OPCODES WITH 24-BITS OF ARGUMENET (arg8 + arg16) ************************/
|
||||
|
||||
/* (o16|o8|0x00)-(o8|o16|0x07) -- unassigned */
|
||||
|
||||
/* Program Control: arg8 = level; arg16 = unsigned label
|
||||
* (No stack arguments)
|
||||
* Behavior:
|
||||
* Push base address of level
|
||||
* Push base register (BR) value
|
||||
* Set new base register value (BR) as top of stack
|
||||
* Push return address
|
||||
* Set program counter (PC) for address associated with label
|
||||
*/
|
||||
|
||||
#define oPCAL (o16|o8|0x08)
|
||||
|
||||
/* (o16|o8|0x09)-(o8|o16|0x1f) -- unassigned */
|
||||
|
||||
/* Load: arg8 = level; arg16 = signed frame offset */
|
||||
|
||||
#define oLDS (o16|o8|0x20) /* (no stack arguments) */
|
||||
#define oLDSH (o16|o8|0x21) /* (no stack arguments) */
|
||||
#define oLDSB (o16|o8|0x22) /* (no stack arguments) */
|
||||
#define oLDSM (o16|o8|0x23) /* (One 16-bit stack argument) */
|
||||
|
||||
/* Store: arg8 = level; arg16 = signed frame offset */
|
||||
|
||||
#define oSTS (o16|o8|0x24) /* (One 32-bit stack argument) */
|
||||
#define oSTSH (o16|o8|0x25) /* (One 16-bit stack argument) */
|
||||
#define oSTSB (o16|o8|0x26) /* (One 16-bit stack argument) */
|
||||
#define oSTSM (o16|o8|0x27) /* (One+n 16-bit stack arguments) */
|
||||
|
||||
/* Load Indexed: arg8 = level; arg16 = signed frame offset */
|
||||
|
||||
#define oLDSX (o16|o8|0x28) /* (One 16-bit stack argument) */
|
||||
#define oLDSXH (o16|o8|0x29) /* (One 16-bit stack argument) */
|
||||
#define oLDSXB (o16|o8|0x2a) /* (One 16-bit stack argument) */
|
||||
#define oLDSXM (o16|o8|0x2b) /* (Two 16-bit stack arguments) */
|
||||
|
||||
/* Store Indexed: arg8 = level; arg16 = signed frame offset */
|
||||
|
||||
#define oSTSX (o16|o8|0x2c) /* (One 32-bit + one 16-bit stack arguments) */
|
||||
#define oSTSXH (o16|o8|0x2d) /* (Two 16-bit stack arguments) */
|
||||
#define oSTSXB (o16|o8|0x2e) /* (Two 16-bit stack arguments) */
|
||||
#define oSTSXM (o16|o8|0x2f) /* (Two+n 16-bit stack arguments) */
|
||||
|
||||
/* FOR LAS/LASX arg8 = level; arg16 = signed frame offset
|
||||
* (no stack arguments)
|
||||
*/
|
||||
|
||||
#define oLAS (o16|o8|0x30)
|
||||
#define oLASX (o16|o8|0x38)
|
||||
|
||||
/* System calls:
|
||||
* For SYSIO: arg8 = file number; arg16 = sub-function code
|
||||
*/
|
||||
|
||||
#define oSYSIO (o16|o8|0x39)
|
||||
|
||||
/* (o16|o8|0x3a)-(o8|o16|0x3e) -- unassigned */
|
||||
|
||||
/* Pseudo-operations:
|
||||
* For LINE: arg8 = file number; arg16 = line number
|
||||
*/
|
||||
|
||||
#define oLINE (o16|o8|0x3f)
|
||||
|
||||
#endif /* __PINSN16_H */
|
||||
|
|
|
@ -431,7 +431,7 @@ static const struct
|
|||
/* 0xfd */ { invOp, NOARG16 },
|
||||
/* 0xfe */ { invOp, NOARG16 },
|
||||
|
||||
/* Psuedo-operations:
|
||||
/* Pseudo-operations:
|
||||
* For LINE: arg8 = file number; arg16 = line number
|
||||
*/
|
||||
|
||||
|
|
|
@ -2185,7 +2185,7 @@ static int pexec32(FAR struct pexec_s *st, uint8_t opcode, uint8_t imm8, uint16_
|
|||
ret = pexec_sysio(st, imm8, imm16);
|
||||
break;
|
||||
|
||||
/* Psuedo-operations: (No stack arguments)
|
||||
/* Pseudo-operations: (No stack arguments)
|
||||
* For LINE: imm8 = file number; imm16 = line number
|
||||
*/
|
||||
|
||||
|
|
|
@ -1,119 +1,119 @@
|
|||
32-bit op-code bit definitions
|
||||
|
||||
Machine model:
|
||||
|
||||
SPB 32-bit Pascal stack base address
|
||||
SP 32-bit Pascal stack pointer
|
||||
LSP 32-bit Level stack pointer
|
||||
CSB 32-bit Character stack base address
|
||||
CSP 32-bit Character stack pointer
|
||||
DS 32-bit Data size register (for multiple reg transfers)
|
||||
PC 32-bit Program Counter
|
||||
CC Condition code register
|
||||
--- Volatile general purpose registers
|
||||
--- Static general purpose registers
|
||||
|
||||
Condition codes: Z(ero), N(egative)
|
||||
|
||||
+=====+=====+
|
||||
| Z | N |
|
||||
+=====+=====+=====+
|
||||
| EQ | 1 | - |
|
||||
| NEQ | 0 | - |
|
||||
| LT | - | 1 |
|
||||
| GTE | - | 0 |
|
||||
| GT | 0 | 0 |
|
||||
| LTE | 1 | 1 |
|
||||
+=====+=====+=====+
|
||||
|
||||
Opcode Encoding Summary:
|
||||
|
||||
0rxx xxxx 1rxxx xxxx
|
||||
xr00 0000 NOP LD uoffs4
|
||||
xr00 0001 NEG LDH uoffs3
|
||||
xr00 0010 ABS LDB uoffs
|
||||
xr00 0011 INC LDM uoffs4
|
||||
xr00 0100 DEC ST uoffs4
|
||||
xr00 0101 NOT STH uoffs2
|
||||
xr00 0110 ADD STB uoffs
|
||||
xr00 0111 SUB STM uoffs4
|
||||
xr00 1000 MUL LDX uoffs4
|
||||
xr00 1001 DIV LDXH uoffs2
|
||||
xr00 1010 MOD LDXB uoffs
|
||||
xr00 1011 SLL LDXM uoffs4
|
||||
xr00 1100 SRL STX uoffs4
|
||||
xr00 1101 SRA STXH uoffs2
|
||||
xr00 1110 OR STXB uoffs
|
||||
xr00 1111 AND STXM uoffs
|
||||
|
||||
xr01 0000 EQUZ JEQUZ ilbl
|
||||
xr01 0001 NEQZ JNEQZ ilbl
|
||||
xr01 0010 LTZ JLTZ ilbl
|
||||
xr01 0011 GTEZ JGTEZ ilbl
|
||||
xr01 0100 GTZ JGTZ ilbl
|
||||
xr01 0101 LTEZ JLTEZ ilbl
|
||||
xr01 0110 --- JMP ilbl
|
||||
xr01 0111 --- PUSH nn
|
||||
xr01 1000 EQU JEQU ilbl
|
||||
xr01 1001 NEQ JNEQ ilbl
|
||||
xr01 1010 LT JLT ilbl
|
||||
xr01 1011 GTE JGTE ilbl
|
||||
xr01 1100 GT JGT ilbl
|
||||
xr01 1101 LTE JLTE ilbl
|
||||
xr01 1110 --- ---
|
||||
xr01 1111 BIT INDS nn
|
||||
|
||||
xr10 0000 LDI LDS offs4
|
||||
xr10 0001 LDIH LDSH offs3
|
||||
xr10 0010 LDIB LDSB offs
|
||||
xr10 0011 LDIM LDSM offs4
|
||||
xr10 0100 STI STS offs4
|
||||
xr10 0101 STIH STSH offs2
|
||||
xr10 0110 STIB STSB offs
|
||||
xr10 0111 STIM STSM offs4
|
||||
xr10 1000 DUP LDSX offs4
|
||||
xr10 1001 --- LDSXH offs2
|
||||
xr10 1010 PUSHS LDSXB offs
|
||||
xr10 1011 POPS LDSXM offs4
|
||||
xr10 1100 --- STSX offs4
|
||||
xr10 1101 --- STSXH offs2
|
||||
xr10 1110 --- STSXB offs
|
||||
xr10 1111 RET STSXM offs
|
||||
|
||||
xr11 0000 --- LA uoffs
|
||||
xr11 0001 --- LAS offs
|
||||
xr11 0010 --- LAC dlbl
|
||||
xr11 0011 --- ---
|
||||
xr11 0100 --- LAX uoffs
|
||||
xr11 0101 --- LASX offs
|
||||
xr11 0110 --- SLSP level
|
||||
xr11 0111 --- SDC uu
|
||||
xr11 1000 --- ---
|
||||
xr11 1001 --- PCAL ilbl
|
||||
xr11 1010 --- SYSIO fn,sop
|
||||
xr11 1011 --- LIB lop
|
||||
xr11 1100 --- FLOAT fop
|
||||
xr11 1101 --- *LABEL ilbl
|
||||
xr11 1110 --- *INCLUDE fn
|
||||
xr11 1111 END *LINE lineno
|
||||
|
||||
KEY:
|
||||
r = Reserved bit (must be zero)
|
||||
fn = 8-bit file number
|
||||
lvl = 8-bit static nexting level
|
||||
sop = 17-bit sysio operation
|
||||
lineno = 17-bit line number
|
||||
nn = 32-bit constant value (signed)
|
||||
uu = 32-bit constant value (unsigned)
|
||||
fop = 32-bit floating point operation
|
||||
lop = 32-bit library call identifier
|
||||
ilbl = 32-bit Instruction space label number
|
||||
dlbl = 32-stack data label
|
||||
offs4 = 32-bit word offset with respect to LSP (signed)
|
||||
offs2 = 32-bit halfword offset with respect to LSP (signed)
|
||||
offs = 32-bit byte offset with respect to LSP (signed)
|
||||
uoffs4 = 32-bit word offset with respect to SPB (unsigned)
|
||||
uoffs2 = 32-bit halfword offset with respect to SPB (unsigned)
|
||||
uoffs = 32-bit byte offset with respect to SPB (unsigned)
|
||||
c = string follows psuedo-operation
|
||||
= Indicates pseudo-operations (these are removed
|
||||
32-bit op-code bit definitions
|
||||
|
||||
Machine model:
|
||||
|
||||
SPB 32-bit Pascal stack base address
|
||||
SP 32-bit Pascal stack pointer
|
||||
LSP 32-bit Level stack pointer
|
||||
CSB 32-bit Character stack base address
|
||||
CSP 32-bit Character stack pointer
|
||||
DS 32-bit Data size register (for multiple reg transfers)
|
||||
PC 32-bit Program Counter
|
||||
CC Condition code register
|
||||
--- Volatile general purpose registers
|
||||
--- Static general purpose registers
|
||||
|
||||
Condition codes: Z(ero), N(egative)
|
||||
|
||||
+=====+=====+
|
||||
| Z | N |
|
||||
+=====+=====+=====+
|
||||
| EQ | 1 | - |
|
||||