Subversion Repositories ngs

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
115 savelij 1
 
2
; ports description and include file for
3
; NeoGS software projects, v0.3
4
;
5
;
6
; bits degisnation:
7
; B_* -bit position (0,1,2,3,4,5,6,7)
8
; M_* -bit mask (1,2,4,8,0X10,
9
;                           0X20,0X40,0X80)
10
;
11
; C_* - constants to be used
12
;
13
;
14
; part of NeoGS project
15
;
16
; (c) 2008 NedoPC
17
 
18
;---------------------------------------
19
 
20
;ZX-side ports
21
 
22
GSCOM           EQU 0XBB                ; write-only, command for NGS
23
 
24
GSSTAT          EQU 0XBB                ; read-only, command and data bits
25
                                ; (positions given immediately below)
26
 
27
B_CBIT          EQU 0           ; Command position
28
M_CBIT          EQU 1           ; BIT:AND Mask
29
 
30
B_DBIT          EQU 7           ; Data position
31
M_DBIT          EQU 0X80                ; BIT and mask
32
 
33
GSDAT           EQU 0XB3                ; read-write
34
                                ; data transfer register for NGS
35
 
36
GSCTR           EQU 0X33                ; write-only, control register for NGS:
37
                                ; constants available given immediately below
38
 
39
C_GRST          EQU 0X80                ; reset constant to be written into
40
 
41
C_GNMI          EQU 0X40                ; NMI constant to be written into GSCTR
42
 
43
C_GLED          EQU 0X20                ; LED toggle constant
44
 
45
;---------------------------------------
46
 
47
;GS-side ports
48
 
49
MPAG            EQU 0X00                ; write-only, Memory PAGe ;port (big
50
                                ; pages at 8000-FFFF or small at 8000-BFFF)
51
 
52
MPAGEX          EQU 0X10                ; write-only, Memory PAGe EXtended
53
                                ; (only small pages at C000-FFFF)
54
 
55
ZXCMD           EQU 0X01                ; read-only, ZX CoMmanD port: here is
56
                                ; the byte written by ZX into GSCOM
57
 
58
ZXDATRD         EQU 0X02                ; read-only, ZX DATa ReaD: a byte
59
                                ; written by ZX into GSDAT appears here
60
                                ; upon reading this port, data bit is cleared
61
 
62
ZXDATWR         EQU 0X03                ; write-only, ZX DATa WRite: a byte
63
                                ; written here is available for ZX in
64
                                ; GSDAT upon writing here, data bit is set
65
 
66
ZXSTAT          EQU 0X04                ; read-only, read ZX STATus: command and
67
                                ; data bits. positions are defined by
68
                                ; *_CBIT and *_DBIT above
69
 
70
CLRCBIT         EQU 0X05                ; read-write, upon either reading or
71
                                ; writing this port, the Command BIT is CLeaRed
72
VOL1            EQU 0X06
73
VOL2            EQU 0X07
74
VOL3            EQU 0X08
75
VOL4            EQU 0X09
76
VOL5            EQU 0X16
77
VOL6            EQU 0X17
78
VOL7            EQU 0X18
79
VOL8            EQU 0X19                ; write-only, volumes for sound channels 1-8
80
 
81
; following two ports are useless and
82
; very odd. They have been made just
83
; because they were on the original GS
84
; and for that strange case when
85
; somebody too crazy have used them.
86
; Nevertheless, DO NOT USE THEM! They
87
; can disappear or even radically change
88
; functionality in future firmware
89
; releases.
90
 
91
DPORT1          EQU 0X0A                ; DAMNPORT1
92
                                ; writing or reading this port sets data
93
                                ; bit to the inverse of bit 0 into MPAG
94
                                ; port
95
 
96
DPORT2          EQU 0X0B                ; DAMNPORT2
97
                                ; the same as DAMNPORT1, but instead
98
                                ; command bit involved, which is made
99
                                ; equal to 5th bit of VOL4
100
 
101
LEDCTR          EQU 0X01                ; write-only, controls on-board LED.
102
                                ; D0=0 - LED is on, D0=1 - LED is off
103
                                ; reset state is LED on.
104
 
105
GSCFG0          EQU 0X0F                ; read-write, GS ConFiG port 0: acts as
106
                                ; memory cell, reads previously written
107
                                ; value. Bits and fields follow:
108
 
109
B_NOROM         EQU 0           ; =0 - there is ROM everywhere except 0X4000-7FFF,
110
                                ; =1 - the RAM is all around
