]> cloudbase.mooo.com Git - z180-stamp.git/blob - z180/config.inc
4421478fec378303972501fa13e56ec1b3c10299
[z180-stamp.git] / z180 / config.inc
1
2 FALSE equ 0
3 TRUE equ NOT FALSE
4
5
6 DEBUG equ true
7
8 banked equ true
9
10 ;-----------------------------------------------------
11 ; CPU and BANKING types
12
13
14 CPU_Z180 equ TRUE
15 CPU_Z80 equ FALSE
16
17 ROMSYS equ FALSE
18
19 AVRCLK equ 18432 ;[KHz]
20
21 if CPU_Z180
22
23 ;-----------------------------------------------------
24 ;FOSC equ AVRCLK/2 ;Oscillator frequency [KHz]
25 ;PHI equ FOSC*2 ;CPU frequency (clock doubler enabled)
26
27 ;----------------------------------------------------------------------
28 ; Baudrate Generator for x16 clock mode:
29 ; TC = (f PHI / (32 * baudrate)) - 2
30 ;
31 ; PHI [MHz]: 9.216 18.432
32 ; baudrate TC TC
33 ; ----------------------
34 ; 115200 - 3
35 ; 57600 3 8
36 ; 38400 - 13
37 ; 19200 13 28
38 ; 9600 28 58
39
40
41 ;-----------------------------------------------------
42 ; Programmable Reload Timer (PRT)
43
44 PRT_PRE equ 20 ;PRT prescaler
45
46 ;-----------------------------------------------------
47 ; MMU
48
49 COMMON_SIZE equ 4*1024 ;Common Area size in bytes
50 ;must be multiple of 4K
51 if (COMMON_SIZE mod 1000h)
52 .printx COMMON_SIZE not multiple of 4K!
53 end ;stop assembly
54 endif
55 CMN_SIZE equ COMMON_SIZE/1000h ;4K units
56 BNK_SIZE equ 64/4 - CMN_SIZE ;bank size (4K units)
57 BANKS equ (512/4 - CMN_SIZE)/BNK_SIZE ;max nr. of banks
58
59 ; Logical address space, CBAR values
60
61 CA equ 10h - CMN_SIZE ;common area start (64K - common size)
62 BA equ 0 ;banked area start
63
64 if 0
65
66 SYS$CBR equ 0
67 SYS$CBAR equ CA*16 + CA ;CBAR in system mode
68 USR$CBAR equ CA*16 + BA ;CBAR in user mode (CP/M)
69
70 endif
71 if 1
72
73 SYS$CBR equ BNK_SIZE
74 SYS$CBAR equ CA*16 + CA ;CBAR in system mode
75 USR$CBAR equ CA*16 + BA ;CBAR in user mode (CP/M)
76
77 endif
78
79
80 ;-----------------------------------------------------
81
82 CREFSH equ 0 ;Refresh rate register (disable refresh)
83 CWAITIO equ 3 shl IWI0 ;Max I/O Wait States, 0 Memory Wait States
84 PHI_X2 equ 0 ;set to M_X2CM to enable the clock doubler
85
86 endif ;CPU_Z180
87 if CPU_Z80
88
89 PHI equ AVRCLK/5 ;CPU frequency [KHz]
90 BAUDCLCK equ AVRCLK/10 ;Baudrate clock [KHz]
91 ;BDCLK16 equ
92
93 SIOAD EQU 0bch
94 SIOAC EQU 0bdh
95 SIOBD EQU 0beh
96 SIOBC EQU 0bfh
97
98 CTC0 EQU 0f4h
99 CTC1 EQU 0f5h
100 CTC2 EQU 0f6h
101 CTC3 EQU 0f7h
102
103 ;
104 ; Init Serial I/O for console input and output (SIO-A)
105 ;
106 ; Baudrate clock: 1843200 Hz (Bus connector pin A17)
107 ;
108 ; Baudrate Divider SIO CTC
109 ; ---------------------------------
110 ; 115200 16 16 1
111 ; 57600 32 16 2
112 ; 38400 48 16 3
113 ; 19200 96 16 6
114 ; 9600 192 16 12
115 ; 4800 384 16 24
116 ; 2400 768 16 48
117 ; 1200 1536 16 96
118 ; 600 3072 16 192
119 ; 300 6144 64 92
120
121 endif ; CPU_Z80
122
123 if ROMSYS
124 c$rom equ 0a5h
125 ROM_EN equ 0C0h
126 ROM_DIS equ ROMEN+1
127 if CPU_Z180
128 CWAITROM equ 2 shl MWI0
129 endif
130 endif
131
132
133 DDTZRSTVEC equ 030h ;DDTZ Restart vector (breakpoints)
134
135 INIDONE equ 03Fh ;CP/M skip hw init, if this address
136 INIDONEVAL equ 080h ; is set to this value.
137
138 mtx.fifo_len equ 64 ;Message transfer fifos
139 mtx.fifo_id equ 0 ; This *must* have #0
140 mrx.fifo_len equ 64
141 mrx.fifo_id equ 1
142
143 ci.fifo_len equ 32 ;AVRCON (USB0) Character I/O via AVR
144 ci.fifo_id equ 2
145 co.fifo_len equ 32
146 co.fifo_id equ 3
147
148 s0.rx_len equ 128 ;Serial 0 (ASCI0) buffers
149 s0.rx_id equ 4 ;
150 s0.tx_len equ 128 ;
151 s0.tx_id equ 5 ;
152
153 s1.rx_len equ 128 ;Serial 1 (ASCI1) buffers
154 s1.rx_id equ 6 ;
155 s1.tx_len equ 128 ;
156 s1.tx_id equ 7 ;
157
158 AVRINT5 equ 4Fh
159 AVRINT6 equ 5Fh
160 ;PMSG equ 80h
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