: .
* ! , const char *. char ( ), C-String. C- " " (-, , + ), 0 ( '\0'), !
( ) . , :
- 0x01 → OP_CODE1
- 0x02 → OP_CODE2
- 0x03 → OP_CODE3
:
const char *getOpcodeName( uint8_t op )
{
if((0x01)==op) return "OP_X";
if((0x02)==op) return "OP_Y";
if((0x03)==op) return "OP_Z";
...
if((0x??)==op) return "OP_?";
return "OP_UNKNOWN";
}
houndreds IF...
#define OPCODE(x, y) if((0x##y)==op) return "OP_" #x;
, OPCODES :
#define OPCODES \
OPCODE( 01, "X" ) \
OPCODE( 02, "Y" ) \
OPCODE( 03, "Z" ) \
...
OPCODE( ??, "?" )
- , ( ). ( Intel):
inc eax ; opcode = 0x40
pusha ; opcode = 0x60
nop ; opcode = 0x90
, :
#define OPCODES \
OPCODE( 40, "INCEAX" ) \
OPCODE( 60, "PUSHA" ) \
OPCODE( 90, "NOP" )