Pick three bugfixes from next branch to trunk for inclusion in 4.5.0 RC2, as discusse...
[sdcc.git] / sdcc / src / z80 / z80.h
blob0a88dc417fd9bf8bb2444abfae9fe7a818065301
1 /** @file z80/z80.h
2 Common definitions for the the z80-related ports.
3 */
4 #include "common.h"
5 #include "ralloc.h"
6 #include "gen.h"
7 #include "peep.h"
8 #include "support.h"
10 typedef enum
12 SUB_Z80,
13 SUB_Z180,
14 SUB_R2K,
15 SUB_R2KA,
16 SUB_R3KA,
17 SUB_SM83,
18 SUB_TLCS90,
19 SUB_EZ80_Z80,
20 SUB_Z80N,
21 SUB_R800
23 Z80_SUB_PORT;
25 typedef struct
27 Z80_SUB_PORT sub;
28 int calleeSavesBC;
29 int port_mode;
30 int port_back;
31 int reserveIY;
32 int noOmitFramePtr;
33 int legacyBanking;
34 int nmosZ80;
36 Z80_OPTS;
38 extern Z80_OPTS z80_opts;
40 #define IS_Z80 (z80_opts.sub == SUB_Z80)
41 #define IS_Z180 (z80_opts.sub == SUB_Z180)
42 #define IS_R2K (z80_opts.sub == SUB_R2K)
43 #define IS_R2KA (z80_opts.sub == SUB_R2KA)
44 #define IS_R3KA (z80_opts.sub == SUB_R3KA)
45 #define IS_RAB (IS_R2K || IS_R2KA || IS_R3KA)
46 #define IS_SM83 (z80_opts.sub == SUB_SM83)
47 #define IS_TLCS90 (z80_opts.sub == SUB_TLCS90)
48 #define IS_EZ80_Z80 (z80_opts.sub == SUB_EZ80_Z80)
49 #define IS_Z80N (z80_opts.sub == SUB_Z80N)
50 #define IS_R800 (z80_opts.sub == SUB_R800)
51 #define HAS_IYL_INST (IS_Z80N || IS_EZ80_Z80 || IS_R800 || IS_Z80 && options.allow_undoc_inst)
53 #define IY_RESERVED (z80_opts.reserveIY)
55 #define OPTRALLOC_IY !(IY_RESERVED || IS_SM83)
57 enum
59 ACCUSE_A = 1,
60 ACCUSE_SCRATCH,
61 ACCUSE_IY