trunk/src/mame/audio/snes_snd.c
r17599 | r17600 | |
1181 | 1181 | spc700->port_in[3] = 0; |
1182 | 1182 | } |
1183 | 1183 | |
1184 | | if ((data & 0x80) != (spc700->ram[0xf1] & 0x80)) |
1185 | | { |
1186 | | if (data & 0x80) |
1187 | | memcpy(spc700->ipl_region, device->machine().root_device().memregion("sound_ipl")->base(), 64); |
1188 | | else |
1189 | | memcpy(spc700->ipl_region, &spc700->ram[0xffc0], 64); |
1190 | | } |
| 1184 | /* bit 7 = IPL ROM enable */ |
1191 | 1185 | break; |
1192 | 1186 | case 0x2: /* Register address */ |
1193 | 1187 | break; |
r17599 | r17600 | |
1221 | 1215 | READ8_DEVICE_HANDLER( spc_ram_r ) |
1222 | 1216 | { |
1223 | 1217 | snes_sound_state *spc700 = get_safe_token(device); |
| 1218 | |
| 1219 | /* IPL ROM enabled */ |
| 1220 | if(offset >= 0xffc0 && spc700->ram[0xf1] & 0x80) |
| 1221 | return spc700->ipl_region[offset & 0x3f]; |
| 1222 | |
1224 | 1223 | return spc700->ram[offset]; |
1225 | 1224 | } |
1226 | 1225 | |
r17599 | r17600 | |
1229 | 1228 | snes_sound_state *spc700 = get_safe_token(device); |
1230 | 1229 | |
1231 | 1230 | spc700->ram[offset] = data; |
1232 | | |
1233 | | /* if RAM is mapped in, mirror accordingly */ |
1234 | | if ((!(spc700->ram[0xf1] & 0x80)) && (offset >= 0xffc0)) |
1235 | | spc700->ipl_region[offset - 0xffc0] = data; |
1236 | 1231 | } |
1237 | 1232 | |
1238 | | READ8_DEVICE_HANDLER( spc_ipl_r ) |
1239 | | { |
1240 | | snes_sound_state *spc700 = get_safe_token(device); |
1241 | | return spc700->ipl_region[offset]; |
1242 | | } |
1243 | 1233 | |
1244 | | |
1245 | 1234 | READ8_DEVICE_HANDLER( spc_port_out ) |
1246 | 1235 | { |
1247 | 1236 | snes_sound_state *spc700 = get_safe_token(device); |
r17599 | r17600 | |
1328 | 1317 | |
1329 | 1318 | spc700->ram = auto_alloc_array_clear(device->machine(), UINT8, SNES_SPCRAM_SIZE); |
1330 | 1319 | |
1331 | | /* default to ROM visible */ |
1332 | | spc700->ram[0xf1] = 0x80; |
1333 | | |
1334 | 1320 | /* put IPL image at the top of RAM */ |
1335 | 1321 | memcpy(spc700->ipl_region, machine.root_device().memregion("sound_ipl")->base(), 64); |
1336 | 1322 | |
r17599 | r17600 | |
1354 | 1340 | snes_sound_state *spc700 = get_safe_token(device); |
1355 | 1341 | int ii; |
1356 | 1342 | |
| 1343 | /* default to ROM visible */ |
| 1344 | spc700->ram[0xf1] = 0x80; |
| 1345 | |
1357 | 1346 | /* Sort out the ports */ |
1358 | 1347 | for (ii = 0; ii < 4; ii++) |
1359 | 1348 | { |
trunk/src/mame/drivers/sfcbox.c
r17599 | r17600 | |
180 | 180 | static ADDRESS_MAP_START( spc_mem, AS_PROGRAM, 8, sfcbox_state ) |
181 | 181 | AM_RANGE(0x0000, 0x00ef) AM_DEVREADWRITE_LEGACY("spc700", spc_ram_r, spc_ram_w) /* lower 32k ram */ |
182 | 182 | AM_RANGE(0x00f0, 0x00ff) AM_DEVREADWRITE_LEGACY("spc700", spc_io_r, spc_io_w) /* spc io */ |
183 | | AM_RANGE(0x0100, 0xffff) AM_DEVWRITE_LEGACY("spc700", spc_ram_100_w) |
184 | | AM_RANGE(0x0100, 0xffbf) AM_DEVREAD_LEGACY("spc700", spc_ram_100_r) |
185 | | AM_RANGE(0xffc0, 0xffff) AM_DEVREAD_LEGACY("spc700", spc_ipl_r) |
| 183 | AM_RANGE(0x0100, 0xffff) AM_DEVREADWRITE_LEGACY("spc700", spc_ram_100_r, spc_ram_100_w) |
186 | 184 | ADDRESS_MAP_END |
187 | 185 | |
188 | 186 | static ADDRESS_MAP_START( sfcbox_map, AS_PROGRAM, 8, sfcbox_state ) |
trunk/src/mame/drivers/snesb.c
r17599 | r17600 | |
246 | 246 | ADDRESS_MAP_END |
247 | 247 | |
248 | 248 | |
249 | | READ8_MEMBER(snesb_state::spc_ram_100_r) |
250 | | { |
251 | | device_t *device = machine().device("spc700"); |
252 | | return spc_ram_r(device, offset + 0x100); |
253 | | } |
254 | | |
255 | | WRITE8_MEMBER(snesb_state::spc_ram_100_w) |
256 | | { |
257 | | device_t *device = machine().device("spc700"); |
258 | | spc_ram_w(device, offset + 0x100, data); |
259 | | } |
260 | | |
261 | 249 | static ADDRESS_MAP_START( spc_mem, AS_PROGRAM, 8, snesb_state ) |
262 | 250 | AM_RANGE(0x0000, 0x00ef) AM_DEVREADWRITE_LEGACY("spc700", spc_ram_r, spc_ram_w) /* lower 32k ram */ |
263 | 251 | AM_RANGE(0x00f0, 0x00ff) AM_DEVREADWRITE_LEGACY("spc700", spc_io_r, spc_io_w) /* spc io */ |
264 | | AM_RANGE(0x0100, 0xffff) AM_WRITE(spc_ram_100_w) |
265 | | AM_RANGE(0x0100, 0xffbf) AM_READ(spc_ram_100_r) |
266 | | AM_RANGE(0xffc0, 0xffff) AM_DEVREAD_LEGACY("spc700", spc_ipl_r) |
| 252 | AM_RANGE(0x0100, 0xffff) AM_DEVREADWRITE_LEGACY("spc700", spc_ram_100_r, spc_ram_100_w) |
267 | 253 | ADDRESS_MAP_END |
268 | 254 | |
269 | 255 | static INPUT_PORTS_START( snes_common ) |
trunk/src/mame/drivers/nss.c
r17599 | r17600 | |
311 | 311 | UINT8 m_cart_sel; |
312 | 312 | UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
313 | 313 | |
314 | | DECLARE_READ8_MEMBER(spc_ram_100_r); |
315 | | DECLARE_WRITE8_MEMBER(spc_ram_100_w); |
316 | 314 | DECLARE_READ8_MEMBER(ram_wp_r); |
317 | 315 | DECLARE_WRITE8_MEMBER(ram_wp_w); |
318 | 316 | DECLARE_READ8_MEMBER(nss_prot_r); |
r17599 | r17600 | |
352 | 350 | AM_RANGE(0xc00000, 0xffffff) AM_READWRITE_LEGACY(snes_r_bank7, snes_w_bank7) /* Mirror and ROM */ |
353 | 351 | ADDRESS_MAP_END |
354 | 352 | |
355 | | READ8_MEMBER(nss_state::spc_ram_100_r) |
356 | | { |
357 | | device_t *device = machine().device("spc700"); |
358 | | return spc_ram_r(device, offset + 0x100); |
359 | | } |
360 | 353 | |
361 | | WRITE8_MEMBER(nss_state::spc_ram_100_w) |
362 | | { |
363 | | device_t *device = machine().device("spc700"); |
364 | | spc_ram_w(device, offset + 0x100, data); |
365 | | } |
366 | | |
367 | 354 | static ADDRESS_MAP_START( spc_mem, AS_PROGRAM, 8, nss_state ) |
368 | 355 | AM_RANGE(0x0000, 0x00ef) AM_DEVREADWRITE_LEGACY("spc700", spc_ram_r, spc_ram_w) /* lower 32k ram */ |
369 | 356 | AM_RANGE(0x00f0, 0x00ff) AM_DEVREADWRITE_LEGACY("spc700", spc_io_r, spc_io_w) /* spc io */ |
370 | | AM_RANGE(0x0100, 0xffff) AM_WRITE(spc_ram_100_w) |
371 | | AM_RANGE(0x0100, 0xffbf) AM_READ(spc_ram_100_r) |
372 | | AM_RANGE(0xffc0, 0xffff) AM_DEVREAD_LEGACY("spc700", spc_ipl_r) |
| 357 | AM_RANGE(0x0100, 0xffff) AM_DEVREADWRITE_LEGACY("spc700", spc_ram_100_r, spc_ram_100_w) |
373 | 358 | ADDRESS_MAP_END |
374 | 359 | |
375 | 360 | /* NSS specific */ |
trunk/src/mess/drivers/snes.c
r17599 | r17600 | |
84 | 84 | static ADDRESS_MAP_START( spc_map, AS_PROGRAM, 8, snes_state ) |
85 | 85 | AM_RANGE(0x0000, 0x00ef) AM_DEVREADWRITE_LEGACY("spc700", spc_ram_r, spc_ram_w) /* lower 32k ram */ |
86 | 86 | AM_RANGE(0x00f0, 0x00ff) AM_DEVREADWRITE_LEGACY("spc700", spc_io_r, spc_io_w) /* spc io */ |
87 | | AM_RANGE(0x0100, 0xffff) AM_DEVWRITE_LEGACY("spc700", spc_ram_100_w) |
88 | | AM_RANGE(0x0100, 0xffbf) AM_DEVREAD_LEGACY("spc700", spc_ram_100_r) |
89 | | AM_RANGE(0xffc0, 0xffff) AM_DEVREAD_LEGACY("spc700", spc_ipl_r) |
| 87 | AM_RANGE(0x0100, 0xffff) AM_DEVREADWRITE_LEGACY("spc700", spc_ram_100_r, spc_ram_100_w) |
90 | 88 | ADDRESS_MAP_END |
91 | 89 | |
92 | 90 | static ADDRESS_MAP_START( dsp_prg_map, AS_PROGRAM, 32, snes_state ) |