* asranlib/asranlib.c, link/lkar.h, link/lkar.c:
[fw/sdcc] / as / z80 / z80pst.c
1 /* z80pst.c
2
3    Copyright (C) 1989-1995 Alan R. Baldwin
4    721 Berkeley St., Kent, Ohio 44240
5
6 This program is free software; you can redistribute it and/or modify it
7 under the terms of the GNU General Public License as published by the
8 Free Software Foundation; either version 3, or (at your option) any
9 later version.
10
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.
15
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/>. */
18
19 /*
20  * Extensions: P. Felber
21  */
22
23 #include <stdio.h>
24 #include <setjmp.h>
25 #include "asm.h"
26 #include "z80.h"
27
28 struct  mne     mne[] = {
29
30         /* machine */
31
32         /* system */
33
34     { NULL,     "CON",          S_ATYP,         0,      A_CON },
35     { NULL,     "OVR",          S_ATYP,         0,      A_OVR },
36     { NULL,     "REL",          S_ATYP,         0,      A_REL },
37     { NULL,     "ABS",          S_ATYP,         0,      A_ABS },
38     { NULL,     "NOPAG",        S_ATYP,         0,      A_NOPAG },
39     { NULL,     "PAG",          S_ATYP,         0,      A_PAG },
40
41     { NULL,     ".byte",        S_BYTE,         0,      0 },
42     { NULL,     ".db",          S_BYTE,         0,      0 },
43     { NULL,     ".word",        S_WORD,         0,      0 },
44     { NULL,     ".dw",          S_WORD,         0,      0 },
45     { NULL,     ".df",          S_FLOAT,        0,      0 },
46     { NULL,     ".ascii",       S_ASCII,        0,      0 },
47     { NULL,     ".asciz",       S_ASCIZ,        0,      0 },
48     { NULL,     ".blkb",        S_BLK,          0,      1 },
49     { NULL,     ".ds",          S_BLK,          0,      1 },
50     { NULL,     ".blkw",        S_BLK,          0,      2 },
51     { NULL,     ".page",        S_PAGE,         0,      0 },
52     { NULL,     ".title",       S_TITLE,        0,      0 },
53     { NULL,     ".sbttl",       S_SBTL,         0,      0 },
54     { NULL,     ".globl",       S_GLOBL,        0,      0 },
55     { NULL,     ".area",        S_DAREA,        0,      0 },
56     { NULL,     ".even",        S_EVEN,         0,      0 },
57     { NULL,     ".odd",         S_ODD,          0,      0 },
58     { NULL,     ".if",          S_IF,           0,      0 },
59     { NULL,     ".else",        S_ELSE,         0,      0 },
60     { NULL,     ".endif",       S_ENDIF,        0,      0 },
61     { NULL,     ".include",     S_INCL,         0,      0 },
62     { NULL,     ".radix",       S_RADIX,        0,      0 },
63     { NULL,     ".org",         S_ORG,          0,      0 },
64     { NULL,     ".module",      S_MODUL,        0,      0 },
65     { NULL,     ".ascis",       S_ASCIS,        0,      0 },
66     { NULL,     ".optsdcc",     S_OPTSDCC,      0,      0 },
67
68         /* z80 / hd64180 */
69
70     { NULL,     "ld",           S_LD,           0,      0x40 },
71
72     { NULL,     "call",         S_CALL,         0,      0xC4 },
73     { NULL,     "jp",           S_JP,           0,      0xC2 },
74     { NULL,     "jr",           S_JR,           0,      0x18 },
75 #ifndef GAMEBOY
76     { NULL,     "djnz",         S_DJNZ,         0,      0x10 },
77 #endif /* GAMEBOY */
78     { NULL,     "ret",          S_RET,          0,      0xC0 },
79
80     { NULL,     "bit",          S_BIT,          0,      0x40 },
81     { NULL,     "res",          S_BIT,          0,      0x80 },
82     { NULL,     "set",          S_BIT,          0,      0xC0 },
83
84     { NULL,     "inc",          S_INC,          0,      0x04 },
85     { NULL,     "dec",          S_DEC,          0,      0x05 },
86
87     { NULL,     "add",          S_ADD,          0,      0x80 },
88     { NULL,     "adc",          S_ADC,          0,      0x88 },
89     { NULL,     "sub",          S_SUB,          0,      0x90 },
90     { NULL,     "sbc",          S_SBC,          0,      0x98 },
91
92     { NULL,     "and",          S_AND,          0,      0xA0 },
93     { NULL,     "cp",           S_AND,          0,      0xB8 },
94     { NULL,     "or",           S_AND,          0,      0xB0 },
95     { NULL,     "xor",          S_AND,          0,      0xA8 },
96
97 #ifndef GAMEBOY
98     { NULL,     "ex",           S_EX,           0,      0xE3 },
99 #endif /* GAMEBOY */
100
101     { NULL,     "push",         S_PUSH,         0,      0xC5 },
102     { NULL,     "pop",          S_PUSH,         0,      0xC1 },
103
104 #ifndef GAMEBOY
105     { NULL,     "in",           S_IN,           0,      0xDB },
106     { NULL,     "out",          S_OUT,          0,      0xD3 },
107 #endif /* GAMEBOY */
108
109     { NULL,     "rl",           S_RL,           0,      0x10 },
110     { NULL,     "rlc",          S_RL,           0,      0x00 },
111     { NULL,     "rr",           S_RL,           0,      0x18 },
112     { NULL,     "rrc",          S_RL,           0,      0x08 },
113     { NULL,     "sla",          S_RL,           0,      0x20 },
114     { NULL,     "sra",          S_RL,           0,      0x28 },
115     { NULL,     "srl",          S_RL,           0,      0x38 },
116
117     { NULL,     "rst",          S_RST,          0,      0xC7 },
118
119 #ifndef GAMEBOY
120     { NULL,     "im",           S_IM,           0,      0xED },
121 #endif /* GAMEBOY */
122
123     { NULL,     "ccf",          S_INH1,         0,      0x3F },
124     { NULL,     "cpl",          S_INH1,         0,      0x2F },
125     { NULL,     "daa",          S_INH1,         0,      0x27 },
126     { NULL,     "di",           S_INH1,         0,      0xF3 },
127     { NULL,     "ei",           S_INH1,         0,      0xFB },
128 #ifndef GAMEBOY
129     { NULL,     "exx",          S_INH1,         0,      0xD9 },
130 #endif /* GAMEBOY */
131     { NULL,     "nop",          S_INH1,         0,      0x00 },
132     { NULL,     "halt",         S_INH1,         0,      0x76 },
133     { NULL,     "rla",          S_INH1,         0,      0x17 },
134     { NULL,     "rlca",         S_INH1,         0,      0x07 },
135     { NULL,     "rra",          S_INH1,         0,      0x1F },
136     { NULL,     "rrca",         S_INH1,         0,      0x0F },
137     { NULL,     "scf",          S_INH1,         0,      0x37 },
138
139 #ifndef GAMEBOY
140     { NULL,     "cpd",          S_INH2,         0,      0xA9 },
141     { NULL,     "cpdr",         S_INH2,         0,      0xB9 },
142     { NULL,     "cpi",          S_INH2,         0,      0xA1 },
143     { NULL,     "cpir",         S_INH2,         0,      0xB1 },
144     { NULL,     "ind",          S_INH2,         0,      0xAA },
145     { NULL,     "indr",         S_INH2,         0,      0xBA },
146     { NULL,     "ini",          S_INH2,         0,      0xA2 },
147     { NULL,     "inir",         S_INH2,         0,      0xB2 },
148     { NULL,     "ldd",          S_INH2,         0,      0xA8 },
149     { NULL,     "lddr",         S_INH2,         0,      0xB8 },
150     { NULL,     "ldi",          S_INH2,         0,      0xA0 },
151     { NULL,     "ldir",         S_INH2,         0,      0xB0 },
152     { NULL,     "neg",          S_INH2,         0,      0x44 },
153     { NULL,     "otdr",         S_INH2,         0,      0xBB },
154     { NULL,     "otir",         S_INH2,         0,      0xB3 },
155     { NULL,     "outd",         S_INH2,         0,      0xAB },
156     { NULL,     "outi",         S_INH2,         0,      0xA3 },
157     { NULL,     "reti",         S_INH2,         0,      0x4D },
158     { NULL,     "retn",         S_INH2,         0,      0x45 },
159     { NULL,     "rld",          S_INH2,         0,      0x6F },
160     { NULL,     "rrd",          S_INH2,         0,      0x67 },
161
162         /* 64180 */
163
164     { NULL,     ".hd64",        X_HD64,         0,      0 },
165
166     { NULL,     "otdm",         X_INH2,         0,      0x8B },
167     { NULL,     "otdmr",        X_INH2,         0,      0x9B },
168     { NULL,     "otim",         X_INH2,         0,      0x83 },
169     { NULL,     "otimr",        X_INH2,         0,      0x93 },
170     { NULL,     "slp",          X_INH2,         0,      0x76 },
171
172     { NULL,     "in0",          X_IN,           0,      0x00 },
173     { NULL,     "out0",         X_OUT,          0,      0x01 },
174
175     { NULL,     "mlt",          X_MLT,          0,      0x4C },
176
177     { NULL,     "tst",          X_TST,          0,      0x04 },
178     { NULL,     "tstio",        X_TSTIO,        S_END,  0x7 }
179 #else /* GAMEBOY */
180     { NULL,     "stop",         S_STOP,         0,      0x10 },
181     { NULL,     "swap",         S_RL,           0,      0x30 },
182     { NULL,     "reti",         S_INH1,         0,      0xD9 },
183     { NULL,     "ldh",          S_LDH,          0,      0xE0 },
184     { NULL,     "lda",          S_LDA,          0,      0xE8 },
185     { NULL,     "ldhl",         S_LDHL,         S_END,  0xF }
186 #endif /* GAMEBOY */
187 };