#ifdef SMPCORE_CPP

void SMPcore::initialize_opcode_table() {
  #define op(id, name) opcode_table[id] = &sSMP::op_ ## name;

  op(0x00, nop)           op(0x01, tcall_0)      op(0x02, set0_dp)      op(0x03, bbs0)
  op(0x04, or_a_dp)       op(0x05, or_a_addr)    op(0x06, or_a_ix)      op(0x07, or_a_idpx)
  op(0x08, or_a_const)    op(0x09, or_dp_dp)     op(0x0a, or1_bit)      op(0x0b, asl_dp)
  op(0x0c, asl_addr)      op(0x0d, push_p)       op(0x0e, tset_addr_a)  op(0x0f, brk)
  op(0x10, bpl)           op(0x11, tcall_1)      op(0x12, clr0_dp)      op(0x13, bbc0)
  op(0x14, or_a_dpx)      op(0x15, or_a_addrx)   op(0x16, or_a_addry)   op(0x17, or_a_idpy)
  op(0x18, or_dp_const)   op(0x19, or_ix_iy)     op(0x1a, decw_dp)      op(0x1b, asl_dpx)
  op(0x1c, asl_a)         op(0x1d, dec_x)        op(0x1e, cmp_x_addr)   op(0x1f, jmp_iaddrx)
  op(0x20, clrp)          op(0x21, tcall_2)      op(0x22, set1_dp)      op(0x23, bbs1)
  op(0x24, and_a_dp)      op(0x25, and_a_addr)   op(0x26, and_a_ix)     op(0x27, and_a_idpx)
  op(0x28, and_a_const)   op(0x29, and_dp_dp)    op(0x2a, or1_notbit)   op(0x2b, rol_dp)
  op(0x2c, rol_addr)      op(0x2d, push_a)       op(0x2e, cbne_dp)      op(0x2f, bra)
  op(0x30, bmi)           op(0x31, tcall_3)      op(0x32, clr1_dp)      op(0x33, bbc1)
  op(0x34, and_a_dpx)     op(0x35, and_a_addrx)  op(0x36, and_a_addry)  op(0x37, and_a_idpy)
  op(0x38, and_dp_const)  op(0x39, and_ix_iy)    op(0x3a, incw_dp)      op(0x3b, rol_dpx)
  op(0x3c, rol_a)         op(0x3d, inc_x)        op(0x3e, cmp_x_dp)     op(0x3f, call)
  op(0x40, setp)          op(0x41, tcall_4)      op(0x42, set2_dp)      op(0x43, bbs2)
  op(0x44, eor_a_dp)      op(0x45, eor_a_addr)   op(0x46, eor_a_ix)     op(0x47, eor_a_idpx)
  op(0x48, eor_a_const)   op(0x49, eor_dp_dp)    op(0x4a, and1_bit)     op(0x4b, lsr_dp)
  op(0x4c, lsr_addr)      op(0x4d, push_x)       op(0x4e, tclr_addr_a)  op(0x4f, pcall)
  op(0x50, bvc)           op(0x51, tcall_5)      op(0x52, clr2_dp)      op(0x53, bbc2)
  op(0x54, eor_a_dpx)     op(0x55, eor_a_addrx)  op(0x56, eor_a_addry)  op(0x57, eor_a_idpy)
  op(0x58, eor_dp_const)  op(0x59, eor_ix_iy)    op(0x5a, cmpw_ya_dp)   op(0x5b, lsr_dpx)
  op(0x5c, lsr_a)         op(0x5d, mov_x_a)      op(0x5e, cmp_y_addr)   op(0x5f, jmp_addr)
  op(0x60, clrc)          op(0x61, tcall_6)      op(0x62, set3_dp)      op(0x63, bbs3)
  op(0x64, cmp_a_dp)      op(0x65, cmp_a_addr)   op(0x66, cmp_a_ix)     op(0x67, cmp_a_idpx)
  op(0x68, cmp_a_const)   op(0x69, cmp_dp_dp)    op(0x6a, and1_notbit)  op(0x6b, ror_dp)
  op(0x6c, ror_addr)      op(0x6d, push_y)       op(0x6e, dbnz_dp)      op(0x6f, ret)
  op(0x70, bvs)           op(0x71, tcall_7)      op(0x72, clr3_dp)      op(0x73, bbc3)
  op(0x74, cmp_a_dpx)     op(0x75, cmp_a_addrx)  op(0x76, cmp_a_addry)  op(0x77, cmp_a_idpy)
  op(0x78, cmp_dp_const)  op(0x79, cmp_ix_iy)    op(0x7a, addw_ya_dp)   op(0x7b, ror_dpx)
  op(0x7c, ror_a)         op(0x7d, mov_a_x)      op(0x7e, cmp_y_dp)     op(0x7f, reti)
  op(0x80, setc)          op(0x81, tcall_8)      op(0x82, set4_dp)      op(0x83, bbs4)
  op(0x84, adc_a_dp)      op(0x85, adc_a_addr)   op(0x86, adc_a_ix)     op(0x87, adc_a_idpx)
  op(0x88, adc_a_const)   op(0x89, adc_dp_dp)    op(0x8a, eor1_bit)     op(0x8b, dec_dp)
  op(0x8c, dec_addr)      op(0x8d, mov_y_const)  op(0x8e, pop_p)        op(0x8f, mov_dp_const)
  op(0x90, bcc)           op(0x91, tcall_9)      op(0x92, clr4_dp)      op(0x93, bbc4)
  op(0x94, adc_a_dpx)     op(0x95, adc_a_addrx)  op(0x96, adc_a_addry)  op(0x97, adc_a_idpy)
  op(0x98, adc_dp_const)  op(0x99, adc_ix_iy)    op(0x9a, subw_ya_dp)   op(0x9b, dec_dpx)
  op(0x9c, dec_a)         op(0x9d, mov_x_sp)     op(0x9e, div_ya_x)     op(0x9f, xcn)
  op(0xa0, ei)            op(0xa1, tcall_10)     op(0xa2, set5_dp)      op(0xa3, bbs5)
  op(0xa4, sbc_a_dp)      op(0xa5, sbc_a_addr)   op(0xa6, sbc_a_ix)     op(0xa7, sbc_a_idpx)
  op(0xa8, sbc_a_const)   op(0xa9, sbc_dp_dp)    op(0xaa, mov1_c_bit)   op(0xab, inc_dp)
  op(0xac, inc_addr)      op(0xad, cmp_y_const)  op(0xae, pop_a)        op(0xaf, mov_ixinc_a)
  op(0xb0, bcs)           op(0xb1, tcall_11)     op(0xb2, clr5_dp)      op(0xb3, bbc5)
  op(0xb4, sbc_a_dpx)     op(0xb5, sbc_a_addrx)  op(0xb6, sbc_a_addry)  op(0xb7, sbc_a_idpy)
  op(0xb8, sbc_dp_const)  op(0xb9, sbc_ix_iy)    op(0xba, movw_ya_dp)   op(0xbb, inc_dpx)
  op(0xbc, inc_a)         op(0xbd, mov_sp_x)     op(0xbe, das)          op(0xbf, mov_a_ixinc)
  op(0xc0, di)            op(0xc1, tcall_12)     op(0xc2, set6_dp)      op(0xc3, bbs6)
  op(0xc4, mov_dp_a)      op(0xc5, mov_addr_a)   op(0xc6, mov_ix_a)     op(0xc7, mov_idpx_a)
  op(0xc8, cmp_x_const)   op(0xc9, mov_addr_x)   op(0xca, mov1_bit_c)   op(0xcb, mov_dp_y)
  op(0xcc, mov_addr_y)    op(0xcd, mov_x_const)  op(0xce, pop_x)        op(0xcf, mul_ya)
  op(0xd0, bne)           op(0xd1, tcall_13)     op(0xd2, clr6_dp)      op(0xd3, bbc6)
  op(0xd4, mov_dpx_a)     op(0xd5, mov_addrx_a)  op(0xd6, mov_addry_a)  op(0xd7, mov_idpy_a)
  op(0xd8, mov_dp_x)      op(0xd9, mov_dpy_x)    op(0xda, movw_dp_ya)   op(0xdb, mov_dpx_y)
  op(0xdc, dec_y)         op(0xdd, mov_a_y)      op(0xde, cbne_dpx)     op(0xdf, daa)
  op(0xe0, clrv)          op(0xe1, tcall_14)     op(0xe2, set7_dp)      op(0xe3, bbs7)
  op(0xe4, mov_a_dp)      op(0xe5, mov_a_addr)   op(0xe6, mov_a_ix)     op(0xe7, mov_a_idpx)
  op(0xe8, mov_a_const)   op(0xe9, mov_x_addr)   op(0xea, not1_bit)     op(0xeb, mov_y_dp)
  op(0xec, mov_y_addr)    op(0xed, notc)         op(0xee, pop_y)        op(0xef, sleep)
  op(0xf0, beq)           op(0xf1, tcall_15)     op(0xf2, clr7_dp)      op(0xf3, bbc7)
  op(0xf4, mov_a_dpx)     op(0xf5, mov_a_addrx)  op(0xf6, mov_a_addry)  op(0xf7, mov_a_idpy)
  op(0xf8, mov_x_dp)      op(0xf9, mov_x_dpy)    op(0xfa, mov_dp_dp)    op(0xfb, mov_y_dpx)
  op(0xfc, inc_y)         op(0xfd, mov_y_a)      op(0xfe, dbnz_y)       op(0xff, stop)

  #undef op
}

#endif