111
M_NOROM         EQU 1
112
 
113
B_RAMRO         EQU 1           ; =1 - ram absolute adresses 0X0000-7FFF
114
                                ; (zeroth big page) are write-protected
115
M_RAMRO         EQU 2
116
 
117
B_8CHAN         EQU 2           ; B_8CHANS
118
                                ; =1 - 8 channels mode
119
M_8CHAN         EQU 4           ; M_8CHANS
120
 
121
B_EXPAG         EQU 3           ; =1 - extended paging: both MPAG and
122
                                ; MPAGEX are used to switch two memory windows
123
M_EXPAG         EQU 8
124
 
125
B_CKSL0         EQU 4           ; B_CKSEL0
126
                                ; these bits should be set according to
127
                                ; the C_**MHZ constants below
128
M_CKSL0         EQU 0X10                ; M_CKSEL0
129
 
130
B_CKSL1         EQU 5           ; B_CKSEL1
131
M_CKSL1         EQU 0X20                ; M_CKSEL1
132
 
133
C_10MHZ         EQU 0X30
134
C_12MHZ         EQU 0X10
135
C_20MHZ         EQU 0X20
136
C_24MHZ         EQU 0X00
137
 
138
B_PAN4C         EQU 6           ; B_PAN4CH
139
                                ; =1 - 4 channels, panning (every
140
                                ; channel is on left and right with two volumes)
141
M_PAN4C         EQU 0X40                ; M_PAN4CH
142
 
143
B_INV7B         EQU 7           ;B_INV7B
144
                                ; =1 - invert 7th bit of sample before
145
                                ; putting them to MUL/DAC
146
M_INV7B         EQU 0X80
147
 
148
B_SNCLR         EQU 7           ; B_SETNCLR
149
M_SNCLR         EQU 0X80                ; M_SETNCLR
150
 
151
SCTRL           EQU 0X11                ; Serial ConTRoL: read-write, read:
152
                                ; current state of below bits, write - see GS_info
153
 
154
B_SDNCS         EQU 0
155
M_SDNCS         EQU 1
156
 
157
B_MCNCS         EQU 1
158
M_MCNCS         EQU 2
159
 
160
B_MPXRS         EQU 2
161
M_MPXRS         EQU 4
162
 
163
B_MCSP0         EQU 3           ; B_MCSPD0
164
M_MCSP0         EQU 8           ; M_MCSPD0
165
 
166
B_MDHLF         EQU 4
167
M_MDHLF         EQU 0X10
168
 
169
B_MCSP1         EQU 5           ; B_MCSPD1
170
M_MCSP1         EQU 0X20                ; M_MCSPD1
171
 
172
SSTAT           EQU 0X12                ; Serial STATus: read-only, reads state of below bits
173
 
174
B_MDDRQ         EQU 0
175
M_MDDRQ         EQU 1
176
 
177
B_SDDET         EQU 1
178
M_SDDET         EQU 2
179
 
180
B_SDWP          EQU 2
181
M_SDWP          EQU 4
182
 
183
B_MCRDY         EQU 3
184
M_MCRDY         EQU 8
185
 
186
SD_SEND         EQU 0X13                ; SD card SEND, write-only, when
187
                                ; written, byte transfer starts with
188
                                ; written byte
189
 
190
SD_READ         EQU 0X13                ; SD card READ, read-only, reads byte
191
                                ; received in previous byte transfer
192
 
193
SD_RSTR         EQU 0X14                ; SD card Read and STaRt, read-only,
194
                                ; reads previously received byte and
195
                                ; starts new byte transfer with 0XFF
196
 
197
MD_SEND         EQU 0X14                ; Mp3 Data SEND, write-only, sends byte
198
                                ; to the mp3 data interface
199
 
200
MC_SEND         EQU 0X15                ; Mp3 Control SEND, write-only, sends
201
                                ; byte to the mp3 control interface
202
 
203
MC_READ         EQU 0X15                ; Mp3 Control READ, read-only, reads
204
                                ; byte that was received during
205
                                ; previous sending of byte
206
 
207
DMA_MOD         EQU 0X1B                ; DMA MODULE
208
 
209
DMA_HAD         EQU 0X1C                ; DMA High ADdress
210
 
211
DMA_MAD         EQU 0X1D                ; DMA Middle ADdress
212
 
213
DMA_LAD         EQU 0X1E                ; DMA Low ADdress
214
 
215
DMA_CST         EQU 0X1F                ; DMA Control and STate