65oo2/lib/op.h

73 lines
1.7 KiB
C

#ifndef OP_H
# define OP_H 1
# include <stdint.h>
# define OP_MAX 256
# define IS_PREFIX(x) (x & 0x3)
# define OP_ADDR_IMPL 1 << 0
# define OP_ADDR_REL 1 << 1
# define OP_ADDR_IMM 1 << 2
# define OP_ADDR_IND 1 << 3
# define OP_ADDR_ABS 1 << 4
# define OP_ADDR_X 1 << 5
# define OP_ADDR_Y 1 << 6
# define OP_ADDR_A 1 << 7
# define OP_BRK_impl 0x00
# define OP_ORA_x_ind 0x01
# define OP_PHP_impl 0x08
# define OP_ORA_imm 0x09
# define OP_ORA_abs 0x0D
# define OP_ASL_abs 0x0E
# define OP_BPL_rel 0x10
# define OP_ORA_ind_y 0x11
# define OP_CLC_impl 0x18
# define OP_ORA_abs_y 0x19
# define OP_ORA_abs_x 0x1D
# define OP_ASL_abs_x 0x1E
# define OP_JSR_abs 0x20
# define OP_AND_x_ind 0x21
# define OP_PLP_impl 0x28
# define OP_AND_imm 0x29
# define OP_ROL_a 0x2A
# define OP_BIT_abs 0x2C
# define OP_AND_abs 0x2D
# define OP_ROL_abs 0x2E
# define OP_BMI_rel 0x30
# define OP_AND_ind_y 0x31
# define OP_JMP_abs 0x4C
# define OP_JMP_ind 0x6C
/*
* size encoding
*/
# define SIZE_BYTE 0x0
# define SIZE_WORD 0x1
# define SIZE_LONG 0x2
# define TARGET_ZEXT (1 << 2)
# define TARGET_SIZE_BYTE SIZE_BYTE
# define TARGET_SIZE_WORD SIZE_WORD
# define TARGET_SIZE_LONG SIZE_LONG
# define ADDRESS_SIZE_BYTE (SIZE_BYTE << 3)
# define ADDRESS_SIZE_WORD (SIZE_WORD << 3)
# define ADDRESS_SIZE_LONG (SIZE_LONG << 3)
# define GET_TARGET_SIZE(x) ((x) & 0x03)
# define GET_ADDRESS_SIZE(x) (((x) >> 3) & 0x03)
# define IS_TARGET_ZEXT(x) ((x) & TARGET_ZEXT)
extern const uint8_t opcode_addr[];
extern const char *opcode_str[];
#endif /* !OP_H */