/* $Id$ */
/* Copyright (c) 2018 Pierre Pronchery <khorben@defora.org> */
/* This file is part of DeforaOS Devel Asm */
/* This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, version 3 of the License.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>. */



/* helpers */
/* opcodes */
#define OP1F		(8 << AOD_SIZE)

/* immediate values */
#define OP_U8		AO_IMMEDIATE(0, 8, 0)
#define OP_U16		AO_IMMEDIATE(0, 16, 0)
#define OP_U24		AO_IMMEDIATE(0, 24, 0)
#define OP_U32		AO_IMMEDIATE(0, 32, 0)
#define OP_U40		AO_IMMEDIATE(0, 40, 0)
#define OP_U48		AO_IMMEDIATE(0, 48, 0)
#define OP_U56		AO_IMMEDIATE(0, 56, 0)
#define OP_U64		AO_IMMEDIATE(0, 64, 0)
#define OP_U72		AO_IMMEDIATE(0, 72, 0)
#define OP_U80		AO_IMMEDIATE(0, 80, 0)
#define OP_U88		AO_IMMEDIATE(0, 88, 0)
#define OP_U96		AO_IMMEDIATE(0, 96, 0)
#define OP_U104		AO_IMMEDIATE(0, 104, 0)
#define OP_U112		AO_IMMEDIATE(0, 112, 0)
#define OP_U120		AO_IMMEDIATE(0, 120, 0)
#define OP_U128		AO_IMMEDIATE(0, 128, 0)
#define OP_U136		AO_IMMEDIATE(0, 136, 0)
#define OP_U144		AO_IMMEDIATE(0, 144, 0)
#define OP_U152		AO_IMMEDIATE(0, 152, 0)
#define OP_U160		AO_IMMEDIATE(0, 160, 0)
#define OP_U168		AO_IMMEDIATE(0, 168, 0)
#define OP_U176		AO_IMMEDIATE(0, 176, 0)
#define OP_U184		AO_IMMEDIATE(0, 184, 0)
#define OP_U192		AO_IMMEDIATE(0, 192, 0)
#define OP_U200		AO_IMMEDIATE(0, 200, 0)
#define OP_U208		AO_IMMEDIATE(0, 208, 0)
#define OP_U216		AO_IMMEDIATE(0, 216, 0)
#define OP_U224		AO_IMMEDIATE(0, 224, 0)
#define OP_U232		AO_IMMEDIATE(0, 232, 0)
#define OP_U240		AO_IMMEDIATE(0, 240, 0)
#define OP_U248		AO_IMMEDIATE(0, 248, 0)
#define OP_U256		AO_IMMEDIATE(0, 256, 0)


