struct / union in initializer, RFE #901.
[sdcc.git] / sdcc / sdas / asgb / gbpst.c
blobccd2535557420fe6481b951d1d07f7854fa80ba1
1 /* gbpst.c */
3 /*
4 * Copyright (C) 1989-2021 Alan R. Baldwin
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation, either version 3 of the License, or
9 * (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
20 * Alan R. Baldwin
21 * 721 Berkeley St.
22 * Kent, Ohio 44240
25 /* Extensions: P. Felber */
27 #include "asxxxx.h"
28 #include "gb.h"
31 * Mnemonic Structure
33 struct mne mne[] = {
35 /* machine */
37 /* system */
39 { NULL, "CON", S_ATYP, 0, A_CON },
40 { NULL, "OVR", S_ATYP, 0, A_OVR },
41 { NULL, "REL", S_ATYP, 0, A_REL },
42 { NULL, "ABS", S_ATYP, 0, A_ABS },
43 { NULL, "NOPAG", S_ATYP, 0, A_NOPAG },
44 { NULL, "PAG", S_ATYP, 0, A_PAG },
46 { NULL, ".page", S_PAGE, 0, 0 },
47 { NULL, ".title", S_HEADER, 0, O_TITLE },
48 { NULL, ".sbttl", S_HEADER, 0, O_SBTTL },
49 { NULL, ".module", S_MODUL, 0, 0 },
50 { NULL, ".include", S_INCL, 0, I_CODE },
51 { NULL, ".incbin", S_INCL, 0, I_BNRY },
52 { NULL, ".area", S_AREA, 0, 0 },
53 // { NULL, ".bank", S_BANK, 0, 0 },
54 { NULL, ".org", S_ORG, 0, 0 },
55 { NULL, ".radix", S_RADIX, 0, 0 },
56 { NULL, ".globl", S_GLOBL, 0, 0 },
57 { NULL, ".local", S_LOCAL, 0, 0 },
58 { NULL, ".if", S_CONDITIONAL, 0, O_IF },
59 { NULL, ".iff", S_CONDITIONAL, 0, O_IFF },
60 { NULL, ".ift", S_CONDITIONAL, 0, O_IFT },
61 { NULL, ".iftf", S_CONDITIONAL, 0, O_IFTF },
62 { NULL, ".ifdef", S_CONDITIONAL, 0, O_IFDEF },
63 { NULL, ".ifndef", S_CONDITIONAL, 0, O_IFNDEF},
64 { NULL, ".ifgt", S_CONDITIONAL, 0, O_IFGT },
65 { NULL, ".iflt", S_CONDITIONAL, 0, O_IFLT },
66 { NULL, ".ifge", S_CONDITIONAL, 0, O_IFGE },
67 { NULL, ".ifle", S_CONDITIONAL, 0, O_IFLE },
68 { NULL, ".ifeq", S_CONDITIONAL, 0, O_IFEQ },
69 { NULL, ".ifne", S_CONDITIONAL, 0, O_IFNE },
70 { NULL, ".ifb", S_CONDITIONAL, 0, O_IFB },
71 { NULL, ".ifnb", S_CONDITIONAL, 0, O_IFNB },
72 { NULL, ".ifidn", S_CONDITIONAL, 0, O_IFIDN },
73 { NULL, ".ifdif", S_CONDITIONAL, 0, O_IFDIF },
74 { NULL, ".iif", S_CONDITIONAL, 0, O_IIF },
75 { NULL, ".iiff", S_CONDITIONAL, 0, O_IIFF },
76 { NULL, ".iift", S_CONDITIONAL, 0, O_IIFT },
77 { NULL, ".iiftf", S_CONDITIONAL, 0, O_IIFTF },
78 { NULL, ".iifdef", S_CONDITIONAL, 0, O_IIFDEF},
79 { NULL, ".iifndef", S_CONDITIONAL, 0, O_IIFNDEF},
80 { NULL, ".iifgt", S_CONDITIONAL, 0, O_IIFGT },
81 { NULL, ".iiflt", S_CONDITIONAL, 0, O_IIFLT },
82 { NULL, ".iifge", S_CONDITIONAL, 0, O_IIFGE },
83 { NULL, ".iifle", S_CONDITIONAL, 0, O_IIFLE },
84 { NULL, ".iifeq", S_CONDITIONAL, 0, O_IIFEQ },
85 { NULL, ".iifne", S_CONDITIONAL, 0, O_IIFNE },
86 { NULL, ".iifb", S_CONDITIONAL, 0, O_IIFB },
87 { NULL, ".iifnb", S_CONDITIONAL, 0, O_IIFNB },
88 { NULL, ".iifidn", S_CONDITIONAL, 0, O_IIFIDN},
89 { NULL, ".iifdif", S_CONDITIONAL, 0, O_IIFDIF},
90 { NULL, ".else", S_CONDITIONAL, 0, O_ELSE },
91 { NULL, ".endif", S_CONDITIONAL, 0, O_ENDIF },
92 { NULL, ".list", S_LISTING, 0, O_LIST },
93 { NULL, ".nlist", S_LISTING, 0, O_NLIST },
94 { NULL, ".equ", S_EQU, 0, O_EQU },
95 { NULL, ".gblequ", S_EQU, 0, O_GBLEQU},
96 { NULL, ".lclequ", S_EQU, 0, O_LCLEQU},
97 { NULL, ".byte", S_DATA, 0, O_1BYTE },
98 { NULL, ".db", S_DATA, 0, O_1BYTE },
99 { NULL, ".fcb", S_DATA, 0, O_1BYTE },
100 { NULL, ".word", S_DATA, 0, O_2BYTE },
101 { NULL, ".dw", S_DATA, 0, O_2BYTE },
102 { NULL, ".fdb", S_DATA, 0, O_2BYTE },
103 /* { NULL, ".3byte", S_DATA, 0, O_3BYTE }, */
104 /* { NULL, ".triple", S_DATA, 0, O_3BYTE }, */
105 /* { NULL, ".4byte", S_DATA, 0, O_4BYTE }, */
106 /* { NULL, ".quad", S_DATA, 0, O_4BYTE }, */
107 { NULL, ".df", S_FLOAT, 0, 0 },
108 { NULL, ".blkb", S_BLK, 0, O_1BYTE },
109 { NULL, ".ds", S_BLK, 0, O_1BYTE },
110 { NULL, ".rmb", S_BLK, 0, O_1BYTE },
111 { NULL, ".rs", S_BLK, 0, O_1BYTE },
112 { NULL, ".blkw", S_BLK, 0, O_2BYTE },
113 /* { NULL, ".blk3", S_BLK, 0, O_3BYTE }, */
114 /* { NULL, ".blk4", S_BLK, 0, O_4BYTE }, */
115 { NULL, ".ascii", S_ASCIX, 0, O_ASCII },
116 { NULL, ".ascis", S_ASCIX, 0, O_ASCIS },
117 { NULL, ".asciz", S_ASCIX, 0, O_ASCIZ },
118 { NULL, ".str", S_ASCIX, 0, O_ASCII },
119 { NULL, ".strs", S_ASCIX, 0, O_ASCIS },
120 { NULL, ".strz", S_ASCIX, 0, O_ASCIZ },
121 { NULL, ".fcc", S_ASCIX, 0, O_ASCII },
122 { NULL, ".define", S_DEFINE, 0, O_DEF },
123 { NULL, ".undefine", S_DEFINE, 0, O_UNDEF },
124 { NULL, ".even", S_BOUNDARY, 0, O_EVEN },
125 { NULL, ".odd", S_BOUNDARY, 0, O_ODD },
126 { NULL, ".bndry", S_BOUNDARY, 0, O_BNDRY },
127 { NULL, ".msg" , S_MSG, 0, 0 },
128 { NULL, ".assume", S_ERROR, 0, O_ASSUME},
129 { NULL, ".error", S_ERROR, 0, O_ERROR },
130 /* sdas specific */
131 { NULL, ".optsdcc", S_OPTSDCC, 0, 0 },
132 /* end sdas specific */
134 /* Macro Processor */
136 { NULL, ".macro", S_MACRO, 0, O_MACRO },
137 { NULL, ".endm", S_MACRO, 0, O_ENDM },
138 { NULL, ".mexit", S_MACRO, 0, O_MEXIT },
140 { NULL, ".narg", S_MACRO, 0, O_NARG },
141 { NULL, ".nchr", S_MACRO, 0, O_NCHR },
142 { NULL, ".ntyp", S_MACRO, 0, O_NTYP },
144 { NULL, ".irp", S_MACRO, 0, O_IRP },
145 { NULL, ".irpc", S_MACRO, 0, O_IRPC },
146 { NULL, ".rept", S_MACRO, 0, O_REPT },
148 { NULL, ".nval", S_MACRO, 0, O_NVAL },
150 { NULL, ".mdelete", S_MACRO, 0, O_MDEL },
152 /* Gameboy, a modified Z80 */
153 { NULL, ".tile", S_TILE, 0, 0 },
155 { NULL, "ld", S_LD, 0, 0x40 },
157 { NULL, "call", S_CALL, 0, 0xC4 },
158 { NULL, "jp", S_JP, 0, 0xC2 },
159 { NULL, "jr", S_JR, 0, 0x18 },
160 { NULL, "ret", S_RET, 0, 0xC0 },
162 { NULL, "bit", S_BIT, 0, 0x40 },
163 { NULL, "res", S_BIT, 0, 0x80 },
164 { NULL, "set", S_BIT, 0, 0xC0 },
166 { NULL, "inc", S_INC, 0, 0x04 },
167 { NULL, "dec", S_DEC, 0, 0x05 },
169 { NULL, "add", S_ADD, 0, 0x80 },
170 { NULL, "adc", S_ADC, 0, 0x88 },
171 { NULL, "sub", S_SUB, 0, 0x90 },
172 { NULL, "sbc", S_SBC, 0, 0x98 },
174 { NULL, "and", S_AND, 0, 0xA0 },
175 { NULL, "cp", S_AND, 0, 0xB8 },
176 { NULL, "or", S_AND, 0, 0xB0 },
177 { NULL, "xor", S_AND, 0, 0xA8 },
179 { NULL, "push", S_PUSH, 0, 0xC5 },
180 { NULL, "pop", S_PUSH, 0, 0xC1 },
182 { NULL, "rl", S_RL, 0, 0x10 },
183 { NULL, "rlc", S_RL, 0, 0x00 },
184 { NULL, "rr", S_RL, 0, 0x18 },
185 { NULL, "rrc", S_RL, 0, 0x08 },
186 { NULL, "sla", S_RL, 0, 0x20 },
187 { NULL, "sra", S_RL, 0, 0x28 },
188 { NULL, "srl", S_RL, 0, 0x38 },
190 { NULL, "swap", S_RL, 0, 0x30 },
192 { NULL, "rst", S_RST, 0, 0xC7 },
194 { NULL, "ldh", S_LDH, 0, 0xE0 },
196 { NULL, "ccf", S_INH1, 0, 0x3F },
197 { NULL, "cpl", S_INH1, 0, 0x2F },
198 { NULL, "daa", S_INH1, 0, 0x27 },
199 { NULL, "di", S_INH1, 0, 0xF3 },
200 { NULL, "ei", S_INH1, 0, 0xFB },
201 { NULL, "nop", S_INH1, 0, 0x00 },
202 { NULL, "halt", S_INH1, 0, 0x76 },
203 { NULL, "rla", S_INH1, 0, 0x17 },
204 { NULL, "rlca", S_INH1, 0, 0x07 },
205 { NULL, "rra", S_INH1, 0, 0x1F },
206 { NULL, "rrca", S_INH1, 0, 0x0F },
207 { NULL, "scf", S_INH1, 0, 0x37 },
208 { NULL, "reti", S_INH1, 0, 0xD9 },
209 { NULL, "lda", S_LDA, 0, 0xE8 },
210 { NULL, "ldhl", S_LDHL, 0, 0x0F },
211 { NULL, "stop", S_STOP, S_EOL, 0x10 }