summaryrefslogtreecommitdiff
path: root/z180/config.inc
blob: 390d3bc9cf1b64595a83e5ef16b112129c3c2e33 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
;-----------------------------------------------------
; CPU and BANKING types


CPU_Z180	equ	1		; 0 = Z80, else Z180
ROMSYS		equ	0

AVRCLK		equ	18432		;[KHz]

	if CPU_Z180

;-----------------------------------------------------
FOSC		equ	AVRCLK/2	;Oscillator frequency [KHz]
PHI		equ	FOSC*2		;CPU frequency (clock doubler enabled)

;-----------------------------------------------------
; Programmable Reload Timer (PRT)

PRT_PRE		equ	20		;PRT prescaler

; Reload value for 10 ms Int. (0.1KHz):
; tc10ms = phi/prescale/0.1KHz  = phi / (prescale/10)

PRT_TC10MS	equ	PHI / (PRT_PRE/10)

;-----------------------------------------------------
; MMU

SYS$CBAR	equ	0C8h
USR$CBAR	equ	0F0h


BANKS		equ	18		;max nr. of banks

;-----------------------------------------------------

CREFSH		equ	0		;Refresh rate register (disable refresh)
CWAITIO		equ	3 shl IWI0	;Max I/O Wait States, 0 Memory Wait States

	else	; Z80

PHI		equ	AVRCLK/5	;CPU frequency [KHz]
BAUDCLCK	equ	AVRCLK/10	;Baudrate clock [KHz]
;BDCLK16		equ

SIOAD	EQU	0bch
SIOAC	EQU	0bdh
SIOBD	EQU	0beh
SIOBC	EQU	0bfh

CTC0	EQU	0f4h
CTC1	EQU	0f5h
CTC2	EQU	0f6h
CTC3	EQU	0f7h

;
; Init Serial I/O for console input and output (SIO-A)
;
; Baudrate clock: 1843200 Hz (Bus connector pin A17)
;
; Baudrate   Divider	SIO	CTC
; ---------------------------------
; 115200	  16	 16	  1
;  57600	  32	 16	  2
;  38400	  48	 16	  3
;  19200	  96	 16	  6
;   9600	 192	 16	 12
;   4800	 384	 16	 24
;   2400	 768	 16	 48
;   1200	1536	 16	 96
;    600	3072	 16	192
;    300	6144	 64	 92

	endif	; CPU_Z180

	if	ROMSYS
c$rom		equ	0a5h
ROM_EN		equ	0C0h
ROM_DIS		equ	ROMEN+1
	if CPU_Z180
CWAITROM 	equ	2 shl MWI0
	endif
	endif


DRSTNUM 	equ	30h		;DDTZ Restart vector (breakpoints)


mrx.fifo_len	equ	256
mtx.fifo_len	equ	256

ci.fifo_len	equ	128
co.fifo_len	equ	256

s1.rx_len	equ	256		;Serial 1 (ASCI1) buffers
s1.tx_len	equ	256		;

AVRINT5		equ	4Fh
AVRINT6		equ	5Fh
;PMSG		equ	80h

;-----------------------------------------------------
; Definition of (locical) top 2 memory pages

sysram_start	equ	0FE00h
stacksize	equ	80

isvsw_loc	equ	0FEE0h

ivtab		equ	0ffc0h		;int vector table
iv2tab		equ	ivtab + 2*9



;-----------------------------------------------------


o.mask		equ	-3
o.in_idx	equ	-2
o.out_idx	equ	-1

	.lall

mkbuf	macro	name,size
  if ((size & (size-1)) ne 0) or (size gt 256)
    .printx Error: buffer ^size must be power of 2 and in range 0..256!
    name&.mask equ ;wrong size error
  else
    ds 3
    name:: ds size
    name&.mask equ low (size-1)
    if size ne 0
      name&.end equ $-1
      name&.len equ size
    endif
  endif
endm

;-----------------------------------------------------

inidat	macro
	cseg
??ps.a	defl	$
	endm

inidate	macro
??ps.len defl	$ - ??ps.a
	dseg
	ds	??ps.len
	endm