/* instructions */
{ "stop",	0x00, OP1F,	AO_0()				},
{ "add",	0x01, OP1F,	AO_0()				},
{ "mul",	0x02, OP1F,	AO_0()				},
{ "sub",	0x03, OP1F,	AO_0()				},
{ "div",	0x04, OP1F,	AO_0()				},
{ "sdiv",	0x05, OP1F,	AO_0()				},
{ "mod",	0x06, OP1F,	AO_0()				},
{ "smod",	0x07, OP1F,	AO_0()				},
{ "addmod",	0x08, OP1F,	AO_0()				},
{ "submod",	0x09, OP1F,	AO_0()				},
{ "exp",	0x0a, OP1F,	AO_0()				},
{ "signextend",	0x0b, OP1F,	AO_0()				},
{ "lt",		0x10, OP1F,	AO_0()				},
{ "gt",		0x11, OP1F,	AO_0()				},
{ "slt",	0x12, OP1F,	AO_0()				},
{ "sgt",	0x13, OP1F,	AO_0()				},
{ "eq",		0x14, OP1F,	AO_0()				},
{ "iszero",	0x15, OP1F,	AO_0()				},
{ "and",	0x16, OP1F,	AO_0()				},
{ "or",		0x17, OP1F,	AO_0()				},
{ "xor",	0x18, OP1F,	AO_0()				},
{ "not",	0x19, OP1F,	AO_0()				},
{ "byte",	0x1a, OP1F,	AO_0()				},
{ "address",	0x30, OP1F,	AO_0()				},
{ "origin",	0x32, OP1F,	AO_0()				},
{ "caller",	0x33, OP1F,	AO_0()				},
{ "callvalue",	0x34, OP1F,	AO_0()				},
{ "calldataload",0x35,OP1F,	AO_0()				},
{ "calldatasize",0x36,OP1F,	AO_0()				},
{ "calldatacopy",0x37,OP1F,	AO_0()				},
{ "callsize",	0x38, OP1F,	AO_0()				},
{ "callcopy",	0x39, OP1F,	AO_0()				},
{ "gasprice",	0x3a, OP1F,	AO_0()				},
{ "extcodesize",0x3b, OP1F,	AO_0()				},
{ "extcodecopy",0x3c, OP1F,	AO_0()				},
{ "blockhash",	0x40, OP1F,	AO_0()				},
{ "coinbase",	0x41, OP1F,	AO_0()				},
{ "timestamp",	0x42, OP1F,	AO_0()				},
{ "number",	0x43, OP1F,	AO_0()				},
{ "difficulty",	0x44, OP1F,	AO_0()				},
{ "gaslimit",	0x45, OP1F,	AO_0()				},
{ "pop",	0x50, OP1F,	AO_0()				},
{ "mload",	0x51, OP1F,	AO_0()				},
{ "mstore",	0x52, OP1F,	AO_0()				},
{ "mstore8",	0x53, OP1F,	AO_0()				},
{ "sload",	0x54, OP1F,	AO_0()				},
{ "sstore",	0x55, OP1F,	AO_0()				},
{ "jump",	0x56, OP1F,	AO_0()				},
{ "jumpi",	0x57, OP1F,	AO_0()				},
{ "pc",		0x58, OP1F,	AO_0()				},
{ "msize",	0x59, OP1F,	AO_0()				},
{ "gas",	0x5a, OP1F,	AO_0()				},
{ "jumpdest",	0x5b, OP1F,	AO_0()				},
{ "push1",	0x60, OP1F,	AO_1(OP_U8)			},
{ "push2",	0x61, OP1F,	AO_1(OP_U16)			},
{ "push3",	0x62, OP1F,	AO_1(OP_U24)			},
{ "push4",	0x63, OP1F,	AO_1(OP_U32)			},
{ "push5",	0x64, OP1F,	AO_1(OP_U40)			},
{ "push6",	0x65, OP1F,	AO_1(OP_U48)			},
{ "push7",	0x66, OP1F,	AO_1(OP_U56)			},
{ "push8",	0x67, OP1F,	AO_1(OP_U64)			},
{ "push9",	0x68, OP1F,	AO_1(OP_U72)			},
{ "push10",	0x69, OP1F,	AO_1(OP_U80)			},
{ "push11",	0x6a, OP1F,	AO_1(OP_U88)			},
{ "push12",	0x6b, OP1F,	AO_1(OP_U96)			},
{ "push13",	0x6c, OP1F,	AO_1(OP_U104)			},
{ "push14",	0x6d, OP1F,	AO_1(OP_U112)			},
{ "push15",	0x6e, OP1F,	AO_1(OP_U120)			},
{ "push16",	0x6f, OP1F,	AO_1(OP_U128)			},
{ "push17",	0x70, OP1F,	AO_1(OP_U136)			},
{ "push18",	0x71, OP1F,	AO_1(OP_U144)			},
{ "push19",	0x72, OP1F,	AO_1(OP_U152)			},
{ "push20",	0x73, OP1F,	AO_1(OP_U160)			},
{ "push21",	0x74, OP1F,	AO_1(OP_U168)			},
{ "push22",	0x75, OP1F,	AO_1(OP_U176)			},
{ "push23",	0x76, OP1F,	AO_1(OP_U184)			},
{ "push24",	0x77, OP1F,	AO_1(OP_U192)			},
{ "push25",	0x78, OP1F,	AO_1(OP_U200)			},
{ "push26",	0x79, OP1F,	AO_1(OP_U208)			},
{ "push27",	0x7a, OP1F,	AO_1(OP_U216)			},
{ "push28",	0x7b, OP1F,	AO_1(OP_U224)			},
{ "push29",	0x7c, OP1F,	AO_1(OP_U232)			},
{ "push30",	0x7d, OP1F,	AO_1(OP_U240)			},
{ "push31",	0x7e, OP1F,	AO_1(OP_U248)			},
{ "push32",	0x7f, OP1F,	AO_1(OP_U256)			},
{ "dup1",	0x80, OP1F,	AO_0()				},
{ "dup2",	0x81, OP1F,	AO_0()				},
{ "dup3",	0x82, OP1F,	AO_0()				},
{ "dup4",	0x83, OP1F,	AO_0()				},
{ "dup5",	0x84, OP1F,	AO_0()				},
{ "dup6",	0x85, OP1F,	AO_0()				},
{ "dup7",	0x86, OP1F,	AO_0()				},
{ "dup8",	0x87, OP1F,	AO_0()				},
{ "dup9",	0x88, OP1F,	AO_0()				},
{ "dup10",	0x89, OP1F,	AO_0()				},
{ "dup11",	0x8a, OP1F,	AO_0()				},
{ "dup12",	0x8b, OP1F,	AO_0()				},
{ "dup13",	0x8c, OP1F,	AO_0()				},
{ "dup14",	0x8d, OP1F,	AO_0()				},
{ "dup15",	0x8e, OP1F,	AO_0()				},
{ "dup16",	0x8f, OP1F,	AO_0()				},
{ "swap1",	0x90, OP1F,	AO_0()				},
{ "swap2",	0x91, OP1F,	AO_0()				},
{ "swap3",	0x92, OP1F,	AO_0()				},
{ "swap4",	0x93, OP1F,	AO_0()				},
{ "swap5",	0x94, OP1F,	AO_0()				},
{ "swap6",	0x95, OP1F,	AO_0()				},
{ "swap7",	0x96, OP1F,	AO_0()				},
{ "swap8",	0x97, OP1F,	AO_0()				},
{ "swap9",	0x98, OP1F,	AO_0()				},
{ "swap10",	0x99, OP1F,	AO_0()				},
{ "swap11",	0x9a, OP1F,	AO_0()				},
{ "swap12",	0x9b, OP1F,	AO_0()				},
{ "swap13",	0x9c, OP1F,	AO_0()				},
{ "swap14",	0x9d, OP1F,	AO_0()				},
{ "swap15",	0x9e, OP1F,	AO_0()				},
{ "swap16",	0x9f, OP1F,	AO_0()				},
{ "log0",	0xa0, OP1F,	AO_0()				},
{ "log1",	0xa1, OP1F,	AO_0()				},
{ "log2",	0xa2, OP1F,	AO_0()				},
{ "log3",	0xa3, OP1F,	AO_0()				},
{ "log4",	0xa4, OP1F,	AO_0()				},
{ "push",	0xb0, OP1F,	AO_0()				},
{ "dup",	0xb1, OP1F,	AO_0()				},
{ "swap",	0xb2, OP1F,	AO_0()				},
{ "create",	0xf0, OP1F,	AO_0()				},
{ "call",	0xf1, OP1F,	AO_0()				},
{ "callcode",	0xf2, OP1F,	AO_0()				},
{ "return",	0xf3, OP1F,	AO_0()				},
{ "delegatecall",0xf4,OP1F,	AO_0()				},
{ "selfdestruct",0xff,OP1F,	AO_0()				},
