| 1 | // |
| 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 | // CPU stuff |
| 7 | #ifndef cpu_H |
| 8 | #define cpu_H |
| 9 | |
| 10 | #include "config.h" |
| 11 | |
| 12 | |
| 13 | // CPU type structure definition |
| 14 | struct cpu_t { |
| 15 | // This function is not allowed to change GlobalDynaBuf |
| 16 | // because that's where the mnemonic is stored! |
| 17 | bool (*keyword_is_mnemonic)(int); |
| 18 | bool* long_regs; // pointer to array of bool: |
| 19 | #define LONGREG_IDX_A 0 // array index for "long accu" bool |
| 20 | #define LONGREG_IDX_R 1 // array index for "long index regs" bool |
| 21 | int flags; |
| 22 | char default_align_value; |
| 23 | }; |
| 24 | #define CPUFLAG_INDJMPBUGGY (1u << 0) |
| 25 | |
| 26 | |
| 27 | // Variables |
| 28 | extern struct cpu_t *CPU_now;// Struct of current CPU type (default 6502) |
| 29 | extern result_int_t CPU_pc; // Current program counter (pseudo value) |
| 30 | extern int CPU_2add; // add to PC after statement |
| 31 | |
| 32 | |
| 33 | // Prototypes |
| 34 | |
| 35 | // create cpu type tree (is done early) |
| 36 | extern void CPUtype_init(void); |
| 37 | // register pseudo opcodes (done later) |
| 38 | extern void CPU_init(void); |
| 39 | // Set default values for pass |
| 40 | extern void CPU_passinit(struct cpu_t* cpu_type); |
| 41 | // set program counter to defined value |
| 42 | extern void CPU_set_pc(intval_t new_pc); |
| 43 | // Try to find CPU type held in DynaBuf. Returns whether succeeded. |
| 44 | extern bool CPU_find_cpu_struct(struct cpu_t** target); |
| 45 | // return whether offset assembly is active |
| 46 | extern bool CPU_uses_pseudo_pc(void); |
| 47 | |
| 48 | #endif |