1 //---------------------------------------------------------------------
2 // FPGA GALAXIAN ADDRESS DECDER
6 // Copyright(c) 2004 Katsumi Degawa , All rights reserved
10 // This program is freeware for non-commercial use.
11 // An author does no guarantee about this program.
12 // You can use this under your own risk.
14 // 2004- 4-30 galaxian modify by K.DEGAWA
15 // 2004- 5- 6 first release.
16 // 2004- 8-23 Improvement with T80-IP.
17 //---------------------------------------------------------------------
19 //GALAXIAN Address Map
21 // Address Item(R..read-mode W..wight-mode) Parts
22 //0000 - 1FFF CPU-ROM..R ( 7H or 7K )
23 //2000 - 3FFF CPU-ROM..R ( 7L )
24 //4000 - 47FF CPU-RAM..RW ( 7N & 7P )
25 //5000 - 57FF VID-RAM..RW
26 //5800 - 5FFF OBJ-RAM..RW
27 //6000 - SW0..R LAMP......W
28 //6800 - SW1..R SOUND.....W
34 //7800 WDR..R PITCH.....W
39 //6004 - 6007 SOUND CONTROL(OSC)
41 //6800 SOUND CONTROL(FS1)
42 //6801 SOUND CONTROL(FS2)
43 //6802 SOUND CONTROL(FS3)
44 //6803 SOUND CONTROL(HIT)
45 //6805 SOUND CONTROL(SHOT)
46 //6806 SOUND CONTROL(VOL1)
47 //6807 SOUND CONTROL(VOL2)
108 output O_CPU_ROM_CSn;
109 output O_CPU_RAM_RDn;
110 output O_CPU_RAM_WRn;
111 output O_CPU_RAM_CSn;
112 output O_OBJ_RAM_RDn;
113 output O_OBJ_RAM_WRn;
114 output O_OBJ_RAM_RQn;
115 output O_VID_RAM_RDn;
116 output O_VID_RAM_WRn;
132 wire [7:0]W_8P_Q,W_8N_Q,W_8M_Q;
134 wire W_NMI_ONn = W_9N_Q[1]; // galaxian
135 //------ CPU WAITn ----------------------------------------------
137 reg W_6S1_Q,W_6S1_Qn;
140 //assign O_WAITn = W_6S1_Qn;
141 assign O_WAITn = 1'b1 ; // No Wait
143 always@(posedge I_CPU_CLK or negedge I_V_BLn)
145 if(I_V_BLn == 1'b0)begin
150 W_6S1_Q <= ~(I_H_BL | W_8P_Q[2]);
151 W_6S1_Qn <= I_H_BL | W_8P_Q[2];
155 always@(negedge I_CPU_CLK)
157 W_6S2_Qn <= ~W_6S1_Q;
159 //------ CPU NMIn -----------------------------------------------
160 wire W_V_BL = ~I_V_BLn;
162 always@(posedge W_V_BL or negedge W_NMI_ONn)
169 //-----------------------------------------------------------------
173 .I_Sel(I_CPU_A[15:14]),
178 //-------- CPU_ROM CS 0000 - 3FFF ---------------------------
182 .I_Sel({W_8E1_Q[0],I_CPU_A[13]}),
187 assign O_CPU_ROM_CSn = W_8E2_Q[0]&W_8E2_Q[1] ; // 0000 - 3FFF
188 //-----------------------------------------------------------------
190 // W_8E1_Q[0] = 0000 - 3FFF ---- CPU_ROM_USE
191 // W_8E1_Q[1] = 4000 - 7FFF ---- GALAXIAN USE *1
192 // W_8E1_Q[2] = 8000 - BFFF ---- MOONCREST USE
193 // W_8E1_Q[3] = C000 - FFFF
198 .I_G2a(W_8E1_Q[1]), // <= *1
199 .I_G2b(W_8E1_Q[1]), // <= *1
200 .I_Sel(I_CPU_A[13:11]),
209 .I_G2b(W_8E1_Q[1]), // <= *1
210 .I_Sel(I_CPU_A[13:11]),
218 .I_G1(1'b1), // No Wait
220 .I_G2b(W_8E1_Q[1]), // <= *1
221 .I_Sel(I_CPU_A[13:11]),
226 assign O_BD_G = ~(W_8E1_Q[0]&W_8P_Q[0]); //
227 assign O_OBJ_RAM_RQn = W_8P_Q[3]; //
229 assign O_CPU_RAM_CSn = W_8N_Q[0]&W_8M_Q[0]; //
230 assign O_CPU_RAM_RDn = W_8N_Q[0]; //
231 assign O_CPU_RAM_WRn = W_8M_Q[0]; //
232 assign O_VID_RAM_RDn = W_8N_Q[2]; //
233 assign O_OBJ_RAM_RDn = W_8N_Q[3]; //
234 assign O_SW0_OEn = W_8N_Q[4]; //
235 assign O_SW1_OEn = W_8N_Q[5]; //
236 assign O_DIP_OEn = W_8N_Q[6]; //
237 assign O_WDR_OEn = W_8N_Q[7]; //
239 assign O_VID_RAM_WRn = W_8M_Q[2]; //
240 assign O_OBJ_RAM_WRn = W_8M_Q[3]; //
241 assign O_LAMP_WEn = W_8M_Q[4]; //
242 assign O_SOUND_WEn = W_8M_Q[5]; //
244 assign O_PITCHn = W_8M_Q[7]; //
246 //--- Parts 9N ---------
248 always@(posedge I_CLK_12M or negedge I_RSTn)
250 if(I_RSTn == 1'b0)begin
254 if(W_8M_Q[6] == 1'b0)begin
256 3'h0 : W_9N_Q[0] <= I_CPU_D;
257 3'h1 : W_9N_Q[1] <= I_CPU_D;
258 3'h2 : W_9N_Q[2] <= I_CPU_D;
259 3'h3 : W_9N_Q[3] <= I_CPU_D;
260 3'h4 : W_9N_Q[4] <= I_CPU_D;
261 3'h5 : W_9N_Q[5] <= I_CPU_D;
262 3'h6 : W_9N_Q[6] <= I_CPU_D;
263 3'h7 : W_9N_Q[7] <= I_CPU_D;
269 assign O_STARS_ON = W_9N_Q[4]; //
270 assign O_H_FLIP = W_9N_Q[6]; //
271 assign O_V_FLIP = W_9N_Q[7]; //