| 1 | //cxx . . $ `<file>/src/asm/mnemo.c`/ |
| 2 | // ACME - a crossassembler for producing 6502/65c02/65816 code. |
| 3 | // Copyright (C) 1998-2006 Marco Baye |
| 4 | // Have a look at "acme.c" for further info |
| 5 | // |
| 6 | // Mnemonics stuff |
| 7 | |
| 8 | #include "config.h"cxx . . $ `<file>/src/asm/config.h`/ |
| 9 | #include "alu.h"cxx . . $ `<file>/src/asm/alu.h`/ |
| 10 | #include "cpu.h"cxx . . $ `<file>/src/asm/cpu.h`/ |
| 11 | #include "dynabuf.h"cxx . . $ `<file>/src/asm/dynabuf.h`/ |
| 12 | #include "global.h"cxx . . $ `<file>/src/asm/global.h`/ |
| 13 | #include "input.h"cxx . . $ `<file>/src/asm/input.h`/ |
| 14 | #include "output.h"cxx . . $ `<file>/src/asm/output.h`/ |
| 15 | #include "tree.h"cxx . . $ `<file>/src/asm/tree.h`/ |
| 16 | |
| 17 | |
| 18 | // Constants |
| 19 | #define s_rorcxx . . $ `src/asm/mnemo.c:19:9`! (s_error+2) // Yes, I know I'm sick |
| 20 | #define MNEMO_DYNABUF_INITIALSIZEcxx . . $ `src/asm/mnemo.c:20:9`! 8 // 4+terminator should suffice |
| 21 | |
| 22 | // These values are needed to recognize addressing modes. |
| 23 | // Bits: |
| 24 | // 7....... "Implied" no value given |
| 25 | // .6...... "Immediate" "#" at start |
| 26 | // ..5..... "IndirectLong" "[" at start and "]" after value |
| 27 | // ...4.... "Indirect" Value has at least one unnecessary pair of "()" |
| 28 | // ....32.. "Indexed-Int" Index given inside of "()" |
| 29 | // ......10 "Indexed-Ext" Index given outside of (or without any) "()" |
| 30 | // |
| 31 | // Index bits: |
| 32 | // 00 = no index |
| 33 | // 01 = ",s" (Stack-indexed) |
| 34 | // 10 = ",x" (X-indexed) |
| 35 | // 11 = ",y" (Y-indexed) |
| 36 | |
| 37 | // Components (Values for indices) |
| 38 | #define HAM__cxx . . $ `src/asm/mnemo.c:38:9`! (0u << 0) // No index |
| 39 | #define HAM_Scxx . . $ `src/asm/mnemo.c:39:9`! (1u << 0) // Stack-indexed |
| 40 | #define HAM_Xcxx . . $ `src/asm/mnemo.c:40:9`! (2u << 0) // X-indexed |
| 41 | #define HAM_Ycxx . . $ `src/asm/mnemo.c:41:9`! (3u << 0) // Y-indexed |
| 42 | |
| 43 | // End values base value internal index external index |
| 44 | #define HAM_IMPcxx . . $ `src/asm/mnemo.c:44:9`! (1u << 7) |
| 45 | #define HAM_IMMcxx . . $ `src/asm/mnemo.c:45:9`! (1u << 6) |
| 46 | #define HAM_ABScxx . . $ `src/asm/mnemo.c:46:9`! 0 |
| 47 | #define HAM_ABSScxx . . $ `src/asm/mnemo.c:47:9`! (1u << 0) |
| 48 | #define HAM_ABSXcxx . . $ `src/asm/mnemo.c:48:9`! (2u << 0) |
| 49 | #define HAM_ABSYcxx . . $ `src/asm/mnemo.c:49:9`! (3u << 0) |
| 50 | #define HAM_INDcxx . . $ `src/asm/mnemo.c:50:9`! (1u << 4) |
| 51 | #define HAM_XINDcxx . . $ `src/asm/mnemo.c:51:9`! ((1u << 4)| (2u << 2)) |
| 52 | #define HAM_INDYcxx . . $ `src/asm/mnemo.c:52:9`! ((1u << 4)| (3u << 0)) |
| 53 | #define HAM_SINDYcxx . . $ `src/asm/mnemo.c:53:9`! ((1u << 4)| (1u << 2)| (3u << 0)) |
| 54 | #define HAM_LINDcxx . . $ `src/asm/mnemo.c:54:9`! (1u << 5) |
| 55 | #define HAM_LINDYcxx . . $ `src/asm/mnemo.c:55:9`! ((1u << 5)| (3u << 0)) |
| 56 | // Values of internal indices equal values of external indices, shifted left |
| 57 | // by two bits. The program relies on this ! |
| 58 | |
| 59 | // Constant values, used to mark the possible parameter lengths of commands. |
| 60 | // Not all of the eight values are actually used, however (because of the |
| 61 | // supported CPUs). |
| 62 | #define MAYBE______cxx . . $ `src/asm/mnemo.c:62:9`! (0) |
| 63 | #define MAYBE_1____cxx . . $ `src/asm/mnemo.c:63:9`! (MVALUE_FORCE08cxx . . $ `src/asm/alu.h:35:9`!) |
| 64 | #define MAYBE___2__cxx . . $ `src/asm/mnemo.c:64:9`! (MVALUE_FORCE16cxx . . $ `src/asm/alu.h:33:9`!) |
| 65 | #define MAYBE_1_2__cxx . . $ `src/asm/mnemo.c:65:9`! (MVALUE_FORCE08 | MVALUE_FORCE16) |
| 66 | #define MAYBE_____3cxx . . $ `src/asm/mnemo.c:66:9`! (MVALUE_FORCE24cxx . . $ `src/asm/alu.h:31:9`!) |
| 67 | #define MAYBE_1___3cxx . . $ `src/asm/mnemo.c:67:9`! (MVALUE_FORCE08 | MVALUE_FORCE24) |
| 68 | #define MAYBE___2_3cxx . . $ `src/asm/mnemo.c:68:9`! (MVALUE_FORCE16 | MVALUE_FORCE24) |
| 69 | #define MAYBE_1_2_3cxx . . $ `src/asm/mnemo.c:69:9`! (MVALUE_FORCE08 | MVALUE_FORCE16 | MVALUE_FORCE24) |
| 70 | |
| 71 | // The mnemonics are split up into groups, each group has its own function to |
| 72 | // be dealt with: |
| 73 | // G_IMPLIED Mnemonics using only implied addressing. Byte value = opcode |
| 74 | // G_MAIN The main accumulator stuff (plus PEI) Byte value = table index |
| 75 | // G_MISC Most of the other opcodes Byte value = table index |
| 76 | // G_REL_SHORT The short branch instructions. Byte value = opcode |
| 77 | // G_REL_LONG Mnemonics with 16bit relative addressing. Byte value = opcode |
| 78 | // G_JUMP The jump instructions Byte value = table index |
| 79 | // G_MOVE The "move" commands. Byte value = opcode |
| 80 | enum mnemogroup_tcxx . . $ mnemogroup_t# { |
| 81 | G_IMPLIEDcxx . . $ G_IMPLIED., // only implied addressing |
| 82 | G_MAINcxx . . $ G_MAIN., // main accumulator stuff (plus PEI) |
| 83 | G_MISCcxx . . $ G_MISC., // misc |
| 84 | G_REL_SHORTcxx . . $ G_REL_SHORT., // short relative |
| 85 | G_REL_LONGcxx . . $ G_REL_LONG., // long relative |
| 86 | G_JUMPcxx . . $ G_JUMP., // jump |
| 87 | G_MOVEcxx . . $ G_MOVE. // MVP, MVN |
| 88 | }; |
| 89 | |
| 90 | // save some space |
| 91 | #define SCBcxx . . $ `src/asm/mnemo.c:91:9`! static const unsigned char |
| 92 | #define SCScxx . . $ `src/asm/mnemo.c:92:9`! static const unsigned short |
| 93 | #define SCLcxx . . $ `src/asm/mnemo.c:93:9`! static const unsigned long |
| 94 | |
| 95 | // Code tables for group G_MAIN: |
| 96 | // These tables are used for the main accumulator-related mnemonics. By reading |
| 97 | // the mnemonic's byte value (from the mnemotable), the assembler finds out the |
| 98 | // column to use here. The row depends on the used addressing mode. A zero |
| 99 | // entry in these tables means that the combination of mnemonic and addressing |
| 100 | // mode is illegal. |
| 101 | enumcxx . . $ $anonymous_type_94e727e0d52df1db_0# { IDX_ORAcxx . . $ IDX_ORA., IDX_ANDcxx . . $ IDX_AND., IDX_EORcxx . . $ IDX_EOR., IDX_ADCcxx . . $ IDX_ADC., IDX_STAcxx . . $ IDX_STA., IDX_LDAcxx . . $ IDX_LDA., IDX_CMPcxx . . $ IDX_CMP., IDX_SBCcxx . . $ IDX_SBC., |
| 102 | IDXC_ORAcxx . . $ IDXC_ORA., IDXC_ANDcxx . . $ IDXC_AND., IDXC_EORcxx . . $ IDXC_EOR., IDXC_ADCcxx . . $ IDXC_ADC., IDXC_STAcxx . . $ IDXC_STA., IDXC_LDAcxx . . $ IDXC_LDA., IDXC_CMPcxx . . $ IDXC_CMP., IDXC_SBCcxx . . $ IDXC_SBC., |
| 103 | IDX8_ORAcxx . . $ IDX8_ORA., IDX8_ANDcxx . . $ IDX8_AND., IDX8_EORcxx . . $ IDX8_EOR., IDX8_ADCcxx . . $ IDX8_ADC., IDX8_STAcxx . . $ IDX8_STA., IDX8_LDAcxx . . $ IDX8_LDA., IDX8_CMPcxx . . $ IDX8_CMP., IDX8_SBCcxx . . $ IDX8_SBC., IDX8_PEIcxx . . $ IDX8_PEI., |
| 104 | IDXI_SLOcxx . . $ IDXI_SLO., IDXI_RLAcxx . . $ IDXI_RLA., IDXI_SREcxx . . $ IDXI_SRE., IDXI_RRAcxx . . $ IDXI_RRA., IDXI_SAXcxx . . $ IDXI_SAX., IDXI_LAXcxx . . $ IDXI_LAX., IDXI_DCPcxx . . $ IDXI_DCP., IDXI_ISCcxx . . $ IDXI_ISC.}; |
| 105 | // | 6502 | 65c02 | 65816 | 6510 | |
| 106 | // | ora and eor adc sta lda cmp sbc| ora and eor adc sta lda cmp sbc| ora and eor adc sta lda cmp sbc pei| slo rla sre rra sax lax dcp isc| |
| 107 | SCBcxx . . $ `src/asm/mnemo.c:91:9`! accu_immcxx . . $ accu_imm.[] = { 0x09, 0x29, 0x49, 0x69, 0, 0xa9, 0xc9, 0xe9, 0x09, 0x29, 0x49, 0x69, 0, 0xa9, 0xc9, 0xe9, 0x09, 0x29, 0x49, 0x69, 0, 0xa9, 0xc9, 0xe9, 0, 0, 0, 0, 0, 0, 0, 0, 0};// #$ff/#$ffff |
| 108 | SCBcxx . . $ `src/asm/mnemo.c:91:9`! accu_sabs8cxx . . $ accu_sabs8.[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x03, 0x23, 0x43, 0x63, 0x83, 0xa3, 0xc3, 0xe3, 0, 0, 0, 0, 0, 0, 0, 0, 0};// $ff,s |
| 109 | SCBcxx . . $ `src/asm/mnemo.c:91:9`! accu_xind8cxx . . $ accu_xind8.[] = { 0x01, 0x21, 0x41, 0x61, 0x81, 0xa1, 0xc1, 0xe1, 0x01, 0x21, 0x41, 0x61, 0x81, 0xa1, 0xc1, 0xe1, 0x01, 0x21, 0x41, 0x61, 0x81, 0xa1, 0xc1, 0xe1, 0, 0x03, 0x23, 0x43, 0x63, 0x83, 0xa3, 0xc3, 0xe3};// ($ff,x) |
| 110 | SCBcxx . . $ `src/asm/mnemo.c:91:9`! accu_sindy8cxx . . $ accu_sindy8.[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x13, 0x33, 0x53, 0x73, 0x93, 0xb3, 0xd3, 0xf3, 0, 0, 0, 0, 0, 0, 0, 0, 0};// ($ff,s),y |
| 111 | SCBcxx . . $ `src/asm/mnemo.c:91:9`! accu_ind8cxx . . $ accu_ind8.[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0x12, 0x32, 0x52, 0x72, 0x92, 0xb2, 0xd2, 0xf2, 0x12, 0x32, 0x52, 0x72, 0x92, 0xb2, 0xd2, 0xf2,0xd4, 0, 0, 0, 0, 0, 0, 0, 0};// ($ff) |
| 112 | SCBcxx . . $ `src/asm/mnemo.c:91:9`! accu_indy8cxx . . $ accu_indy8.[] = { 0x11, 0x31, 0x51, 0x71, 0x91, 0xb1, 0xd1, 0xf1, 0x11, 0x31, 0x51, 0x71, 0x91, 0xb1, 0xd1, 0xf1, 0x11, 0x31, 0x51, 0x71, 0x91, 0xb1, 0xd1, 0xf1, 0, 0x13, 0x33, 0x53, 0x73, 0, 0xb3, 0xd3, 0xf3};// ($ff),y |
| 113 | SCBcxx . . $ `src/asm/mnemo.c:91:9`! accu_lind8cxx . . $ accu_lind8.[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x07, 0x27, 0x47, 0x67, 0x87, 0xa7, 0xc7, 0xe7, 0, 0, 0, 0, 0, 0, 0, 0, 0};// [$ff] |
| 114 | SCBcxx . . $ `src/asm/mnemo.c:91:9`! accu_lindy8cxx . . $ accu_lindy8.[] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x17, 0x37, 0x57, 0x77, 0x97, 0xb7, 0xd7, 0xf7, 0, 0, 0, 0, 0, 0, 0, 0, 0};// [$ff],y |
| 115 | SCLcxx . . $ `src/asm/mnemo.c:93:9`! accu_abscxx . . $ accu_abs.[] = {0x0d05,0x2d25,0x4d45,0x6d65,0x8d85,0xada5,0xcdc5,0xede5,0x0d05,0x2d25,0x4d45,0x6d65,0x8d85,0xada5,0xcdc5,0xede5,0x0f0d05,0x2f2d25,0x4f4d45,0x6f6d65,0x8f8d85,0xafada5,0xcfcdc5,0xefede5, 0,0x0f07,0x2f27,0x4f47,0x6f67,0x8f87,0xafa7,0xcfc7,0xefe7};// $ff /$ffff /$ffffff |
| 116 | SCLcxx . . $ `src/asm/mnemo.c:93:9`! accu_xabscxx . . $ accu_xabs.[] = {0x1d15,0x3d35,0x5d55,0x7d75,0x9d95,0xbdb5,0xddd5,0xfdf5,0x1d15,0x3d35,0x5d55,0x7d75,0x9d95,0xbdb5,0xddd5,0xfdf5,0x1f1d15,0x3f3d35,0x5f5d55,0x7f7d75,0x9f9d95,0xbfbdb5,0xdfddd5,0xfffdf5, 0,0x1f17,0x3f37,0x5f57,0x7f77, 0, 0,0xdfd7,0xfff7};// $ff,x/$ffff,x/$ffffff,x |
| 117 | SCScxx . . $ `src/asm/mnemo.c:92:9`! accu_yabscxx . . $ accu_yabs.[] = {0x1900,0x3900,0x5900,0x7900,0x9900,0xb900,0xd900,0xf900,0x1900,0x3900,0x5900,0x7900,0x9900,0xb900,0xd900,0xf900, 0x1900, 0x3900, 0x5900, 0x7900, 0x9900, 0xb900, 0xd900, 0xf900, 0,0x1b00,0x3b00,0x5b00,0x7b00, 0x97,0xbfb7,0xdb00,0xfb00};// $ff,y/$ffff,y |
| 118 | |
| 119 | // Code tables for group G_MISC: |
| 120 | // These tables are needed for finding out the correct code in cases when |
| 121 | // there are no general rules. By reading the mnemonic's byte value (from the |
| 122 | // mnemotable), the assembler finds out the column to use here. The row |
| 123 | // depends on the used addressing mode. A zero entry in these tables means |
| 124 | // that the combination of mnemonic and addressing mode is illegal. |
| 125 | enumcxx . . $ $anonymous_type_94e727e0d52df1db_1# { IDX_BITcxx . . $ IDX_BIT., IDX_ASLcxx . . $ IDX_ASL., IDX_ROLcxx . . $ IDX_ROL., IDX_LSRcxx . . $ IDX_LSR., IDX_RORcxx . . $ IDX_ROR., IDX_STYcxx . . $ IDX_STY., IDX_STXcxx . . $ IDX_STX., |
| 126 | IDX_LDYcxx . . $ IDX_LDY., IDX_LDXcxx . . $ IDX_LDX., IDX_CPYcxx . . $ IDX_CPY., IDX_CPXcxx . . $ IDX_CPX., IDX_DECcxx . . $ IDX_DEC., IDX_INCcxx . . $ IDX_INC., |
| 127 | IDXC_TSBcxx . . $ IDXC_TSB., IDXC_TRBcxx . . $ IDXC_TRB., IDXC_BITcxx . . $ IDXC_BIT., IDXC_DECcxx . . $ IDXC_DEC., IDXC_INCcxx . . $ IDXC_INC., IDXC_STZcxx . . $ IDXC_STZ., |
| 128 | IDX8_COPcxx . . $ IDX8_COP., IDX8_REPcxx . . $ IDX8_REP., IDX8_SEPcxx . . $ IDX8_SEP., IDX8_PEAcxx . . $ IDX8_PEA., |
| 129 | IDXI_ANCcxx . . $ IDXI_ANC., IDXI_ASRcxx . . $ IDXI_ASR., IDXI_ARRcxx . . $ IDXI_ARR., IDXI_SBXcxx . . $ IDXI_SBX., IDXI_DOPcxx . . $ IDXI_DOP., IDXI_TOPcxx . . $ IDXI_TOP., IDXI_JAMcxx . . $ IDXI_JAM.}; |
| 130 | // | 6502 | 65c02 | 65816 | 6510 | |
| 131 | // | bit asl rol lsr ror sty stx ldy ldx cpy cpx dec inc| tsb trb bit dec inc stz| cop rep sep pea| anc asr arr sbx dop top jam| |
| 132 | SCBcxx . . $ `src/asm/mnemo.c:91:9`! misc_implcxx . . $ misc_impl.[] = { 0, 0x0a, 0x2a, 0x4a, 0x6a, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x3a, 0x1a, 0, 0, 0, 0, 0, 0, 0, 0, 0,0x80, 0x0c,0x02};// implied/accu |
| 133 | SCBcxx . . $ `src/asm/mnemo.c:91:9`! misc_immcxx . . $ misc_imm.[] = { 0, 0, 0, 0, 0, 0, 0, 0xa0, 0xa2, 0xc0, 0xe0, 0, 0, 0, 0, 0x89, 0, 0, 0, 0,0xc2,0xe2, 0,0x2b,0x4b,0x6b,0xcb,0x80, 0, 0};// #$ff |
| 134 | SCScxx . . $ `src/asm/mnemo.c:92:9`! misc_abscxx . . $ misc_abs.[] = {0x2c24,0x0e06,0x2e26,0x4e46,0x6e66,0x8c84,0x8e86,0xaca4,0xaea6,0xccc4,0xece4,0xcec6,0xeee6,0x0c04,0x1c14,0x2c24,0xcec6,0xeee6,0x9c64,0x02, 0, 0,0xf400, 0, 0, 0, 0,0x04,0x0c00, 0};// $ff/$ffff |
| 135 | SCScxx . . $ `src/asm/mnemo.c:92:9`! misc_xabscxx . . $ misc_xabs.[] = { 0,0x1e16,0x3e36,0x5e56,0x7e76, 0x94, 0,0xbcb4, 0, 0, 0,0xded6,0xfef6, 0, 0,0x3c34,0xded6,0xfef6,0x9e74, 0, 0, 0, 0, 0, 0, 0, 0,0x14,0x1c00, 0};// $ff,x/$ffff,x |
| 136 | SCScxx . . $ `src/asm/mnemo.c:92:9`! misc_yabscxx . . $ misc_yabs.[] = { 0, 0, 0, 0, 0, 0, 0x96, 0,0xbeb6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};// $ff,y/$ffff,y |
| 137 | |
| 138 | // Code tables for group G_JUMP: |
| 139 | // |
| 140 | // These tables are needed for finding out the correct code when the mnemonic |
| 141 | // is "jmp" or "jsr" (or the long versions "jml" and "jsl"). |
| 142 | // By reading the mnemonic's byte value (from the mnemotable), the assembler |
| 143 | // finds out the column to use here. The row depends on the used addressing |
| 144 | // mode. A zero entry in these tables means that the combination of mnemonic |
| 145 | // and addressing mode is illegal. |
| 146 | enumcxx . . $ $anonymous_type_94e727e0d52df1db_2# { IDX_JMPcxx . . $ IDX_JMP., IDX_JSRcxx . . $ IDX_JSR., IDXC_JMPcxx . . $ IDXC_JMP., IDX8_JMPcxx . . $ IDX8_JMP., IDX8_JMLcxx . . $ IDX8_JML., IDX8_JSRcxx . . $ IDX8_JSR., IDX8_JSLcxx . . $ IDX8_JSL.}; |
| 147 | // | 6502 | 65c02| 65816 | |
| 148 | // | jmp jsr | jmp | jmp jml jsr jsl | |
| 149 | SCLcxx . . $ `src/asm/mnemo.c:93:9`! jump_abscxx . . $ jump_abs.[] = {0x4c00,0x2000,0x4c00,0x5c4c00,0x5c0000,0x222000,0x220000};// $ffff/$ffffff |
| 150 | SCScxx . . $ `src/asm/mnemo.c:92:9`! jump_indcxx . . $ jump_ind.[] = {0x6c00, 0,0x6c00, 0x6c00, 0, 0, 0};// ($ffff) |
| 151 | SCScxx . . $ `src/asm/mnemo.c:92:9`! jump_xindcxx . . $ jump_xind.[] = { 0, 0,0x7c00, 0x7c00, 0, 0xfc00, 0};// ($ffff,x) |
| 152 | SCScxx . . $ `src/asm/mnemo.c:92:9`! jump_lindcxx . . $ jump_lind.[] = { 0, 0, 0, 0xdc00, 0xdc00, 0, 0};// [$ffff] |
| 153 | |
| 154 | #undef SCBcxx . . $ `src/asm/mnemo.c:91:9`! |
| 155 | #undef SCScxx . . $ `src/asm/mnemo.c:92:9`! |
| 156 | #undef SCLcxx . . $ `src/asm/mnemo.c:93:9`! |
| 157 | |
| 158 | // error message strings |
| 159 | static const char exception_illegal_combinationcxx . . $ exception_illegal_combination.[] = "Illegal combination of command and addressing mode."; |
| 160 | static const char exception_highbyte_zerocxx . . $ exception_highbyte_zero.[]= "Using oversized addressing mode."; |
| 161 | static const char exception_too_farcxx . . $ exception_too_far.[] = "Target out of range."; |
| 162 | |
| 163 | |
| 164 | // Variables |
| 165 | |
| 166 | static dynabuf_tcxx . . $ dynabuf_t#* mnemo_dyna_bufcxx . . $ mnemo_dyna_buf.; // dynamic buffer for mnemonics |
| 167 | // predefined stuff |
| 168 | static node_tcxx . . $ node_t#* mnemo_6502_treecxx . . $ mnemo_6502_tree. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;// holds 6502 mnemonics |
| 169 | static node_tcxx . . $ node_t#* mnemo_6510_treecxx . . $ mnemo_6510_tree. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;// holds 6510 extensions |
| 170 | static node_tcxx . . $ node_t#* mnemo_65c02_treecxx . . $ mnemo_65c02_tree.= NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;// holds 65c02 extensions |
| 171 | //static node_t* mnemo_Rockwell65c02_tree = NULL;// Rockwell |
| 172 | static node_tcxx . . $ node_t#* mnemo_WDC65c02_treecxx . . $ mnemo_WDC65c02_tree. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;// WDC's "stp"/"wai" |
| 173 | static node_tcxx . . $ node_t#* mnemo_65816_treecxx . . $ mnemo_65816_tree. = NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!;// holds 65816 extensions |
| 174 | |
| 175 | // Command's code and group values are stored together in a single integer. |
| 176 | // To extract the code, use "& CODEMASK". |
| 177 | // To extract the group, use ">> GROUPSHIFT" |
| 178 | #define CODEMASKcxx . . $ `src/asm/mnemo.c:178:9`! 0xff // opcode or table index |
| 179 | #define FLAGSMASKcxx . . $ `src/asm/mnemo.c:179:9`! 0x300 // flags concerning immediate addressing: |
| 180 | #define IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`! 0x100 // ...depends on accumulator length |
| 181 | #define IMM_IDXcxx . . $ `src/asm/mnemo.c:181:9`! 0x200 // ...depends on index register length |
| 182 | #define GROUPSHIFTcxx . . $ `src/asm/mnemo.c:182:9`! 10 // shift right by this to extract group |
| 183 | #define MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(g, v) ((g << GROUPSHIFTcxx . . $ `src/asm/mnemo.c:182:9`!) | v) |
| 184 | |
| 185 | static node_tcxx . . $ node_t# mnemos_6502cxx . . $ mnemos_6502.[] = { |
| 186 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("ora", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDX_ORA | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 187 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!(s_and, MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDX_AND | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 188 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!(s_eor, MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDX_EOR | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 189 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("adc", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDX_ADC | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 190 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("sta", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDX_STA)), |
| 191 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("lda", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDX_LDA | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 192 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("cmp", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDX_CMP | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 193 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("sbc", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDX_SBC | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 194 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("bit", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDX_BIT | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 195 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!(s_asl, MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDX_ASL)), |
| 196 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("rol", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDX_ROL)), |
| 197 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!(s_lsr, MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDX_LSR)), |
| 198 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!(s_rorcxx . . $ `src/asm/mnemo.c:19:9`!, MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDX_ROR)), |
| 199 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("sty", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDX_STY)), |
| 200 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("stx", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDX_STX)), |
| 201 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("ldy", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDX_LDY | IMM_IDXcxx . . $ `src/asm/mnemo.c:181:9`!)), |
| 202 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("ldx", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDX_LDX | IMM_IDXcxx . . $ `src/asm/mnemo.c:181:9`!)), |
| 203 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("cpy", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDX_CPY | IMM_IDXcxx . . $ `src/asm/mnemo.c:181:9`!)), |
| 204 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("cpx", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDX_CPX | IMM_IDXcxx . . $ `src/asm/mnemo.c:181:9`!)), |
| 205 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("dec", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDX_DEC)), |
| 206 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("inc", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDX_INC)), |
| 207 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("bpl", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_REL_SHORT , 16)), |
| 208 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("bmi", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_REL_SHORT , 48)), |
| 209 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("bvc", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_REL_SHORT , 80)), |
| 210 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("bvs", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_REL_SHORT , 112)), |
| 211 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("bcc", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_REL_SHORT , 144)), |
| 212 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("bcs", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_REL_SHORT , 176)), |
| 213 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("bne", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_REL_SHORT , 208)), |
| 214 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("beq", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_REL_SHORT , 240)), |
| 215 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("jmp", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_JUMP , IDX_JMP)), |
| 216 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("jsr", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_JUMP , IDX_JSR)), |
| 217 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("brk", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 0)), |
| 218 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("php", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 8)), |
| 219 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("clc", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 24)), |
| 220 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("plp", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 40)), |
| 221 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("sec", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 56)), |
| 222 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("rti", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 64)), |
| 223 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("pha", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 72)), |
| 224 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("cli", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 88)), |
| 225 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("rts", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 96)), |
| 226 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("pla", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 104)), |
| 227 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("sei", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 120)), |
| 228 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("dey", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 136)), |
| 229 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("txa", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 138)), |
| 230 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("tya", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 152)), |
| 231 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("txs", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 154)), |
| 232 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("tay", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 168)), |
| 233 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("tax", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 170)), |
| 234 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("clv", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 184)), |
| 235 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("tsx", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 186)), |
| 236 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("iny", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 200)), |
| 237 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("dex", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 202)), |
| 238 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("cld", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 216)), |
| 239 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("inx", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 232)), |
| 240 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("nop", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 234)), |
| 241 | PREDEFLASTcxx . . $ `src/asm/tree.h:16:9`!("sed", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 248)), |
| 242 | // ^^^^ this marks the last element |
| 243 | }; |
| 244 | |
| 245 | static node_tcxx . . $ node_t# mnemos_6510cxx . . $ mnemos_6510.[] = { |
| 246 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("slo", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN, IDXI_SLO)),// ASL+ORA, ASO |
| 247 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("rla", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN, IDXI_RLA)),// ROL+AND |
| 248 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("sre", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN, IDXI_SRE)),// LSR+EOR, LSE |
| 249 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("rra", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN, IDXI_RRA)),// ROR+ADC |
| 250 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("sax", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN, IDXI_SAX)),// STX+STA, AAX, AXS |
| 251 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("lax", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN, IDXI_LAX)),// LDX+LDA |
| 252 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("dcp", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN, IDXI_DCP)),// DEC+CMP, DCM |
| 253 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("isc", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN, IDXI_ISC)),// INC+SBC, ISB, INS |
| 254 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("anc", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC, IDXI_ANC)),// ROL+AND, ASL+ORA, AAC |
| 255 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!(s_asr, MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC, IDXI_ASR)),// LSR+EOR, ALR |
| 256 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("arr", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC, IDXI_ARR)),// ROR+ADC |
| 257 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("sbx", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC, IDXI_SBX)),// DEX+CMP, AXS, SAX |
| 258 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("dop", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC, IDXI_DOP)),// skip next byte |
| 259 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("top", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC, IDXI_TOP)),// skip next two bytes |
| 260 | PREDEFLASTcxx . . $ `src/asm/tree.h:16:9`!("jam", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC, IDXI_JAM)),// jam/crash/halt/kill |
| 261 | // ^^^^ this marks the last element |
| 262 | }; |
| 263 | |
| 264 | static node_tcxx . . $ node_t# mnemos_65c02cxx . . $ mnemos_65c02.[] = { |
| 265 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("ora", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDXC_ORA | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 266 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!(s_and, MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDXC_AND | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 267 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!(s_eor, MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDXC_EOR | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 268 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("adc", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDXC_ADC | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 269 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("sta", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDXC_STA)), |
| 270 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("lda", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDXC_LDA | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 271 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("cmp", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDXC_CMP | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 272 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("sbc", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDXC_SBC | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 273 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("jmp", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_JUMP , IDXC_JMP)), |
| 274 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("bit", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDXC_BIT | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 275 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("dec", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDXC_DEC)), |
| 276 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("inc", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDXC_INC)), |
| 277 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("bra", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_REL_SHORT , 128)), |
| 278 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("phy", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 90)), |
| 279 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("ply", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 122)), |
| 280 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("phx", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 218)), |
| 281 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("plx", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 250)), |
| 282 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("tsb", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDXC_TSB)), |
| 283 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("trb", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDXC_TRB)), |
| 284 | PREDEFLASTcxx . . $ `src/asm/tree.h:16:9`!("stz", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDXC_STZ)), |
| 285 | // ^^^^ this marks the last element |
| 286 | }; |
| 287 | |
| 288 | //static node_t mnemos_Rockwell65c02[] = { |
| 289 | // PREDEFNODE("rmb0", MERGE(G_ , 0x07)), |
| 290 | // PREDEFNODE("rmb1", MERGE(G_ , 0x17)), |
| 291 | // PREDEFNODE("rmb2", MERGE(G_ , 0x27)), |
| 292 | // PREDEFNODE("rmb3", MERGE(G_ , 0x37)), |
| 293 | // PREDEFNODE("rmb4", MERGE(G_ , 0x47)), |
| 294 | // PREDEFNODE("rmb5", MERGE(G_ , 0x57)), |
| 295 | // PREDEFNODE("rmb6", MERGE(G_ , 0x67)), |
| 296 | // PREDEFNODE("rmb7", MERGE(G_ , 0x77)), |
| 297 | // PREDEFNODE("smb0", MERGE(G_ , 0x87)), |
| 298 | // PREDEFNODE("smb1", MERGE(G_ , 0x97)), |
| 299 | // PREDEFNODE("smb2", MERGE(G_ , 0xa7)), |
| 300 | // PREDEFNODE("smb3", MERGE(G_ , 0xb7)), |
| 301 | // PREDEFNODE("smb4", MERGE(G_ , 0xc7)), |
| 302 | // PREDEFNODE("smb5", MERGE(G_ , 0xd7)), |
| 303 | // PREDEFNODE("smb6", MERGE(G_ , 0xe7)), |
| 304 | // PREDEFNODE("smb7", MERGE(G_ , 0xf7)), |
| 305 | // PREDEFNODE("bbr0", MERGE(G_ , 0x0f)), |
| 306 | // PREDEFNODE("bbr1", MERGE(G_ , 0x1f)), |
| 307 | // PREDEFNODE("bbr2", MERGE(G_ , 0x2f)), |
| 308 | // PREDEFNODE("bbr3", MERGE(G_ , 0x3f)), |
| 309 | // PREDEFNODE("bbr4", MERGE(G_ , 0x4f)), |
| 310 | // PREDEFNODE("bbr5", MERGE(G_ , 0x5f)), |
| 311 | // PREDEFNODE("bbr6", MERGE(G_ , 0x6f)), |
| 312 | // PREDEFNODE("bbr7", MERGE(G_ , 0x7f)), |
| 313 | // PREDEFNODE("bbs0", MERGE(G_ , 0x8f)), |
| 314 | // PREDEFNODE("bbs1", MERGE(G_ , 0x9f)), |
| 315 | // PREDEFNODE("bbs2", MERGE(G_ , 0xaf)), |
| 316 | // PREDEFNODE("bbs3", MERGE(G_ , 0xbf)), |
| 317 | // PREDEFNODE("bbs4", MERGE(G_ , 0xcf)), |
| 318 | // PREDEFNODE("bbs5", MERGE(G_ , 0xdf)), |
| 319 | // PREDEFNODE("bbs6", MERGE(G_ , 0xef)), |
| 320 | // PREDEFLAST("bbs7", MERGE(G_ , 0xff)), |
| 321 | // // ^^^^ this marks the last element |
| 322 | //}; |
| 323 | |
| 324 | static node_tcxx . . $ node_t# mnemos_WDC65c02cxx . . $ mnemos_WDC65c02.[] = { |
| 325 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("stp", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 219)), |
| 326 | PREDEFLASTcxx . . $ `src/asm/tree.h:16:9`!("wai", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 203)), |
| 327 | // ^^^^ this marks the last element |
| 328 | }; |
| 329 | |
| 330 | static node_tcxx . . $ node_t# mnemos_65816cxx . . $ mnemos_65816.[] = { |
| 331 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("ora", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDX8_ORA | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 332 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!(s_and, MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDX8_AND | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 333 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!(s_eor, MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDX8_EOR | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 334 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("adc", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDX8_ADC | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 335 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("sta", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDX8_STA)), |
| 336 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("lda", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDX8_LDA | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 337 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("cmp", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDX8_CMP | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 338 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("sbc", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDX8_SBC | IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!)), |
| 339 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("pei", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MAIN , IDX8_PEI)), |
| 340 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("jmp", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_JUMP , IDX8_JMP)), |
| 341 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("jsr", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_JUMP , IDX8_JSR)), |
| 342 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("jml", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_JUMP , IDX8_JML)), |
| 343 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("jsl", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_JUMP , IDX8_JSL)), |
| 344 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("mvp", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MOVE , 0x44)), |
| 345 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("mvn", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MOVE , 0x54)), |
| 346 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("per", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_REL_LONG , 98)), |
| 347 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!(s_brl, MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_REL_LONG , 130)), |
| 348 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("cop", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDX8_COP)), |
| 349 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("rep", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDX8_REP)), |
| 350 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("sep", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDX8_SEP)), |
| 351 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("pea", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_MISC , IDX8_PEA)), |
| 352 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("phd", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 11)), |
| 353 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("tcs", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 27)), |
| 354 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("pld", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 43)), |
| 355 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("tsc", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 59)), |
| 356 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("wdm", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 66)), |
| 357 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("phk", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 75)), |
| 358 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("tcd", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 91)), |
| 359 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("rtl", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 107)), |
| 360 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("tdc", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 123)), |
| 361 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("phb", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 139)), |
| 362 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("txy", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 155)), |
| 363 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("plb", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 171)), |
| 364 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("tyx", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 187)), |
| 365 | PREDEFNODEcxx . . $ `src/asm/tree.h:15:9`!("xba", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 235)), |
| 366 | PREDEFLASTcxx . . $ `src/asm/tree.h:16:9`!("xce", MERGEcxx . . $ `src/asm/mnemo.c:183:9`!(G_IMPLIED , 251)), |
| 367 | // ^^^^ this marks the last element |
| 368 | }; |
| 369 | |
| 370 | |
| 371 | // Functions |
| 372 | |
| 373 | // create dynamic buffer, build keyword trees |
| 374 | void Mnemo_initcxx . . $ Mnemo_init(49f6e7a06ebc5aa8).(void) { |
| 375 | mnemo_dyna_bufcxx . . $ mnemo_dyna_buf. = DynaBuf_createcxx . . $ DynaBuf_create(139370366a5bf8f7).(MNEMO_DYNABUF_INITIALSIZEcxx . . $ `src/asm/mnemo.c:20:9`!); |
| 376 | Tree_add_tablecxx . . $ Tree_add_table(90ba9e887489f1c).(&mnemo_6502_treecxx . . $ mnemo_6502_tree., mnemos_6502cxx . . $ mnemos_6502.); |
| 377 | Tree_add_tablecxx . . $ Tree_add_table(90ba9e887489f1c).(&mnemo_6510_treecxx . . $ mnemo_6510_tree., mnemos_6510cxx . . $ mnemos_6510.); |
| 378 | Tree_add_tablecxx . . $ Tree_add_table(90ba9e887489f1c).(&mnemo_65c02_treecxx . . $ mnemo_65c02_tree., mnemos_65c02cxx . . $ mnemos_65c02.); |
| 379 | // Tree_add_table(&mnemo_Rockwell65c02_tree, mnemos_Rockwell65c02); |
| 380 | Tree_add_tablecxx . . $ Tree_add_table(90ba9e887489f1c).(&mnemo_WDC65c02_treecxx . . $ mnemo_WDC65c02_tree., mnemos_WDC65c02cxx . . $ mnemos_WDC65c02.); |
| 381 | Tree_add_tablecxx . . $ Tree_add_table(90ba9e887489f1c).(&mnemo_65816_treecxx . . $ mnemo_65816_tree., mnemos_65816cxx . . $ mnemos_65816.); |
| 382 | } |
| 383 | |
| 384 | |
| 385 | // Address mode parsing |
| 386 | |
| 387 | // Utility function for parsing indices. |
| 388 | static int get_indexcxx . . $ get_index(73da94e76e6bd037).(boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! next) { |
| 389 | int addressing_mode = HAM__cxx . . $ `src/asm/mnemo.c:38:9`!; |
| 390 | |
| 391 | if(next) |
| 392 | GetBytecxx . . $ GetByte(6e9c618e4dd2eafc).(); |
| 393 | if(!Input_accept_commacxx . . $ Input_accept_comma(c9857a73d68e59ba).()) |
| 394 | return(addressing_mode); |
| 395 | switch(GotBytecxx . . $ GotByte.) { |
| 396 | |
| 397 | case 's': |
| 398 | case 'S': |
| 399 | addressing_mode = HAM_Scxx . . $ `src/asm/mnemo.c:39:9`!; |
| 400 | break; |
| 401 | |
| 402 | case 'x': |
| 403 | case 'X': |
| 404 | addressing_mode = HAM_Xcxx . . $ `src/asm/mnemo.c:40:9`!; |
| 405 | break; |
| 406 | |
| 407 | case 'y': |
| 408 | case 'Y': |
| 409 | addressing_mode = HAM_Ycxx . . $ `src/asm/mnemo.c:41:9`!; |
| 410 | break; |
| 411 | |
| 412 | default: |
| 413 | Throw_errorcxx . . $ Throw_error(85c52e162fed56f9).(exception_syntaxcxx . . $ exception_syntax.); |
| 414 | |
| 415 | } |
| 416 | if(addressing_mode != HAM__cxx . . $ `src/asm/mnemo.c:38:9`!) |
| 417 | NEXTANDSKIPSPACEcxx . . $ `src/asm/global.h:76:9`!(); |
| 418 | return(addressing_mode); |
| 419 | } |
| 420 | |
| 421 | // This function stores the command's argument in the given result_int_t |
| 422 | // structure (using the valueparser). The addressing mode is returned. |
| 423 | static int get_argumentcxx . . $ get_argument(ee210d144587f61c).(result_int_tcxx . . $ result_int_t#* result) { |
| 424 | int open_paren, |
| 425 | addressing_mode = HAM_ABScxx . . $ `src/asm/mnemo.c:46:9`!; |
| 426 | |
| 427 | SKIPSPACEcxx . . $ `src/asm/global.h:75:9`!(); |
| 428 | switch(GotBytecxx . . $ GotByte.) { |
| 429 | |
| 430 | case '[': |
| 431 | GetBytecxx . . $ GetByte(6e9c618e4dd2eafc).();// proceed with next char |
| 432 | ALU_int_resultcxx . . $ ALU_int_result(1ba379088691677b).(result); |
| 433 | if(GotBytecxx . . $ GotByte. == ']') |
| 434 | addressing_mode |= HAM_LINDcxx . . $ `src/asm/mnemo.c:54:9`! | get_indexcxx . . $ get_index(73da94e76e6bd037).(TRUEcxx . . $ `src/asm/config.h:55:9`!); |
| 435 | else |
| 436 | Throw_errorcxx . . $ Throw_error(85c52e162fed56f9).(exception_syntaxcxx . . $ exception_syntax.); |
| 437 | break; |
| 438 | |
| 439 | case '#': |
| 440 | GetBytecxx . . $ GetByte(6e9c618e4dd2eafc).();// proceed with next char |
| 441 | addressing_mode |= HAM_IMMcxx . . $ `src/asm/mnemo.c:45:9`!; |
| 442 | ALU_int_resultcxx . . $ ALU_int_result(1ba379088691677b).(result); |
| 443 | break; |
| 444 | |
| 445 | default: |
| 446 | // liberal, to allow for "(...," |
| 447 | open_paren = ALU_liberal_intcxx . . $ ALU_liberal_int(ee210d144587f61c).(result); |
| 448 | // check for implied addressing |
| 449 | if((result->flagscxx . . $ result_int_t#flags. & MVALUE_EXISTScxx . . $ `src/asm/alu.h:20:9`!) == 0) |
| 450 | addressing_mode |= HAM_IMPcxx . . $ `src/asm/mnemo.c:44:9`!; |
| 451 | // check for indirect addressing |
| 452 | if(result->flagscxx . . $ result_int_t#flags. & MVALUE_INDIRECTcxx . . $ `src/asm/alu.h:18:9`!) |
| 453 | addressing_mode |= HAM_INDcxx . . $ `src/asm/mnemo.c:50:9`!; |
| 454 | // check for internal index (before closing parenthesis) |
| 455 | if(open_paren) { |
| 456 | // in case there are still open parentheses, |
| 457 | // read internal index |
| 458 | addressing_mode |= (get_indexcxx . . $ get_index(73da94e76e6bd037).(FALSEcxx . . $ `src/asm/config.h:54:9`!) << 2); |
| 459 | if(GotBytecxx . . $ GotByte. == ')') |
| 460 | GetBytecxx . . $ GetByte(6e9c618e4dd2eafc).();// go on with next char |
| 461 | else |
| 462 | Throw_errorcxx . . $ Throw_error(85c52e162fed56f9).(exception_syntaxcxx . . $ exception_syntax.); |
| 463 | } |
| 464 | // check for external index (after closing parenthesis) |
| 465 | addressing_mode |= get_indexcxx . . $ get_index(73da94e76e6bd037).(FALSEcxx . . $ `src/asm/config.h:54:9`!); |
| 466 | break; |
| 467 | |
| 468 | } |
| 469 | // ensure end of line |
| 470 | Input_ensure_EOScxx . . $ Input_ensure_EOS(49f6e7a06ebc5aa8).(); |
| 471 | //printf("AM: %x\n", addressing_mode); |
| 472 | return(addressing_mode); |
| 473 | } |
| 474 | |
| 475 | // Helper function for calc_arg_size() |
| 476 | // Only call with "size_bit = MVALUE_FORCE16" or "size_bit = MVALUE_FORCE24" |
| 477 | static int check_oversizecxx . . $ check_oversize(86b284291be3c06e).(int size_bit, result_int_tcxx . . $ result_int_t#* argument) { |
| 478 | // only check if value is *defined* |
| 479 | if((argument->flagscxx . . $ result_int_t#flags. & MVALUE_DEFINEDcxx . . $ `src/asm/alu.h:27:9`!) == 0) |
| 480 | return(size_bit);// pass on result |
| 481 | |
| 482 | // value is defined, so check |
| 483 | if(size_bit == MVALUE_FORCE16cxx . . $ `src/asm/alu.h:33:9`!) { |
| 484 | // check 16-bit argument for high byte zero |
| 485 | if((argument->intvalcxx . . $ result_int_t#intval. <= 255) && (argument->intvalcxx . . $ result_int_t#intval. >= -128)) |
| 486 | Throw_warningcxx . . $ Throw_warning(85c52e162fed56f9).(exception_highbyte_zerocxx . . $ exception_highbyte_zero.); |
| 487 | } else |
| 488 | // check 24-bit argument for bank byte zero |
| 489 | if((argument->intvalcxx . . $ result_int_t#intval. <= 65535) && (argument->intvalcxx . . $ result_int_t#intval. >= -32768)) |
| 490 | Throw_warningcxx . . $ Throw_warning(85c52e162fed56f9).(exception_highbyte_zerocxx . . $ exception_highbyte_zero.); |
| 491 | return(size_bit);// pass on result |
| 492 | } |
| 493 | |
| 494 | // Utility function for comparing force bits, argument value, argument size, |
| 495 | // "unsure"-flag and possible addressing modes. Returns force bit matching |
| 496 | // number of parameter bytes to send. If it returns zero, an error occurred |
| 497 | // (and has already been delivered). |
| 498 | // force_bit none, 8b, 16b, 24b |
| 499 | // argument value and flags of parameter |
| 500 | // addressing_modes adressing modes (8b, 16b, 24b or any combination) |
| 501 | // Return value = force bit for number of parameter bytes to send (0 = error) |
| 502 | static int calc_arg_sizecxx . . $ calc_arg_size(b3049405226bd830).(int force_bit, result_int_tcxx . . $ result_int_t#* argument, int addressing_modes) { |
| 503 | // If there are no possible addressing modes, complain |
| 504 | if(addressing_modes == MAYBE______cxx . . $ `src/asm/mnemo.c:62:9`!) { |
| 505 | Throw_errorcxx . . $ Throw_error(85c52e162fed56f9).(exception_illegal_combinationcxx . . $ exception_illegal_combination.); |
| 506 | return(0); |
| 507 | } |
| 508 | // If command has force bit, act upon it |
| 509 | if(force_bit) { |
| 510 | // If command allows this force bit, return it |
| 511 | if(addressing_modes & force_bit) |
| 512 | return(force_bit); |
| 513 | // If not, complain |
| 514 | Throw_errorcxx . . $ Throw_error(85c52e162fed56f9).("Illegal combination of command and postfix."); |
| 515 | return(0); |
| 516 | } |
| 517 | // Command has no force bit. Check whether value has one |
| 518 | // If value has force bit, act upon it |
| 519 | if(argument->flagscxx . . $ result_int_t#flags. & MVALUE_FORCEBITScxx . . $ `src/asm/alu.h:37:9`!) { |
| 520 | // Value has force bit set, so return this or bigger size |
| 521 | if(MVALUE_FORCE08cxx . . $ `src/asm/alu.h:35:9`! & addressing_modes & argument->flagscxx . . $ result_int_t#flags.) |
| 522 | return(MVALUE_FORCE08cxx . . $ `src/asm/alu.h:35:9`!); |
| 523 | if(MVALUE_FORCE16cxx . . $ `src/asm/alu.h:33:9`! & addressing_modes & argument->flagscxx . . $ result_int_t#flags.) |
| 524 | return(MVALUE_FORCE16cxx . . $ `src/asm/alu.h:33:9`!); |
| 525 | if(MVALUE_FORCE24cxx . . $ `src/asm/alu.h:31:9`! & addressing_modes) |
| 526 | return(MVALUE_FORCE24cxx . . $ `src/asm/alu.h:31:9`!); |
| 527 | Throw_errorcxx . . $ Throw_error(85c52e162fed56f9).(exception_number_out_of_rangecxx . . $ exception_number_out_of_range.);// else error |
| 528 | return(0); |
| 529 | } |
| 530 | // Value has no force bit. Check whether there's only one addr mode |
| 531 | // If only one addressing mode, use that |
| 532 | if((addressing_modes == MVALUE_FORCE08cxx . . $ `src/asm/alu.h:35:9`!) |
| 533 | || (addressing_modes == MVALUE_FORCE16cxx . . $ `src/asm/alu.h:33:9`!) |
| 534 | || (addressing_modes == MVALUE_FORCE24cxx . . $ `src/asm/alu.h:31:9`!)) |
| 535 | return(addressing_modes);// There's only one, so use it |
| 536 | // There's more than one addressing mode. Check whether value is sure |
| 537 | // If value is unsure, use default size |
| 538 | if(argument->flagscxx . . $ result_int_t#flags. & MVALUE_UNSUREcxx . . $ `src/asm/alu.h:22:9`!) { |
| 539 | // If there is an 8-bit addressing mode *and* the value |
| 540 | // is sure to fit into 8 bits, use the 8-bit mode |
| 541 | if((addressing_modes & MVALUE_FORCE08cxx . . $ `src/asm/alu.h:35:9`!) && (argument->flagscxx . . $ result_int_t#flags. & MVALUE_ISBYTEcxx . . $ `src/asm/alu.h:29:9`!)) |
| 542 | return(MVALUE_FORCE08cxx . . $ `src/asm/alu.h:35:9`!); |
| 543 | // If there is a 16-bit addressing, use that |
| 544 | // Call helper function for "oversized addr mode" warning |
| 545 | if(MVALUE_FORCE16cxx . . $ `src/asm/alu.h:33:9`! & addressing_modes) |
| 546 | return(check_oversizecxx . . $ check_oversize(86b284291be3c06e).(MVALUE_FORCE16cxx . . $ `src/asm/alu.h:33:9`!, argument)); |
| 547 | // If there is a 24-bit addressing, use that |
| 548 | // Call helper function for "oversized addr mode" warning |
| 549 | if(MVALUE_FORCE24cxx . . $ `src/asm/alu.h:31:9`! & addressing_modes) |
| 550 | return(check_oversizecxx . . $ check_oversize(86b284291be3c06e).(MVALUE_FORCE24cxx . . $ `src/asm/alu.h:31:9`!, argument)); |
| 551 | // otherwise, use 8-bit-addressing, which will raise an |
| 552 | // error later on if the value won't fit |
| 553 | return(MVALUE_FORCE08cxx . . $ `src/asm/alu.h:35:9`!); |
| 554 | } |
| 555 | // Value is sure, so use its own size |
| 556 | // If value is negative, size cannot be chosen. Complain! |
| 557 | if(argument->intvalcxx . . $ result_int_t#intval. < 0) { |
| 558 | Throw_errorcxx . . $ Throw_error(85c52e162fed56f9).("Negative value - cannot choose addressing mode."); |
| 559 | return(0); |
| 560 | } |
| 561 | // Value is positive or zero. Check size ranges |
| 562 | // If there is an 8-bit addressing mode and value fits, use 8 bits |
| 563 | if((addressing_modes & MVALUE_FORCE08cxx . . $ `src/asm/alu.h:35:9`!) && (argument->intvalcxx . . $ result_int_t#intval. < 256)) |
| 564 | return(MVALUE_FORCE08cxx . . $ `src/asm/alu.h:35:9`!); |
| 565 | // If there is a 16-bit addressing mode and value fits, use 16 bits |
| 566 | if((addressing_modes & MVALUE_FORCE16cxx . . $ `src/asm/alu.h:33:9`!) && (argument->intvalcxx . . $ result_int_t#intval. < 65536)) |
| 567 | return(MVALUE_FORCE16cxx . . $ `src/asm/alu.h:33:9`!); |
| 568 | // If there is a 24-bit addressing mode, use that. In case the |
| 569 | // value doesn't fit, the output function will do the complaining. |
| 570 | if(addressing_modes & MVALUE_FORCE24cxx . . $ `src/asm/alu.h:31:9`!) |
| 571 | return(MVALUE_FORCE24cxx . . $ `src/asm/alu.h:31:9`!); |
| 572 | // Value is too big for all possible addressing modes |
| 573 | Throw_errorcxx . . $ Throw_error(85c52e162fed56f9).(exception_number_out_of_rangecxx . . $ exception_number_out_of_range.); |
| 574 | return(0); |
| 575 | } |
| 576 | |
| 577 | // Mnemonics using only implied addressing. |
| 578 | static void group_only_implied_addressingcxx . . $ group_only_implied_addressing(d4f767463ce0a6b3).(int opcode) { |
| 579 | Output_bytecxx . . $ Output_byte.(opcode); |
| 580 | Input_ensure_EOScxx . . $ Input_ensure_EOS(49f6e7a06ebc5aa8).(); |
| 581 | } |
| 582 | |
| 583 | // Mnemonics using only 8bit relative addressing (short branch instructions). |
| 584 | static void group_only_relative8_addressingcxx . . $ group_only_relative8_addressing(d4f767463ce0a6b3).(int opcode) { |
| 585 | result_int_tcxx . . $ result_int_t# result; |
| 586 | |
| 587 | ALU_int_resultcxx . . $ ALU_int_result(1ba379088691677b).(&result); |
| 588 | if(result.flagscxx . . $ result_int_t#flags. & MVALUE_DEFINEDcxx . . $ `src/asm/alu.h:27:9`!) { |
| 589 | result.intvalcxx . . $ result_int_t#intval. -= (CPU_pccxx . . $ CPU_pc..intvalcxx . . $ result_int_t#intval. + 2); |
| 590 | if((result.intvalcxx . . $ result_int_t#intval. > 127) || (result.intvalcxx . . $ result_int_t#intval. < -128)) |
| 591 | Throw_errorcxx . . $ Throw_error(85c52e162fed56f9).(exception_too_farcxx . . $ exception_too_far.); |
| 592 | } |
| 593 | Output_bytecxx . . $ Output_byte.(opcode); |
| 594 | // this fn has its own range check (see above). |
| 595 | // No reason to irritate the user with another error message, |
| 596 | // so use Output_byte() instead of Output_8b() |
| 597 | //Output_8b(result.value); |
| 598 | Output_bytecxx . . $ Output_byte.(result.intvalcxx . . $ result_int_t#intval.); |
| 599 | Input_ensure_EOScxx . . $ Input_ensure_EOS(49f6e7a06ebc5aa8).(); |
| 600 | } |
| 601 | |
| 602 | // Mnemonics using only 16bit relative addressing (BRL and PER). |
| 603 | static void group_only_relative16_addressingcxx . . $ group_only_relative16_addressing(d4f767463ce0a6b3).(int opcode) { |
| 604 | result_int_tcxx . . $ result_int_t# result; |
| 605 | |
| 606 | ALU_int_resultcxx . . $ ALU_int_result(1ba379088691677b).(&result); |
| 607 | if(result.flagscxx . . $ result_int_t#flags. & MVALUE_DEFINEDcxx . . $ `src/asm/alu.h:27:9`!) { |
| 608 | result.intvalcxx . . $ result_int_t#intval. -= (CPU_pccxx . . $ CPU_pc..intvalcxx . . $ result_int_t#intval. + 3); |
| 609 | if((result.intvalcxx . . $ result_int_t#intval. > 32767) || (result.intvalcxx . . $ result_int_t#intval. < -32768)) |
| 610 | Throw_errorcxx . . $ Throw_error(85c52e162fed56f9).(exception_too_farcxx . . $ exception_too_far.); |
| 611 | } |
| 612 | Output_bytecxx . . $ Output_byte.(opcode); |
| 613 | // this fn has its own range check (see above). |
| 614 | // No reason to irritate the user with another error message, |
| 615 | // so use Output_byte() instead of Output_16b() |
| 616 | //Output_16b(result.value); |
| 617 | Output_bytecxx . . $ Output_byte.(result.intvalcxx . . $ result_int_t#intval.); |
| 618 | Output_bytecxx . . $ Output_byte.(result.intvalcxx . . $ result_int_t#intval. >> 8); |
| 619 | Input_ensure_EOScxx . . $ Input_ensure_EOS(49f6e7a06ebc5aa8).(); |
| 620 | } |
| 621 | |
| 622 | // set addressing mode bits depending on which opcodes exist, then calculate |
| 623 | // argument size and output both opcode and argument |
| 624 | static void make_commandcxx . . $ make_command(c8a7f53fa5101553).(int force_bit, result_int_tcxx . . $ result_int_t#* result, unsigned long opcodes) { |
| 625 | int addressing_modes = MAYBE______cxx . . $ `src/asm/mnemo.c:62:9`!; |
| 626 | |
| 627 | if(opcodes & 0x0000ff) |
| 628 | addressing_modes |= MAYBE_1____cxx . . $ `src/asm/mnemo.c:63:9`!; |
| 629 | if(opcodes & 0x00ff00) |
| 630 | addressing_modes |= MAYBE___2__cxx . . $ `src/asm/mnemo.c:64:9`!; |
| 631 | if(opcodes & 0xff0000) |
| 632 | addressing_modes |= MAYBE_____3cxx . . $ `src/asm/mnemo.c:66:9`!; |
| 633 | switch(calc_arg_sizecxx . . $ calc_arg_size(b3049405226bd830).(force_bit, result, addressing_modes)) { |
| 634 | |
| 635 | case MVALUE_FORCE08cxx . . $ `src/asm/alu.h:35:9`!: |
| 636 | Output_bytecxx . . $ Output_byte.(opcodes & 255); |
| 637 | Output_8bcxx . . $ Output_8b(1624ee8275b10bda).(result->intvalcxx . . $ result_int_t#intval.); |
| 638 | break; |
| 639 | |
| 640 | case MVALUE_FORCE16cxx . . $ `src/asm/alu.h:33:9`!: |
| 641 | Output_bytecxx . . $ Output_byte.((opcodes >> 8) & 255); |
| 642 | Output_16bcxx . . $ Output_16b(1624ee8275b10bda).(result->intvalcxx . . $ result_int_t#intval.); |
| 643 | break; |
| 644 | |
| 645 | case MVALUE_FORCE24cxx . . $ `src/asm/alu.h:31:9`!: |
| 646 | Output_bytecxx . . $ Output_byte.((opcodes >> 16) & 255); |
| 647 | Output_24bcxx . . $ Output_24b(1624ee8275b10bda).(result->intvalcxx . . $ result_int_t#intval.); |
| 648 | break; |
| 649 | |
| 650 | } |
| 651 | } |
| 652 | |
| 653 | // check whether 16bit immediate addressing is allowed. If not, return given |
| 654 | // opcode. If it is allowed, set force bits according to CPU register length |
| 655 | // and return given opcode for both 8- and 16-bit mode. |
| 656 | static unsigned int imm_opscxx . . $ imm_ops(4b4abe6976e726c7).(int *force_bit, unsigned char opcode, int imm_flag) { |
| 657 | // if the CPU does not allow 16bit immediate addressing (or if the |
| 658 | // opcode does not allow it), return immediately. |
| 659 | if((CPU_nowcxx . . $ CPU_now.->long_regscxx . . $ cpu_t#long_regs. == NULLcxx . . $ `/usr/lib/gcc/x86_64-linux-gnu/16/include/stddef.h:419:9`!) || (imm_flag == 0)) |
| 660 | return(opcode); |
| 661 | // check force bits (if no force bits given, use relevant flag) |
| 662 | if(*force_bit == 0) |
| 663 | *force_bit = ((imm_flag & IMM_ACCUcxx . . $ `src/asm/mnemo.c:180:9`!) ? |
| 664 | CPU_nowcxx . . $ CPU_now.->long_regscxx . . $ cpu_t#long_regs.[LONGREG_IDX_Acxx . . $ `src/asm/cpu.h:19:9`!] : |
| 665 | CPU_nowcxx . . $ CPU_now.->long_regscxx . . $ cpu_t#long_regs.[LONGREG_IDX_Rcxx . . $ `src/asm/cpu.h:20:9`!]) ? |
| 666 | MVALUE_FORCE16cxx . . $ `src/asm/alu.h:33:9`! : |
| 667 | MVALUE_FORCE08cxx . . $ `src/asm/alu.h:35:9`!; |
| 668 | // return identical opcodes for 8bit and 16bit args! |
| 669 | return((((unsigned int) opcode) << 8) | opcode); |
| 670 | } |
| 671 | |
| 672 | // The main accumulator stuff (ADC, AND, CMP, EOR, LDA, ORA, SBC, STA) |
| 673 | // plus PEI. |
| 674 | static void group_maincxx . . $ group_main(3e454b8ccf442868).(int index, int imm_flag) { |
| 675 | unsigned long imm_opcodes; |
| 676 | result_int_tcxx . . $ result_int_t# result; |
| 677 | int force_bit = Input_get_force_bitcxx . . $ Input_get_force_bit(b126dc7c1de90089).();// skips spaces after |
| 678 | |
| 679 | switch(get_argumentcxx . . $ get_argument(ee210d144587f61c).(&result)) { |
| 680 | |
| 681 | // #$ff or #$ffff (depending on accu length) |
| 682 | case HAM_IMMcxx . . $ `src/asm/mnemo.c:45:9`!: |
| 683 | imm_opcodes = imm_opscxx . . $ imm_ops(4b4abe6976e726c7).(&force_bit, accu_immcxx . . $ accu_imm.[index], imm_flag); |
| 684 | // CAUTION - do not incorporate the line above into the line |
| 685 | // below - "fb" might be undefined (depends on compiler). |
| 686 | make_commandcxx . . $ make_command(c8a7f53fa5101553).(force_bit, &result, imm_opcodes); |
| 687 | break; |
| 688 | |
| 689 | // $ff, $ffff, $ffffff |
| 690 | case HAM_ABScxx . . $ `src/asm/mnemo.c:46:9`!: |
| 691 | make_commandcxx . . $ make_command(c8a7f53fa5101553).(force_bit, &result, accu_abscxx . . $ accu_abs.[index]); |
| 692 | break; |
| 693 | |
| 694 | // $ff,x, $ffff,x, $ffffff,x |
| 695 | case HAM_ABSXcxx . . $ `src/asm/mnemo.c:48:9`!: |
| 696 | make_commandcxx . . $ make_command(c8a7f53fa5101553).(force_bit, &result, accu_xabscxx . . $ accu_xabs.[index]); |
| 697 | break; |
| 698 | |
| 699 | // $ffff,y (in theory, "$ff,y" as well) |
| 700 | case HAM_ABSYcxx . . $ `src/asm/mnemo.c:49:9`!: |
| 701 | make_commandcxx . . $ make_command(c8a7f53fa5101553).(force_bit, &result, accu_yabscxx . . $ accu_yabs.[index]); |
| 702 | break; |
| 703 | |
| 704 | // $ff,s |
| 705 | case HAM_ABSScxx . . $ `src/asm/mnemo.c:47:9`!: |
| 706 | make_commandcxx . . $ make_command(c8a7f53fa5101553).(force_bit, &result, accu_sabs8cxx . . $ accu_sabs8.[index]); |
| 707 | break; |
| 708 | |
| 709 | // ($ff,x) |
| 710 | case HAM_XINDcxx . . $ `src/asm/mnemo.c:51:9`!: |
| 711 | make_commandcxx . . $ make_command(c8a7f53fa5101553).(force_bit, &result, accu_xind8cxx . . $ accu_xind8.[index]); |
| 712 | break; |
| 713 | |
| 714 | // ($ff) |
| 715 | case HAM_INDcxx . . $ `src/asm/mnemo.c:50:9`!: |
| 716 | make_commandcxx . . $ make_command(c8a7f53fa5101553).(force_bit, &result, accu_ind8cxx . . $ accu_ind8.[index]); |
| 717 | break; |
| 718 | |
| 719 | // ($ff),y |
| 720 | case HAM_INDYcxx . . $ `src/asm/mnemo.c:52:9`!: |
| 721 | make_commandcxx . . $ make_command(c8a7f53fa5101553).(force_bit, &result, accu_indy8cxx . . $ accu_indy8.[index]); |
| 722 | break; |
| 723 | |
| 724 | // [$ff] |
| 725 | case HAM_LINDcxx . . $ `src/asm/mnemo.c:54:9`!: |
| 726 | make_commandcxx . . $ make_command(c8a7f53fa5101553).(force_bit, &result, accu_lind8cxx . . $ accu_lind8.[index]); |
| 727 | break; |
| 728 | |
| 729 | // [$ff],y |
| 730 | case HAM_LINDYcxx . . $ `src/asm/mnemo.c:55:9`!: |
| 731 | make_commandcxx . . $ make_command(c8a7f53fa5101553).(force_bit, &result, accu_lindy8cxx . . $ accu_lindy8.[index]); |
| 732 | break; |
| 733 | |
| 734 | // ($ff,s),y |
| 735 | case HAM_SINDYcxx . . $ `src/asm/mnemo.c:53:9`!: |
| 736 | make_commandcxx . . $ make_command(c8a7f53fa5101553).(force_bit, &result, accu_sindy8cxx . . $ accu_sindy8.[index]); |
| 737 | break; |
| 738 | |
| 739 | // other combinations are illegal |
| 740 | default: |
| 741 | Throw_errorcxx . . $ Throw_error(85c52e162fed56f9).(exception_illegal_combinationcxx . . $ exception_illegal_combination.); |
| 742 | |
| 743 | } |
| 744 | } |
| 745 | |
| 746 | // Various mnemonics with different addressing modes. |
| 747 | static void group_misccxx . . $ group_misc(3e454b8ccf442868).(int index, int imm_flag) { |
| 748 | unsigned long imm_opcodes; |
| 749 | result_int_tcxx . . $ result_int_t# result; |
| 750 | int force_bit = Input_get_force_bitcxx . . $ Input_get_force_bit(b126dc7c1de90089).();// skips spaces after |
| 751 | |
| 752 | switch(get_argumentcxx . . $ get_argument(ee210d144587f61c).(&result)) { |
| 753 | |
| 754 | // implied addressing |
| 755 | case HAM_IMPcxx . . $ `src/asm/mnemo.c:44:9`!: |
| 756 | if(misc_implcxx . . $ misc_impl.[index]) |
| 757 | Output_bytecxx . . $ Output_byte.(misc_implcxx . . $ misc_impl.[index]); |
| 758 | else |
| 759 | Throw_errorcxx . . $ Throw_error(85c52e162fed56f9).(exception_illegal_combinationcxx . . $ exception_illegal_combination.); |
| 760 | break; |
| 761 | |
| 762 | // #$ff or #$ffff (depending on index register length) |
| 763 | case HAM_IMMcxx . . $ `src/asm/mnemo.c:45:9`!: |
| 764 | imm_opcodes = imm_opscxx . . $ imm_ops(4b4abe6976e726c7).(&force_bit, misc_immcxx . . $ misc_imm.[index], imm_flag); |
| 765 | // CAUTION - do not incorporate the line above into the line |
| 766 | // below - force_bit might be undefined (depends on compiler). |
| 767 | make_commandcxx . . $ make_command(c8a7f53fa5101553).(force_bit, &result, imm_opcodes); |
| 768 | break; |
| 769 | |
| 770 | // $ff or $ffff |
| 771 | case HAM_ABScxx . . $ `src/asm/mnemo.c:46:9`!: |
| 772 | make_commandcxx . . $ make_command(c8a7f53fa5101553).(force_bit, &result, misc_abscxx . . $ misc_abs.[index]); |
| 773 | break; |
| 774 | |
| 775 | // $ff,x or $ffff,x |
| 776 | case HAM_ABSXcxx . . $ `src/asm/mnemo.c:48:9`!: |
| 777 | make_commandcxx . . $ make_command(c8a7f53fa5101553).(force_bit, &result, misc_xabscxx . . $ misc_xabs.[index]); |
| 778 | break; |
| 779 | |
| 780 | // $ff,y or $ffff,y |
| 781 | case HAM_ABSYcxx . . $ `src/asm/mnemo.c:49:9`!: |
| 782 | make_commandcxx . . $ make_command(c8a7f53fa5101553).(force_bit, &result, misc_yabscxx . . $ misc_yabs.[index]); |
| 783 | break; |
| 784 | |
| 785 | // other combinations are illegal |
| 786 | default: |
| 787 | Throw_errorcxx . . $ Throw_error(85c52e162fed56f9).(exception_illegal_combinationcxx . . $ exception_illegal_combination.); |
| 788 | } |
| 789 | } |
| 790 | |
| 791 | // Mnemonics using "8bit, 8bit" addressing. Only applies to "MVN" and "MVP". |
| 792 | static void group_movecxx . . $ group_move(d4f767463ce0a6b3).(int opcode) { |
| 793 | intval_tcxx . . $ intval_t# source, |
| 794 | target; |
| 795 | |
| 796 | // assembler syntax: "opcode source, target" |
| 797 | source = ALU_any_intcxx . . $ ALU_any_int(da6335ded91d79c2).(); |
| 798 | if(Input_accept_commacxx . . $ Input_accept_comma(c9857a73d68e59ba).()) { |
| 799 | target = ALU_any_intcxx . . $ ALU_any_int(da6335ded91d79c2).(); // machine language: |
| 800 | Output_bytecxx . . $ Output_byte.(opcode); // opcode |
| 801 | Output_8bcxx . . $ Output_8b(1624ee8275b10bda).(target); // target |
| 802 | Output_8bcxx . . $ Output_8b(1624ee8275b10bda).(source); // source |
| 803 | Input_ensure_EOScxx . . $ Input_ensure_EOS(49f6e7a06ebc5aa8).(); |
| 804 | } else |
| 805 | Throw_errorcxx . . $ Throw_error(85c52e162fed56f9).(exception_syntaxcxx . . $ exception_syntax.); |
| 806 | } |
| 807 | |
| 808 | // The jump instructions. |
| 809 | static void group_jumpcxx . . $ group_jump(d4f767463ce0a6b3).(int index) { |
| 810 | result_int_tcxx . . $ result_int_t# result; |
| 811 | int force_bit = Input_get_force_bitcxx . . $ Input_get_force_bit(b126dc7c1de90089).();// skips spaces after |
| 812 | |
| 813 | switch(get_argumentcxx . . $ get_argument(ee210d144587f61c).(&result)) { |
| 814 | |
| 815 | // absolute16 or absolute24 |
| 816 | case HAM_ABScxx . . $ `src/asm/mnemo.c:46:9`!: |
| 817 | make_commandcxx . . $ make_command(c8a7f53fa5101553).(force_bit, &result, jump_abscxx . . $ jump_abs.[index]); |
| 818 | break; |
| 819 | |
| 820 | // ($ffff) |
| 821 | case HAM_INDcxx . . $ `src/asm/mnemo.c:50:9`!: |
| 822 | make_commandcxx . . $ make_command(c8a7f53fa5101553).(force_bit, &result, jump_indcxx . . $ jump_ind.[index]); |
| 823 | // check whether to warn about 6502's JMP() bug |
| 824 | if(((result.intvalcxx . . $ result_int_t#intval. & 0xff) == 0xff) |
| 825 | && (result.flagscxx . . $ result_int_t#flags. & MVALUE_DEFINEDcxx . . $ `src/asm/alu.h:27:9`!) |
| 826 | && (CPU_nowcxx . . $ CPU_now.->flagscxx . . $ cpu_t#flags. & CPUFLAG_INDJMPBUGGYcxx . . $ `src/asm/cpu.h:24:9`!)) |
| 827 | Throw_warningcxx . . $ Throw_warning(85c52e162fed56f9).("Assembling buggy JMP($xxff) instruction"); |
| 828 | break; |
| 829 | |
| 830 | // ($ffff,x) |
| 831 | case HAM_XINDcxx . . $ `src/asm/mnemo.c:51:9`!: |
| 832 | make_commandcxx . . $ make_command(c8a7f53fa5101553).(force_bit, &result, jump_xindcxx . . $ jump_xind.[index]); |
| 833 | break; |
| 834 | |
| 835 | // [$ffff] |
| 836 | case HAM_LINDcxx . . $ `src/asm/mnemo.c:54:9`!: |
| 837 | make_commandcxx . . $ make_command(c8a7f53fa5101553).(force_bit, &result, jump_lindcxx . . $ jump_lind.[index]); |
| 838 | break; |
| 839 | |
| 840 | // other combinations are illegal |
| 841 | default: |
| 842 | Throw_errorcxx . . $ Throw_error(85c52e162fed56f9).(exception_illegal_combinationcxx . . $ exception_illegal_combination.); |
| 843 | |
| 844 | } |
| 845 | } |
| 846 | |
| 847 | // Work function |
| 848 | static boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! check_mnemo_treecxx . . $ check_mnemo_tree(256a06d5280309c1).(node_tcxx . . $ node_t#* tree, dynabuf_tcxx . . $ dynabuf_t#* dyna_buf) { |
| 849 | void* node_body; |
| 850 | int code, |
| 851 | imm_flag; // flag for immediate addressing |
| 852 | |
| 853 | // search for tree item |
| 854 | if(!Tree_easy_scancxx . . $ Tree_easy_scan(7f10be3e8224db50).(tree, &node_body, dyna_buf)) |
| 855 | return(FALSEcxx . . $ `src/asm/config.h:54:9`!); |
| 856 | code = ((int) node_body) & CODEMASKcxx . . $ `src/asm/mnemo.c:178:9`!; // get opcode or table index |
| 857 | imm_flag = ((int) node_body) & FLAGSMASKcxx . . $ `src/asm/mnemo.c:179:9`!; // get flag |
| 858 | switch(((long) node_body) >> GROUPSHIFTcxx . . $ `src/asm/mnemo.c:182:9`!) { |
| 859 | |
| 860 | // mnemonics with only implied addressing |
| 861 | case G_IMPLIEDcxx . . $ G_IMPLIED.: |
| 862 | group_only_implied_addressingcxx . . $ group_only_implied_addressing(d4f767463ce0a6b3).(code); |
| 863 | break; |
| 864 | |
| 865 | // main accumulator stuff |
| 866 | case G_MAINcxx . . $ G_MAIN.: |
| 867 | group_maincxx . . $ group_main(3e454b8ccf442868).(code, imm_flag); |
| 868 | break; |
| 869 | |
| 870 | // misc |
| 871 | case G_MISCcxx . . $ G_MISC.: |
| 872 | group_misccxx . . $ group_misc(3e454b8ccf442868).(code, imm_flag); |
| 873 | break; |
| 874 | |
| 875 | // short relative |
| 876 | case G_REL_SHORTcxx . . $ G_REL_SHORT.: |
| 877 | group_only_relative8_addressingcxx . . $ group_only_relative8_addressing(d4f767463ce0a6b3).(code); |
| 878 | break; |
| 879 | |
| 880 | // long relative |
| 881 | case G_REL_LONGcxx . . $ G_REL_LONG.: |
| 882 | group_only_relative16_addressingcxx . . $ group_only_relative16_addressing(d4f767463ce0a6b3).(code); |
| 883 | break; |
| 884 | |
| 885 | // the jump instructions |
| 886 | case G_JUMPcxx . . $ G_JUMP.: |
| 887 | group_jumpcxx . . $ group_jump(d4f767463ce0a6b3).(code); |
| 888 | break; |
| 889 | |
| 890 | // "mvp" and "mvn" |
| 891 | case G_MOVEcxx . . $ G_MOVE.: |
| 892 | group_movecxx . . $ group_move(d4f767463ce0a6b3).(code); |
| 893 | break; |
| 894 | |
| 895 | // others indicate bugs |
| 896 | default: |
| 897 | Bug_foundcxx . . $ Bug_found(34d26762b42c433a).("IllegalGroupIndex", code); |
| 898 | |
| 899 | } |
| 900 | return(TRUEcxx . . $ `src/asm/config.h:55:9`!); |
| 901 | } |
| 902 | |
| 903 | // Check whether mnemonic in GlobalDynaBuf is supported by 6502 cpu. |
| 904 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! keyword_is_6502mnemocxx . . $ keyword_is_6502mnemo(83c267b20bac841a).(int length) { |
| 905 | if(length != 3) |
| 906 | return(FALSEcxx . . $ `src/asm/config.h:54:9`!); |
| 907 | // make lower case version of mnemonic in local dynamic buffer |
| 908 | DynaBuf_to_lowercxx . . $ DynaBuf_to_lower(a0224c2fdd28a46d).(mnemo_dyna_bufcxx . . $ mnemo_dyna_buf., GlobalDynaBufcxx . . $ GlobalDynaBuf.); |
| 909 | if(check_mnemo_treecxx . . $ check_mnemo_tree(256a06d5280309c1).(mnemo_6502_treecxx . . $ mnemo_6502_tree., mnemo_dyna_bufcxx . . $ mnemo_dyna_buf.)) |
| 910 | return(TRUEcxx . . $ `src/asm/config.h:55:9`!); |
| 911 | return(FALSEcxx . . $ `src/asm/config.h:54:9`!); |
| 912 | } |
| 913 | |
| 914 | // Check whether mnemonic in GlobalDynaBuf is supported by 6510 cpu. |
| 915 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! keyword_is_6510mnemocxx . . $ keyword_is_6510mnemo(83c267b20bac841a).(int length) { |
| 916 | if(length != 3) |
| 917 | return(FALSEcxx . . $ `src/asm/config.h:54:9`!); |
| 918 | // make lower case version of mnemonic in local dynamic buffer |
| 919 | DynaBuf_to_lowercxx . . $ DynaBuf_to_lower(a0224c2fdd28a46d).(mnemo_dyna_bufcxx . . $ mnemo_dyna_buf., GlobalDynaBufcxx . . $ GlobalDynaBuf.); |
| 920 | // first check extensions... |
| 921 | if(check_mnemo_treecxx . . $ check_mnemo_tree(256a06d5280309c1).(mnemo_6510_treecxx . . $ mnemo_6510_tree., mnemo_dyna_bufcxx . . $ mnemo_dyna_buf.)) |
| 922 | return(TRUEcxx . . $ `src/asm/config.h:55:9`!); |
| 923 | // ...then check original opcodes |
| 924 | if(check_mnemo_treecxx . . $ check_mnemo_tree(256a06d5280309c1).(mnemo_6502_treecxx . . $ mnemo_6502_tree., mnemo_dyna_bufcxx . . $ mnemo_dyna_buf.)) |
| 925 | return(TRUEcxx . . $ `src/asm/config.h:55:9`!); |
| 926 | return(FALSEcxx . . $ `src/asm/config.h:54:9`!); |
| 927 | } |
| 928 | |
| 929 | // Check whether mnemonic in GlobalDynaBuf is supported by 65c02 cpu. |
| 930 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! keyword_is_65c02mnemocxx . . $ keyword_is_65c02mnemo(83c267b20bac841a).(int length) { |
| 931 | if(length != 3) |
| 932 | return(FALSEcxx . . $ `src/asm/config.h:54:9`!); |
| 933 | // make lower case version of mnemonic in local dynamic buffer |
| 934 | DynaBuf_to_lowercxx . . $ DynaBuf_to_lower(a0224c2fdd28a46d).(mnemo_dyna_bufcxx . . $ mnemo_dyna_buf., GlobalDynaBufcxx . . $ GlobalDynaBuf.); |
| 935 | // first check extensions... |
| 936 | if(check_mnemo_treecxx . . $ check_mnemo_tree(256a06d5280309c1).(mnemo_65c02_treecxx . . $ mnemo_65c02_tree., mnemo_dyna_bufcxx . . $ mnemo_dyna_buf.)) |
| 937 | return(TRUEcxx . . $ `src/asm/config.h:55:9`!); |
| 938 | // ...then check original opcodes |
| 939 | if(check_mnemo_treecxx . . $ check_mnemo_tree(256a06d5280309c1).(mnemo_6502_treecxx . . $ mnemo_6502_tree., mnemo_dyna_bufcxx . . $ mnemo_dyna_buf.)) |
| 940 | return(TRUEcxx . . $ `src/asm/config.h:55:9`!); |
| 941 | return(FALSEcxx . . $ `src/asm/config.h:54:9`!); |
| 942 | } |
| 943 | |
| 944 | //// Check whether mnemonic in GlobalDynaBuf is supported by Rockwell 65c02 cpu. |
| 945 | //bool keyword_is_Rockwell65c02mnemo(int length) { |
| 946 | // if((length != 3) && (length != 4)) |
| 947 | // return(FALSE); |
| 948 | // // make lower case version of mnemonic in local dynamic buffer |
| 949 | // DynaBuf_to_lower(mnemo_dyna_buf, GlobalDynaBuf); |
| 950 | // // first check 65c02 extensions... |
| 951 | // if(check_mnemo_tree(mnemo_65c02_tree, mnemo_dyna_buf)) |
| 952 | // return(TRUE); |
| 953 | // // ...then check original opcodes... |
| 954 | // if(check_mnemo_tree(mnemo_6502_tree, mnemo_dyna_buf)) |
| 955 | // return(TRUE); |
| 956 | // // ...then check Rockwell/WDC extensions (rmb, smb, bbr, bbs) |
| 957 | // if(check_mnemo_tree(mnemo_Rockwell65c02_tree, mnemo_dyna_buf)) |
| 958 | // return(TRUE); |
| 959 | // return(FALSE); |
| 960 | //} |
| 961 | |
| 962 | //// Check whether mnemonic in GlobalDynaBuf is supported by WDC 65c02 cpu. |
| 963 | //bool keyword_is_WDC65c02mnemo(int length) { |
| 964 | // if((length != 3) && (length != 4)) |
| 965 | // return(FALSE); |
| 966 | // // make lower case version of mnemonic in local dynamic buffer |
| 967 | // DynaBuf_to_lower(mnemo_dyna_buf, GlobalDynaBuf); |
| 968 | // // first check 65c02 extensions... |
| 969 | // if(check_mnemo_tree(mnemo_65c02_tree, mnemo_dyna_buf)) |
| 970 | // return(TRUE); |
| 971 | // // ...then check original opcodes... |
| 972 | // if(check_mnemo_tree(mnemo_6502_tree, mnemo_dyna_buf)) |
| 973 | // return(TRUE); |
| 974 | // // ...then check Rockwell/WDC extensions (rmb, smb, bbr, bbs)... |
| 975 | // if(check_mnemo_tree(mnemo_Rockwell65c02_tree, mnemo_dyna_buf)) |
| 976 | // return(TRUE); |
| 977 | // // ...then check WDC extensions (only two mnemonics, so do last) |
| 978 | // if(check_mnemo_tree(mnemo_WDC65c02_tree, mnemo_dyna_buf)) |
| 979 | // return(TRUE); |
| 980 | // return(FALSE); |
| 981 | //} |
| 982 | |
| 983 | // Check whether mnemonic in GlobalDynaBuf is supported by 65816 cpu. |
| 984 | boolcxx . . $ `<external>/13015445228558014418/stdbool.h:36:9`! keyword_is_65816mnemocxx . . $ keyword_is_65816mnemo(83c267b20bac841a).(int length) { |
| 985 | if(length != 3) |
| 986 | return(FALSEcxx . . $ `src/asm/config.h:54:9`!); |
| 987 | // make lower case version of mnemonic in local dynamic buffer |
| 988 | DynaBuf_to_lowercxx . . $ DynaBuf_to_lower(a0224c2fdd28a46d).(mnemo_dyna_bufcxx . . $ mnemo_dyna_buf., GlobalDynaBufcxx . . $ GlobalDynaBuf.); |
| 989 | // first check "new" extensions... |
| 990 | if(check_mnemo_treecxx . . $ check_mnemo_tree(256a06d5280309c1).(mnemo_65816_treecxx . . $ mnemo_65816_tree., mnemo_dyna_bufcxx . . $ mnemo_dyna_buf.)) |
| 991 | return(TRUEcxx . . $ `src/asm/config.h:55:9`!); |
| 992 | // ...then "old" extensions... |
| 993 | if(check_mnemo_treecxx . . $ check_mnemo_tree(256a06d5280309c1).(mnemo_65c02_treecxx . . $ mnemo_65c02_tree., mnemo_dyna_bufcxx . . $ mnemo_dyna_buf.)) |
| 994 | return(TRUEcxx . . $ `src/asm/config.h:55:9`!); |
| 995 | // ...then check original opcodes... |
| 996 | if(check_mnemo_treecxx . . $ check_mnemo_tree(256a06d5280309c1).(mnemo_6502_treecxx . . $ mnemo_6502_tree., mnemo_dyna_bufcxx . . $ mnemo_dyna_buf.)) |
| 997 | return(TRUEcxx . . $ `src/asm/config.h:55:9`!); |
| 998 | // ...then check WDC extensions "stp" and "wai" |
| 999 | if(check_mnemo_treecxx . . $ check_mnemo_tree(256a06d5280309c1).(mnemo_WDC65c02_treecxx . . $ mnemo_WDC65c02_tree., mnemo_dyna_bufcxx . . $ mnemo_dyna_buf.)) |
| 1000 | return(TRUEcxx . . $ `src/asm/config.h:55:9`!); |
| 1001 | return(FALSEcxx . . $ `src/asm/config.h:54:9`!); |
| 1002 | } |