trunk/src/mame/drivers/panicr.c
r17585 | r17586 | |
3 | 3 | ---------- |
4 | 4 | |
5 | 5 | TODO: |
6 | | - there are 3 more bitplanes of tile graphics, but colors are correct as they are... |
7 | | what are they, priority info? Should they be mapped at 8000-bfff in memory? |
8 | | - problems with bg tilemaps reading (USER3 region) |
| 6 | - problems with bg collision |
| 7 | - high priority tiles |
9 | 8 | |
10 | 9 | -- |
11 | 10 | |
r17585 | r17586 | |
69 | 68 | { |
70 | 69 | public: |
71 | 70 | panicr_state(const machine_config &mconfig, device_type type, const char *tag) |
72 | | : driver_device(mconfig, type, tag) , |
| 71 | : driver_device(mconfig, type, tag), |
73 | 72 | m_mainram(*this, "mainram"), |
74 | 73 | m_spriteram(*this, "spriteram"), |
75 | | m_videoram(*this, "videoram"), |
76 | | m_scrollram(*this, "scrollram") |
| 74 | m_textram(*this, "textram"), |
| 75 | m_spritebank(*this, "spritebank") |
77 | 76 | { } |
78 | 77 | |
79 | 78 | required_shared_ptr<UINT8> m_mainram; |
80 | 79 | required_shared_ptr<UINT8> m_spriteram; |
81 | | required_shared_ptr<UINT8> m_videoram; |
82 | | required_shared_ptr<UINT8> m_scrollram; |
| 80 | required_shared_ptr<UINT8> m_textram; |
| 81 | required_shared_ptr<UINT8> m_spritebank; |
| 82 | |
83 | 83 | tilemap_t *m_bgtilemap; |
| 84 | tilemap_t *m_infotilemap; |
84 | 85 | tilemap_t *m_txttilemap; |
| 86 | int m_scrollx; |
| 87 | |
| 88 | DECLARE_READ8_MEMBER(panicr_collision_r); |
| 89 | DECLARE_WRITE8_MEMBER(panicr_scrollx_lo_w); |
| 90 | DECLARE_WRITE8_MEMBER(panicr_scrollx_hi_w); |
| 91 | DECLARE_WRITE8_MEMBER(panicr_output_w); |
85 | 92 | DECLARE_READ8_MEMBER(t5182shared_r); |
86 | 93 | DECLARE_WRITE8_MEMBER(t5182shared_w); |
| 94 | |
87 | 95 | DECLARE_DRIVER_INIT(panicr); |
88 | 96 | }; |
89 | 97 | |
r17585 | r17586 | |
93 | 101 | #define TC15_CLOCK XTAL_12MHz |
94 | 102 | |
95 | 103 | |
| 104 | /*************************************************************************** |
| 105 | |
| 106 | Video |
| 107 | |
| 108 | ***************************************************************************/ |
| 109 | |
96 | 110 | static PALETTE_INIT( panicr ) |
97 | 111 | { |
98 | 112 | const UINT8 *color_prom = machine.root_device().memregion("proms")->base(); |
r17585 | r17586 | |
149 | 163 | } |
150 | 164 | } |
151 | 165 | |
| 166 | |
152 | 167 | static TILE_GET_INFO( get_bgtile_info ) |
153 | 168 | { |
154 | 169 | int code,attr; |
r17585 | r17586 | |
163 | 178 | 0); |
164 | 179 | } |
165 | 180 | |
| 181 | static TILE_GET_INFO( get_infotile_info ) |
| 182 | { |
| 183 | int code,attr; |
| 184 | |
| 185 | code=machine.root_device().memregion("user1")->base()[tile_index]; |
| 186 | attr=machine.root_device().memregion("user2")->base()[tile_index]; |
| 187 | code+=((attr&7)<<8); |
| 188 | SET_TILE_INFO( |
| 189 | 2, |
| 190 | code, |
| 191 | (attr & 0xf0) >> 4, |
| 192 | 0); |
| 193 | } |
| 194 | |
166 | 195 | static TILE_GET_INFO( get_txttile_info ) |
167 | 196 | { |
168 | 197 | panicr_state *state = machine.driver_data<panicr_state>(); |
169 | | UINT8 *videoram = state->m_videoram; |
170 | | int code=videoram[tile_index*4]; |
171 | | int attr=videoram[tile_index*4+2]; |
| 198 | int code=state->m_textram[tile_index*4]; |
| 199 | int attr=state->m_textram[tile_index*4+2]; |
172 | 200 | int color = attr & 0x07; |
173 | 201 | |
174 | 202 | tileinfo.group = color; |
r17585 | r17586 | |
180 | 208 | 0); |
181 | 209 | } |
182 | 210 | |
183 | | READ8_MEMBER(panicr_state::t5182shared_r) |
184 | | { |
185 | | if ((offset & 1) == 0) |
186 | | return t5182_sharedram_r(&space, offset/2); |
187 | | else |
188 | | return 0; |
189 | | } |
190 | 211 | |
191 | | WRITE8_MEMBER(panicr_state::t5182shared_w) |
192 | | { |
193 | | if ((offset & 1) == 0) |
194 | | t5182_sharedram_w(&space, offset/2, data); |
195 | | } |
196 | | |
197 | | |
198 | | static ADDRESS_MAP_START( panicr_map, AS_PROGRAM, 8, panicr_state ) |
199 | | AM_RANGE(0x00000, 0x01fff) AM_RAM AM_SHARE("mainram") |
200 | | AM_RANGE(0x02000, 0x02fff) AM_RAM AM_SHARE("spriteram") |
201 | | AM_RANGE(0x03000, 0x03fff) AM_RAM |
202 | | AM_RANGE(0x08000, 0x0bfff) AM_RAM AM_REGION("user3", 0) //attribue map ? |
203 | | AM_RANGE(0x0c000, 0x0cfff) AM_RAM AM_SHARE("videoram") |
204 | | AM_RANGE(0x0d000, 0x0d000) AM_WRITE_LEGACY(t5182_sound_irq_w) |
205 | | AM_RANGE(0x0d002, 0x0d002) AM_READ_LEGACY(t5182_sharedram_semaphore_snd_r) |
206 | | AM_RANGE(0x0d004, 0x0d004) AM_WRITE_LEGACY(t5182_sharedram_semaphore_main_acquire_w) |
207 | | AM_RANGE(0x0d006, 0x0d006) AM_WRITE_LEGACY(t5182_sharedram_semaphore_main_release_w) |
208 | | AM_RANGE(0x0d200, 0x0d2ff) AM_READWRITE(t5182shared_r, t5182shared_w) |
209 | | AM_RANGE(0x0d400, 0x0d400) AM_READ_PORT("P1") |
210 | | AM_RANGE(0x0d402, 0x0d402) AM_READ_PORT("P2") |
211 | | AM_RANGE(0x0d404, 0x0d404) AM_READ_PORT("START") |
212 | | AM_RANGE(0x0d406, 0x0d406) AM_READ_PORT("DSW1") |
213 | | AM_RANGE(0x0d407, 0x0d407) AM_READ_PORT("DSW2") |
214 | | AM_RANGE(0x0d800, 0x0d81f) AM_RAM AM_SHARE("scrollram") |
215 | | AM_RANGE(0xf0000, 0xfffff) AM_ROM |
216 | | ADDRESS_MAP_END |
217 | | |
218 | 212 | static VIDEO_START( panicr ) |
219 | 213 | { |
220 | 214 | panicr_state *state = machine.driver_data<panicr_state>(); |
| 215 | |
221 | 216 | state->m_bgtilemap = tilemap_create( machine, get_bgtile_info,tilemap_scan_rows,16,16,1024,16 ); |
| 217 | state->m_infotilemap = tilemap_create( machine, get_infotile_info,tilemap_scan_rows,16,16,1024,16 ); // 3 more bitplanes, contains collision and priority data |
222 | 218 | |
223 | 219 | state->m_txttilemap = tilemap_create( machine, get_txttile_info,tilemap_scan_rows,8,8,32,32 ); |
224 | 220 | colortable_configure_tilemap_groups(machine.colortable, state->m_txttilemap, machine.gfx[0], 0); |
r17585 | r17586 | |
239 | 235 | if (spriteram[offs+1] & 0x40) x -= 0x100; |
240 | 236 | |
241 | 237 | color = spriteram[offs+1] & 0x0f; |
242 | | sprite = spriteram[offs+0]+(state->m_scrollram[0x0c]<<8); |
| 238 | sprite = spriteram[offs+0] | (*state->m_spritebank << 8); |
243 | 239 | |
244 | | drawgfx_transmask(bitmap,cliprect,machine.gfx[2], |
| 240 | drawgfx_transmask(bitmap,cliprect,machine.gfx[3], |
245 | 241 | sprite, |
246 | 242 | color,flipx,flipy,x,y, |
247 | | colortable_get_transpen_mask(machine.colortable, machine.gfx[2], color, 0)); |
| 243 | colortable_get_transpen_mask(machine.colortable, machine.gfx[3], color, 0)); |
248 | 244 | } |
249 | 245 | } |
250 | 246 | |
r17585 | r17586 | |
252 | 248 | { |
253 | 249 | panicr_state *state = screen.machine().driver_data<panicr_state>(); |
254 | 250 | bitmap.fill(get_black_pen(screen.machine()), cliprect); |
255 | | state->m_txttilemap ->mark_all_dirty(); |
256 | | state->m_bgtilemap->set_scrollx(0, ((state->m_scrollram[0x02]&0x0f)<<12)+((state->m_scrollram[0x02]&0xf0)<<4)+((state->m_scrollram[0x04]&0x7f)<<1)+((state->m_scrollram[0x04]&0x80)>>7) ); |
| 251 | state->m_txttilemap->mark_all_dirty(); |
| 252 | state->m_bgtilemap->set_scrollx(0, state->m_scrollx); |
257 | 253 | state->m_bgtilemap->draw(bitmap, cliprect, 0,0); |
258 | 254 | draw_sprites(screen.machine(),bitmap,cliprect); |
259 | 255 | state->m_txttilemap->draw(bitmap, cliprect, 0,0); |
r17585 | r17586 | |
261 | 257 | return 0; |
262 | 258 | } |
263 | 259 | |
264 | | static TIMER_DEVICE_CALLBACK( panicr_scanline ) |
| 260 | |
| 261 | /*************************************************************************** |
| 262 | |
| 263 | I/O |
| 264 | |
| 265 | ***************************************************************************/ |
| 266 | |
| 267 | READ8_MEMBER(panicr_state::panicr_collision_r) |
265 | 268 | { |
266 | | int scanline = param; |
| 269 | // 0x40 bytes per line, 2 bits per x |
| 270 | // implementation is still wrong though :( |
| 271 | const bitmap_ind16 &src_bitmap = m_infotilemap->pixmap(); |
| 272 | int width_mask = src_bitmap.width() - 1; |
| 273 | int height_mask = src_bitmap.height() - 1; |
| 274 | int y = offset >> 6; |
| 275 | int x = (offset & 0x3f) * 4; |
| 276 | UINT8 data = 0; |
267 | 277 | |
268 | | if(scanline == 240) // vblank-out irq |
269 | | cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE, 0xc4/4); |
| 278 | for (int i = 0; i < 4; i++) |
| 279 | { |
| 280 | int p = src_bitmap.pix16(y & height_mask, (i + x + m_scrollx) & width_mask); |
| 281 | data <<= 2; |
| 282 | data |= p&3; |
| 283 | } |
270 | 284 | |
271 | | if(scanline == 0) // <unknown> |
272 | | cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE, 0xc8/4); |
| 285 | return data; |
273 | 286 | } |
274 | 287 | |
| 288 | |
| 289 | |
| 290 | WRITE8_MEMBER(panicr_state::panicr_scrollx_lo_w) |
| 291 | { |
| 292 | m_scrollx = (m_scrollx & 0xff00) | (data << 1 & 0xfe) | (data >> 7 & 0x01); |
| 293 | } |
| 294 | |
| 295 | WRITE8_MEMBER(panicr_state::panicr_scrollx_hi_w) |
| 296 | { |
| 297 | m_scrollx = (m_scrollx & 0xff) | (data << 4 & 0x0f00) | (data << 12 & 0xf000); |
| 298 | } |
| 299 | |
| 300 | WRITE8_MEMBER(panicr_state::panicr_output_w) |
| 301 | { |
| 302 | // d6, d7: play counter? (it only triggers on 1st coin) |
| 303 | coin_counter_w(machine(), 0, (data & 0x40) ? 1 : 0); |
| 304 | coin_counter_w(machine(), 1, (data & 0x80) ? 1 : 0); |
| 305 | |
| 306 | // other bits: ? |
| 307 | } |
| 308 | |
| 309 | READ8_MEMBER(panicr_state::t5182shared_r) |
| 310 | { |
| 311 | if ((offset & 1) == 0) |
| 312 | return t5182_sharedram_r(&space, offset/2); |
| 313 | else |
| 314 | return 0; |
| 315 | } |
| 316 | |
| 317 | WRITE8_MEMBER(panicr_state::t5182shared_w) |
| 318 | { |
| 319 | if ((offset & 1) == 0) |
| 320 | t5182_sharedram_w(&space, offset/2, data); |
| 321 | } |
| 322 | |
| 323 | |
| 324 | static ADDRESS_MAP_START( panicr_map, AS_PROGRAM, 8, panicr_state ) |
| 325 | AM_RANGE(0x00000, 0x01fff) AM_RAM AM_SHARE("mainram") |
| 326 | AM_RANGE(0x02000, 0x02fff) AM_RAM AM_SHARE("spriteram") |
| 327 | AM_RANGE(0x03000, 0x03fff) AM_RAM |
| 328 | AM_RANGE(0x08000, 0x0bfff) AM_READ(panicr_collision_r) |
| 329 | AM_RANGE(0x0c000, 0x0cfff) AM_RAM AM_SHARE("textram") |
| 330 | AM_RANGE(0x0d000, 0x0d000) AM_WRITE_LEGACY(t5182_sound_irq_w) |
| 331 | AM_RANGE(0x0d002, 0x0d002) AM_WRITE_LEGACY(t5182_sharedram_semaphore_main_acquire_w) |
| 332 | AM_RANGE(0x0d004, 0x0d004) AM_READ_LEGACY(t5182_sharedram_semaphore_snd_r) |
| 333 | AM_RANGE(0x0d006, 0x0d006) AM_WRITE_LEGACY(t5182_sharedram_semaphore_main_release_w) |
| 334 | AM_RANGE(0x0d200, 0x0d2ff) AM_READWRITE(t5182shared_r, t5182shared_w) |
| 335 | AM_RANGE(0x0d400, 0x0d400) AM_READ_PORT("P1") |
| 336 | AM_RANGE(0x0d402, 0x0d402) AM_READ_PORT("P2") |
| 337 | AM_RANGE(0x0d404, 0x0d404) AM_READ_PORT("START") |
| 338 | AM_RANGE(0x0d406, 0x0d406) AM_READ_PORT("DSW1") |
| 339 | AM_RANGE(0x0d407, 0x0d407) AM_READ_PORT("DSW2") |
| 340 | AM_RANGE(0x0d802, 0x0d802) AM_WRITE(panicr_scrollx_hi_w) |
| 341 | AM_RANGE(0x0d804, 0x0d804) AM_WRITE(panicr_scrollx_lo_w) |
| 342 | AM_RANGE(0x0d80a, 0x0d80a) AM_WRITE(panicr_output_w) |
| 343 | AM_RANGE(0x0d80c, 0x0d80c) AM_WRITEONLY AM_SHARE("spritebank") |
| 344 | AM_RANGE(0x0d818, 0x0d818) AM_WRITENOP // watchdog? |
| 345 | AM_RANGE(0xf0000, 0xfffff) AM_ROM |
| 346 | ADDRESS_MAP_END |
| 347 | |
| 348 | |
| 349 | /*************************************************************************** |
| 350 | |
| 351 | Inputs |
| 352 | |
| 353 | ***************************************************************************/ |
| 354 | |
275 | 355 | static INPUT_PORTS_START( panicr ) |
276 | 356 | PORT_START("P1") |
277 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) //left |
278 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) //right |
279 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) //shake 1 |
280 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) //shake 2 |
281 | | PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 357 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(1) PORT_NAME("P1 Left Flipper") |
| 358 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(1) PORT_NAME("P1 Right Flipper") |
| 359 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(1) PORT_NAME("P1 Left Shake") |
| 360 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(1) PORT_NAME("P1 Right Shake") |
| 361 | PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) |
282 | 362 | |
283 | 363 | PORT_START("P2") |
284 | | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) //left |
285 | | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) //right |
286 | | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) //shake 1 |
287 | | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) //shake 2 |
288 | | PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
| 364 | PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_BUTTON1 ) PORT_PLAYER(2) PORT_NAME("P1 Left Flipper") |
| 365 | PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_BUTTON2 ) PORT_PLAYER(2) PORT_NAME("P1 Right Flipper") |
| 366 | PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_BUTTON3 ) PORT_PLAYER(2) PORT_NAME("P1 Left Shake") |
| 367 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_BUTTON4 ) PORT_PLAYER(2) PORT_NAME("P1 Right Shake") |
| 368 | PORT_BIT( 0xf0, IP_ACTIVE_LOW, IPT_UNUSED ) |
289 | 369 | |
290 | 370 | PORT_START("START") |
291 | 371 | PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_START1 ) |
r17585 | r17586 | |
293 | 373 | PORT_BIT( 0xe7, IP_ACTIVE_LOW, IPT_UNKNOWN ) |
294 | 374 | |
295 | 375 | PORT_START("DSW1") |
296 | | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:8,7,6") |
| 376 | PORT_DIPNAME( 0x07, 0x07, DEF_STR( Coin_A ) ) PORT_DIPLOCATION("SW1:1,2,3") |
297 | 377 | PORT_DIPSETTING( 0x00, DEF_STR( 5C_1C ) ) |
298 | 378 | PORT_DIPSETTING( 0x04, DEF_STR( 4C_1C ) ) |
299 | 379 | PORT_DIPSETTING( 0x02, DEF_STR( 3C_1C ) ) |
r17585 | r17586 | |
302 | 382 | PORT_DIPSETTING( 0x03, DEF_STR( 1C_2C ) ) |
303 | 383 | PORT_DIPSETTING( 0x05, DEF_STR( 1C_3C ) ) |
304 | 384 | PORT_DIPSETTING( 0x01, DEF_STR( 1C_5C ) ) |
305 | | PORT_DIPNAME( 0x18, 0x18, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:5,4") |
| 385 | PORT_DIPNAME( 0x18, 0x18, DEF_STR( Coin_B ) ) PORT_DIPLOCATION("SW1:4,5") |
306 | 386 | PORT_DIPSETTING( 0x10, DEF_STR( 2C_1C ) ) |
307 | 387 | PORT_DIPSETTING( 0x18, DEF_STR( 1C_1C ) ) |
308 | 388 | PORT_DIPSETTING( 0x00, DEF_STR( 2C_3C ) ) |
309 | 389 | PORT_DIPSETTING( 0x08, DEF_STR( 1C_2C ) ) |
310 | | PORT_SERVICE_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW1:3" ) |
311 | | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW1:2") |
| 390 | PORT_SERVICE_DIPLOC( 0x20, IP_ACTIVE_LOW, "SW1:6" ) |
| 391 | PORT_DIPNAME( 0x40, 0x00, DEF_STR( Allow_Continue ) ) PORT_DIPLOCATION("SW1:7") |
312 | 392 | PORT_DIPSETTING( 0x40, DEF_STR( No ) ) |
313 | 393 | PORT_DIPSETTING( 0x00, DEF_STR( Yes ) ) |
314 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:1") |
| 394 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Unknown ) ) PORT_DIPLOCATION("SW1:8") |
315 | 395 | PORT_DIPSETTING( 0x80, DEF_STR( Off ) ) |
316 | 396 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
317 | 397 | |
318 | 398 | PORT_START("DSW2") |
319 | | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:8") |
| 399 | PORT_DIPNAME( 0x01, 0x00, DEF_STR( Demo_Sounds ) ) PORT_DIPLOCATION("SW2:1") |
320 | 400 | PORT_DIPSETTING( 0x01, DEF_STR( Off ) ) |
321 | 401 | PORT_DIPSETTING( 0x00, DEF_STR( On ) ) |
322 | | PORT_DIPNAME( 0x06, 0x04, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:7,6") |
| 402 | PORT_DIPNAME( 0x06, 0x06, DEF_STR( Difficulty ) ) PORT_DIPLOCATION("SW2:2,3") |
323 | 403 | PORT_DIPSETTING( 0x06, DEF_STR( Easy ) ) |
324 | 404 | PORT_DIPSETTING( 0x04, DEF_STR( Medium ) ) |
325 | 405 | PORT_DIPSETTING( 0x02, DEF_STR( Hard ) ) |
326 | 406 | PORT_DIPSETTING( 0x00, DEF_STR( Hardest ) ) |
327 | | PORT_DIPNAME( 0x18, 0x18, "Bonus" ) PORT_DIPLOCATION("SW2:5,4") |
328 | | PORT_DIPSETTING( 0x18, "50k & every 1OOk" ) |
329 | | PORT_DIPSETTING( 0x10, "1Ok 20k" ) |
| 407 | PORT_DIPNAME( 0x18, 0x18, "Bonus Points" ) PORT_DIPLOCATION("SW2:4,5") |
| 408 | PORT_DIPSETTING( 0x18, "5k 10k" ) |
| 409 | PORT_DIPSETTING( 0x10, "10k 20k" ) |
330 | 410 | PORT_DIPSETTING( 0x08, "20k 40k" ) |
331 | 411 | PORT_DIPSETTING( 0x00, "50k 100k" ) |
332 | | PORT_DIPNAME( 0x60, 0x40, "Balls" ) PORT_DIPLOCATION("SW2:3,2") |
| 412 | PORT_DIPNAME( 0x60, 0x40, DEF_STR( Lives ) ) PORT_DIPLOCATION("SW2:6,7") |
333 | 413 | PORT_DIPSETTING( 0x00, "4" ) |
334 | 414 | PORT_DIPSETTING( 0x20, "2" ) |
335 | 415 | PORT_DIPSETTING( 0x40, "3" ) |
336 | 416 | PORT_DIPSETTING( 0x60, "1" ) |
337 | | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:1") |
| 417 | PORT_DIPNAME( 0x80, 0x80, DEF_STR( Cabinet ) ) PORT_DIPLOCATION("SW2:8") |
338 | 418 | PORT_DIPSETTING( 0x80, DEF_STR( Upright ) ) |
339 | 419 | PORT_DIPSETTING( 0x00, DEF_STR( Cocktail ) ) |
340 | 420 | |
r17585 | r17586 | |
343 | 423 | PORT_BIT( 0x02, IP_ACTIVE_HIGH, IPT_COIN2 ) PORT_IMPULSE(2) |
344 | 424 | INPUT_PORTS_END |
345 | 425 | |
| 426 | |
| 427 | /*************************************************************************** |
| 428 | |
| 429 | Machine Config |
| 430 | |
| 431 | ***************************************************************************/ |
| 432 | |
346 | 433 | static const gfx_layout charlayout = |
347 | 434 | { |
348 | 435 | 8,8, |
r17585 | r17586 | |
354 | 441 | 16*8 |
355 | 442 | }; |
356 | 443 | |
357 | | static const gfx_layout tilelayout = |
| 444 | static const gfx_layout bgtilelayout = |
358 | 445 | { |
359 | 446 | 16,16, |
360 | 447 | RGN_FRAC(1,4), |
361 | | // 8, |
362 | | // { 0, 4, RGN_FRAC(1,4)+0, RGN_FRAC(1,4)+4, RGN_FRAC(2,4)+0, RGN_FRAC(2,4)+4, RGN_FRAC(3,4)+0, RGN_FRAC(3,4)+4 }, |
363 | 448 | 4, |
364 | 449 | { RGN_FRAC(2,4)+0, RGN_FRAC(2,4)+4, RGN_FRAC(3,4)+0, RGN_FRAC(3,4)+4 }, |
365 | 450 | { 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3, |
r17585 | r17586 | |
369 | 454 | 32*16 |
370 | 455 | }; |
371 | 456 | |
| 457 | static const gfx_layout infotilelayout = |
| 458 | { |
| 459 | 16,16, |
| 460 | RGN_FRAC(1,4), |
| 461 | 4, |
| 462 | { 0, 4, RGN_FRAC(1,4)+0, RGN_FRAC(1,4)+4 }, |
| 463 | { 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3, |
| 464 | 16+0, 16+1, 16+2, 16+3, 24+0, 24+1, 24+2, 24+3 }, |
| 465 | { 0*32, 1*32, 2*32, 3*32, 4*32, 5*32, 6*32, 7*32, |
| 466 | 8*32, 9*32, 10*32, 11*32, 12*32, 13*32, 14*32, 15*32 }, |
| 467 | 32*16 |
| 468 | }; |
372 | 469 | |
373 | 470 | static const gfx_layout spritelayout = |
374 | 471 | { |
r17585 | r17586 | |
384 | 481 | }; |
385 | 482 | |
386 | 483 | static GFXDECODE_START( panicr ) |
387 | | GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0x000, 8 ) |
388 | | GFXDECODE_ENTRY( "gfx2", 0, tilelayout, 0x100, 16 ) |
389 | | GFXDECODE_ENTRY( "gfx3", 0, spritelayout, 0x200, 16 ) |
| 484 | GFXDECODE_ENTRY( "gfx1", 0, charlayout, 0x000, 8 ) |
| 485 | GFXDECODE_ENTRY( "gfx2", 0, bgtilelayout, 0x100, 16 ) |
| 486 | GFXDECODE_ENTRY( "gfx2", 0, infotilelayout, 0x100, 16 ) // palette is just to make it viewable with F4 |
| 487 | GFXDECODE_ENTRY( "gfx3", 0, spritelayout, 0x200, 16 ) |
390 | 488 | GFXDECODE_END |
391 | 489 | |
| 490 | |
| 491 | static TIMER_DEVICE_CALLBACK( panicr_scanline ) |
| 492 | { |
| 493 | int scanline = param; |
| 494 | |
| 495 | if(scanline == 240) // vblank-out irq |
| 496 | cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE, 0xc4/4); |
| 497 | |
| 498 | if(scanline == 0) // <unknown> |
| 499 | cputag_set_input_line_and_vector(timer.machine(), "maincpu", 0, HOLD_LINE, 0xc8/4); |
| 500 | } |
| 501 | |
392 | 502 | static MACHINE_CONFIG_START( panicr, panicr_state ) |
393 | 503 | MCFG_CPU_ADD("maincpu", V20,MASTER_CLOCK/2) /* Sony 8623h9 CXQ70116D-8 (V20 compatible) */ |
394 | 504 | MCFG_CPU_PROGRAM_MAP(panicr_map) |
r17585 | r17586 | |
421 | 531 | |
422 | 532 | MACHINE_CONFIG_END |
423 | 533 | |
| 534 | |
424 | 535 | ROM_START( panicr ) |
425 | 536 | ROM_REGION( 0x200000, "maincpu", 0 ) /* v20 main cpu */ |
426 | 537 | ROM_LOAD16_BYTE("2.19m", 0x0f0000, 0x08000, CRC(3d48b0b5) SHA1(a6e8b38971a8964af463c16f32bb7dbd301dd314) ) |
r17585 | r17586 | |
449 | 560 | ROM_REGION( 0x04000, "user2", 0 ) |
450 | 561 | ROM_LOAD( "7d.bin", 0x00000, 0x4000, CRC(8032c1e9) SHA1(fcc8579c0117ebe9271cff31e14a30f61a9cf031) ) //attribute maps |
451 | 562 | |
452 | | ROM_REGION( 0x04000, "user3", 0 ) |
453 | | ROM_COPY( "user2", 0x0000, 0x0000, 0x4000 ) |
454 | | |
455 | 563 | ROM_REGION( 0x0800, "proms", 0 ) |
456 | 564 | ROM_LOAD( "b.14c", 0x00000, 0x100, CRC(145d1e0d) SHA1(8073fd176a1805552a5ac00ca0d9189e6e8936b1) ) // red |
457 | 565 | ROM_LOAD( "a.15c", 0x00100, 0x100, CRC(c75772bc) SHA1(ec84052aedc1d53f9caba3232ffff17de69561b2) ) // green |
r17585 | r17586 | |
491 | 599 | ROM_REGION( 0x04000, "user2", 0 ) |
492 | 600 | ROM_LOAD( "7d.bin", 0x00000, 0x4000, CRC(8032c1e9) SHA1(fcc8579c0117ebe9271cff31e14a30f61a9cf031) ) //attribute maps |
493 | 601 | |
494 | | ROM_REGION( 0x04000, "user3", 0 ) |
495 | | ROM_COPY( "user2", 0x0000, 0x0000, 0x4000 ) |
496 | | |
497 | 602 | ROM_REGION( 0x0800, "proms", 0 ) |
498 | 603 | ROM_LOAD( "b.14c", 0x00000, 0x100, CRC(145d1e0d) SHA1(8073fd176a1805552a5ac00ca0d9189e6e8936b1) ) // red |
499 | 604 | ROM_LOAD( "a.15c", 0x00100, 0x100, CRC(c75772bc) SHA1(ec84052aedc1d53f9caba3232ffff17de69561b2) ) // green |
r17585 | r17586 | |
511 | 616 | UINT8 *buf = auto_alloc_array(machine(), UINT8, 0x80000); |
512 | 617 | UINT8 *rom; |
513 | 618 | int size; |
514 | | int i; |
| 619 | int i,j; |
515 | 620 | |
516 | 621 | rom = machine().root_device().memregion("gfx1")->base(); |
517 | 622 | size = machine().root_device().memregion("gfx1")->bytes(); |
r17585 | r17586 | |
588 | 693 | } |
589 | 694 | |
590 | 695 | //rearrange bg tilemaps a bit.... |
591 | | |
592 | 696 | rom = machine().root_device().memregion("user1")->base(); |
593 | 697 | size = machine().root_device().memregion("user1")->bytes(); |
594 | 698 | memcpy(buf,rom, size); |
595 | 699 | |
| 700 | for(j=0;j<16;j++) |
596 | 701 | { |
597 | | int j; |
598 | | for(j=0;j<16;j++) |
599 | | for (i = 0;i < size/16;i+=8) |
600 | | { |
601 | | memcpy(&rom[i+(size/16)*j],&buf[i*16+8*j],8); |
602 | | } |
| 702 | for (i = 0;i < size/16;i+=8) |
| 703 | { |
| 704 | memcpy(&rom[i+(size/16)*j],&buf[i*16+8*j],8); |
| 705 | } |
603 | 706 | } |
604 | 707 | |
605 | 708 | rom = machine().root_device().memregion("user2")->base(); |
606 | 709 | size = machine().root_device().memregion("user2")->bytes(); |
| 710 | memcpy(buf,rom, size); |
607 | 711 | |
608 | | memcpy(buf,rom, size); |
| 712 | for(j=0;j<16;j++) |
609 | 713 | { |
610 | | int j; |
611 | | for(j=0;j<16;j++) |
612 | | for (i = 0;i < size/16;i+=8) |
613 | | { |
614 | | memcpy(&rom[i+(size/16)*j],&buf[i*16+8*j],8); |
615 | | } |
| 714 | for (i = 0;i < size/16;i+=8) |
| 715 | { |
| 716 | memcpy(&rom[i+(size/16)*j],&buf[i*16+8*j],8); |
| 717 | } |
616 | 718 | } |
617 | 719 | |
618 | 720 | auto_free(machine(), buf); |