trunk/src/mame/drivers/bnstars.c
| r20626 | r20627 | |
| 158 | 158 | UINT32 screen_update_bnstars_left(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 159 | 159 | UINT32 screen_update_bnstars_right(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 160 | 160 | TIMER_DEVICE_CALLBACK_MEMBER(ms32_interrupt); |
| 161 | void draw_roz(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority, int chip); |
| 162 | void update_color(int color, int screen); |
| 163 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT32 *sprram_top, size_t sprram_size, int region); |
| 164 | void irq_init(); |
| 165 | void irq_raise(int level); |
| 161 | 166 | }; |
| 162 | 167 | |
| 163 | 168 | |
| r20626 | r20627 | |
| 230 | 235 | |
| 231 | 236 | /* ROZ Layers */ |
| 232 | 237 | |
| 233 | | static void draw_roz(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int priority, int chip) |
| 238 | void bnstars_state::draw_roz(bitmap_ind16 &bitmap, const rectangle &cliprect, int priority, int chip) |
| 234 | 239 | { |
| 235 | | bnstars_state *state = machine.driver_data<bnstars_state>(); |
| 236 | 240 | /* TODO: registers 0x40/4 / 0x44/4 and 0x50/4 / 0x54/4 are used, meaning unknown */ |
| 237 | 241 | |
| 238 | | if (state->m_ms32_roz_ctrl[chip][0x5c/4] & 1) /* "super" mode */ |
| 242 | if (m_ms32_roz_ctrl[chip][0x5c/4] & 1) /* "super" mode */ |
| 239 | 243 | { |
| 240 | 244 | printf("no lineram!\n"); |
| 241 | 245 | return; |
| r20626 | r20627 | |
| 257 | 261 | int start2y = (lineaddr[0x08/4] & 0xffff) | ((lineaddr[0x0c/4] & 3) << 16); |
| 258 | 262 | int incxx = (lineaddr[0x10/4] & 0xffff) | ((lineaddr[0x14/4] & 1) << 16); |
| 259 | 263 | int incxy = (lineaddr[0x18/4] & 0xffff) | ((lineaddr[0x1c/4] & 1) << 16); |
| 260 | | int startx = (state->m_ms32_roz_ctrl[0x00/4] & 0xffff) | ((state->m_ms32_roz_ctrl[0x04/4] & 3) << 16); |
| 261 | | int starty = (state->m_ms32_roz_ctrl[0x08/4] & 0xffff) | ((state->m_ms32_roz_ctrl[0x0c/4] & 3) << 16); |
| 262 | | int offsx = state->m_ms32_roz_ctrl[0x30/4]; |
| 263 | | int offsy = state->m_ms32_roz_ctrl[0x34/4]; |
| 264 | int startx = (m_ms32_roz_ctrl[0x00/4] & 0xffff) | ((m_ms32_roz_ctrl[0x04/4] & 3) << 16); |
| 265 | int starty = (m_ms32_roz_ctrl[0x08/4] & 0xffff) | ((m_ms32_roz_ctrl[0x0c/4] & 3) << 16); |
| 266 | int offsx = m_ms32_roz_ctrl[0x30/4]; |
| 267 | int offsy = m_ms32_roz_ctrl[0x34/4]; |
| 264 | 268 | |
| 265 | 269 | my_clip.min_y = my_clip.max_y = y; |
| 266 | 270 | |
| 267 | | offsx += (state->m_ms32_roz_ctrl[0x38/4] & 1) * 0x400; // ??? gratia, hayaosi1... |
| 268 | | offsy += (state->m_ms32_roz_ctrl[0x3c/4] & 1) * 0x400; // ??? gratia, hayaosi1... |
| 271 | offsx += (m_ms32_roz_ctrl[0x38/4] & 1) * 0x400; // ??? gratia, hayaosi1... |
| 272 | offsy += (m_ms32_roz_ctrl[0x3c/4] & 1) * 0x400; // ??? gratia, hayaosi1... |
| 269 | 273 | |
| 270 | 274 | // extend sign |
| 271 | 275 | if (start2x & 0x20000) start2x |= ~0x3ffff; |
| r20626 | r20627 | |
| 275 | 279 | if (incxx & 0x10000) incxx |= ~0x1ffff; |
| 276 | 280 | if (incxy & 0x10000) incxy |= ~0x1ffff; |
| 277 | 281 | |
| 278 | | state->m_ms32_roz_tilemap->draw_roz(bitmap, &my_clip, |
| 282 | m_ms32_roz_tilemap->draw_roz(bitmap, &my_clip, |
| 279 | 283 | (start2x+startx+offsx)<<16, (start2y+starty+offsy)<<16, |
| 280 | 284 | incxx<<8, incxy<<8, 0, 0, |
| 281 | 285 | 1, // Wrap |
| r20626 | r20627 | |
| 287 | 291 | } |
| 288 | 292 | else /* "simple" mode */ |
| 289 | 293 | { |
| 290 | | int startx = (state->m_ms32_roz_ctrl[chip][0x00/4] & 0xffff) | ((state->m_ms32_roz_ctrl[chip][0x04/4] & 3) << 16); |
| 291 | | int starty = (state->m_ms32_roz_ctrl[chip][0x08/4] & 0xffff) | ((state->m_ms32_roz_ctrl[chip][0x0c/4] & 3) << 16); |
| 292 | | int incxx = (state->m_ms32_roz_ctrl[chip][0x10/4] & 0xffff) | ((state->m_ms32_roz_ctrl[chip][0x14/4] & 1) << 16); |
| 293 | | int incxy = (state->m_ms32_roz_ctrl[chip][0x18/4] & 0xffff) | ((state->m_ms32_roz_ctrl[chip][0x1c/4] & 1) << 16); |
| 294 | | int incyy = (state->m_ms32_roz_ctrl[chip][0x20/4] & 0xffff) | ((state->m_ms32_roz_ctrl[chip][0x24/4] & 1) << 16); |
| 295 | | int incyx = (state->m_ms32_roz_ctrl[chip][0x28/4] & 0xffff) | ((state->m_ms32_roz_ctrl[chip][0x2c/4] & 1) << 16); |
| 296 | | int offsx = state->m_ms32_roz_ctrl[chip][0x30/4]; |
| 297 | | int offsy = state->m_ms32_roz_ctrl[chip][0x34/4]; |
| 294 | int startx = (m_ms32_roz_ctrl[chip][0x00/4] & 0xffff) | ((m_ms32_roz_ctrl[chip][0x04/4] & 3) << 16); |
| 295 | int starty = (m_ms32_roz_ctrl[chip][0x08/4] & 0xffff) | ((m_ms32_roz_ctrl[chip][0x0c/4] & 3) << 16); |
| 296 | int incxx = (m_ms32_roz_ctrl[chip][0x10/4] & 0xffff) | ((m_ms32_roz_ctrl[chip][0x14/4] & 1) << 16); |
| 297 | int incxy = (m_ms32_roz_ctrl[chip][0x18/4] & 0xffff) | ((m_ms32_roz_ctrl[chip][0x1c/4] & 1) << 16); |
| 298 | int incyy = (m_ms32_roz_ctrl[chip][0x20/4] & 0xffff) | ((m_ms32_roz_ctrl[chip][0x24/4] & 1) << 16); |
| 299 | int incyx = (m_ms32_roz_ctrl[chip][0x28/4] & 0xffff) | ((m_ms32_roz_ctrl[chip][0x2c/4] & 1) << 16); |
| 300 | int offsx = m_ms32_roz_ctrl[chip][0x30/4]; |
| 301 | int offsy = m_ms32_roz_ctrl[chip][0x34/4]; |
| 298 | 302 | |
| 299 | | offsx += (state->m_ms32_roz_ctrl[chip][0x38/4] & 1) * 0x400; // ??? gratia, hayaosi1... |
| 300 | | offsy += (state->m_ms32_roz_ctrl[chip][0x3c/4] & 1) * 0x400; // ??? gratia, hayaosi1... |
| 303 | offsx += (m_ms32_roz_ctrl[chip][0x38/4] & 1) * 0x400; // ??? gratia, hayaosi1... |
| 304 | offsy += (m_ms32_roz_ctrl[chip][0x3c/4] & 1) * 0x400; // ??? gratia, hayaosi1... |
| 301 | 305 | |
| 302 | 306 | /* extend sign */ |
| 303 | 307 | if (startx & 0x20000) startx |= ~0x3ffff; |
| r20626 | r20627 | |
| 307 | 311 | if (incyy & 0x10000) incyy |= ~0x1ffff; |
| 308 | 312 | if (incyx & 0x10000) incyx |= ~0x1ffff; |
| 309 | 313 | |
| 310 | | state->m_ms32_roz_tilemap[chip]->draw_roz(bitmap, cliprect, |
| 314 | m_ms32_roz_tilemap[chip]->draw_roz(bitmap, cliprect, |
| 311 | 315 | (startx+offsx)<<16, (starty+offsy)<<16, |
| 312 | 316 | incxx<<8, incxy<<8, incyx<<8, incyy<<8, |
| 313 | 317 | 1, // Wrap |
| r20626 | r20627 | |
| 349 | 353 | } |
| 350 | 354 | |
| 351 | 355 | |
| 352 | | static void update_color(running_machine &machine, int color, int screen) |
| 356 | void bnstars_state::update_color(int color, int screen) |
| 353 | 357 | { |
| 354 | | bnstars_state *state = machine.driver_data<bnstars_state>(); |
| 355 | 358 | int r,g,b; |
| 356 | 359 | |
| 357 | | r = ((state->m_ms32_pal_ram[screen][color*2] & 0xff00) >>8 ); |
| 358 | | g = ((state->m_ms32_pal_ram[screen][color*2] & 0x00ff) >>0 ); |
| 359 | | b = ((state->m_ms32_pal_ram[screen][color*2+1] & 0x00ff) >>0 ); |
| 360 | r = ((m_ms32_pal_ram[screen][color*2] & 0xff00) >>8 ); |
| 361 | g = ((m_ms32_pal_ram[screen][color*2] & 0x00ff) >>0 ); |
| 362 | b = ((m_ms32_pal_ram[screen][color*2+1] & 0x00ff) >>0 ); |
| 360 | 363 | |
| 361 | | palette_set_color(machine,color+screen*0x8000,MAKE_RGB(r,g,b)); |
| 364 | palette_set_color(machine(),color+screen*0x8000,MAKE_RGB(r,g,b)); |
| 362 | 365 | } |
| 363 | 366 | |
| 364 | 367 | WRITE32_MEMBER(bnstars_state::ms32_pal0_ram_w) |
| 365 | 368 | { |
| 366 | 369 | COMBINE_DATA(&m_ms32_pal_ram[0][offset]); |
| 367 | | update_color(machine(), offset/2, 0); |
| 370 | update_color(offset/2, 0); |
| 368 | 371 | } |
| 369 | 372 | |
| 370 | 373 | WRITE32_MEMBER(bnstars_state::ms32_pal1_ram_w) |
| 371 | 374 | { |
| 372 | 375 | COMBINE_DATA(&m_ms32_pal_ram[1][offset]); |
| 373 | | update_color(machine(), offset/2, 1); |
| 376 | update_color(offset/2, 1); |
| 374 | 377 | } |
| 375 | 378 | |
| 376 | 379 | |
| 377 | 380 | /* SPRITES based on tetrisp2 for now, readd priority bits later */ |
| 378 | | static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT32 *sprram_top, size_t sprram_size, int region) |
| 381 | void bnstars_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect, UINT32 *sprram_top, size_t sprram_size, int region) |
| 379 | 382 | { |
| 380 | | bnstars_state *state = machine.driver_data<bnstars_state>(); |
| 381 | 383 | /*************************************************************************** |
| 382 | 384 | |
| 383 | 385 | |
| r20626 | r20627 | |
| 418 | 420 | int tx, ty, sx, sy, flipx, flipy; |
| 419 | 421 | int xsize, ysize, xzoom, yzoom; |
| 420 | 422 | int code, attr, color, size, pri, pri_mask; |
| 421 | | gfx_element *gfx = machine.gfx[region]; |
| 423 | gfx_element *gfx = machine().gfx[region]; |
| 422 | 424 | |
| 423 | 425 | UINT32 *source = sprram_top; |
| 424 | 426 | const UINT32 *finish = sprram_top + (sprram_size - 0x10) / 4; |
| 425 | 427 | |
| 426 | 428 | |
| 427 | | if (state->m_ms32_reverse_sprite_order == 1) |
| 429 | if (m_ms32_reverse_sprite_order == 1) |
| 428 | 430 | { |
| 429 | 431 | source = sprram_top + (sprram_size - 0x10) / 4; |
| 430 | 432 | finish = sprram_top; |
| 431 | 433 | } |
| 432 | 434 | |
| 433 | 435 | |
| 434 | | for (;state->m_ms32_reverse_sprite_order ? (source>=finish) : (source<finish); state->m_ms32_reverse_sprite_order ? (source-=4) : (source+=4)) |
| 436 | for (;m_ms32_reverse_sprite_order ? (source>=finish) : (source<finish); m_ms32_reverse_sprite_order ? (source-=4) : (source+=4)) |
| 435 | 437 | { |
| 436 | 438 | attr = source[ 0 ]; |
| 437 | 439 | |
| r20626 | r20627 | |
| 473 | 475 | |
| 474 | 476 | // there are surely also shadows (see gametngk) but how they're enabled we don't know |
| 475 | 477 | |
| 476 | | if (state->m_flipscreen) |
| 478 | if (m_flipscreen) |
| 477 | 479 | { |
| 478 | 480 | sx = 320 - ((xsize*xzoom)>>16) - sx; |
| 479 | 481 | sy = 224 - ((ysize*yzoom)>>16) - sy; |
| r20626 | r20627 | |
| 497 | 499 | color, |
| 498 | 500 | flipx, flipy, |
| 499 | 501 | sx,sy, |
| 500 | | xzoom, yzoom, machine.priority_bitmap,pri_mask, 0); |
| 502 | xzoom, yzoom, machine().priority_bitmap,pri_mask, 0); |
| 501 | 503 | } /* end sprite loop */ |
| 502 | 504 | } |
| 503 | 505 | |
| r20626 | r20627 | |
| 544 | 546 | m_ms32_bg_tilemap[0]->set_scrolly(0, m_ms32_bg0_scroll[0x0c/4] + m_ms32_bg0_scroll[0x14/4] ); |
| 545 | 547 | m_ms32_bg_tilemap[0]->draw(bitmap, cliprect, 0,1); |
| 546 | 548 | |
| 547 | | draw_roz(machine(),bitmap,cliprect,2,0); |
| 549 | draw_roz(bitmap,cliprect,2,0); |
| 548 | 550 | |
| 549 | 551 | m_ms32_tx_tilemap[0]->set_scrollx(0, m_ms32_tx0_scroll[0x00/4] + m_ms32_tx0_scroll[0x08/4] + 0x18); |
| 550 | 552 | m_ms32_tx_tilemap[0]->set_scrolly(0, m_ms32_tx0_scroll[0x0c/4] + m_ms32_tx0_scroll[0x14/4]); |
| 551 | 553 | m_ms32_tx_tilemap[0]->draw(bitmap, cliprect, 0,4); |
| 552 | 554 | |
| 553 | 555 | |
| 554 | | draw_sprites(machine(),bitmap,cliprect, m_ms32_spram, 0x20000, 0); |
| 556 | draw_sprites(bitmap,cliprect, m_ms32_spram, 0x20000, 0); |
| 555 | 557 | |
| 556 | 558 | return 0; |
| 557 | 559 | } |
| r20626 | r20627 | |
| 567 | 569 | m_ms32_bg_tilemap[1]->set_scrolly(0, m_ms32_bg1_scroll[0x0c/4] + m_ms32_bg1_scroll[0x14/4] ); |
| 568 | 570 | m_ms32_bg_tilemap[1]->draw(bitmap, cliprect, 0,1); |
| 569 | 571 | |
| 570 | | draw_roz(machine(),bitmap,cliprect,2,1); |
| 572 | draw_roz(bitmap,cliprect,2,1); |
| 571 | 573 | |
| 572 | 574 | m_ms32_tx_tilemap[1]->set_scrollx(0, m_ms32_tx1_scroll[0x00/4] + m_ms32_tx1_scroll[0x08/4] + 0x18); |
| 573 | 575 | m_ms32_tx_tilemap[1]->set_scrolly(0, m_ms32_tx1_scroll[0x0c/4] + m_ms32_tx1_scroll[0x14/4]); |
| 574 | 576 | m_ms32_tx_tilemap[1]->draw(bitmap, cliprect, 0,4); |
| 575 | 577 | |
| 576 | | draw_sprites(machine(),bitmap,cliprect, m_ms32_spram+(0x20000/4), 0x20000, 4); |
| 578 | draw_sprites(bitmap,cliprect, m_ms32_spram+(0x20000/4), 0x20000, 4); |
| 577 | 579 | |
| 578 | 580 | return 0; |
| 579 | 581 | } |
| r20626 | r20627 | |
| 1334 | 1336 | return i; |
| 1335 | 1337 | } |
| 1336 | 1338 | |
| 1337 | | static void irq_init(running_machine &machine) |
| 1339 | void bnstars_state::irq_init() |
| 1338 | 1340 | { |
| 1339 | | bnstars_state *state = machine.driver_data<bnstars_state>(); |
| 1340 | | state->m_irqreq = 0; |
| 1341 | | machine.device("maincpu")->execute().set_input_line(0, CLEAR_LINE); |
| 1342 | | machine.device("maincpu")->execute().set_irq_acknowledge_callback(irq_callback); |
| 1341 | m_irqreq = 0; |
| 1342 | machine().device("maincpu")->execute().set_input_line(0, CLEAR_LINE); |
| 1343 | machine().device("maincpu")->execute().set_irq_acknowledge_callback(irq_callback); |
| 1343 | 1344 | } |
| 1344 | 1345 | |
| 1345 | | static void irq_raise(running_machine &machine, int level) |
| 1346 | void bnstars_state::irq_raise(int level) |
| 1346 | 1347 | { |
| 1347 | | bnstars_state *state = machine.driver_data<bnstars_state>(); |
| 1348 | | state->m_irqreq |= (1<<level); |
| 1349 | | machine.device("maincpu")->execute().set_input_line(0, ASSERT_LINE); |
| 1348 | m_irqreq |= (1<<level); |
| 1349 | machine().device("maincpu")->execute().set_input_line(0, ASSERT_LINE); |
| 1350 | 1350 | } |
| 1351 | 1351 | |
| 1352 | 1352 | /* TODO: fix this arrangement (derived from old deprecat lib) */ |
| 1353 | 1353 | TIMER_DEVICE_CALLBACK_MEMBER(bnstars_state::ms32_interrupt) |
| 1354 | 1354 | { |
| 1355 | 1355 | int scanline = param; |
| 1356 | | if( scanline == 0 ) irq_raise(machine(), 10); |
| 1357 | | if( scanline == 8) irq_raise(machine(), 9); |
| 1356 | if( scanline == 0 ) irq_raise(10); |
| 1357 | if( scanline == 8) irq_raise(9); |
| 1358 | 1358 | /* hayaosi1 needs at least 12 IRQ 0 per frame to work (see code at FFE02289) |
| 1359 | 1359 | kirarast needs it too, at least 8 per frame, but waits for a variable amount |
| 1360 | 1360 | 47pi2 needs ?? per frame (otherwise it hangs when you lose) |
| r20626 | r20627 | |
| 1363 | 1363 | desertwr |
| 1364 | 1364 | p47aces |
| 1365 | 1365 | */ |
| 1366 | | if( (scanline % 8) == 0 && scanline <= 224 ) irq_raise(machine(), 0); |
| 1366 | if( (scanline % 8) == 0 && scanline <= 224 ) irq_raise(0); |
| 1367 | 1367 | } |
| 1368 | 1368 | |
| 1369 | 1369 | void bnstars_state::machine_reset() |
| 1370 | 1370 | { |
| 1371 | | irq_init(machine()); |
| 1371 | irq_init(); |
| 1372 | 1372 | } |
| 1373 | 1373 | |
| 1374 | 1374 | |
trunk/src/mame/drivers/arcadia.c
| r20626 | r20627 | |
| 79 | 79 | DECLARE_DRIVER_INIT(airh); |
| 80 | 80 | DECLARE_DRIVER_INIT(ldrba); |
| 81 | 81 | DECLARE_DRIVER_INIT(socc); |
| 82 | void arcadia_init(); |
| 83 | inline void generic_decode(const char *tag, int bit7, int bit6, int bit5, int bit4, int bit3, int bit2, int bit1, int bit0); |
| 82 | 84 | }; |
| 83 | 85 | |
| 84 | 86 | |
| r20626 | r20627 | |
| 764 | 766 | * |
| 765 | 767 | *************************************/ |
| 766 | 768 | |
| 767 | | INLINE void generic_decode(running_machine &machine, const char *tag, int bit7, int bit6, int bit5, int bit4, int bit3, int bit2, int bit1, int bit0) |
| 769 | void arcadia_amiga_state::generic_decode(const char *tag, int bit7, int bit6, int bit5, int bit4, int bit3, int bit2, int bit1, int bit0) |
| 768 | 770 | { |
| 769 | | UINT16 *rom = (UINT16 *)machine.root_device().memregion(tag)->base(); |
| 771 | UINT16 *rom = (UINT16 *)machine().root_device().memregion(tag)->base(); |
| 770 | 772 | int i; |
| 771 | 773 | |
| 772 | 774 | /* only the low byte of ROMs are encrypted in these games */ |
| r20626 | r20627 | |
| 775 | 777 | |
| 776 | 778 | #if 0 |
| 777 | 779 | { |
| 778 | | UINT8 *ROM = machine.root_device().memregion(tag)->base(); |
| 779 | | int size = machine.root_device().memregion(tag)->bytes(); |
| 780 | UINT8 *ROM = machine().root_device().memregion(tag)->base(); |
| 781 | int size = machine().root_device().memregion(tag)->bytes(); |
| 780 | 782 | |
| 781 | 783 | FILE *fp; |
| 782 | 784 | char filename[256]; |
| 783 | | sprintf(filename,"decrypted_%s", machine.system().name); |
| 785 | sprintf(filename,"decrypted_%s", machine().system().name); |
| 784 | 786 | fp=fopen(filename, "w+b"); |
| 785 | 787 | if (fp) |
| 786 | 788 | { |
| r20626 | r20627 | |
| 799 | 801 | * |
| 800 | 802 | *************************************/ |
| 801 | 803 | |
| 802 | | static void arcadia_init(running_machine &machine) |
| 804 | void arcadia_amiga_state::arcadia_init() |
| 803 | 805 | { |
| 804 | | arcadia_amiga_state *state = machine.driver_data<arcadia_amiga_state>(); |
| 805 | 806 | static const amiga_machine_interface arcadia_intf = |
| 806 | 807 | { |
| 807 | 808 | ANGUS_CHIP_RAM_MASK, |
| r20626 | r20627 | |
| 814 | 815 | UINT16 *biosrom; |
| 815 | 816 | |
| 816 | 817 | /* configure our Amiga setup */ |
| 817 | | amiga_machine_config(machine, &arcadia_intf); |
| 818 | amiga_machine_config(machine(), &arcadia_intf); |
| 818 | 819 | |
| 819 | 820 | /* set up memory */ |
| 820 | | state->m_bank1->configure_entry(0, state->m_chip_ram); |
| 821 | | state->m_bank1->configure_entry(1, machine.root_device().memregion("user1")->base()); |
| 821 | m_bank1->configure_entry(0, m_chip_ram); |
| 822 | m_bank1->configure_entry(1, machine().root_device().memregion("user1")->base()); |
| 822 | 823 | |
| 823 | 824 | /* OnePlay bios is encrypted, TenPlay is not */ |
| 824 | | biosrom = (UINT16 *)machine.root_device().memregion("user2")->base(); |
| 825 | biosrom = (UINT16 *)machine().root_device().memregion("user2")->base(); |
| 825 | 826 | if (biosrom[0] != 0x4afc) |
| 826 | | generic_decode(machine, "user2", 6, 1, 0, 2, 3, 4, 5, 7); |
| 827 | generic_decode("user2", 6, 1, 0, 2, 3, 4, 5, 7); |
| 827 | 828 | } |
| 828 | 829 | |
| 829 | 830 | |
| r20626 | r20627 | |
| 834 | 835 | * |
| 835 | 836 | *************************************/ |
| 836 | 837 | |
| 837 | | DRIVER_INIT_MEMBER(arcadia_amiga_state,none) { arcadia_init(machine()); } |
| 838 | | DRIVER_INIT_MEMBER(arcadia_amiga_state,airh) { arcadia_init(machine()); generic_decode(machine(), "user3", 5, 0, 2, 4, 7, 6, 1, 3); } |
| 839 | | DRIVER_INIT_MEMBER(arcadia_amiga_state,bowl) { arcadia_init(machine()); generic_decode(machine(), "user3", 7, 6, 0, 1, 2, 3, 4, 5); } |
| 840 | | DRIVER_INIT_MEMBER(arcadia_amiga_state,dart) { arcadia_init(machine()); generic_decode(machine(), "user3", 4, 0, 7, 6, 3, 1, 2, 5); } |
| 841 | | DRIVER_INIT_MEMBER(arcadia_amiga_state,ldrba) { arcadia_init(machine()); generic_decode(machine(), "user3", 2, 3, 4, 1, 0, 7, 5, 6); } |
| 842 | | DRIVER_INIT_MEMBER(arcadia_amiga_state,ninj) { arcadia_init(machine()); generic_decode(machine(), "user3", 1, 6, 5, 7, 4, 2, 0, 3); } |
| 843 | | DRIVER_INIT_MEMBER(arcadia_amiga_state,rdwr) { arcadia_init(machine()); generic_decode(machine(), "user3", 3, 1, 6, 4, 0, 5, 2, 7); } |
| 844 | | DRIVER_INIT_MEMBER(arcadia_amiga_state,sdwr) { arcadia_init(machine()); generic_decode(machine(), "user3", 6, 3, 4, 5, 2, 1, 0, 7); } |
| 845 | | DRIVER_INIT_MEMBER(arcadia_amiga_state,socc) { arcadia_init(machine()); generic_decode(machine(), "user3", 0, 7, 1, 6, 5, 4, 3, 2); } |
| 846 | | DRIVER_INIT_MEMBER(arcadia_amiga_state,sprg) { arcadia_init(machine()); generic_decode(machine(), "user3", 4, 7, 3, 0, 6, 5, 2, 1); } |
| 847 | | DRIVER_INIT_MEMBER(arcadia_amiga_state,xeon) { arcadia_init(machine()); generic_decode(machine(), "user3", 3, 1, 2, 4, 0, 5, 6, 7); } |
| 838 | DRIVER_INIT_MEMBER(arcadia_amiga_state,none) { arcadia_init(); } |
| 839 | DRIVER_INIT_MEMBER(arcadia_amiga_state,airh) { arcadia_init(); generic_decode("user3", 5, 0, 2, 4, 7, 6, 1, 3); } |
| 840 | DRIVER_INIT_MEMBER(arcadia_amiga_state,bowl) { arcadia_init(); generic_decode("user3", 7, 6, 0, 1, 2, 3, 4, 5); } |
| 841 | DRIVER_INIT_MEMBER(arcadia_amiga_state,dart) { arcadia_init(); generic_decode("user3", 4, 0, 7, 6, 3, 1, 2, 5); } |
| 842 | DRIVER_INIT_MEMBER(arcadia_amiga_state,ldrba) { arcadia_init(); generic_decode("user3", 2, 3, 4, 1, 0, 7, 5, 6); } |
| 843 | DRIVER_INIT_MEMBER(arcadia_amiga_state,ninj) { arcadia_init(); generic_decode("user3", 1, 6, 5, 7, 4, 2, 0, 3); } |
| 844 | DRIVER_INIT_MEMBER(arcadia_amiga_state,rdwr) { arcadia_init(); generic_decode("user3", 3, 1, 6, 4, 0, 5, 2, 7); } |
| 845 | DRIVER_INIT_MEMBER(arcadia_amiga_state,sdwr) { arcadia_init(); generic_decode("user3", 6, 3, 4, 5, 2, 1, 0, 7); } |
| 846 | DRIVER_INIT_MEMBER(arcadia_amiga_state,socc) { arcadia_init(); generic_decode("user3", 0, 7, 1, 6, 5, 4, 3, 2); } |
| 847 | DRIVER_INIT_MEMBER(arcadia_amiga_state,sprg) { arcadia_init(); generic_decode("user3", 4, 7, 3, 0, 6, 5, 2, 1); } |
| 848 | DRIVER_INIT_MEMBER(arcadia_amiga_state,xeon) { arcadia_init(); generic_decode("user3", 3, 1, 2, 4, 0, 5, 6, 7); } |
| 848 | 849 | |
| 849 | 850 | /************************************* |
| 850 | 851 | * |
trunk/src/mame/drivers/blackt96.c
| r20626 | r20627 | |
| 151 | 151 | TILE_GET_INFO_MEMBER(get_bg7_tile_info); |
| 152 | 152 | virtual void video_start(); |
| 153 | 153 | UINT32 screen_update_blackt96(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 154 | void draw_strip(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int column); |
| 155 | void draw_page(bitmap_ind16 &bitmap, const rectangle &cliprect, int page); |
| 154 | 156 | }; |
| 155 | 157 | |
| 156 | 158 | #define GET_INFO( ram ) \ |
| r20626 | r20627 | |
| 200 | 202 | m_spriteram[7] = m_spriteram7; |
| 201 | 203 | } |
| 202 | 204 | |
| 203 | | static void draw_strip(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int column) |
| 205 | void blackt96_state::draw_strip(bitmap_ind16 &bitmap, const rectangle &cliprect, int page, int column) |
| 204 | 206 | { |
| 205 | | blackt96_state *state = machine.driver_data<blackt96_state>(); |
| 206 | 207 | /* the very first 'page' in the spriteram contains the x/y positions for each tile strip */ |
| 207 | | gfx_element *gfxbg = machine.gfx[0]; |
| 208 | | gfx_element *gfxspr = machine.gfx[1]; |
| 208 | gfx_element *gfxbg = machine().gfx[0]; |
| 209 | gfx_element *gfxspr = machine().gfx[1]; |
| 209 | 210 | |
| 210 | 211 | int base = column * (0x80/2); |
| 211 | 212 | base += page * 2; |
| r20626 | r20627 | |
| 213 | 214 | /* ---- ---- ---x xxxx |
| 214 | 215 | xxxx ---y yyyy yyyy */ |
| 215 | 216 | |
| 216 | | int xx= ((state->m_spriteram[0][base+0]&0x001f)<<4) | (state->m_spriteram[0][base+1]&0xf000)>>12; |
| 217 | | int yy = ((state->m_spriteram[0][base+1]&0x1ff)); |
| 217 | int xx= ((m_spriteram[0][base+0]&0x001f)<<4) | (m_spriteram[0][base+1]&0xf000)>>12; |
| 218 | int yy = ((m_spriteram[0][base+1]&0x1ff)); |
| 218 | 219 | |
| 219 | 220 | if (xx&0x100) xx-=0x200; |
| 220 | 221 | yy = 0x1ff-yy; |
| r20626 | r20627 | |
| 222 | 223 | |
| 223 | 224 | yy -= 15; |
| 224 | 225 | |
| 225 | | UINT16* base2 = state->m_spriteram[page]+column * (0x80/2); |
| 226 | UINT16* base2 = m_spriteram[page]+column * (0x80/2); |
| 226 | 227 | |
| 227 | 228 | for (int y=0;y<32;y++) |
| 228 | 229 | { |
| r20626 | r20627 | |
| 244 | 245 | } |
| 245 | 246 | } |
| 246 | 247 | |
| 247 | | static void draw_page(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect, int page) |
| 248 | void blackt96_state::draw_page(bitmap_ind16 &bitmap, const rectangle &cliprect, int page) |
| 248 | 249 | { |
| 249 | 250 | for (int strip=0;strip<32;strip++) |
| 250 | 251 | { |
| 251 | | draw_strip(machine, bitmap, cliprect, page, strip); |
| 252 | draw_strip(bitmap, cliprect, page, strip); |
| 252 | 253 | } |
| 253 | 254 | } |
| 254 | 255 | |
| r20626 | r20627 | |
| 256 | 257 | { |
| 257 | 258 | bitmap.fill(get_black_pen(machine()), cliprect); |
| 258 | 259 | |
| 259 | | draw_page(machine(), bitmap, cliprect, 2); // bg |
| 260 | | draw_page(machine(), bitmap, cliprect, 3); // lower pri sprites |
| 261 | | draw_page(machine(), bitmap, cliprect, 1); // higher pri sprites |
| 260 | draw_page(bitmap, cliprect, 2); // bg |
| 261 | draw_page(bitmap, cliprect, 3); // lower pri sprites |
| 262 | draw_page(bitmap, cliprect, 1); // higher pri sprites |
| 262 | 263 | |
| 263 | 264 | |
| 264 | 265 | /* Text Layer */ |
trunk/src/mame/drivers/berzerk.c
| r20626 | r20627 | |
| 61 | 61 | UINT32 screen_update_berzerk(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 62 | 62 | TIMER_CALLBACK_MEMBER(irq_callback); |
| 63 | 63 | TIMER_CALLBACK_MEMBER(nmi_callback); |
| 64 | void vpos_to_vsync_chain_counter(int vpos, UINT8 *counter, UINT8 *v256); |
| 65 | int vsync_chain_counter_to_vpos(UINT8 counter, UINT8 v256); |
| 66 | void create_irq_timer(); |
| 67 | void start_irq_timer(); |
| 68 | void create_nmi_timer(); |
| 69 | void start_nmi_timer(); |
| 70 | void get_pens(pen_t *pens); |
| 64 | 71 | }; |
| 65 | 72 | |
| 66 | 73 | |
| r20626 | r20627 | |
| 130 | 137 | * |
| 131 | 138 | *************************************/ |
| 132 | 139 | |
| 133 | | static void vpos_to_vsync_chain_counter(int vpos, UINT8 *counter, UINT8 *v256) |
| 140 | void berzerk_state::vpos_to_vsync_chain_counter(int vpos, UINT8 *counter, UINT8 *v256) |
| 134 | 141 | { |
| 135 | 142 | /* convert from a vertical position to the actual values on the vertical sync counters */ |
| 136 | 143 | *v256 = ((vpos < VBEND) || (vpos >= VBSTART)); |
| r20626 | r20627 | |
| 149 | 156 | } |
| 150 | 157 | |
| 151 | 158 | |
| 152 | | static int vsync_chain_counter_to_vpos(UINT8 counter, UINT8 v256) |
| 159 | int berzerk_state::vsync_chain_counter_to_vpos(UINT8 counter, UINT8 v256) |
| 153 | 160 | { |
| 154 | 161 | /* convert from the vertical sync counters to an actual vertical position */ |
| 155 | 162 | int vpos; |
| r20626 | r20627 | |
| 205 | 212 | } |
| 206 | 213 | |
| 207 | 214 | |
| 208 | | static void create_irq_timer(running_machine &machine) |
| 215 | void berzerk_state::create_irq_timer() |
| 209 | 216 | { |
| 210 | | berzerk_state *state = machine.driver_data<berzerk_state>(); |
| 211 | | state->m_irq_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(berzerk_state::irq_callback),state)); |
| 217 | m_irq_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(berzerk_state::irq_callback),this)); |
| 212 | 218 | } |
| 213 | 219 | |
| 214 | 220 | |
| 215 | | static void start_irq_timer(running_machine &machine) |
| 221 | void berzerk_state::start_irq_timer() |
| 216 | 222 | { |
| 217 | | berzerk_state *state = machine.driver_data<berzerk_state>(); |
| 218 | 223 | int vpos = vsync_chain_counter_to_vpos(irq_trigger_counts[0], irq_trigger_v256s[0]); |
| 219 | | state->m_irq_timer->adjust(machine.primary_screen->time_until_pos(vpos)); |
| 224 | m_irq_timer->adjust(machine().primary_screen->time_until_pos(vpos)); |
| 220 | 225 | } |
| 221 | 226 | |
| 222 | 227 | |
| r20626 | r20627 | |
| 284 | 289 | } |
| 285 | 290 | |
| 286 | 291 | |
| 287 | | static void create_nmi_timer(running_machine &machine) |
| 292 | void berzerk_state::create_nmi_timer() |
| 288 | 293 | { |
| 289 | | berzerk_state *state = machine.driver_data<berzerk_state>(); |
| 290 | | state->m_nmi_timer = machine.scheduler().timer_alloc(timer_expired_delegate(FUNC(berzerk_state::nmi_callback),state)); |
| 294 | m_nmi_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(berzerk_state::nmi_callback),this)); |
| 291 | 295 | } |
| 292 | 296 | |
| 293 | 297 | |
| 294 | | static void start_nmi_timer(running_machine &machine) |
| 298 | void berzerk_state::start_nmi_timer() |
| 295 | 299 | { |
| 296 | | berzerk_state *state = machine.driver_data<berzerk_state>(); |
| 297 | 300 | int vpos = vsync_chain_counter_to_vpos(nmi_trigger_counts[0], nmi_trigger_v256s[0]); |
| 298 | | state->m_nmi_timer->adjust(machine.primary_screen->time_until_pos(vpos)); |
| 301 | m_nmi_timer->adjust(machine().primary_screen->time_until_pos(vpos)); |
| 299 | 302 | } |
| 300 | 303 | |
| 301 | 304 | |
| r20626 | r20627 | |
| 308 | 311 | |
| 309 | 312 | void berzerk_state::machine_start() |
| 310 | 313 | { |
| 311 | | create_irq_timer(machine()); |
| 312 | | create_nmi_timer(machine()); |
| 314 | create_irq_timer(); |
| 315 | create_nmi_timer(); |
| 313 | 316 | |
| 314 | 317 | /* register for state saving */ |
| 315 | 318 | state_save_register_global(machine(), m_magicram_control); |
| r20626 | r20627 | |
| 334 | 337 | set_led_status(machine(), 0, 0); |
| 335 | 338 | m_magicram_control = 0; |
| 336 | 339 | |
| 337 | | start_irq_timer(machine()); |
| 338 | | start_nmi_timer(machine()); |
| 340 | start_irq_timer(); |
| 341 | start_nmi_timer(); |
| 339 | 342 | } |
| 340 | 343 | |
| 341 | 344 | |
| r20626 | r20627 | |
| 421 | 424 | } |
| 422 | 425 | |
| 423 | 426 | |
| 424 | | static void get_pens(running_machine &machine, pen_t *pens) |
| 427 | void berzerk_state::get_pens(pen_t *pens) |
| 425 | 428 | { |
| 426 | 429 | static const int resistances_wg[] = { 750, 0 }; |
| 427 | 430 | static const int resistances_el[] = { 1.0 / ((1.0 / 750.0) + (1.0 / 360.0)), 0 }; |
| r20626 | r20627 | |
| 429 | 432 | int color; |
| 430 | 433 | double color_weights[2]; |
| 431 | 434 | |
| 432 | | if (machine.root_device().ioport(MONITOR_TYPE_PORT_TAG)->read() == 0) |
| 435 | if (machine().root_device().ioport(MONITOR_TYPE_PORT_TAG)->read() == 0) |
| 433 | 436 | compute_resistor_weights(0, 0xff, -1.0, |
| 434 | 437 | 2, resistances_wg, color_weights, 0, 270, |
| 435 | 438 | 2, resistances_wg, color_weights, 0, 270, |
| r20626 | r20627 | |
| 461 | 464 | pen_t pens[NUM_PENS]; |
| 462 | 465 | offs_t offs; |
| 463 | 466 | |
| 464 | | get_pens(machine(), pens); |
| 467 | get_pens(pens); |
| 465 | 468 | |
| 466 | 469 | for (offs = 0; offs < m_videoram.bytes(); offs++) |
| 467 | 470 | { |
trunk/src/mame/drivers/bestleag.c
| r20626 | r20627 | |
| 53 | 53 | virtual void video_start(); |
| 54 | 54 | UINT32 screen_update_bestleag(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 55 | 55 | UINT32 screen_update_bestleaw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 56 | void draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 56 | 57 | }; |
| 57 | 58 | |
| 58 | 59 | |
| r20626 | r20627 | |
| 118 | 119 | include several similiarities with other Playmark games (including |
| 119 | 120 | the sprite end code and the data being offset (i.e. spriteram starting from 0x16/2)) |
| 120 | 121 | */ |
| 121 | | static void draw_sprites(running_machine &machine, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 122 | void bestleag_state::draw_sprites(bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 122 | 123 | { |
| 123 | | bestleag_state *state = machine.driver_data<bestleag_state>(); |
| 124 | | UINT16 *spriteram16 = state->m_spriteram; |
| 124 | UINT16 *spriteram16 = m_spriteram; |
| 125 | 125 | |
| 126 | 126 | /* |
| 127 | 127 | |
| r20626 | r20627 | |
| 131 | 131 | |
| 132 | 132 | int offs; |
| 133 | 133 | |
| 134 | | for (offs = 0x16/2;offs < state->m_spriteram.bytes()/2;offs += 4) |
| 134 | for (offs = 0x16/2;offs < m_spriteram.bytes()/2;offs += 4) |
| 135 | 135 | { |
| 136 | 136 | int code = spriteram16[offs+3] & 0xfff; |
| 137 | 137 | int color = (spriteram16[offs+2] & 0xf000) >> 12; |
| r20626 | r20627 | |
| 144 | 144 | return; |
| 145 | 145 | |
| 146 | 146 | /* it can change sprites color mask like the original set */ |
| 147 | | if(state->m_vregs[0x00/2] & 0x1000) |
| 147 | if(m_vregs[0x00/2] & 0x1000) |
| 148 | 148 | color &= 7; |
| 149 | 149 | |
| 150 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[2], |
| 150 | drawgfx_transpen(bitmap,cliprect,machine().gfx[2], |
| 151 | 151 | code, |
| 152 | 152 | color, |
| 153 | 153 | flipx, 0, |
| 154 | 154 | flipx ? (sx+16) : (sx),sy,15); |
| 155 | 155 | |
| 156 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[2], |
| 156 | drawgfx_transpen(bitmap,cliprect,machine().gfx[2], |
| 157 | 157 | code+1, |
| 158 | 158 | color, |
| 159 | 159 | flipx, 0, |
| 160 | 160 | flipx ? (sx) : (sx+16),sy,15); |
| 161 | 161 | |
| 162 | 162 | /* wraparound x */ |
| 163 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[2], |
| 163 | drawgfx_transpen(bitmap,cliprect,machine().gfx[2], |
| 164 | 164 | code, |
| 165 | 165 | color, |
| 166 | 166 | flipx, 0, |
| 167 | 167 | flipx ? (sx+16 - 512) : (sx - 512),sy,15); |
| 168 | 168 | |
| 169 | | drawgfx_transpen(bitmap,cliprect,machine.gfx[2], |
| 169 | drawgfx_transpen(bitmap,cliprect,machine().gfx[2], |
| 170 | 170 | code+1, |
| 171 | 171 | color, |
| 172 | 172 | flipx, 0, |
| r20626 | r20627 | |
| 185 | 185 | |
| 186 | 186 | m_bg_tilemap->draw(bitmap, cliprect, 0,0); |
| 187 | 187 | m_fg_tilemap->draw(bitmap, cliprect, 0,0); |
| 188 | | draw_sprites(machine(),bitmap,cliprect); |
| 188 | draw_sprites(bitmap,cliprect); |
| 189 | 189 | m_tx_tilemap->draw(bitmap, cliprect, 0,0); |
| 190 | 190 | return 0; |
| 191 | 191 | } |
| r20626 | r20627 | |
| 201 | 201 | |
| 202 | 202 | m_bg_tilemap->draw(bitmap, cliprect, 0,0); |
| 203 | 203 | m_fg_tilemap->draw(bitmap, cliprect, 0,0); |
| 204 | | draw_sprites(machine(),bitmap,cliprect); |
| 204 | draw_sprites(bitmap,cliprect); |
| 205 | 205 | m_tx_tilemap->draw(bitmap, cliprect, 0,0); |
| 206 | 206 | return 0; |
| 207 | 207 | } |
trunk/src/mame/drivers/atvtrack.c
| r20626 | r20627 | |
| 60 | 60 | #include "cpu/sh4/sh4.h" |
| 61 | 61 | #include "debugger.h" |
| 62 | 62 | |
| 63 | | memory_region *nandregion; |
| 64 | | int nandcommand[4], nandoffset[4], nandaddressstep, nandaddress[4]; |
| 65 | | UINT32 area1_data[4]; |
| 66 | 63 | |
| 67 | 64 | //#define SPECIALMODE 1 // Alternate code path |
| 68 | 65 | |
| r20626 | r20627 | |
| 86 | 83 | virtual void machine_reset(); |
| 87 | 84 | virtual void video_start(); |
| 88 | 85 | UINT32 screen_update_atvtrack(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 86 | inline UINT32 decode64_32(offs_t offset64, UINT64 data, UINT64 mem_mask, offs_t &offset32); |
| 87 | void logbinary(UINT32 data,int high,int low); |
| 88 | |
| 89 | memory_region *m_nandregion; |
| 90 | int m_nandcommand[4], m_nandoffset[4], m_nandaddressstep, m_nandaddress[4]; |
| 91 | UINT32 m_area1_data[4]; |
| 92 | |
| 89 | 93 | }; |
| 90 | 94 | |
| 91 | | static void logbinary(UINT32 data,int high=31,int low=0) |
| 95 | void atvtrack_state::logbinary(UINT32 data,int high=31,int low=0) |
| 92 | 96 | { |
| 93 | 97 | UINT32 s; |
| 94 | 98 | int z; |
| r20626 | r20627 | |
| 103 | 107 | } |
| 104 | 108 | } |
| 105 | 109 | |
| 106 | | static inline UINT32 decode64_32(offs_t offset64, UINT64 data, UINT64 mem_mask, offs_t &offset32) |
| 110 | inline UINT32 atvtrack_state::decode64_32(offs_t offset64, UINT64 data, UINT64 mem_mask, offs_t &offset32) |
| 107 | 111 | { |
| 108 | 112 | if (ACCESSING_BITS_0_31) { |
| 109 | 113 | offset32 = offset64 << 1; |
| r20626 | r20627 | |
| 137 | 141 | |
| 138 | 142 | addr = 0; |
| 139 | 143 | dat = decode64_32(offset, data, mem_mask, addr); |
| 140 | | // old = area1_data[addr]; |
| 141 | | area1_data[addr] = dat; |
| 144 | // old = m_area1_data[addr]; |
| 145 | m_area1_data[addr] = dat; |
| 142 | 146 | if (addr == (0x00020000-0x00020000)/4) { |
| 143 | 147 | if (data & 4) { |
| 144 | 148 | device_execute_interface *exec = dynamic_cast<device_execute_interface *>(machine().device("subcpu")); |
| r20626 | r20627 | |
| 160 | 164 | if (addr == 0) { |
| 161 | 165 | dat = 0; |
| 162 | 166 | for (c = 3;c >= 0;c--) { |
| 163 | | if (nandcommand[c] <= 0x50) { |
| 164 | | addr = nandaddress[c]+nandoffset[c]; |
| 165 | | dat = (dat << 8) | nandregion->u8(addr+c); |
| 166 | | nandoffset[c] += 4; |
| 167 | if (m_nandcommand[c] <= 0x50) { |
| 168 | addr = m_nandaddress[c]+m_nandoffset[c]; |
| 169 | dat = (dat << 8) | m_nandregion->u8(addr+c); |
| 170 | m_nandoffset[c] += 4; |
| 167 | 171 | } else |
| 168 | 172 | dat = (dat << 8) | 0xc0; |
| 169 | 173 | } |
| r20626 | r20627 | |
| 207 | 211 | // dat = decode64_32(offset, data, mem_mask, addr); |
| 208 | 212 | if (addr == 0) { |
| 209 | 213 | for (c = 0;c < 4;c++) { |
| 210 | | nandcommand[c] = data & 0xff; |
| 211 | | if (nandcommand[c] == 0x00) { |
| 212 | | nandoffset[c] = 0; |
| 213 | | } else if (nandcommand[c] == 0x01) { |
| 214 | | nandoffset[c] = 256*4; |
| 215 | | } else if (nandcommand[c] == 0x50) { |
| 216 | | nandoffset[c] = 512*4; |
| 217 | | } else if (nandcommand[c] == 0x90) { |
| 218 | | } else if (nandcommand[c] == 0xff) { |
| 219 | | } else if (nandcommand[c] == 0x80) { |
| 220 | | } else if (nandcommand[c] == 0x60) { |
| 221 | | } else if (nandcommand[c] == 0x70) { |
| 222 | | } else if (nandcommand[c] == 0x10) { |
| 223 | | } else if (nandcommand[c] == 0xd0) { |
| 214 | m_nandcommand[c] = data & 0xff; |
| 215 | if (m_nandcommand[c] == 0x00) { |
| 216 | m_nandoffset[c] = 0; |
| 217 | } else if (m_nandcommand[c] == 0x01) { |
| 218 | m_nandoffset[c] = 256*4; |
| 219 | } else if (m_nandcommand[c] == 0x50) { |
| 220 | m_nandoffset[c] = 512*4; |
| 221 | } else if (m_nandcommand[c] == 0x90) { |
| 222 | } else if (m_nandcommand[c] == 0xff) { |
| 223 | } else if (m_nandcommand[c] == 0x80) { |
| 224 | } else if (m_nandcommand[c] == 0x60) { |
| 225 | } else if (m_nandcommand[c] == 0x70) { |
| 226 | } else if (m_nandcommand[c] == 0x10) { |
| 227 | } else if (m_nandcommand[c] == 0xd0) { |
| 224 | 228 | } else { |
| 225 | | nandcommand[c] = 0xff; |
| 229 | m_nandcommand[c] = 0xff; |
| 226 | 230 | } |
| 227 | 231 | data=data >> 8; |
| 228 | 232 | } |
| 229 | | nandaddressstep = 0; |
| 233 | m_nandaddressstep = 0; |
| 230 | 234 | } else |
| 231 | 235 | ; |
| 232 | 236 | } |
| r20626 | r20627 | |
| 253 | 257 | // dat = decode64_32(offset, data, mem_mask, addr); |
| 254 | 258 | if (addr == 0) { |
| 255 | 259 | for (c = 0;c < 4;c++) { |
| 256 | | if (nandaddressstep == 0) { |
| 257 | | nandaddress[c] = (data & 0xff)*4; |
| 258 | | } else if (nandaddressstep == 1) { |
| 259 | | nandaddress[c] = nandaddress[c]+(data & 0xff)*0x840; |
| 260 | | } else if (nandaddressstep == 2) { |
| 261 | | nandaddress[c] = nandaddress[c]+(data & 0xff)*0x84000; |
| 260 | if (m_nandaddressstep == 0) { |
| 261 | m_nandaddress[c] = (data & 0xff)*4; |
| 262 | } else if (m_nandaddressstep == 1) { |
| 263 | m_nandaddress[c] = m_nandaddress[c]+(data & 0xff)*0x840; |
| 264 | } else if (m_nandaddressstep == 2) { |
| 265 | m_nandaddress[c] = m_nandaddress[c]+(data & 0xff)*0x84000; |
| 262 | 266 | } |
| 263 | 267 | data = data >> 8; |
| 264 | 268 | } |
| 265 | | nandaddressstep++; |
| 269 | m_nandaddressstep++; |
| 266 | 270 | } else |
| 267 | 271 | ; |
| 268 | 272 | } |
| r20626 | r20627 | |
| 328 | 332 | { |
| 329 | 333 | UINT8 *src, *dst; |
| 330 | 334 | |
| 331 | | nandaddressstep = 0; |
| 332 | | nandregion = machine().root_device().memregion("maincpu"); |
| 335 | m_nandaddressstep = 0; |
| 336 | m_nandregion = machine().root_device().memregion("maincpu"); |
| 333 | 337 | address_space &as = machine().device("maincpu")->memory().space(AS_PROGRAM); |
| 334 | 338 | dst = (UINT8 *)(as.get_write_ptr(0x0c7f0000)); |
| 335 | | src = nandregion->base()+0x10; |
| 339 | src = m_nandregion->base()+0x10; |
| 336 | 340 | // copy 0x10000 bytes from region "maincpu" offset 0x10 to 0x0c7f0000 |
| 337 | 341 | memcpy(dst, src, 0x10000); |
| 338 | 342 | } |
trunk/src/mame/drivers/bfcobra.c
| r20626 | r20627 | |
| 302 | 302 | UINT32 screen_update_bfcobra(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 303 | 303 | INTERRUPT_GEN_MEMBER(timer_irq); |
| 304 | 304 | INTERRUPT_GEN_MEMBER(vblank_gen); |
| 305 | void RunBlit(address_space &space); |
| 306 | void update_irqs(); |
| 307 | void reset_fdc(); |
| 308 | void exec_w_phase(UINT8 data); |
| 309 | void init_ram(); |
| 310 | void command_phase(struct fdc_t &fdc, UINT8 data); |
| 305 | 311 | }; |
| 306 | 312 | |
| 307 | 313 | |
| r20626 | r20627 | |
| 459 | 465 | The Flare One blitter is a simpler design with slightly different parameters |
| 460 | 466 | and will require hardware tests to figure everything out correctly. |
| 461 | 467 | */ |
| 462 | | static void RunBlit(address_space &space) |
| 468 | void bfcobra_state::RunBlit(address_space &space) |
| 463 | 469 | { |
| 464 | 470 | #define BLITPRG_READ(x) blitter.x = *(blitter_get_addr(space.machine(), blitter.program.addr++)) |
| 465 | 471 | |
| 466 | | bfcobra_state *state = space.machine().driver_data<bfcobra_state>(); |
| 467 | | struct blitter_t &blitter = state->m_blitter; |
| 472 | struct blitter_t &blitter = m_blitter; |
| 468 | 473 | int cycles_used = 0; |
| 469 | 474 | |
| 470 | 475 | |
| r20626 | r20627 | |
| 873 | 878 | |
| 874 | 879 | ***************************************************************************/ |
| 875 | 880 | |
| 876 | | static void update_irqs(running_machine &machine) |
| 881 | void bfcobra_state::update_irqs() |
| 877 | 882 | { |
| 878 | | bfcobra_state *state = machine.driver_data<bfcobra_state>(); |
| 879 | | int newstate = state->m_blitter_irq || state->m_vblank_irq || state->m_acia_irq; |
| 883 | int newstate = m_blitter_irq || m_vblank_irq || m_acia_irq; |
| 880 | 884 | |
| 881 | | if (newstate != state->m_irq_state) |
| 885 | if (newstate != m_irq_state) |
| 882 | 886 | { |
| 883 | | state->m_irq_state = newstate; |
| 884 | | machine.device("maincpu")->execute().set_input_line(0, state->m_irq_state ? ASSERT_LINE : CLEAR_LINE); |
| 887 | m_irq_state = newstate; |
| 888 | machine().device("maincpu")->execute().set_input_line(0, m_irq_state ? ASSERT_LINE : CLEAR_LINE); |
| 885 | 889 | } |
| 886 | 890 | } |
| 887 | 891 | |
| r20626 | r20627 | |
| 910 | 914 | val = 0x1; |
| 911 | 915 | |
| 912 | 916 | /* TODO */ |
| 913 | | update_irqs(machine()); |
| 917 | update_irqs(); |
| 914 | 918 | break; |
| 915 | 919 | } |
| 916 | 920 | case 0x1C: |
| r20626 | r20627 | |
| 1067 | 1071 | |
| 1068 | 1072 | ***************************************************************************/ |
| 1069 | 1073 | |
| 1070 | | static void command_phase(struct fdc_t &fdc, UINT8 data); |
| 1071 | | static void exec_w_phase(UINT8 data); |
| 1072 | | //UINT8 exec_r_phase(void); |
| 1073 | 1074 | |
| 1074 | 1075 | /* |
| 1075 | 1076 | WD37C656C-PL (or equivalent) Floppy Disk Controller |
| r20626 | r20627 | |
| 1102 | 1103 | SCAN_HIGH_OR_EQUAL = 29 |
| 1103 | 1104 | }; |
| 1104 | 1105 | |
| 1105 | | static void reset_fdc(running_machine &machine) |
| 1106 | void bfcobra_state::reset_fdc() |
| 1106 | 1107 | { |
| 1107 | | bfcobra_state *state = machine.driver_data<bfcobra_state>(); |
| 1108 | | memset(&state->m_fdc, 0, sizeof(state->m_fdc)); |
| 1108 | memset(&m_fdc, 0, sizeof(m_fdc)); |
| 1109 | 1109 | |
| 1110 | | state->m_fdc.MSR = 0x80; |
| 1111 | | state->m_fdc.phase = COMMAND; |
| 1110 | m_fdc.MSR = 0x80; |
| 1111 | m_fdc.phase = COMMAND; |
| 1112 | 1112 | } |
| 1113 | 1113 | |
| 1114 | 1114 | READ8_MEMBER(bfcobra_state::fdctrl_r) |
| r20626 | r20627 | |
| 1215 | 1215 | } |
| 1216 | 1216 | } |
| 1217 | 1217 | |
| 1218 | | static void command_phase(struct fdc_t &fdc, UINT8 data) |
| 1218 | void bfcobra_state::command_phase(struct fdc_t &fdc, UINT8 data) |
| 1219 | 1219 | { |
| 1220 | 1220 | if (fdc.cmd_cnt == 0) |
| 1221 | 1221 | { |
| r20626 | r20627 | |
| 1303 | 1303 | } |
| 1304 | 1304 | #endif |
| 1305 | 1305 | |
| 1306 | | static void exec_w_phase(UINT8 data) |
| 1306 | void bfcobra_state::exec_w_phase(UINT8 data) |
| 1307 | 1307 | { |
| 1308 | 1308 | } |
| 1309 | 1309 | |
| r20626 | r20627 | |
| 1333 | 1333 | |
| 1334 | 1334 | m_bank_data[0] = 1; |
| 1335 | 1335 | memset(&m_ramdac, 0, sizeof(m_ramdac)); |
| 1336 | | reset_fdc(machine()); |
| 1336 | reset_fdc(); |
| 1337 | 1337 | |
| 1338 | 1338 | m_irq_state = m_blitter_irq = m_vblank_irq = m_acia_irq = 0; |
| 1339 | 1339 | } |
| r20626 | r20627 | |
| 1604 | 1604 | /* |
| 1605 | 1605 | Allocate work RAM and video RAM shared by the Z80 and chipset. |
| 1606 | 1606 | */ |
| 1607 | | static void init_ram(running_machine &machine) |
| 1607 | void bfcobra_state::init_ram() |
| 1608 | 1608 | { |
| 1609 | | bfcobra_state *state = machine.driver_data<bfcobra_state>(); |
| 1610 | 1609 | /* 768kB work RAM */ |
| 1611 | | state->m_work_ram = auto_alloc_array_clear(machine, UINT8, 0xC0000); |
| 1610 | m_work_ram = auto_alloc_array_clear(machine(), UINT8, 0xC0000); |
| 1612 | 1611 | |
| 1613 | 1612 | /* 128kB video RAM */ |
| 1614 | | state->m_video_ram = auto_alloc_array_clear(machine, UINT8, 0x20000); |
| 1613 | m_video_ram = auto_alloc_array_clear(machine(), UINT8, 0x20000); |
| 1615 | 1614 | } |
| 1616 | 1615 | |
| 1617 | 1616 | /* |
| r20626 | r20627 | |
| 1631 | 1630 | WRITE_LINE_MEMBER(bfcobra_state::z80_acia_irq) |
| 1632 | 1631 | { |
| 1633 | 1632 | m_acia_irq = state; |
| 1634 | | update_irqs(machine()); |
| 1633 | update_irqs(); |
| 1635 | 1634 | } |
| 1636 | 1635 | |
| 1637 | 1636 | static ACIA6850_INTERFACE( z80_acia_if ) |
| r20626 | r20627 | |
| 1733 | 1732 | |
| 1734 | 1733 | auto_free(machine(), tmp); |
| 1735 | 1734 | |
| 1736 | | init_ram(machine()); |
| 1735 | init_ram(); |
| 1737 | 1736 | |
| 1738 | 1737 | m_bank_data[0] = 1; |
| 1739 | 1738 | m_bank_data[1] = 0; |
| r20626 | r20627 | |
| 1772 | 1771 | INTERRUPT_GEN_MEMBER(bfcobra_state::vblank_gen) |
| 1773 | 1772 | { |
| 1774 | 1773 | m_vblank_irq = 1; |
| 1775 | | update_irqs(machine()); |
| 1774 | update_irqs(); |
| 1776 | 1775 | } |
| 1777 | 1776 | |
| 1778 | 1777 | static MACHINE_CONFIG_START( bfcobra, bfcobra_state ) |
trunk/src/mame/drivers/bfm_sc1.c
| r20626 | r20627 | |
| 180 | 180 | DECLARE_DRIVER_INIT(nocrypt); |
| 181 | 181 | virtual void machine_reset(); |
| 182 | 182 | INTERRUPT_GEN_MEMBER(timer_irq); |
| 183 | void sc1_common_init(int reels, int decrypt, int defaultbank); |
| 183 | 184 | }; |
| 184 | 185 | |
| 185 | 186 | #define VFD_RESET 0x20 |
| r20626 | r20627 | |
| 1152 | 1153 | MACHINE_CONFIG_END |
| 1153 | 1154 | |
| 1154 | 1155 | |
| 1155 | | static void sc1_common_init(running_machine &machine, int reels, int decrypt, int defaultbank) |
| 1156 | void bfm_sc1_state::sc1_common_init(int reels, int decrypt, int defaultbank) |
| 1156 | 1157 | { |
| 1157 | | bfm_sc1_state *state = machine.driver_data<bfm_sc1_state>(); |
| 1158 | 1158 | UINT8 i; |
| 1159 | 1159 | |
| 1160 | | memset(state->m_sc1_Inputs, 0, sizeof(state->m_sc1_Inputs)); |
| 1160 | memset(m_sc1_Inputs, 0, sizeof(m_sc1_Inputs)); |
| 1161 | 1161 | |
| 1162 | 1162 | // setup n default 96 half step reels /////////////////////////////////////////// |
| 1163 | 1163 | for ( i = 0; i < reels; i++ ) |
| 1164 | 1164 | { |
| 1165 | | stepper_config(machine, i, &starpoint_interface_48step); |
| 1165 | stepper_config(machine(), i, &starpoint_interface_48step); |
| 1166 | 1166 | } |
| 1167 | | if (decrypt) bfm_decode_mainrom(machine,"maincpu", state->m_codec_data); // decode main rom |
| 1167 | if (decrypt) bfm_decode_mainrom(machine(),"maincpu", m_codec_data); // decode main rom |
| 1168 | 1168 | |
| 1169 | | state->m_defaultbank = defaultbank; |
| 1169 | m_defaultbank = defaultbank; |
| 1170 | 1170 | |
| 1171 | 1171 | } |
| 1172 | 1172 | |
| r20626 | r20627 | |
| 1249 | 1249 | |
| 1250 | 1250 | DRIVER_INIT_MEMBER(bfm_sc1_state,toppoker) |
| 1251 | 1251 | { |
| 1252 | | sc1_common_init(machine(),3,1, 3); |
| 1252 | sc1_common_init(3,1, 3); |
| 1253 | 1253 | adder2_decode_char_roms(machine()); // decode GFX roms |
| 1254 | 1254 | MechMtr_config(machine(),8); |
| 1255 | 1255 | sc1_find_project_string(machine()); |
| r20626 | r20627 | |
| 1257 | 1257 | |
| 1258 | 1258 | DRIVER_INIT_MEMBER(bfm_sc1_state,lotse) |
| 1259 | 1259 | { |
| 1260 | | sc1_common_init(machine(),6,1, 3); |
| 1260 | sc1_common_init(6,1, 3); |
| 1261 | 1261 | MechMtr_config(machine(),8); |
| 1262 | 1262 | sc1_find_project_string(machine()); |
| 1263 | 1263 | } |
| 1264 | 1264 | |
| 1265 | 1265 | DRIVER_INIT_MEMBER(bfm_sc1_state,lotse_bank0) |
| 1266 | 1266 | { |
| 1267 | | sc1_common_init(machine(),6,1, 0); |
| 1267 | sc1_common_init(6,1, 0); |
| 1268 | 1268 | MechMtr_config(machine(),8); |
| 1269 | 1269 | sc1_find_project_string(machine()); |
| 1270 | 1270 | } |
| r20626 | r20627 | |
| 1272 | 1272 | |
| 1273 | 1273 | DRIVER_INIT_MEMBER(bfm_sc1_state,nocrypt) |
| 1274 | 1274 | { |
| 1275 | | sc1_common_init(machine(),6,0, 3); |
| 1275 | sc1_common_init(6,0, 3); |
| 1276 | 1276 | MechMtr_config(machine(),8); |
| 1277 | 1277 | sc1_find_project_string(machine()); |
| 1278 | 1278 | } |
| 1279 | 1279 | |
| 1280 | 1280 | DRIVER_INIT_MEMBER(bfm_sc1_state,nocrypt_bank0) |
| 1281 | 1281 | { |
| 1282 | | sc1_common_init(machine(),6,0, 0); |
| 1282 | sc1_common_init(6,0, 0); |
| 1283 | 1283 | MechMtr_config(machine(),8); |
| 1284 | 1284 | sc1_find_project_string(machine()); |
| 1285 | 1285 | } |
| r20626 | r20627 | |
| 1289 | 1289 | |
| 1290 | 1290 | DRIVER_INIT_MEMBER(bfm_sc1_state,rou029) |
| 1291 | 1291 | { |
| 1292 | | sc1_common_init(machine(),6,0, 3); |
| 1292 | sc1_common_init(6,0, 3); |
| 1293 | 1293 | MechMtr_config(machine(),8); |
| 1294 | 1294 | sc1_find_project_string(machine()); |
| 1295 | 1295 | } |
| r20626 | r20627 | |
| 1298 | 1298 | |
| 1299 | 1299 | DRIVER_INIT_MEMBER(bfm_sc1_state,clatt) |
| 1300 | 1300 | { |
| 1301 | | sc1_common_init(machine(),6,1, 3); |
| 1301 | sc1_common_init(6,1, 3); |
| 1302 | 1302 | MechMtr_config(machine(),8); |
| 1303 | 1303 | |
| 1304 | 1304 | Scorpion1_SetSwitchState(this,3,2,1); |