Rev 94 | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
91 | lvd | 1 | ; ports description and include file for NeoGS software projects, v0.3 |
2 | ; |
||
3 | ; |
||
4 | ; bits degisnation: B_* - bit position (0,1,2,3,4,5,6,7), M_* - bit mask (1,2,4,8,#10,#20,#40,#80) |
||
5 | ; C_* - constants to be used |
||
6 | ; |
||
7 | ; |
||
8 | ; part of NeoGS project |
||
9 | ; |
||
10 | ; (c) 2008 NedoPC |
||
11 | |||
12 | |||
13 | ;ZX-side ports |
||
14 | |||
15 | GSCOM EQU #BB ;write-only, command for NGS |
||
16 | |||
17 | |||
18 | GSSTAT equ #BB ;read-only, command and data bits (positions given immediately below) |
||
19 | |||
20 | B_CBIT equ 0 ;Command position |
||
21 | M_CBIT equ 1 ; BIT and mask |
||
22 | |||
23 | B_DBIT equ 7 ;Data position |
||
24 | M_DBIT equ #80 ; BIT and mask |
||
25 | |||
26 | |||
27 | GSDAT EQU #B3 ; read-write, data transfer register for NGS |
||
28 | |||
29 | GSCTR EQU #33 ; write-only, control register for NGS: constants available given immediately below |
||
30 | |||
31 | C_GRST equ #80 ; reset constant to be written into GSCTR |
||
32 | C_GNMI equ #40 ; NMI constant to be written into GSCTR |
||
33 | C_GLED equ #20 ; LED toggle constant |
||
34 | |||
35 | |||
36 | ;GS-side ports |
||
37 | |||
38 | MPAG equ #00 ; write-only, Memory PAGe port (big pages at 8000-FFFF or small at 8000-BFFF) |
||
39 | MPAGEX equ #10 ; write-only, Memory PAGe EXtended (only small pages at C000-FFFF) |
||
40 | |||
41 | ZXCMD equ #01 ; read-only, ZX CoMmanD port: here is the byte written by ZX into GSCOM |
||
42 | |||
43 | ZXDATRD equ #02 ; read-only, ZX DATa ReaD: a byte written by ZX into GSDAT appears here; |
||
44 | ; upon reading this port, data bit is cleared |
||
45 | |||
46 | ZXDATWR equ #03 ; write-only, ZX DATa WRite: a byte written here is available for ZX in GSDAT; |
||
47 | ; upon writing here, data bit is set |
||
48 | |||
49 | ZXSTAT equ #04 ; read-only, read ZX STATus: command and data bits. positions are defined by *_CBIT and *_DBIT above |
||
50 | |||
51 | CLRCBIT equ #05 ; read-write, upon either reading or writing this port, the Command BIT is CLeaRed |
||
52 | |||
53 | |||
54 | VOL1 equ #06 ; write-only, volumes for sound channels 1-8 |
||
55 | VOL2 equ #07 |
||
56 | VOL3 equ #08 |
||
57 | VOL4 equ #09 |
||
58 | VOL5 equ #16 |
||
59 | VOL6 equ #17 |
||
60 | VOL7 equ #18 |
||
61 | VOL8 equ #19 |
||
62 | |||
63 | |||
64 | ; following two ports are useless and very odd. They have been made just because they were on the original GS and for that |
||
65 | ; strange case when somebody too crazy have used them. Nevertheless, DO NOT USE THEM! They can disappear or even radically |
||
66 | ; change functionality in future firmware releases. |
||
67 | DAMNPORT1 equ #0A ; writing or reading this port sets data bit to the inverse of bit 0 into MPAG port |
||
68 | DAMNPORT2 equ #0B ; the same as DAMNPORT1, but instead command bit involved, which is made equal to 5th bit of VOL4 |
||
69 | |||
70 | LEDCTR equ #01 ; write-only, controls on-board LED. D0=0 - LED is on, D0=1 - LED is off |
||
71 | ; reset state is LED on. |
||
72 | |||
73 | GSCFG0 equ #0F ; read-write, GS ConFiG port 0: acts as memory cell, reads previously written value. Bits and fields follow: |
||
74 | |||
75 | B_NOROM equ 0 ; =0 - there is ROM everywhere except 4000-7FFF, =1 - the RAM is all around |
||
76 | M_NOROM equ 1 |
||
77 | |||
78 | B_RAMRO equ 1 ; =1 - ram absolute addresses 0000-7FFF (zeroth big page) are write-protected |
||
79 | M_RAMRO equ 2 |
||
80 | |||
81 | B_8CHANS equ 2 ; =1 - 8 channels mode |
||
82 | M_8CHANS equ 4 |
||
83 | |||
84 | B_EXPAG equ 3 ; =1 - extended paging: both MPAG and MPAGEX are used to switch two memory windows |
||
85 | M_EXPAG equ 8 |
||
86 | |||
87 | B_CKSEL0 equ 4 ;these bits should be set according to the C_**MHZ constants below |
||
88 | M_CKSEL0 equ #10 |
||
89 | B_CKSEL1 equ 5 |
||
90 | M_CKSEL1 equ #20 |
||
91 | |||
92 | C_10MHZ equ #30 |
||
93 | C_12MHZ equ #10 |
||
94 | C_20MHZ equ #20 |
||
95 | C_24MHZ equ #00 |
||
96 | |||
97 | B_PAN4CH equ 6 ; =1 - 4 channels, panning (every channel is on left and right with two volumes) |
||
98 | M_PAN4CH equ #40 |
||
99 | |||
100 | B_INV7B equ 7 ; =1 - invert 7th bit of samples before putting them to MUL/DAC |
||
101 | M_INV7B equ #80 |
||
102 | |||
103 | |||
104 | |||
105 | |||
106 | |||
107 | B_SETNCLR equ 7 |
||
108 | M_SETNCLR equ #80 |
||
109 | |||
110 | |||
111 | SCTRL EQU #11 ;Serial ConTRoL: read-write, read: current state of below bits, write - see GS_info |
||
112 | |||
113 | B_SDNCS equ 0 |
||
114 | M_SDNCS equ 1 |
||
115 | |||
116 | B_MCNCS equ 1 |
||
117 | M_MCNCS equ 2 |
||
118 | |||
119 | B_MPXRS equ 2 |
||
120 | M_MPXRS equ 4 |
||
121 | |||
122 | B_MCSPD0 equ 3 |
||
123 | M_MCSPD0 equ 8 |
||
124 | |||
125 | B_MDHLF equ 4 |
||
126 | M_MDHLF equ #10 |
||
127 | |||
128 | B_MCSPD1 equ 5 |
||
129 | M_MCSPD1 equ #20 |
||
130 | |||
131 | |||
132 | |||
133 | SSTAT EQU #12 ;Serial STATus: read-only, reads state of below bits |
||
134 | |||
135 | B_MDDRQ equ 0 |
||
136 | M_MDDRQ equ 1 |
||
137 | |||
138 | B_SDDET equ 1 |
||
139 | M_SDDET equ 2 |
||
140 | |||
141 | B_SDWP equ 2 |
||
142 | M_SDWP equ 4 |
||
143 | |||
144 | B_MCRDY equ 3 |
||
145 | M_MCRDY equ 8 |
||
146 | |||
147 | |||
148 | |||
149 | SD_SEND EQU #13 ;SD card SEND, write-only, when written, byte transfer starts with written byte |
||
150 | SD_READ EQU #13 ;SD card READ, read-only, reads byte received in previous byte transfer |
||
151 | SD_RSTR EQU #14 ;SD card Read and STaRt, read-only, reads previously received byte and starts new byte transfer with #FF |
||
152 | |||
153 | MD_SEND EQU #14 ;Mp3 Data SEND, write-only, sends byte to the mp3 data interface |
||
154 | |||
155 | MC_SEND EQU #15 ;Mp3 Control SEND, write-only, sends byte to the mp3 control interface |
||
156 | MC_READ EQU #15 ;Mp3 Control READ, read-only, reads byte that was received during previous sending of byte |
||
157 | |||
158 | |||
159 | |||
160 | DMA_MOD EQU #1B ;select DMA module to work with via DMA_HAD, DMA_MAD, DMA_LAD, DMA_CST ports: |
||
161 | |||
162 | C_DMA_NONE equ 0 ; none selected |
||
163 | C_DMA_ZX equ 1 ; ZX module selected |
||
100 | lvd | 164 | C_DMA_SD equ 2 ; SD module selected |
165 | C_DMA_MP3 equ 3 ; MP3 module selected |
||
91 | lvd | 166 | |
167 | |||
168 | DMA_HAD EQU #1C ; High DMA ADdress (bits 21:16) |
||
169 | DMA_MAD EQU #1D ; Middle DMA ADdress (bits 15:8 ) |
||
170 | DMA_LAD EQU #1E ; Low DMA ADdress (bits 7:0 ) |
||
171 | DMA_CST EQU #1F ; DMA Control and STate |
||
172 | |||
173 | |||
174 | |||
175 | TIM_FRQ equ #0E ;timer frequency |
||
176 | |||
177 | C_DEF equ #00 ;default 37500 Hz (after reset) |
||
178 | C_DIV2 equ #01 ;18750 Hz (div by 2) |
||
179 | C_DIV4 equ #02 ;9375 Hz (div by 4) |
||
180 | C_DIV8 equ #03 ; etc... |
||
181 | C_DIV16 equ #04 |
||
182 | C_DIV64 equ #05 |
||
183 | C_DIV256 equ #06 |
||
184 | C_DIV1024 equ #07 |
||
185 | |||
186 | |||
187 | |||
188 | INTENA equ #0C ;interrupt enables |
||
189 | INTREQ equ #0D ;interrupt requests |
||
190 | |||
191 | ;bit 7 - B_SETNCLR or M_SETNCLR |
||
192 | |||
193 | B_MP3_DMA_INT equ 2 |
||
194 | M_MP3_DMA_INT equ #04 |
||
195 | |||
196 | B_SD_DMA_INT equ 1 |
||
197 | M_SD_DMA_INT equ #02 |
||
198 | |||
199 | B_TIMER_INT equ 0 |
||
200 | M_TIMER_INT equ #01 |
||
201 | |||
94 | lvd | 202 | |
203 | WIN0 equ #20 ;0000-3fff 16k page (0..255 -- 0..4Mb) |
||
204 | WIN1 equ #21 ;4000-7fff |
||
205 | WIN2 equ #22 ;8000-bfff |
||
206 | WIN3 equ #23 ;c000-ffff |
||
207 | |||
208 |