]>
Commit | Line | Data |
---|---|---|
1 | ; Configuration, hardware definition, ... | |
2 | ; | |
3 | ; Copyright (C) 2010 Sprite_tm | |
4 | ; Copyright (C) 2010 Leo C. | |
5 | ; | |
6 | ; This file is part of avrcpm. | |
7 | ; | |
8 | ; avrcpm is free software: you can redistribute it and/or modify it | |
9 | ; under the terms of the GNU General Public License as published by | |
10 | ; the Free Software Foundation, either version 3 of the License, or | |
11 | ; (at your option) any later version. | |
12 | ; | |
13 | ; avrcpm is distributed in the hope that it will be useful, | |
14 | ; but WITHOUT ANY WARRANTY; without even the implied warranty of | |
15 | ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
16 | ; GNU General Public License for more details. | |
17 | ; | |
18 | ; You should have received a copy of the GNU General Public License | |
19 | ; along with avrcpm. If not, see <http://www.gnu.org/licenses/>. | |
20 | ; | |
21 | ; $Id$ | |
22 | ; | |
23 | ||
24 | ||
25 | #define VMAJOR 2 /* Version number */ | |
26 | #define VMINOR 0 | |
27 | ||
28 | #ifndef DRAM_8BIT | |
29 | #define DRAM_8BIT 0 /* 1 = 8bit wide DRAM */ | |
30 | #endif | |
31 | #ifndef F_CPU | |
32 | #define F_CPU 20000000 /* system clock in Hz; defaults to 20MHz */ | |
33 | #endif | |
34 | #ifndef BAUD | |
35 | #define BAUD 38400 /* console baud rate */ | |
36 | #endif | |
37 | ||
38 | #define PARTID 0x52 /* Partition table id */ | |
39 | /* http://www.win.tue.nl/~aeb/partitions/partition_types-1.html */ | |
40 | #define K 1024 | |
41 | #define M 1204*K | |
42 | ||
43 | ;#define RAMSIZE 256*K*4 /* 1 chip 256Kx4 */ | |
44 | #define RAMSIZE 4*M*4 * 2 /* 2 chips 4Mx4 */ | |
45 | ||
46 | #define RAMDISKCNT 0 /* Number of RAM disks */ | |
47 | #define RAMDISKNR 'I'-'A' /* Drive "letter" for first RAM disk */ | |
48 | ||
49 | #define PARTID 0x52 /* Partition table id */ | |
50 | /* http://www.win.tue.nl/~aeb/partitions/partition_types-1.html */ | |
51 | #define IPLADDR 0x2000 /* Bootloader load address */ | |
52 | ||
53 | #define DRAM_WAITSTATES 1 /* Number of additional clock cycles for dram read access */ | |
54 | #define REFR_RATE 64000 /* dram refresh rate in cycles/s. */ | |
55 | /* Most drams need 1/15.6µs. */ | |
56 | #define RXBUFSIZE 128 /* USART recieve buffer size. Must be power of 2 */ | |
57 | #define TXBUFSIZE 128 /* USART transmit buffer size. Must be power of 2 */ | |
58 | ||
59 | ||
60 | ||
61 | #define EM_Z80 0 /* we don't have any z80 instructions yet */ | |
62 | ||
63 | .equ BOOT_DEBUG = 0 | |
64 | .equ MMC_DEBUG = 0 /* Increase for more debugging */ | |
65 | .equ INS_DEBUG = 0 | |
66 | .equ MEMTEST = 1 | |
67 | .equ BOOTWAIT = 1 | |
68 | .equ PORT_DEBUG = 0 | |
69 | .equ DISK_DEBUG = 0 /* Increase for more debugging */ | |
70 | .equ HOSTRW_DEBUG= 0 | |
71 | .equ MEMFILL = 1 | |
72 | .equ STACK_DBG = 0 | |
73 | .equ PRINT_PC = 0 | |
74 | ||
75 | #define MMC_SPI2X 1 /* 0 = SPI CLK/4, 1 = SPI CLK/2 */ | |
76 | ||
77 | #define MEMFILL_VAL 0xCB /* Fill ram with cbs, which will trigger an invalid opcode error. */ | |
78 | #define DBG_TRACE_BOTTOM 0x01 /* Page boundaries for INS_DEBUG and PRINT_PC */ | |
79 | #define DBG_TRACE_TOP 0xdc /* Trace is off, below bottom page and above top page. */ | |
80 | ||
81 | ;----------------------------------------------------------------------- | |
82 | ; Port declarations | |
83 | ||
84 | #if DRAM_8BIT /* Implies software uart */ | |
85 | ||
86 | ;Port D | |
87 | .equ RAM_D0 = 0 | |
88 | .equ RAM_D1 = 1 | |
89 | .equ RAM_D2 = 2 | |
90 | .equ RAM_D3 = 3 | |
91 | .equ RAM_D4 = 4 | |
92 | .equ RAM_D5 = 5 | |
93 | .equ RAM_D6 = 6 | |
94 | .equ RAM_D7 = 7 | |
95 | .equ RAM_A0 = 0 | |
96 | .equ RAM_A1 = 1 | |
97 | .equ RAM_A2 = 2 | |
98 | .equ RAM_A3 = 3 | |
99 | .equ RAM_A4 = 4 | |
100 | .equ RAM_A5 = 5 | |
101 | .equ RAM_A6 = 6 | |
102 | .equ RAM_A7 = 7 | |
103 | ||
104 | ;Port B | |
105 | .equ MMC_MOSI = 3 | |
106 | .equ MMC_MISO = 4 | |
107 | .equ MMC_SCK = 5 | |
108 | .equ RAM_A8 = 3 | |
109 | .equ RAM_A9 = 4 | |
110 | .equ RAM_A10 = 5 | |
111 | ||
112 | .equ RXD = 0 | |
113 | .equ TXD = 1 | |
114 | .equ MMC_CS = 2 | |
115 | ||
116 | .equ P_MMC_CS = PORTB | |
117 | .equ P_A8 = PORTB | |
118 | .equ P_RXD = PORTB | |
119 | ||
120 | ;Port C | |
121 | .equ RAM_RAS = 0 | |
122 | .equ RAM_CAS = 1 | |
123 | .equ RAM_OE = 2 | |
124 | .equ RAM_W = 3 | |
125 | ||
126 | .equ P_RAS = PORTC | |
127 | .equ P_CAS = PORTC | |
128 | .equ P_OE = PORTC | |
129 | .equ P_W = PORTC | |
130 | ||
131 | ||
132 | #else /* 4 bit RAM, hardware uart */ | |
133 | ||
134 | ; Port D | |
135 | .equ RXD = 0 | |
136 | .equ TXD = 1 | |
137 | .equ RAM_OE = 2 | |
138 | .equ RAM_A8 = 3 | |
139 | .equ MMC_CS = 4 | |
140 | .equ RAM_A5 = 5 | |
141 | .equ RAM_A6 = 6 | |
142 | .equ RAM_A7 = 7 | |
143 | ||
144 | .equ P_RXD = PORTD | |
145 | .equ P_OE = PORTD | |
146 | .equ P_A8 = PORTD | |
147 | .equ P_MMC_CS = PORTD | |
148 | .equ P_AH = PORTD | |
149 | ; RAM_A[7..5] | |
150 | .equ RAM_AH_MASK = (1<<RAM_A8)|(1<<RAM_A7)|(1<<RAM_A6)|(1<<RAM_A5) | |
151 | .equ PD_OUTPUT_MASK = (1<<MMC_CS) | (1<<RAM_OE) | RAM_AH_MASK | |
152 | ||
153 | ||
154 | ;Port B | |
155 | .equ RAM_A4 = 0 | |
156 | .equ RAM_A3 = 1 | |
157 | .equ RAM_A2 = 2 | |
158 | .equ RAM_A1 = 3 | |
159 | .equ MMC_MOSI = 3 | |
160 | .equ RAM_A0 = 4 | |
161 | .equ MMC_MISO = 4 | |
162 | .equ RAM_RAS = 5 | |
163 | .equ MMC_SCK = 5 | |
164 | ||
165 | .equ P_RAS = PORTB | |
166 | .equ P_AL = PORTB | |
167 | ; RAM_A[4..0] | |
168 | .equ RAM_AL_MASK = (1<<RAM_A4)|(1<<RAM_A3)|(1<<RAM_A2)|(1<<RAM_A1)|(1<<RAM_A0) | |
169 | .equ PB_OUTPUT_MASK = (1<<RAM_ras) | RAM_AL_MASK | |
170 | ||
171 | ;Port C | |
172 | .equ RAM_D0 = 0 | |
173 | .equ RAM_D1 = 1 | |
174 | .equ RAM_D2 = 2 | |
175 | .equ RAM_D3 = 3 | |
176 | .equ RAM_W = 4 | |
177 | .equ RAM_CAS = 5 | |
178 | ||
179 | .equ P_DQ = PORTC | |
180 | .equ P_W = PORTC | |
181 | .equ P_CAS = PORTC | |
182 | ||
183 | .equ RAM_DQ_MASK = (1<<RAM_D3)|(1<<RAM_D2)|(1<<RAM_D1)|(1<<RAM_D0) | |
184 | .equ PC_OUTPUT_MASK = (1<<RAM_CAS)|(1<<RAM_W) | |
185 | ||
186 | #endif /* DRAM_8BIT */ | |
187 | ||
188 | ||
189 | ;----------------------------------------------------------------------- | |
190 | ;Register definitions | |
191 | ||
192 | .def _tmp0 = r0 | |
193 | .def _tmp1 = r1 | |
194 | ||
195 | .def _RAS0 = r2 | |
196 | .def _CAS0 = r3 | |
197 | .def _OE = r4 | |
198 | .def _WE = r5 | |
199 | .def _255 = r6 | |
200 | .def _0 = r7 | |
201 | .def z_a = r9 | |
202 | ;.def stx_bitcount = r9 | |
203 | ;.def stx_dr = r10 | |
204 | .def srx_lastedgel = r10 | |
205 | .def srx_lastedgeh = r11 | |
206 | ||
207 | .def insstore= r8 ; | |
208 | ;.def insop = r13 ; | |
209 | .def insdecl = r12 ; | |
210 | .def insdech = r13 ; | |
211 | .def z_spl = r14 | |
212 | .def z_sph = r15 ; | |
213 | .def temp = r16 ; | |
214 | .def temp2 = r17 ; | |
215 | .def temp3 = r18 | |
216 | .def temp4 = r19 | |
217 | .def z_flags = r20 ; | |
218 | ; | |
219 | .def opl = r22 ; | |
220 | .def oph = r23 ; | |
221 | .def z_pcl = r24 ; | |
222 | .def z_pch = r25 ; | |
223 | ; xl ;r26 | |
224 | ; xh ;r27 | |
225 | ; yl ;r28 | |
226 | ; yh ;r29 | |
227 | ; zl ;r30 ; | |
228 | ; zh ;r31 ; | |
229 | ||
230 | ||
231 | ||
232 | #if defined __ATmega8__ | |
233 | .equ flags = TWBR | |
234 | .equ P_PUD = SFIOR | |
235 | #else | |
236 | .equ flags = GPIOR0 | |
237 | .equ P_PUD = MCUCR | |
238 | #endif | |
239 | ||
240 | ; Flags: | |
241 | .equ hostact = 7 ;host active flag | |
242 | .equ hostwrt = 6 ;host written flag | |
243 | .equ rsflag = 5 ;read sector flag | |
244 | .equ readop = 4 ;1 if read operation | |
245 | .equ trace = 0 | |
246 | ||
247 | ; This is the base z80 port address for clock access | |
248 | #define TIMERPORT 0x40 | |
249 | #define TIMER_CTL TIMERPORT | |
250 | #define TIMER_MSECS TIMERPORT+1 | |
251 | #define TIMER_SECS TIMER_MSECS+2 | |
252 | ||
253 | #define starttimercmd 1 | |
254 | #define quitTimerCmd 2 | |
255 | #define printTimerCmd 15 | |
256 | #define uptimeCmd 16 | |
257 | ||
258 | #if defined __ATmega8__ | |
259 | .equ RXTXDR0 = UDR | |
260 | .equ UCSR0A = UCSRA | |
261 | .equ UDRE0 = UDRE | |
262 | .equ UCSR0B = UCSRB | |
263 | .equ RXCIE0 = RXCIE | |
264 | .equ UDRIE0 = UDRIE | |
265 | .equ RXEN0 = RXEN | |
266 | .equ TXEN0 = TXEN | |
267 | .equ UCSR0C = UCSRC | |
268 | .equ UCSZ00 = UCSZ0 | |
269 | .equ UCSZ01 = UCSZ1 | |
270 | .equ UBRR0H = UBRRH | |
271 | .equ UBRR0L = UBRRL | |
272 | .equ OCR2A = OCR2 | |
273 | .equ OC2Aaddr= OC2addr | |
274 | .equ TCCR2A = TCCR2 | |
275 | .equ TCCR2B = TCCR2 | |
276 | .equ TIMSK1 = TIMSK | |
277 | .equ TIMSK2 = TIMSK | |
278 | .equ OCIE2A = OCIE2 | |
279 | .equ TIFR1 = TIFR | |
280 | .equ ICIE1 = TICIE1 | |
281 | #else | |
282 | .equ RXTXDR0 = UDR0 | |
283 | #endif | |
284 | ||
285 | ; vim:set ts=8 noet nowrap | |
286 | ||
287 |