Debian Codegraph @

src/cpu.h

raw symbols SCIP
1 // ACME - a crossassembler for producing 6502/65c02/65816/65ce02 code.
2 // Copyright (C) 1998-2024 Marco Baye
3 // Have a look at "acme.c" for further info
4 //
5 // CPU type stuff
6 #ifndef cpu_type_H
7 #define cpu_type_H
8
9
10 #include "config.h"
11
12
13 // types
14
15 struct cpu_type {
16 // This function is not allowed to change GlobalDynaBuf
17 // because that's where the mnemonic is stored!
18 boolean (*keyword_is_mnemonic)(int);
19 bits flags; // see below for bit meanings
20 // int pc_mask; // last value before program counter wraps to zero
21 int dummy_pc; // value to use for pc after complaining to user they did not set it
22 unsigned char default_align_value;
23 //int reserved_keywords_maxlen; // TODO - add
24 //int (*reserved_keyword_check)(void); // TODO - add
25 };
26 #define CPUFLAG_INDIRECTJMPBUGGY (1u << 0) // warn if "jmp ($xxff)" is assembled
27 #define CPUFLAG_SUPPORTSLONGREGS (1u << 1) // allow "!al" and "!rl" pseudo opcodes
28 #define CPUFLAG_8B_AND_AB_NEED_0_ARG (1u << 2) // warn if "ane/lxa #$xx" uses non-zero arg
29 #define CPUFLAG_ISBIGENDIAN (1u << 3) // for 16/24/32-bit values, output msb first
30 #define CPUFLAG_DECIMALSUBTRACTBUGGY (1u << 4) // warn if "sed" is assembled
31 #define CPUFLAG_WARN_ABOUT_FF_PTR (1u << 5) // warn if MNEMO($ff) is assembled
32
33
34 // constants
35
36 extern const char cputype_names[]; // string to show if cputype_find() returns NULL
37
38
39 // variables
40
41 extern const struct cpu_type *cpu_current_type;
42 extern boolean cpu_a_is_long;
43 extern boolean cpu_xy_are_long;
44
45
46 // prototypes
47
48 // if cpu type and value match, set register length variable to value.
49 // if cpu type and value don't match, complain instead.
50 extern void vcpu_check_and_set_reg_length(boolean *var, boolean make_long);
51
52 // set default value for pass
53 extern void cputype_passinit(void);
54
55 // lookup cpu type held in DynaBuf and return its struct pointer (or NULL on failure)
56 extern const struct cpu_type *cputype_find(void);
57
58
59 #endif