spinsim/opcodes.h

251 lines
8.3 KiB
C
Raw Normal View History

/*******************************************************************************
' Author: Dave Hein
' Version 0.21
' Copyright (c) 2010, 2011
' See end of file for terms of use.
'******************************************************************************/
typedef struct OpCodeS {
unsigned char opform;
unsigned char opcode;
char *opname;
} OpCodeT;
static OpCodeT optable[] = {
{0x00, 0x00, "ldfrmr"},
{0x00, 0x01, "ldfrm"},
{0x00, 0x02, "ldfrmar"},
{0x00, 0x03, "ldfrma"},
{0x05, 0x04, "jmp"},
{0x0a, 0x05, "call"},
{0x07, 0x06, "callobj"},
{0x07, 0x07, "callobjx"},
{0x05, 0x08, "tjz"},
{0x05, 0x09, "djnz"},
{0x05, 0x0a, "jz"},
{0x05, 0x0b, "jnz"},
{0x00, 0x0c, "casedone"},
{0x08, 0x0d, "casevalue"},
{0x08, 0x0e, "caserange"},
{0x00, 0x0f, "lookdone"},
{0x00, 0x10, "lookupval"},
{0x00, 0x11, "lookdnval"},
{0x00, 0x12, "lookuprng"},
{0x00, 0x13, "lookdnrng"},
{0x00, 0x14, "pop"},
{0x00, 0x15, "run"},
{0x00, 0x16, "strsize"},
{0x00, 0x17, "strcomp"},
{0x00, 0x18, "bytefill"},
{0x00, 0x19, "wordfill"},
{0x00, 0x1a, "longfill"},
{0x00, 0x1b, "waitpeq"},
{0x00, 0x1c, "bytemove"},
{0x00, 0x1d, "wordmove"},
{0x00, 0x1e, "longmove"},
{0x00, 0x1f, "waitpne"},
{0x00, 0x20, "clkset"},
{0x00, 0x21, "cogstop"},
{0x00, 0x22, "lockret"},
{0x00, 0x23, "waitcnt"},
{0x00, 0x24, "ldregx"},
{0x00, 0x25, "stregx"},
{0x20, 0x26, "exregx"},
{0x00, 0x27, "waitvid"},
{0x00, 0x28, "coginitret"},
{0x00, 0x29, "locknewret"},
{0x00, 0x2a, "locksetret"},
{0x00, 0x2b, "lockclrret"},
{0x00, 0x2c, "coginit"},
{0x00, 0x2d, "locknew"},
{0x00, 0x2e, "lockset"},
{0x00, 0x2f, "lockclr"},
{0x00, 0x30, "abort"},
{0x00, 0x31, "abortval"},
{0x00, 0x32, "ret"},
{0x00, 0x33, "retval"},
{0x00, 0x34, "ldlim1"},
{0x00, 0x35, "ldli0"},
{0x00, 0x36, "ldli1"},
{0x09, 0x37, "ldlip"},
{0x0a, 0x38, "ldbi"},
{0x0b, 0x39, "ldwi"},
{0x0c, 0x3a, "ldmi"},
{0x0d, 0x3b, "ldli"},
{0x00, 0x3c, "lmm"},
{0x0f, 0x3d, "ldregbit"},
{0x0e, 0x3d, "stregbit"},
{0x0e, 0x3d, "exregbit"},
{0x0f, 0x3e, "ldregbits"},
{0x0e, 0x3e, "stregbits"},
{0x0e, 0x3e, "exregbits"},
{0x0f, 0x3f, "ldreg"},
{0x06, 0x3f, "streg"},
{0x0e, 0x3f, "exreg"},
{0x10, 0x40, "ldlvc"},
{0x10, 0x41, "stlvc"},
{0x30, 0x42, "exlvc"},
{0x10, 0x43, "lalvc"},
{0x11, 0x60, "ldllc"},
{0x11, 0x61, "stllc"},
{0x31, 0x62, "exllc"},
{0x11, 0x63, "lallc"},
{0x00, 0x80, "ldba"},
{0x00, 0x81, "stba"},
{0x20, 0x82, "exba"},
{0x00, 0x83, "laba"},
{0x01, 0x84, "ldbo"},
{0x01, 0x85, "stbo"},
{0x21, 0x86, "exbo"},
{0x01, 0x87, "labo"},
{0x02, 0x88, "ldbv"},
{0x02, 0x89, "stbv"},
{0x22, 0x8a, "exbv"},
{0x02, 0x8b, "labv"},
{0x03, 0x8c, "ldbl"},
{0x03, 0x8d, "stbl"},
{0x23, 0x8e, "exbl"},
{0x03, 0x8f, "labl"},
{0x00, 0x90, "ldbax"},
{0x00, 0x91, "stbax"},
{0x20, 0x92, "exbax"},
{0x00, 0x93, "labax"},
{0x01, 0x94, "ldbox"},
{0x01, 0x95, "stbox"},
{0x21, 0x96, "exbox"},
{0x01, 0x97, "labox"},
{0x02, 0x98, "ldbvx"},
{0x02, 0x99, "stbvx"},
{0x22, 0x9a, "exbvx"},
{0x02, 0x9b, "labvx"},
{0x03, 0x9c, "ldblx"},
{0x03, 0x9d, "stblx"},
{0x23, 0x9e, "exblx"},
{0x03, 0x9f, "lablx"},
{0x00, 0xa0, "ldwa"},
{0x00, 0xa1, "stwa"},
{0x20, 0xa2, "exwa"},
{0x00, 0xa3, "lawa"},
{0x01, 0xa4, "ldwo"},
{0x01, 0xa5, "stwo"},
{0x21, 0xa6, "exwo"},
{0x01, 0xa7, "lawo"},
{0x02, 0xa8, "ldwv"},
{0x02, 0xa9, "stwv"},
{0x22, 0xaa, "exwv"},
{0x02, 0xab, "lawv"},
{0x03, 0xac, "ldwl"},
{0x03, 0xad, "stwl"},
{0x23, 0xae, "exwl"},
{0x03, 0xaf, "lawl"},
{0x00, 0xb0, "ldwax"},
{0x00, 0xb1, "stwax"},
{0x20, 0xb2, "exwax"},
{0x00, 0xb3, "lawax"},
{0x01, 0xb4, "ldwox"},
{0x01, 0xb5, "stwox"},
{0x21, 0xb6, "exwox"},
{0x01, 0xb7, "lawox"},
{0x02, 0xb8, "ldwvx"},
{0x02, 0xb9, "stwvx"},
{0x22, 0xba, "exwvx"},
{0x02, 0xbb, "lawvx"},
{0x03, 0xbc, "ldwlx"},
{0x03, 0xbd, "stwlx"},
{0x23, 0xbe, "exwlx"},
{0x03, 0xbf, "lawlx"},
{0x00, 0xc0, "ldla"},
{0x00, 0xc1, "stla"},
{0x20, 0xc2, "exla"},
{0x00, 0xc3, "lala"},
{0x01, 0xc4, "ldlo"},
{0x01, 0xc5, "stlo"},
{0x21, 0xc6, "exlo"},
{0x01, 0xc7, "lalo"},
{0x02, 0xc8, "ldlv"},
{0x02, 0xc9, "stlv"},
{0x22, 0xca, "exlv"},
{0x02, 0xcb, "lalv"},
{0x03, 0xcc, "ldll"},
{0x03, 0xcd, "stll"},
{0x23, 0xce, "exll"},
{0x03, 0xcf, "lall"},
{0x00, 0xd0, "ldlax"},
{0x00, 0xd1, "stlax"},
{0x20, 0xd2, "exlax"},
{0x00, 0xd3, "lalax"},
{0x01, 0xd4, "ldlox"},
{0x01, 0xd5, "stlox"},
{0x21, 0xd6, "exlox"},
{0x01, 0xd7, "lalox"},
{0x02, 0xd8, "ldlvx"},
{0x02, 0xd9, "stlvx"},
{0x22, 0xda, "exlvx"},
{0x02, 0xdb, "lalvx"},
{0x03, 0xdc, "ldllx"},
{0x03, 0xdd, "stllx"},
{0x23, 0xde, "exllx"},
{0x03, 0xdf, "lallx"},
{0x40, 0xe0, "ror"},
{0x40, 0xe1, "rol"},
{0x40, 0xe2, "shr"},
{0x40, 0xe3, "shl"},
{0x40, 0xe4, "minlim"},
{0x40, 0xe5, "maxlim"},
{0x40, 0xe6, "neg"},
{0x40, 0xe7, "com"},
{0x40, 0xe8, "and"},
{0x40, 0xe9, "abs"},
{0x40, 0xea, "or"},
{0x40, 0xeb, "xor"},
{0x40, 0xec, "add"},
{0x40, 0xed, "sub"},
{0x40, 0xee, "sar"},
{0x40, 0xef, "rev"},
{0x40, 0xf0, "andl"},
{0x40, 0xf1, "encode"},
{0x40, 0xf2, "orl"},
{0x40, 0xf3, "decode"},
{0x40, 0xf4, "mul"},
{0x40, 0xf5, "mulh"},
{0x40, 0xf6, "div"},
{0x40, 0xf7, "mod"},
{0x40, 0xf8, "sqrt"},
{0x40, 0xf9, "cmplt"},
{0x40, 0xfa, "cmpgt"},
{0x40, 0xfb, "cmpne"},
{0x40, 0xfc, "cmpeq"},
{0x40, 0xfd, "cmple"},
{0x40, 0xfe, "cmpge"},
{0x40, 0xff, "notl"},
{0x60, 0x00, "store"},
{0x60, 0x02, "repeat"},
{0x60, 0x06, "repeats"},
{0x60, 0x08, "randf"},
{0x60, 0x0c, "randr"},
{0x60, 0x10, "sexb"},
{0x60, 0x14, "sexw"},
{0x60, 0x18, "postclr"},
{0x60, 0x1c, "postset"},
{0x60, 0x20, "preinc"},
{0x60, 0x28, "postinc"},
{0x60, 0x30, "predec"},
{0x60, 0x38, "postdec"},
{0, 0, 0}};
/*
+ -----------------------------------------------------------------------------------------------------------------------------+
| TERMS OF USE: MIT License |
+------------------------------------------------------------------------------------------------------------------------------+
|Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation |
|files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, |
|modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software|
|is furnished to do so, subject to the following conditions: |
| |
|The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.|
| |
|THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE |
|WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
|COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, |
|ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
+------------------------------------------------------------------------------------------------------------------------------+
*/