1 /* ds8.h */ 2 3 /* 4 * Copyright (C) 1998-2009 Alan R. Baldwin 5 * 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. 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 * Alan R. Baldwin 21 * 721 Berkeley St. 22 * Kent, Ohio 44240 23 * 24 * This Assember Ported by 25 * jhartman at compuserve dot com 26 * noice at noicedebugger dot com 27 * 28 * Modified from i51pst.c 29 * Bill McKinnon 30 * w_mckinnon at conknet dot com 31 * 32 */ 33 34 /*)BUILD 35 $(PROGRAM) = AS8XCXXX 36 $(INCLUDE) = { 37 ASXXXX.H 38 DS8.H 39 } 40 $(FILES) = { 41 DS8MCH.C 42 DS8ADR.C 43 DS80PST.C 44 ASMAIN.C 45 ASDBG.C 46 ASLEX.C 47 ASSYM.C 48 ASSUBR.C 49 ASEXPR.C 50 ASDATA.C 51 ASLIST.C 52 ASOUT.C 53 } 54 $(STACK) = 3000 55 */ 56 57 /* Addressing modes */ 58 #define S_A 30 /* A */ 59 /* #define S_B 31 */ /* B */ 60 #define S_C 32 /* C (carry) */ 61 #define S_RAB 33 /* AB */ 62 #define S_DPTR 34 /* DPTR */ 63 #define S_REG 35 /* Register R0-R7 */ 64 #define S_IMMED 36 /* immediate */ 65 #define S_DIR 37 /* direct */ 66 #define S_EXT 38 /* extended */ 67 #define S_PC 39 /* PC (for addressing mode) */ 68 69 #define S_AT_R 40 /* @R0 or @R1 */ 70 #define S_AT_DP 41 /* @DPTR */ 71 #define S_AT_APC 42 /* @A+PC */ 72 #define S_AT_ADP 43 /* @A+DPTR */ 73 #define S_NOT_BIT 44 /* /BIT (/DIR) */ 74 75 /* 76 * Symbol types. 77 */ 78 #define S_INH 50 /* One byte inherent */ 79 #define S_JMP11 51 /* Jump and call 11 bit. */ 80 #define S_JMP16 52 /* Jump and call 16 bit */ 81 #define S_ACC 53 /* Accumulator */ 82 #define S_TYP1 54 /* Type 1 (inc and dec) */ 83 #define S_TYP2 55 /* Type 2 (arith ops) */ 84 #define S_TYP3 56 /* Type 3 (logic ops) */ 85 #define S_TYP4 57 /* Type 4 (XCH) */ 86 #define S_MOV 58 /* MOV */ 87 #define S_BITBR 59 /* bit branch */ 88 #define S_BR 60 /* branch */ 89 #define S_ACBIT 61 /* CLR, CPL */ 90 #define S_CJNE 62 /* CJNE */ 91 #define S_DJNZ 63 /* DJNZ */ 92 #define S_JMP 64 /* JMP */ 93 #define S_MOVC 65 /* MOVC */ 94 #define S_MOVX 66 /* MOVX */ 95 #define S_AB 67 /* AB (div and mul) */ 96 #define S_CPL 68 /* CPL */ 97 #define S_SETB 69 /* SETB */ 98 #define S_DIRECT 70 /* DIRECT (pusha and pop) */ 99 #define S_XCHD 71 /* XCHD */ 100 101 #define S_AMODE 90 /* address mode directive */ 102 103 #define S_CPU 91 /* Machines */ 104 105 /* 106 * Processor Types (S_CPU) 107 */ 108 #define X_DS______ 0 109 #define X_DS8XCXXX 1 110 #define X_DS80C310 2 111 #define X_DS80C320 3 112 #define X_DS80C323 4 113 #define X_DS80C390 5 114 #define X_DS83C520 6 115 #define X_DS83C530 7 116 #define X_DS83C550 8 117 #define X_DS87C520 9 118 #define X_DS87C530 10 119 #define X_DS87C550 11 120 121 /* 122 * Registers. Value == address in RAM, except for PC 123 */ 124 #define R0 0 125 #define R1 1 126 #define R2 2 127 #define R3 3 128 #define R4 4 129 #define R5 5 130 #define R6 6 131 #define R7 7 132 #define A 0xE0 133 #define DPTR 0x82 134 #define PC 0xFF /* dummy number for register ID only */ 135 #define AB 0xFE /* dummy number for register ID only */ 136 #define C 0xFD /* dummy number for register ID only */ 137 138 struct adsym 139 { 140 char a_str[5]; /* addressing string (length for DPTR+null)*/ 141 int a_val; /* addressing mode value */ 142 }; 143 144 /* pre-defined symbol structure: name, value, processor type */ 145 struct PreDef 146 { 147 char *id; /* ARB */ 148 int value; 149 int ptype; 150 }; 151 extern struct PreDef preDef[]; 152 153 /* 154 * Assembler Types 155 */ 156 #define DS______ (0x00000000) 157 #define DS8XCXXX (0x00000001) 158 #define DS80C310 (0x00000002) 159 #define DS80C320 (0x00000004) 160 #define DS80C323 (0x00000008) 161 #define DS80C390 (0x00000010) 162 #define DS83C520 (0x00000100) 163 #define DS83C530 (0x00000200) 164 #define DS83C550 (0x00000400) 165 #define DS87C520 (0x00001000) 166 #define DS87C530 (0x00002000) 167 #define DS87C550 (0x00004000) 168 169 /* machine dependent functions */ 170 171 #define DS_CPU "Dallas Semiconductor" 172 173 #ifdef OTHERSYSTEM 174 175 /* ds8adr.c */ 176 extern struct adsym reg51[]; 177 extern int addr(struct expr *esp); 178 extern int admode(struct adsym *sp); 179 extern int any(int c, char *str); 180 extern int srch(char *str); 181 extern int reg(void); 182 183 /* ds8mch.c */ 184 extern VOID machine(struct mne *mp); 185 extern int mchpcr(struct expr *esp); 186 extern VOID minit(void); 187 188 #else 189 190 /* ds8adr.c */ 191 extern struct adsym reg51[]; 192 extern int addr(); 193 extern int admode(); 194 extern int any(); 195 extern int srch(); 196 extern int reg(); 197 198 /* ds8mch.c */ 199 extern VOID machine(); 200 extern int mchpcr(); 201 extern VOID minit(); 202 203 #endif 204