]> cloudbase.mooo.com Git - z180-stamp.git/blob - z180/config.inc
Adaptions for fatfs R0.13b
[z180-stamp.git] / z180 / config.inc
1
2 FALSE equ 0
3 TRUE equ NOT FALSE
4
5
6 banked equ true
7
8 ;-----------------------------------------------------
9 ; CPU and BANKING types
10
11
12 CPU_Z180 equ TRUE
13 CPU_Z80 equ FALSE
14
15 ROMSYS equ FALSE
16
17 AVRCLK equ 18432 ;[KHz]
18
19 if CPU_Z180
20
21 ;-----------------------------------------------------
22 ;FOSC equ AVRCLK/2 ;Oscillator frequency [KHz]
23 ;PHI equ FOSC*2 ;CPU frequency (clock doubler enabled)
24
25 ;----------------------------------------------------------------------
26 ; Baudrate Generator for x16 clock mode:
27 ; TC = (f PHI / (32 * baudrate)) - 2
28 ;
29 ; PHI [MHz]: 9.216 18.432
30 ; baudrate TC TC
31 ; ----------------------
32 ; 115200 - 3
33 ; 57600 3 8
34 ; 38400 - 13
35 ; 19200 13 28
36 ; 9600 28 58
37
38
39 ;-----------------------------------------------------
40 ; Programmable Reload Timer (PRT)
41
42 PRT_PRE equ 20 ;PRT prescaler
43
44 ;-----------------------------------------------------
45 ; MMU
46
47 COMMON_SIZE equ 4*1024 ;Common Area size in bytes
48 ;must be multiple of 4K
49 if (COMMON_SIZE mod 1000h)
50 .printx COMMON_SIZE not multiple of 4K!
51 end ;stop assembly
52 endif
53 CMN_SIZE equ COMMON_SIZE/1000h ;4K units
54 BNK_SIZE equ 64/4 - CMN_SIZE ;bank size (4K units)
55 BANKS equ (512/4 - CMN_SIZE)/BNK_SIZE ;max nr. of banks
56
57 ; Logical address space, CBAR values
58
59 CA equ 10h - CMN_SIZE ;common area start (64K - common size)
60 BA equ 0 ;banked area start
61
62 if 0
63
64 SYS$CBR equ 0
65 SYS$CBAR equ CA*16 + CA ;CBAR in system mode
66 USR$CBAR equ CA*16 + BA ;CBAR in user mode (CP/M)
67
68 endif
69 if 1
70
71 SYS$CBR equ BNK_SIZE
72 SYS$CBAR equ CA*16 + CA ;CBAR in system mode
73 USR$CBAR equ CA*16 + BA ;CBAR in user mode (CP/M)
74
75 endif
76
77
78 ;-----------------------------------------------------
79
80 CREFSH equ 0 ;Refresh rate register (disable refresh)
81 CWAITIO equ 3 shl IWI0 ;Max I/O Wait States, 0 Memory Wait States
82 PHI_X2 equ 0 ;set to M_X2CM to enable the clock doubler
83
84 endif ;CPU_Z180
85 if CPU_Z80
86
87 PHI equ AVRCLK/5 ;CPU frequency [KHz]
88 BAUDCLCK equ AVRCLK/10 ;Baudrate clock [KHz]
89 ;BDCLK16 equ
90
91 SIOAD EQU 0bch
92 SIOAC EQU 0bdh
93 SIOBD EQU 0beh
94 SIOBC EQU 0bfh
95
96 CTC0 EQU 0f4h
97 CTC1 EQU 0f5h
98 CTC2 EQU 0f6h
99 CTC3 EQU 0f7h
100
101 ;
102 ; Init Serial I/O for console input and output (SIO-A)
103 ;
104 ; Baudrate clock: 1843200 Hz (Bus connector pin A17)
105 ;
106 ; Baudrate Divider SIO CTC
107 ; ---------------------------------
108 ; 115200 16 16 1
109 ; 57600 32 16 2
110 ; 38400 48 16 3
111 ; 19200 96 16 6
112 ; 9600 192 16 12
113 ; 4800 384 16 24
114 ; 2400 768 16 48
115 ; 1200 1536 16 96
116 ; 600 3072 16 192
117 ; 300 6144 64 92
118
119 endif ; CPU_Z80
120
121 if ROMSYS
122 c$rom equ 0a5h
123 ROM_EN equ 0C0h
124 ROM_DIS equ ROMEN+1
125 if CPU_Z180
126 CWAITROM equ 2 shl MWI0
127 endif
128 endif
129
130
131 DDTZRSTVEC equ 030h ;DDTZ Restart vector (breakpoints)
132
133 INIDONE equ 03Fh ;CP/M skip hw init, if this address
134 INIDONEVAL equ 080h ; is set to this value.
135
136 mtx.fifo_len equ 64 ;Message transfer fifos
137 mtx.fifo_id equ 0 ; This *must* have #0
138 mrx.fifo_len equ 64
139 mrx.fifo_id equ 1
140
141 ci.fifo_len equ 32 ;AVRCON (USB0) Character I/O via AVR
142 ci.fifo_id equ 2
143 co.fifo_len equ 32
144 co.fifo_id equ 3
145
146 s0.rx_len equ 128 ;Serial 0 (ASCI0) buffers
147 s0.rx_id equ 4 ;
148 s0.tx_len equ 128 ;
149 s0.tx_id equ 5 ;
150
151 s1.rx_len equ 128 ;Serial 1 (ASCI1) buffers
152 s1.rx_id equ 6 ;
153 s1.tx_len equ 128 ;
154 s1.tx_id equ 7 ;
155
156 AVRINT5 equ 4Fh
157 AVRINT6 equ 5Fh
158 ;PMSG equ 80h
159
160 IDEBASE equ 60h
161
162 ;-----------------------------------------------------
163 ; Definition of (logical) top 2 memory pages
164
165 sysram_start equ 0FE00h
166 bs$stack$size equ 80
167
168 isvsw_loc equ 0FEE0h
169
170 ivtab equ 0ffc0h ;int vector table
171 iv2tab equ ivtab + 2*9
172
173
174
175 ;-----------------------------------------------------
176
177 o.id equ -4
178 o.mask equ -3
179 o.in_idx equ -2
180 o.out_idx equ -1
181
182 .lall
183
184 mkbuf macro id,name,size
185 if ((size AND (size-1)) NE 0) OR (size GT 256)
186 .printx Error: buffer ^size must be power of 2 and in range 0..256!
187 name&.mask equ ;wrong size error
188 else
189 db id
190 db size-1
191 ds 2
192 name:: ds size
193 name&.mask equ low (size-1)
194 if size ne 0
195 name&.end equ $-1
196 name&.len equ size
197 name&.id equ id
198 endif
199 endif
200 endm
201
202 ;-----------------------------------------------------
203
204 inidat macro
205 cseg
206 ??ps.a defl $
207 endm
208
209 inidate macro
210 ??ps.len defl $ - ??ps.a
211 dseg
212 ds ??ps.len
213 endm
214
215 ;-----------------------------------------------------
216
217 b0call macro address
218 call _b0call
219 dw address
220 endm