trunk/src/emu/sound/tms5110.c
| r242475 | r242476 | |
| 79 | 79 | |
| 80 | 80 | /* States for CTL */ |
| 81 | 81 | |
| 82 | | #define CTL_STATE_INPUT (0) |
| 83 | | #define CTL_STATE_OUTPUT (1) |
| 84 | | #define CTL_STATE_NEXT_OUTPUT (2) |
| 82 | // ctl bus is input to tms51xx |
| 83 | #define CTL_STATE_INPUT (0) |
| 84 | // ctl bus is outputting a test talk command on CTL1(bit 0) |
| 85 | #define CTL_STATE_TTALK_OUTPUT (1) |
| 86 | // ctl bus is switching direction, next will be above |
| 87 | #define CTL_STATE_NEXT_TTALK_OUTPUT (2) |
| 88 | // ctl bus is outputting a read nybble 'output' command on CTL1,2,4,8 (bits 0-3) |
| 89 | #define CTL_STATE_OUTPUT (3) |
| 90 | // ctl bus is switching direction, next will be above |
| 91 | #define CTL_STATE_NEXT_OUTPUT (4) |
| 85 | 92 | |
| 93 | |
| 94 | |
| 86 | 95 | /* Pull in the ROM tables */ |
| 87 | 96 | #include "tms5110r.inc" |
| 88 | 97 | |
| r242475 | r242476 | |
| 125 | 134 | |
| 126 | 135 | void tms5110_device::new_int_write_addr(UINT8 addr) |
| 127 | 136 | { |
| 128 | | new_int_write(1, 0, 1, addr); |
| 129 | | new_int_write(0, 0, 1, addr); |
| 130 | | new_int_write(1, 0, 0, addr); |
| 131 | | new_int_write(0, 0, 0, addr); |
| 137 | new_int_write(1, 0, 1, addr); // romclk 1, m0 0, m1 1, addr bus nybble = xxxx |
| 138 | new_int_write(0, 0, 1, addr); // romclk 0, m0 0, m1 1, addr bus nybble = xxxx |
| 139 | new_int_write(1, 0, 0, addr); // romclk 1, m0 0, m1 0, addr bus nybble = xxxx |
| 140 | new_int_write(0, 0, 0, addr); // romclk 0, m0 0, m1 0, addr bus nybble = xxxx |
| 132 | 141 | } |
| 133 | 142 | |
| 134 | 143 | UINT8 tms5110_device::new_int_read() |
| 135 | 144 | { |
| 136 | | new_int_write(1, 1, 0, 0); |
| 137 | | new_int_write(0, 1, 0, 0); |
| 138 | | new_int_write(1, 0, 0, 0); |
| 139 | | new_int_write(0, 0, 0, 0); |
| 145 | new_int_write(1, 1, 0, 0); // romclk 1, m0 1, m1 0, addr bus nybble = 0/open bus |
| 146 | new_int_write(0, 1, 0, 0); // romclk 0, m0 1, m1 0, addr bus nybble = 0/open bus |
| 147 | new_int_write(1, 0, 0, 0); // romclk 1, m0 0, m1 0, addr bus nybble = 0/open bus |
| 148 | new_int_write(0, 0, 0, 0); // romclk 0, m0 0, m1 0, addr bus nybble = 0/open bus |
| 140 | 149 | if (!m_data_cb.isnull()) |
| 141 | 150 | return m_data_cb(); |
| 142 | 151 | return 0; |
| r242475 | r242476 | |
| 179 | 188 | save_item(NAME(m_address)); |
| 180 | 189 | save_item(NAME(m_schedule_dummy_read)); |
| 181 | 190 | save_item(NAME(m_addr_bit)); |
| 191 | save_item(NAME(m_CTL_buffer)); |
| 182 | 192 | |
| 183 | 193 | save_item(NAME(m_x)); |
| 184 | 194 | |
| r242475 | r242476 | |
| 587 | 597 | case CTL_STATE_INPUT: |
| 588 | 598 | /* continue */ |
| 589 | 599 | break; |
| 600 | case CTL_STATE_NEXT_TTALK_OUTPUT: |
| 601 | m_state = CTL_STATE_TTALK_OUTPUT; |
| 602 | return; |
| 603 | case CTL_STATE_TTALK_OUTPUT: |
| 604 | m_state = CTL_STATE_INPUT; |
| 605 | return; |
| 590 | 606 | case CTL_STATE_NEXT_OUTPUT: |
| 591 | 607 | m_state = CTL_STATE_OUTPUT; |
| 592 | 608 | return; |
| r242475 | r242476 | |
| 607 | 623 | { |
| 608 | 624 | switch (m_CTL_pins & 0xe) /*CTL1 - don't care*/ |
| 609 | 625 | { |
| 610 | | case TMS5110_CMD_SPEAK: |
| 626 | case TMS5110_CMD_RESET: |
| 611 | 627 | perform_dummy_read(); |
| 612 | | m_speaking_now = 1; |
| 628 | reset(); |
| 629 | break; |
| 613 | 630 | |
| 614 | | //should FIFO be cleared now ????? |
| 631 | case TMS5110_CMD_LOAD_ADDRESS: |
| 632 | m_next_is_address = TRUE; |
| 615 | 633 | break; |
| 616 | 634 | |
| 617 | | case TMS5110_CMD_RESET: |
| 635 | case TMS5110_CMD_OUTPUT: |
| 636 | m_state = CTL_STATE_NEXT_OUTPUT; |
| 637 | break; |
| 638 | |
| 639 | case TMS5110_CMD_SPKSLOW: |
| 618 | 640 | perform_dummy_read(); |
| 619 | | reset(); |
| 641 | m_speaking_now = 1; |
| 642 | //should FIFO be cleared now ????? there is no fifo! the fifo is a lie! |
| 620 | 643 | break; |
| 621 | 644 | |
| 622 | 645 | case TMS5110_CMD_READ_BIT: |
| r242475 | r242476 | |
| 625 | 648 | else |
| 626 | 649 | { |
| 627 | 650 | request_bits(1); |
| 628 | | m_CTL_pins = (m_CTL_pins & 0x0E) | extract_bits(1); |
| 651 | //m_CTL_pins = (m_CTL_pins & 0x0E) | extract_bits(1); |
| 652 | m_CTL_buffer <<= 1; |
| 653 | m_CTL_buffer |= extract_bits(1); |
| 654 | m_CTL_buffer &= 0xF; |
| 629 | 655 | } |
| 630 | 656 | break; |
| 631 | 657 | |
| 632 | | case TMS5110_CMD_LOAD_ADDRESS: |
| 633 | | m_next_is_address = TRUE; |
| 658 | case TMS5110_CMD_SPEAK: |
| 659 | perform_dummy_read(); |
| 660 | m_speaking_now = 1; |
| 661 | //should FIFO be cleared now ????? there is no fifo! the fifo is a lie! |
| 634 | 662 | break; |
| 635 | 663 | |
| 636 | 664 | case TMS5110_CMD_READ_BRANCH: |
| r242475 | r242476 | |
| 644 | 672 | break; |
| 645 | 673 | |
| 646 | 674 | case TMS5110_CMD_TEST_TALK: |
| 647 | | m_state = CTL_STATE_NEXT_OUTPUT; |
| 675 | m_state = CTL_STATE_NEXT_TTALK_OUTPUT; |
| 648 | 676 | break; |
| 649 | 677 | |
| 650 | 678 | default: |
| r242475 | r242476 | |
| 917 | 945 | m_speaking_now = m_talk_status = 0; |
| 918 | 946 | m_CTL_pins = 0; |
| 919 | 947 | m_RNG = 0x1fff; |
| 948 | m_CTL_buffer = 0; |
| 920 | 949 | |
| 921 | 950 | /* initialize the energy/pitch/k states */ |
| 922 | 951 | m_old_energy = m_new_energy = m_current_energy = m_target_energy = 0; |
| r242475 | r242476 | |
| 935 | 964 | { |
| 936 | 965 | /* legacy interface */ |
| 937 | 966 | m_schedule_dummy_read = TRUE; |
| 938 | | |
| 939 | 967 | } |
| 940 | 968 | else |
| 941 | 969 | { |
| r242475 | r242476 | |
| 998 | 1026 | { |
| 999 | 1027 | /* bring up to date first */ |
| 1000 | 1028 | m_stream->update(); |
| 1001 | | if (m_state == CTL_STATE_OUTPUT) |
| 1029 | if (m_state == CTL_STATE_TTALK_OUTPUT) |
| 1002 | 1030 | { |
| 1003 | 1031 | //if (DEBUG_5110) logerror("Status read (status=%2d)\n", m_talk_status); |
| 1004 | 1032 | return (m_talk_status << 0); /*CTL1 = still talking ? */ |
| 1005 | 1033 | } |
| 1034 | else if (m_state == CTL_STATE_OUTPUT) |
| 1035 | { |
| 1036 | //if (DEBUG_5110) logerror("Status read (status=%2d)\n", m_talk_status); |
| 1037 | return (m_CTL_buffer); |
| 1038 | } |
| 1006 | 1039 | else |
| 1007 | 1040 | { |
| 1008 | 1041 | //if (DEBUG_5110) logerror("Status read (not in output mode)\n"); |
trunk/src/mame/drivers/segas16b.c
| r242475 | r242476 | |
| 912 | 912 | break; |
| 913 | 913 | |
| 914 | 914 | case 5: // 64k of tileram + 4k of textram |
| 915 | | mapper.map_as_ram(0x00000, 0x10000, 0xfe0000, "tileram", write16_delegate(FUNC(segas16b_state::tileram_w), this)); |
| 916 | | mapper.map_as_ram(0x10000, 0x01000, 0xfef000, "textram", write16_delegate(FUNC(segas16b_state::textram_w), this)); |
| 915 | mapper.map_as_ram(0x00000, 0x10000, 0xfe0000, "tileram", write16_delegate(FUNC(segas16b_state::sega_tileram_0_w), this)); |
| 916 | mapper.map_as_ram(0x10000, 0x01000, 0xfef000, "textram", write16_delegate(FUNC(segas16b_state::sega_textram_0_w), this)); |
| 917 | 917 | break; |
| 918 | 918 | |
| 919 | 919 | case 4: // 2k of spriteram |
| r242475 | r242476 | |
| 1003 | 1003 | WRITE16_MEMBER( segas16b_state::rom_5704_bank_w ) |
| 1004 | 1004 | { |
| 1005 | 1005 | if (ACCESSING_BITS_0_7) |
| 1006 | | m_segaic16vid->tilemap_set_bank(0, offset & 1, data & 7); |
| 1006 | m_segaic16vid->segaic16_tilemap_set_bank(0, offset & 1, data & 7); |
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | 1009 | |
| r242475 | r242476 | |
| 1051 | 1051 | |
| 1052 | 1052 | case 0x2000/2: |
| 1053 | 1053 | if (ACCESSING_BITS_0_7) |
| 1054 | | m_segaic16vid->tilemap_set_bank(0, offset & 1, data & 7); |
| 1054 | m_segaic16vid->segaic16_tilemap_set_bank(0, offset & 1, data & 7); |
| 1055 | 1055 | break; |
| 1056 | 1056 | } |
| 1057 | 1057 | } |
| r242475 | r242476 | |
| 1124 | 1124 | // D1 : (Output to coin counter 2?) |
| 1125 | 1125 | // D0 : Output to coin counter 1 |
| 1126 | 1126 | // |
| 1127 | | m_segaic16vid->tilemap_set_flip(0, data & 0x40); |
| 1127 | m_segaic16vid->segaic16_tilemap_set_flip(0, data & 0x40); |
| 1128 | 1128 | m_sprites->set_flip(data & 0x40); |
| 1129 | 1129 | if (!m_disable_screen_blanking) |
| 1130 | | m_segaic16vid->set_display_enable(data & 0x20); |
| 1130 | m_segaic16vid->segaic16_set_display_enable(data & 0x20); |
| 1131 | 1131 | set_led_status(machine(), 1, data & 0x08); |
| 1132 | 1132 | set_led_status(machine(), 0, data & 0x04); |
| 1133 | 1133 | coin_counter_w(machine(), 1, data & 0x02); |
| r242475 | r242476 | |
| 1288 | 1288 | synchronize(TID_INIT_I8751); |
| 1289 | 1289 | |
| 1290 | 1290 | // reset tilemap state |
| 1291 | | m_segaic16vid->tilemap_reset(*m_screen); |
| 1291 | m_segaic16vid->segaic16_tilemap_reset(*m_screen); |
| 1292 | 1292 | |
| 1293 | 1293 | // configure sprite banks |
| 1294 | 1294 | static const UINT8 default_banklist[] = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 }; |
| r242475 | r242476 | |
| 6625 | 6625 | m_custom_io_r = read16_delegate(FUNC(segas16b_state::standard_io_r), this); |
| 6626 | 6626 | m_custom_io_w = write16_delegate(FUNC(segas16b_state::standard_io_w), this); |
| 6627 | 6627 | |
| 6628 | // point globals to allocated memory regions |
| 6629 | m_segaic16vid->segaic16_tileram_0 = reinterpret_cast<UINT16 *>(memshare("tileram")->ptr()); |
| 6630 | m_segaic16vid->segaic16_textram_0 = reinterpret_cast<UINT16 *>(memshare("textram")->ptr()); |
| 6631 | |
| 6628 | 6632 | // save state |
| 6629 | 6633 | save_item(NAME(m_atomicp_sound_count)); |
| 6630 | 6634 | save_item(NAME(m_hwc_input_value)); |
| r242475 | r242476 | |
| 6650 | 6654 | // configure special behaviors for the Korean boards |
| 6651 | 6655 | m_disable_screen_blanking = true; |
| 6652 | 6656 | m_atomicp_sound_divisor = 1; |
| 6653 | | m_segaic16vid->m_display_enable = 1; |
| 6657 | m_segaic16vid->segaic16_display_enable = 1; |
| 6654 | 6658 | |
| 6655 | 6659 | // allocate a sound timer |
| 6656 | 6660 | emu_timer *timer = timer_alloc(TID_ATOMICP_SOUND_IRQ); |
| r242475 | r242476 | |
| 7217 | 7221 | AM_RANGE(0x000000, 0x0fffff) AM_ROMBANK(ISGSM_MAIN_BANK) AM_REGION("bios", 0) // this area is ALWAYS read-only, even when the game is banked in |
| 7218 | 7222 | AM_RANGE(0x200000, 0x23ffff) AM_RAM // used during startup for decompression |
| 7219 | 7223 | AM_RANGE(0x3f0000, 0x3fffff) AM_WRITE(rom_5704_bank_w) |
| 7220 | | AM_RANGE(0x400000, 0x40ffff) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, tileram_r, tileram_w) AM_SHARE("tileram") |
| 7221 | | AM_RANGE(0x410000, 0x410fff) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, textram_r, textram_w) AM_SHARE("textram") |
| 7224 | AM_RANGE(0x400000, 0x40ffff) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, segaic16_tileram_0_r, segaic16_tileram_0_w) AM_SHARE("textram") |
| 7225 | AM_RANGE(0x410000, 0x410fff) AM_DEVREADWRITE("segaic16vid", segaic16_video_device, segaic16_textram_0_r, segaic16_textram_0_w) AM_SHARE("tileram") |
| 7222 | 7226 | AM_RANGE(0x440000, 0x4407ff) AM_RAM AM_SHARE("sprites") |
| 7223 | 7227 | AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram") |
| 7224 | 7228 | AM_RANGE(0xc40000, 0xc43fff) AM_READWRITE(standard_io_r, standard_io_w) |
| r242475 | r242476 | |
| 7354 | 7358 | |
| 7355 | 7359 | void isgsm_state::machine_reset() |
| 7356 | 7360 | { |
| 7357 | | m_segaic16vid->tilemap_reset(*m_screen); |
| 7361 | m_segaic16vid->segaic16_tilemap_reset(*m_screen); |
| 7358 | 7362 | |
| 7359 | 7363 | // configure sprite banks |
| 7360 | 7364 | for (int i = 0; i < 16; i++) |
trunk/src/mame/video/segaic16.c
| r242475 | r242476 | |
| 336 | 336 | and clipping capabilities, and advanced hot-spot positioning. The |
| 337 | 337 | mixer chip adds totally dynamic priorities, alpha-blending of the |
| 338 | 338 | tilemaps, per-component color control, and some other funnies we |
| 339 | | have not been able to decipher. |
| 339 | have not been able to decypher. |
| 340 | 340 | |
| 341 | 341 | ST-V (also know as Titan or the Saturn console): |
| 342 | 342 | The ultimate 2D system. Even more advanced tilemaps, with 6-dof |
| 343 | 343 | roz support, alpha up to the wazoo and other niceties, known as |
| 344 | | the vdp2. The sprite engine, vdp1, allows for any 4-point |
| 345 | | stretching of the sprites, actually giving polygonal 3D |
| 344 | the vdp2. Ths sprite engine, vdp1, allows for any 4-point |
| 345 | streching of the sprites, actually giving polygonal 3D |
| 346 | 346 | capabilities. Interestingly, the mixer capabilities took a hit, |
| 347 | 347 | with no real per-sprite mixer priority, which could be considered |
| 348 | 348 | annoying for a 2D system. It still allowed some beauties like |
| r242475 | r242476 | |
| 374 | 374 | segaic16_video_device::segaic16_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) |
| 375 | 375 | : device_t(mconfig, SEGAIC16VID, "Sega 16-bit Video", tag, owner, clock, "segaic16_video", __FILE__), |
| 376 | 376 | device_video_interface(mconfig, *this), |
| 377 | | m_display_enable(0), |
| 378 | | m_tileram(*this, ":tileram"), |
| 379 | | m_textram(*this, ":textram"), |
| 380 | | m_rotateram(*this, ":rotateram"), |
| 381 | 377 | m_gfxdecode(*this) |
| 382 | 378 | { |
| 383 | | memset(m_rotate, 0, sizeof(m_rotate)); |
| 384 | | memset(m_bg_tilemap, 0, sizeof(m_bg_tilemap)); |
| 385 | 379 | } |
| 386 | 380 | |
| 387 | 381 | //------------------------------------------------- |
| r242475 | r242476 | |
| 395 | 389 | } |
| 396 | 390 | |
| 397 | 391 | |
| 392 | void segaic16_video_device::device_config_complete() |
| 393 | { |
| 394 | } |
| 395 | |
| 398 | 396 | void segaic16_video_device::device_start() |
| 399 | 397 | { |
| 400 | | save_item(NAME(m_display_enable)); |
| 401 | 398 | } |
| 402 | 399 | |
| 403 | 400 | void segaic16_video_device::device_reset() |
| r242475 | r242476 | |
| 405 | 402 | } |
| 406 | 403 | |
| 407 | 404 | |
| 405 | |
| 406 | |
| 407 | |
| 408 | |
| 409 | |
| 410 | |
| 411 | |
| 412 | |
| 408 | 413 | /************************************* |
| 409 | 414 | * |
| 410 | 415 | * Misc functions |
| 411 | 416 | * |
| 412 | 417 | *************************************/ |
| 413 | 418 | |
| 414 | | void segaic16_video_device::set_display_enable(int enable) |
| 419 | void segaic16_video_device::segaic16_set_display_enable(int enable) |
| 415 | 420 | { |
| 416 | 421 | enable = (enable != 0); |
| 417 | | if (m_display_enable != enable) |
| 422 | if (segaic16_display_enable != enable) |
| 418 | 423 | { |
| 419 | 424 | m_screen->update_partial(m_screen->vpos()); |
| 420 | | m_display_enable = enable; |
| 425 | segaic16_display_enable = enable; |
| 421 | 426 | } |
| 422 | 427 | } |
| 423 | 428 | |
| r242475 | r242476 | |
| 430 | 435 | * |
| 431 | 436 | *************************************/ |
| 432 | 437 | |
| 433 | | void draw_virtual_tilemap(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 pages, UINT16 xscroll, UINT16 yscroll, UINT32 flags, UINT32 priority) |
| 438 | void segaic16_draw_virtual_tilemap(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 pages, UINT16 xscroll, UINT16 yscroll, UINT32 flags, UINT32 priority) |
| 434 | 439 | { |
| 435 | 440 | int leftmin = -1, leftmax = -1, rightmin = -1, rightmax = -1; |
| 436 | 441 | int topmin = -1, topmax = -1, bottommin = -1, bottommax = -1; |
| r242475 | r242476 | |
| 632 | 637 | * |
| 633 | 638 | *******************************************************************************************/ |
| 634 | 639 | |
| 635 | | TILE_GET_INFO_MEMBER( segaic16_video_device::tilemap_16a_tile_info ) |
| 640 | TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16a_tile_info ) |
| 636 | 641 | { |
| 637 | 642 | const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data(); |
| 638 | 643 | UINT16 data = info->rambase[tile_index]; |
| r242475 | r242476 | |
| 644 | 649 | } |
| 645 | 650 | |
| 646 | 651 | |
| 647 | | TILE_GET_INFO_MEMBER( segaic16_video_device::tilemap_16a_text_info ) |
| 652 | TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16a_text_info ) |
| 648 | 653 | { |
| 649 | 654 | const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data(); |
| 650 | 655 | UINT16 data = info->rambase[tile_index]; |
| r242475 | r242476 | |
| 656 | 661 | } |
| 657 | 662 | |
| 658 | 663 | |
| 659 | | void tilemap_16a_draw_layer(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flags, int priority) |
| 664 | void segaic16_tilemap_16a_draw_layer(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flags, int priority) |
| 660 | 665 | { |
| 661 | 666 | UINT16 *textram = info->textram; |
| 662 | 667 | |
| r242475 | r242476 | |
| 707 | 712 | /* draw the chunk */ |
| 708 | 713 | effxscroll = (0xc8 - effxscroll + info->xoffs) & 0x3ff; |
| 709 | 714 | effyscroll = effyscroll & 0x1ff; |
| 710 | | draw_virtual_tilemap(screen, info, bitmap, rowcolclip, pages, effxscroll, effyscroll, flags, priority); |
| 715 | segaic16_draw_virtual_tilemap(screen, info, bitmap, rowcolclip, pages, effxscroll, effyscroll, flags, priority); |
| 711 | 716 | } |
| 712 | 717 | } |
| 713 | 718 | } |
| r242475 | r242476 | |
| 736 | 741 | /* draw the chunk */ |
| 737 | 742 | effxscroll = (0xc8 - effxscroll + info->xoffs) & 0x3ff; |
| 738 | 743 | effyscroll = effyscroll & 0x1ff; |
| 739 | | draw_virtual_tilemap(screen, info, bitmap, colclip, pages, effxscroll, effyscroll, flags, priority); |
| 744 | segaic16_draw_virtual_tilemap(screen, info, bitmap, colclip, pages, effxscroll, effyscroll, flags, priority); |
| 740 | 745 | } |
| 741 | 746 | } |
| 742 | 747 | else if (info->rowscroll) |
| r242475 | r242476 | |
| 765 | 770 | /* draw the chunk */ |
| 766 | 771 | effxscroll = (0xc8 - effxscroll + info->xoffs) & 0x3ff; |
| 767 | 772 | effyscroll = effyscroll & 0x1ff; |
| 768 | | draw_virtual_tilemap(screen, info, bitmap, rowclip, pages, effxscroll, effyscroll, flags, priority); |
| 773 | segaic16_draw_virtual_tilemap(screen, info, bitmap, rowclip, pages, effxscroll, effyscroll, flags, priority); |
| 769 | 774 | } |
| 770 | 775 | } |
| 771 | 776 | else |
| r242475 | r242476 | |
| 775 | 780 | xscroll += 17; |
| 776 | 781 | xscroll = (0xc8 - xscroll + info->xoffs) & 0x3ff; |
| 777 | 782 | yscroll = yscroll & 0x1ff; |
| 778 | | draw_virtual_tilemap(screen, info, bitmap, cliprect, pages, xscroll, yscroll, flags, priority); |
| 783 | segaic16_draw_virtual_tilemap(screen, info, bitmap, cliprect, pages, xscroll, yscroll, flags, priority); |
| 779 | 784 | } |
| 780 | 785 | } |
| 781 | 786 | |
| r242475 | r242476 | |
| 844 | 849 | * |
| 845 | 850 | *******************************************************************************************/ |
| 846 | 851 | |
| 847 | | TILE_GET_INFO_MEMBER( segaic16_video_device::tilemap_16b_tile_info ) |
| 852 | TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_tile_info ) |
| 848 | 853 | { |
| 849 | 854 | const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data(); |
| 850 | 855 | UINT16 data = info->rambase[tile_index]; |
| r242475 | r242476 | |
| 858 | 863 | } |
| 859 | 864 | |
| 860 | 865 | |
| 861 | | TILE_GET_INFO_MEMBER( segaic16_video_device::tilemap_16b_text_info ) |
| 866 | TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_text_info ) |
| 862 | 867 | { |
| 863 | 868 | const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data(); |
| 864 | 869 | UINT16 data = info->rambase[tile_index]; |
| r242475 | r242476 | |
| 871 | 876 | } |
| 872 | 877 | |
| 873 | 878 | |
| 874 | | TILE_GET_INFO_MEMBER( segaic16_video_device::tilemap_16b_alt_tile_info ) |
| 879 | TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_alt_tile_info ) |
| 875 | 880 | { |
| 876 | 881 | const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data(); |
| 877 | 882 | UINT16 data = info->rambase[tile_index]; |
| r242475 | r242476 | |
| 885 | 890 | } |
| 886 | 891 | |
| 887 | 892 | |
| 888 | | TILE_GET_INFO_MEMBER( segaic16_video_device::tilemap_16b_alt_text_info ) |
| 893 | TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_alt_text_info ) |
| 889 | 894 | { |
| 890 | 895 | const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data(); |
| 891 | 896 | UINT16 data = info->rambase[tile_index]; |
| r242475 | r242476 | |
| 898 | 903 | } |
| 899 | 904 | |
| 900 | 905 | |
| 901 | | void tilemap_16b_draw_layer(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flags, int priority) |
| 906 | void segaic16_tilemap_16b_draw_layer(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flags, int priority) |
| 902 | 907 | { |
| 903 | 908 | UINT16 *textram = info->textram; |
| 904 | 909 | UINT16 xscroll, yscroll, pages; |
| r242475 | r242476 | |
| 950 | 955 | /* draw the chunk */ |
| 951 | 956 | effxscroll = (0xc0 - effxscroll + info->xoffs) & 0x3ff; |
| 952 | 957 | effyscroll = effyscroll & 0x1ff; |
| 953 | | draw_virtual_tilemap(screen, info, bitmap, rowcolclip, effpages, effxscroll, effyscroll, flags, priority); |
| 958 | segaic16_draw_virtual_tilemap(screen, info, bitmap, rowcolclip, effpages, effxscroll, effyscroll, flags, priority); |
| 954 | 959 | } |
| 955 | 960 | } |
| 956 | 961 | } |
| r242475 | r242476 | |
| 986 | 991 | /* draw the chunk */ |
| 987 | 992 | effxscroll = (0xc0 - effxscroll + info->xoffs) & 0x3ff; |
| 988 | 993 | effyscroll = effyscroll & 0x1ff; |
| 989 | | draw_virtual_tilemap(screen, info, bitmap, rowclip, effpages, effxscroll, effyscroll, flags, priority); |
| 994 | segaic16_draw_virtual_tilemap(screen, info, bitmap, rowclip, effpages, effxscroll, effyscroll, flags, priority); |
| 990 | 995 | } |
| 991 | 996 | } |
| 992 | 997 | } |
| 993 | 998 | |
| 994 | 999 | |
| 995 | | TIMER_CALLBACK_MEMBER( segaic16_video_device::tilemap_16b_latch_values ) |
| 1000 | TIMER_CALLBACK_MEMBER( segaic16_video_device::segaic16_tilemap_16b_latch_values ) |
| 996 | 1001 | { |
| 997 | | struct tilemap_info *info = &m_bg_tilemap[param]; |
| 1002 | struct tilemap_info *info = &bg_tilemap[param]; |
| 998 | 1003 | UINT16 *textram = info->textram; |
| 999 | 1004 | int i; |
| 1000 | 1005 | |
| r242475 | r242476 | |
| 1011 | 1016 | } |
| 1012 | 1017 | |
| 1013 | 1018 | |
| 1014 | | void tilemap_16b_reset(screen_device &screen, struct tilemap_info *info) |
| 1019 | void segaic16_tilemap_16b_reset(screen_device &screen, struct tilemap_info *info) |
| 1015 | 1020 | { |
| 1016 | 1021 | /* set a timer to latch values on scanline 261 */ |
| 1017 | 1022 | info->latch_timer->adjust(screen.time_until_pos(261), info->index); |
| r242475 | r242476 | |
| 1025 | 1030 | * |
| 1026 | 1031 | *************************************/ |
| 1027 | 1032 | |
| 1028 | | void segaic16_video_device::tilemap_init(int which, int type, int colorbase, int xoffs, int numbanks) |
| 1033 | void segaic16_video_device::segaic16_tilemap_init(running_machine &machine, int which, int type, int colorbase, int xoffs, int numbanks) |
| 1029 | 1034 | { |
| 1030 | | struct tilemap_info *info = &m_bg_tilemap[which]; |
| 1035 | struct tilemap_info *info = &bg_tilemap[which]; |
| 1031 | 1036 | tilemap_get_info_delegate get_text_info; |
| 1032 | 1037 | tilemap_get_info_delegate get_tile_info; |
| 1033 | 1038 | int pagenum; |
| r242475 | r242476 | |
| 1046 | 1051 | switch (which) |
| 1047 | 1052 | { |
| 1048 | 1053 | case 0: |
| 1049 | | info->textram = m_textram; |
| 1050 | | info->tileram = m_tileram; |
| 1054 | info->textram = segaic16_textram_0; |
| 1055 | info->tileram = segaic16_tileram_0; |
| 1051 | 1056 | break; |
| 1052 | 1057 | |
| 1053 | 1058 | default: |
| 1054 | | fatalerror("Invalid tilemap index specified in tilemap_init\n"); |
| 1059 | fatalerror("Invalid tilemap index specified in segaic16_tilemap_init\n"); |
| 1055 | 1060 | } |
| 1056 | 1061 | |
| 1057 | 1062 | /* determine the parameters of the tilemaps */ |
| 1058 | 1063 | switch (type) |
| 1059 | 1064 | { |
| 1060 | 1065 | case SEGAIC16_TILEMAP_HANGON: |
| 1061 | | get_text_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::tilemap_16a_text_info),this); |
| 1062 | | get_tile_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::tilemap_16a_tile_info),this); |
| 1066 | get_text_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::segaic16_tilemap_16a_text_info),this); |
| 1067 | get_tile_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::segaic16_tilemap_16a_tile_info),this); |
| 1063 | 1068 | info->numpages = 4; |
| 1064 | | info->draw_layer = tilemap_16a_draw_layer; |
| 1069 | info->draw_layer = segaic16_tilemap_16a_draw_layer; |
| 1065 | 1070 | info->reset = NULL; |
| 1066 | 1071 | info->latch_timer = NULL; |
| 1067 | 1072 | break; |
| 1068 | 1073 | |
| 1069 | 1074 | case SEGAIC16_TILEMAP_16A: |
| 1070 | | get_text_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::tilemap_16a_text_info),this); |
| 1071 | | get_tile_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::tilemap_16a_tile_info),this); |
| 1075 | get_text_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::segaic16_tilemap_16a_text_info),this); |
| 1076 | get_tile_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::segaic16_tilemap_16a_tile_info),this); |
| 1072 | 1077 | info->numpages = 8; |
| 1073 | | info->draw_layer = tilemap_16a_draw_layer; |
| 1078 | info->draw_layer = segaic16_tilemap_16a_draw_layer; |
| 1074 | 1079 | info->reset = NULL; |
| 1075 | 1080 | info->latch_timer = NULL; |
| 1076 | 1081 | break; |
| 1077 | 1082 | |
| 1078 | 1083 | case SEGAIC16_TILEMAP_16B: |
| 1079 | | get_text_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::tilemap_16b_text_info),this); |
| 1080 | | get_tile_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::tilemap_16b_tile_info),this); |
| 1084 | get_text_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::segaic16_tilemap_16b_text_info),this); |
| 1085 | get_tile_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::segaic16_tilemap_16b_tile_info),this); |
| 1081 | 1086 | info->numpages = 16; |
| 1082 | | info->draw_layer = tilemap_16b_draw_layer; |
| 1083 | | info->reset = tilemap_16b_reset; |
| 1084 | | info->latch_timer = machine().scheduler().timer_alloc( timer_expired_delegate(FUNC(segaic16_video_device::tilemap_16b_latch_values),this) ); |
| 1087 | info->draw_layer = segaic16_tilemap_16b_draw_layer; |
| 1088 | info->reset = segaic16_tilemap_16b_reset; |
| 1089 | info->latch_timer = machine.scheduler().timer_alloc( timer_expired_delegate(FUNC(segaic16_video_device::segaic16_tilemap_16b_latch_values),this) ); |
| 1085 | 1090 | break; |
| 1086 | 1091 | |
| 1087 | 1092 | case SEGAIC16_TILEMAP_16B_ALT: |
| 1088 | | get_text_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::tilemap_16b_alt_text_info),this); |
| 1089 | | get_tile_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::tilemap_16b_alt_tile_info),this); |
| 1093 | get_text_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::segaic16_tilemap_16b_alt_text_info),this); |
| 1094 | get_tile_info = tilemap_get_info_delegate(FUNC(segaic16_video_device::segaic16_tilemap_16b_alt_tile_info),this); |
| 1090 | 1095 | info->numpages = 16; |
| 1091 | | info->draw_layer = tilemap_16b_draw_layer; |
| 1092 | | info->reset = tilemap_16b_reset; |
| 1093 | | info->latch_timer = machine().scheduler().timer_alloc( timer_expired_delegate(FUNC(segaic16_video_device::tilemap_16b_latch_values),this) ); |
| 1096 | info->draw_layer = segaic16_tilemap_16b_draw_layer; |
| 1097 | info->reset = segaic16_tilemap_16b_reset; |
| 1098 | info->latch_timer = machine.scheduler().timer_alloc( timer_expired_delegate(FUNC(segaic16_video_device::segaic16_tilemap_16b_latch_values),this) ); |
| 1094 | 1099 | break; |
| 1095 | 1100 | |
| 1096 | 1101 | default: |
| 1097 | | fatalerror("Invalid tilemap type specified in tilemap_init\n"); |
| 1102 | fatalerror("Invalid tilemap type specified in segaic16_tilemap_init\n"); |
| 1098 | 1103 | } |
| 1099 | 1104 | |
| 1100 | 1105 | /* create the tilemap for the text layer */ |
| 1101 | | info->textmap = &machine().tilemap().create(m_gfxdecode, get_text_info, TILEMAP_SCAN_ROWS, 8,8, 64,28); |
| 1106 | info->textmap = &machine.tilemap().create(m_gfxdecode, get_text_info, TILEMAP_SCAN_ROWS, 8,8, 64,28); |
| 1102 | 1107 | |
| 1103 | 1108 | /* configure it */ |
| 1104 | 1109 | info->textmap_info.rambase = info->textram; |
| r242475 | r242476 | |
| 1114 | 1119 | for (pagenum = 0; pagenum < info->numpages; pagenum++) |
| 1115 | 1120 | { |
| 1116 | 1121 | /* each page is 64x32 */ |
| 1117 | | info->tilemaps[pagenum] = &machine().tilemap().create(m_gfxdecode, get_tile_info, TILEMAP_SCAN_ROWS, 8,8, 64,32); |
| 1122 | info->tilemaps[pagenum] = &machine.tilemap().create(m_gfxdecode, get_tile_info, TILEMAP_SCAN_ROWS, 8,8, 64,32); |
| 1118 | 1123 | |
| 1119 | 1124 | /* configure the tilemap */ |
| 1120 | 1125 | info->tmap_info[pagenum].rambase = info->tileram + pagenum * 64*32; |
| r242475 | r242476 | |
| 1126 | 1131 | info->tilemaps[pagenum]->set_scrolldx(0, 22); |
| 1127 | 1132 | info->tilemaps[pagenum]->set_scrolldy(0, 38); |
| 1128 | 1133 | } |
| 1129 | | |
| 1130 | | save_item(NAME(info->flip), which); |
| 1131 | | save_item(NAME(info->rowscroll), which); |
| 1132 | | save_item(NAME(info->colscroll), which); |
| 1133 | | save_item(NAME(info->bank), which); |
| 1134 | | save_item(NAME(info->latched_xscroll), which); |
| 1135 | | save_item(NAME(info->latched_yscroll), which); |
| 1136 | | save_item(NAME(info->latched_pageselect), which); |
| 1137 | 1134 | } |
| 1138 | 1135 | |
| 1139 | 1136 | |
| r242475 | r242476 | |
| 1144 | 1141 | * |
| 1145 | 1142 | *************************************/ |
| 1146 | 1143 | |
| 1147 | | void segaic16_video_device::tilemap_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int map, int priority, int priority_mark) |
| 1144 | void segaic16_video_device::segaic16_tilemap_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int map, int priority, int priority_mark) |
| 1148 | 1145 | { |
| 1149 | | struct tilemap_info *info = &m_bg_tilemap[which]; |
| 1146 | struct tilemap_info *info = &bg_tilemap[which]; |
| 1150 | 1147 | |
| 1151 | 1148 | /* text layer is a special common case */ |
| 1152 | 1149 | if (map == SEGAIC16_TILEMAP_TEXT) |
| r242475 | r242476 | |
| 1165 | 1162 | * |
| 1166 | 1163 | *************************************/ |
| 1167 | 1164 | |
| 1168 | | void segaic16_video_device::tilemap_reset(screen_device &screen) |
| 1165 | void segaic16_video_device::segaic16_tilemap_reset(screen_device &screen) |
| 1169 | 1166 | { |
| 1170 | | struct tilemap_info *info = &m_bg_tilemap[0]; |
| 1167 | struct tilemap_info *info = &bg_tilemap[0]; |
| 1171 | 1168 | |
| 1172 | 1169 | if (info->reset) |
| 1173 | 1170 | (*info->reset)(screen, info); |
| r242475 | r242476 | |
| 1181 | 1178 | * |
| 1182 | 1179 | *************************************/ |
| 1183 | 1180 | |
| 1184 | | void segaic16_video_device::tilemap_set_bank(int which, int banknum, int offset) |
| 1181 | void segaic16_video_device::segaic16_tilemap_set_bank(int which, int banknum, int offset) |
| 1185 | 1182 | { |
| 1186 | | struct tilemap_info *info = &m_bg_tilemap[which]; |
| 1183 | struct tilemap_info *info = &bg_tilemap[which]; |
| 1187 | 1184 | |
| 1188 | 1185 | if (info->bank[banknum] != offset) |
| 1189 | 1186 | { |
| r242475 | r242476 | |
| 1201 | 1198 | * |
| 1202 | 1199 | *************************************/ |
| 1203 | 1200 | |
| 1204 | | void segaic16_video_device::tilemap_set_flip(int which, int flip) |
| 1201 | void segaic16_video_device::segaic16_tilemap_set_flip(int which, int flip) |
| 1205 | 1202 | { |
| 1206 | | struct tilemap_info *info = &m_bg_tilemap[which]; |
| 1203 | struct tilemap_info *info = &bg_tilemap[which]; |
| 1207 | 1204 | int pagenum; |
| 1208 | 1205 | |
| 1209 | 1206 | flip = (flip != 0); |
| r242475 | r242476 | |
| 1225 | 1222 | * |
| 1226 | 1223 | *************************************/ |
| 1227 | 1224 | |
| 1228 | | void segaic16_video_device::tilemap_set_rowscroll(int which, int enable) |
| 1225 | void segaic16_video_device::segaic16_tilemap_set_rowscroll(int which, int enable) |
| 1229 | 1226 | { |
| 1230 | | struct tilemap_info *info = &m_bg_tilemap[which]; |
| 1227 | struct tilemap_info *info = &bg_tilemap[which]; |
| 1231 | 1228 | |
| 1232 | 1229 | enable = (enable != 0); |
| 1233 | 1230 | if (info->rowscroll != enable) |
| r242475 | r242476 | |
| 1245 | 1242 | * |
| 1246 | 1243 | *************************************/ |
| 1247 | 1244 | |
| 1248 | | void segaic16_video_device::tilemap_set_colscroll(int which, int enable) |
| 1245 | void segaic16_video_device::segaic16_tilemap_set_colscroll(int which, int enable) |
| 1249 | 1246 | { |
| 1250 | | struct tilemap_info *info = &m_bg_tilemap[which]; |
| 1247 | struct tilemap_info *info = &bg_tilemap[which]; |
| 1251 | 1248 | |
| 1252 | 1249 | enable = (enable != 0); |
| 1253 | 1250 | if (info->colscroll != enable) |
| r242475 | r242476 | |
| 1265 | 1262 | * |
| 1266 | 1263 | *************************************/ |
| 1267 | 1264 | |
| 1268 | | READ16_MEMBER( segaic16_video_device::tileram_r ) |
| 1265 | READ16_MEMBER( segaic16_video_device::segaic16_tileram_0_r ) |
| 1269 | 1266 | { |
| 1270 | | return m_tileram[offset]; |
| 1267 | return segaic16_tileram_0[offset]; |
| 1271 | 1268 | } |
| 1272 | 1269 | |
| 1273 | 1270 | |
| 1274 | | WRITE16_MEMBER( segaic16_video_device::tileram_w ) |
| 1271 | WRITE16_MEMBER( segaic16_video_device::segaic16_tileram_0_w ) |
| 1275 | 1272 | { |
| 1276 | | COMBINE_DATA(&m_tileram[offset]); |
| 1277 | | m_bg_tilemap[0].tilemaps[offset / (64*32)]->mark_tile_dirty(offset % (64*32)); |
| 1273 | COMBINE_DATA(&segaic16_tileram_0[offset]); |
| 1274 | bg_tilemap[0].tilemaps[offset / (64*32)]->mark_tile_dirty(offset % (64*32)); |
| 1278 | 1275 | } |
| 1279 | 1276 | |
| 1280 | 1277 | |
| 1281 | | READ16_MEMBER( segaic16_video_device::textram_r ) |
| 1278 | READ16_MEMBER( segaic16_video_device::segaic16_textram_0_r ) |
| 1282 | 1279 | { |
| 1283 | | return m_textram[offset]; |
| 1280 | return segaic16_textram_0[offset]; |
| 1284 | 1281 | } |
| 1285 | 1282 | |
| 1286 | 1283 | |
| 1287 | | WRITE16_MEMBER( segaic16_video_device::textram_w ) |
| 1284 | WRITE16_MEMBER( segaic16_video_device::segaic16_textram_0_w ) |
| 1288 | 1285 | { |
| 1289 | 1286 | /* certain ranges need immediate updates */ |
| 1290 | 1287 | if (offset >= 0xe80/2) |
| 1291 | 1288 | m_screen->update_partial(m_screen->vpos()); |
| 1292 | 1289 | |
| 1293 | | COMBINE_DATA(&m_textram[offset]); |
| 1294 | | m_bg_tilemap[0].textmap->mark_tile_dirty(offset); |
| 1290 | COMBINE_DATA(&segaic16_textram_0[offset]); |
| 1291 | bg_tilemap[0].textmap->mark_tile_dirty(offset); |
| 1295 | 1292 | } |
| 1296 | 1293 | |
| 1297 | 1294 | |
| r242475 | r242476 | |
| 1306 | 1303 | * |
| 1307 | 1304 | *************************************/ |
| 1308 | 1305 | |
| 1309 | | void segaic16_video_device::rotate_init(int which, int type, int colorbase) |
| 1306 | void segaic16_video_device::segaic16_rotate_init(running_machine &machine, int which, int type, int colorbase) |
| 1310 | 1307 | { |
| 1311 | | struct rotate_info *info = &m_rotate[which]; |
| 1308 | struct rotate_info *info = &segaic16_rotate[which]; |
| 1312 | 1309 | |
| 1313 | 1310 | /* reset the tilemap info */ |
| 1314 | 1311 | memset(info, 0, sizeof(*info)); |
| r242475 | r242476 | |
| 1320 | 1317 | switch (which) |
| 1321 | 1318 | { |
| 1322 | 1319 | case 0: |
| 1323 | | info->rotateram = m_rotateram; |
| 1320 | info->rotateram = segaic16_rotateram_0; |
| 1324 | 1321 | break; |
| 1325 | 1322 | |
| 1326 | 1323 | default: |
| 1327 | | fatalerror("Invalid rotate index specified in rotate_init\n"); |
| 1324 | fatalerror("Invalid rotate index specified in segaic16_rotate_init\n"); |
| 1328 | 1325 | } |
| 1329 | 1326 | |
| 1330 | 1327 | /* determine the parameters of the rotate */ |
| r242475 | r242476 | |
| 1335 | 1332 | break; |
| 1336 | 1333 | |
| 1337 | 1334 | default: |
| 1338 | | fatalerror("Invalid rotate system specified in rotate_init\n"); |
| 1335 | fatalerror("Invalid rotate system specified in segaic16_rotate_init\n"); |
| 1339 | 1336 | } |
| 1340 | 1337 | |
| 1341 | 1338 | /* allocate a buffer for swapping */ |
| 1342 | | info->buffer = auto_alloc_array(machine(), UINT16, info->ramsize/2); |
| 1339 | info->buffer = auto_alloc_array(machine, UINT16, info->ramsize/2); |
| 1343 | 1340 | |
| 1344 | | save_item(NAME(info->colorbase), which); |
| 1345 | | save_pointer(NAME((UINT8 *) info->buffer), info->ramsize, which); |
| 1341 | state_save_register_item(machine, "segaic16_rot", NULL, which, info->colorbase); |
| 1342 | state_save_register_item_pointer(machine, "segaic16_rot", NULL, which, ((UINT8 *) info->buffer), info->ramsize); |
| 1346 | 1343 | } |
| 1347 | 1344 | |
| 1348 | 1345 | |
| r242475 | r242476 | |
| 1353 | 1350 | * |
| 1354 | 1351 | *************************************/ |
| 1355 | 1352 | |
| 1356 | | void segaic16_video_device::rotate_draw(int which, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, bitmap_ind16 &srcbitmap) |
| 1353 | void segaic16_video_device::segaic16_rotate_draw(int which, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, bitmap_ind16 &srcbitmap) |
| 1357 | 1354 | { |
| 1358 | | struct rotate_info *info = &m_rotate[which]; |
| 1355 | struct rotate_info *info = &segaic16_rotate[which]; |
| 1359 | 1356 | INT32 currx = (info->buffer[0x3f0] << 16) | info->buffer[0x3f1]; |
| 1360 | 1357 | INT32 curry = (info->buffer[0x3f2] << 16) | info->buffer[0x3f3]; |
| 1361 | 1358 | INT32 dyy = (info->buffer[0x3f4] << 16) | info->buffer[0x3f5]; |
| r242475 | r242476 | |
| 1416 | 1413 | * |
| 1417 | 1414 | *************************************/ |
| 1418 | 1415 | |
| 1419 | | READ16_MEMBER( segaic16_video_device::rotate_control_r ) |
| 1416 | READ16_MEMBER( segaic16_video_device::segaic16_rotate_control_0_r ) |
| 1420 | 1417 | { |
| 1421 | | struct rotate_info *info = &m_rotate[0]; |
| 1418 | struct rotate_info *info = &segaic16_rotate[0]; |
| 1422 | 1419 | |
| 1423 | 1420 | if (info->buffer) |
| 1424 | 1421 | { |
trunk/src/mame/video/segaic16.h
| r242475 | r242476 | |
| 99 | 99 | // static configuration |
| 100 | 100 | static void static_set_gfxdecode_tag(device_t &device, const char *tag); |
| 101 | 101 | |
| 102 | | UINT8 m_display_enable; |
| 103 | | optional_shared_ptr<UINT16> m_tileram; |
| 104 | | optional_shared_ptr<UINT16> m_textram; |
| 105 | | optional_shared_ptr<UINT16> m_rotateram; |
| 102 | UINT8 segaic16_display_enable; |
| 103 | UINT16 *segaic16_tileram_0; |
| 104 | UINT16 *segaic16_textram_0; |
| 105 | UINT16 *segaic16_rotateram_0; |
| 106 | 106 | |
| 107 | | void tilemap_set_colscroll(int which, int enable); |
| 108 | | void tilemap_set_rowscroll(int which, int enable); |
| 109 | | void tilemap_set_flip(int which, int flip); |
| 110 | | void tilemap_set_bank(int which, int banknum, int offset); |
| 111 | | void tilemap_reset(screen_device &screen); |
| 112 | | void tilemap_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int map, int priority, int priority_mark); |
| 113 | | // void tilemap_16b_draw_layer(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flags, int priority); |
| 114 | | // void tilemap_16a_draw_layer(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flags, int priority); |
| 115 | | // void draw_virtual_tilemap(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 pages, UINT16 xscroll, UINT16 yscroll, UINT32 flags, UINT32 priority); |
| 116 | | // void tilemap_16b_reset(screen_device &screen, struct tilemap_info *info); |
| 107 | void segaic16_tilemap_set_colscroll(int which, int enable); |
| 108 | void segaic16_tilemap_set_rowscroll(int which, int enable); |
| 109 | void segaic16_tilemap_set_flip(int which, int flip); |
| 110 | void segaic16_tilemap_set_bank(int which, int banknum, int offset); |
| 111 | void segaic16_tilemap_reset(screen_device &screen); |
| 112 | void segaic16_tilemap_draw(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int map, int priority, int priority_mark); |
| 113 | // void segaic16_tilemap_16b_draw_layer(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flags, int priority); |
| 114 | // void segaic16_tilemap_16a_draw_layer(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, int which, int flags, int priority); |
| 115 | // void segaic16_draw_virtual_tilemap(screen_device &screen, struct tilemap_info *info, bitmap_ind16 &bitmap, const rectangle &cliprect, UINT16 pages, UINT16 xscroll, UINT16 yscroll, UINT32 flags, UINT32 priority); |
| 116 | // void segaic16_tilemap_16b_reset(screen_device &screen, struct tilemap_info *info); |
| 117 | 117 | |
| 118 | | TIMER_CALLBACK_MEMBER( tilemap_16b_latch_values ); |
| 118 | TIMER_CALLBACK_MEMBER( segaic16_tilemap_16b_latch_values ); |
| 119 | 119 | |
| 120 | | struct rotate_info m_rotate[SEGAIC16_MAX_ROTATE]; |
| 121 | | struct tilemap_info m_bg_tilemap[SEGAIC16_MAX_TILEMAPS]; |
| 120 | struct rotate_info segaic16_rotate[SEGAIC16_MAX_ROTATE]; |
| 121 | struct tilemap_info bg_tilemap[SEGAIC16_MAX_TILEMAPS]; |
| 122 | 122 | |
| 123 | | void set_display_enable(int enable); |
| 124 | | void tilemap_init(int which, int type, int colorbase, int xoffs, int numbanks); |
| 125 | | void rotate_init(int which, int type, int colorbase); |
| 123 | void segaic16_set_display_enable(int enable); |
| 124 | void segaic16_tilemap_init(running_machine &machine, int which, int type, int colorbase, int xoffs, int numbanks); |
| 125 | void segaic16_rotate_init(running_machine &machine, int which, int type, int colorbase); |
| 126 | 126 | |
| 127 | | DECLARE_READ16_MEMBER( tileram_r ); |
| 128 | | DECLARE_READ16_MEMBER( textram_r ); |
| 129 | | DECLARE_WRITE16_MEMBER( tileram_w ); |
| 130 | | DECLARE_WRITE16_MEMBER( textram_w ); |
| 127 | DECLARE_READ16_MEMBER( segaic16_tileram_0_r ); |
| 128 | DECLARE_READ16_MEMBER( segaic16_textram_0_r ); |
| 129 | DECLARE_WRITE16_MEMBER( segaic16_tileram_0_w ); |
| 130 | DECLARE_WRITE16_MEMBER( segaic16_textram_0_w ); |
| 131 | 131 | |
| 132 | | void rotate_draw(int which, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, bitmap_ind16 &srcbitmap); |
| 132 | void segaic16_rotate_draw(int which, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, bitmap_ind16 &srcbitmap); |
| 133 | 133 | |
| 134 | | DECLARE_READ16_MEMBER( rotate_control_r ); |
| 134 | DECLARE_READ16_MEMBER( segaic16_rotate_control_0_r ); |
| 135 | 135 | |
| 136 | | TILE_GET_INFO_MEMBER( tilemap_16b_tile_info ); |
| 137 | | TILE_GET_INFO_MEMBER( tilemap_16b_text_info ); |
| 138 | | TILE_GET_INFO_MEMBER( tilemap_16b_alt_tile_info ); |
| 139 | | TILE_GET_INFO_MEMBER( tilemap_16b_alt_text_info ); |
| 136 | TILE_GET_INFO_MEMBER( segaic16_tilemap_16b_tile_info ); |
| 137 | TILE_GET_INFO_MEMBER( segaic16_tilemap_16b_text_info ); |
| 138 | TILE_GET_INFO_MEMBER( segaic16_tilemap_16b_alt_tile_info ); |
| 139 | TILE_GET_INFO_MEMBER( segaic16_tilemap_16b_alt_text_info ); |
| 140 | 140 | |
| 141 | | TILE_GET_INFO_MEMBER( tilemap_16a_tile_info ); |
| 142 | | TILE_GET_INFO_MEMBER( tilemap_16a_text_info ); |
| 141 | TILE_GET_INFO_MEMBER( segaic16_tilemap_16a_tile_info ); |
| 142 | TILE_GET_INFO_MEMBER( segaic16_tilemap_16a_text_info ); |
| 143 | 143 | |
| 144 | 144 | protected: |
| 145 | 145 | // device-level overrides |
| 146 | virtual void device_config_complete(); |
| 146 | 147 | virtual void device_start(); |
| 147 | 148 | virtual void device_reset(); |
| 148 | 149 | |
trunk/src/mame/video/segaorun.c
| r242475 | r242476 | |
| 20 | 20 | if (m_shangon_video) |
| 21 | 21 | { |
| 22 | 22 | // initialize the tile/text layers |
| 23 | | m_segaic16vid->tilemap_init(0, SEGAIC16_TILEMAP_16B_ALT, 0x000, 0, 2); |
| 23 | m_segaic16vid->segaic16_tilemap_init(machine(), 0, SEGAIC16_TILEMAP_16B_ALT, 0x000, 0, 2); |
| 24 | 24 | |
| 25 | 25 | // initialize the road |
| 26 | 26 | m_segaic16road->segaic16_road_init(machine(), 0, SEGAIC16_ROAD_OUTRUN, 0x7f6, 0x7c0, 0x7c0, 0); |
| r242475 | r242476 | |
| 28 | 28 | else |
| 29 | 29 | { |
| 30 | 30 | // initialize the tile/text layers |
| 31 | | m_segaic16vid->tilemap_init(0, SEGAIC16_TILEMAP_16B, 0x000, 0, 2); |
| 31 | m_segaic16vid->segaic16_tilemap_init(machine(), 0, SEGAIC16_TILEMAP_16B, 0x000, 0, 2); |
| 32 | 32 | |
| 33 | 33 | // initialize the road |
| 34 | 34 | m_segaic16road->segaic16_road_init(machine(), 0, SEGAIC16_ROAD_OUTRUN, 0x400, 0x420, 0x780, 0); |
| r242475 | r242476 | |
| 53 | 53 | m_segaic16road->segaic16_road_draw(0, bitmap, cliprect, SEGAIC16_ROAD_BACKGROUND); |
| 54 | 54 | |
| 55 | 55 | // draw background |
| 56 | | m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); |
| 57 | | m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); |
| 56 | m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); |
| 57 | m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); |
| 58 | 58 | |
| 59 | 59 | // draw foreground |
| 60 | | m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); |
| 61 | | m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); |
| 60 | m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); |
| 61 | m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); |
| 62 | 62 | |
| 63 | 63 | // draw the high priority road |
| 64 | 64 | m_segaic16road->segaic16_road_draw(0, bitmap, cliprect, SEGAIC16_ROAD_FOREGROUND); |
| r242475 | r242476 | |
| 66 | 66 | // text layer |
| 67 | 67 | // note that we inflate the priority of the text layer to prevent sprites |
| 68 | 68 | // from drawing over the high scores |
| 69 | | m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x08); |
| 70 | | m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); |
| 69 | m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x08); |
| 70 | m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); |
| 71 | 71 | |
| 72 | 72 | // mix in sprites |
| 73 | 73 | bitmap_ind16 &sprites = m_sprites->bitmap(); |
| r242475 | r242476 | |
| 106 | 106 | UINT32 segaorun_state::screen_update_outrun(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 107 | 107 | { |
| 108 | 108 | // if no drawing is happening, fill with black and get out |
| 109 | | if (!m_segaic16vid->m_display_enable) |
| 109 | if (!m_segaic16vid->segaic16_display_enable) |
| 110 | 110 | { |
| 111 | 111 | bitmap.fill(m_palette->black_pen(), cliprect); |
| 112 | 112 | return 0; |
| r242475 | r242476 | |
| 122 | 122 | m_segaic16road->segaic16_road_draw(0, bitmap, cliprect, SEGAIC16_ROAD_BACKGROUND); |
| 123 | 123 | |
| 124 | 124 | // draw background |
| 125 | | m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); |
| 126 | | m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); |
| 125 | m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); |
| 126 | m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); |
| 127 | 127 | |
| 128 | 128 | // draw foreground |
| 129 | | m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); |
| 130 | | m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); |
| 129 | m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); |
| 130 | m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); |
| 131 | 131 | |
| 132 | 132 | // draw the high priority road |
| 133 | 133 | m_segaic16road->segaic16_road_draw(0, bitmap, cliprect, SEGAIC16_ROAD_FOREGROUND); |
| 134 | 134 | |
| 135 | 135 | // text layer |
| 136 | | m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x04); |
| 137 | | m_segaic16vid->tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); |
| 136 | m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x04); |
| 137 | m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); |
| 138 | 138 | |
| 139 | 139 | // mix in sprites |
| 140 | 140 | bitmap_ind16 &sprites = m_sprites->bitmap(); |
trunk/src/mame/video/segas18.c
| r242475 | r242476 | |
| 34 | 34 | m_vdp_mixing = 0; |
| 35 | 35 | |
| 36 | 36 | // initialize the tile/text layers |
| 37 | | m_segaic16vid->tilemap_init( 0, SEGAIC16_TILEMAP_16B, 0x000, 0, 8); |
| 37 | m_segaic16vid->segaic16_tilemap_init(machine(), 0, SEGAIC16_TILEMAP_16B, 0x000, 0, 8); |
| 38 | 38 | |
| 39 | 39 | save_item(NAME(m_grayscale_enable)); |
| 40 | 40 | save_item(NAME(m_vdp_enable)); |
| r242475 | r242476 | |
| 187 | 187 | #endif |
| 188 | 188 | |
| 189 | 189 | // if no drawing is happening, fill with black and get out |
| 190 | | if (!m_segaic16vid->m_display_enable) |
| 190 | if (!m_segaic16vid->segaic16_display_enable) |
| 191 | 191 | { |
| 192 | 192 | bitmap.fill(m_palette->black_pen(), cliprect); |
| 193 | 193 | return 0; |
| r242475 | r242476 | |
| 200 | 200 | screen.priority().fill(0, cliprect); |
| 201 | 201 | |
| 202 | 202 | // draw background opaquely first, not setting any priorities |
| 203 | | m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0 | TILEMAP_DRAW_OPAQUE, 0x00); |
| 204 | | m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1 | TILEMAP_DRAW_OPAQUE, 0x00); |
| 203 | m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0 | TILEMAP_DRAW_OPAQUE, 0x00); |
| 204 | m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1 | TILEMAP_DRAW_OPAQUE, 0x00); |
| 205 | 205 | if (m_vdp_enable && vdplayer == 0) draw_vdp(screen, bitmap, cliprect, vdppri); |
| 206 | 206 | |
| 207 | 207 | // draw background again to draw non-transparent pixels over the VDP and set the priority |
| 208 | | m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); |
| 209 | | m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); |
| 208 | m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 0, 0x01); |
| 209 | m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_BACKGROUND, 1, 0x02); |
| 210 | 210 | if (m_vdp_enable && vdplayer == 1) draw_vdp(screen, bitmap, cliprect, vdppri); |
| 211 | 211 | |
| 212 | 212 | // draw foreground |
| 213 | | m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); |
| 214 | | m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); |
| 213 | m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 0, 0x02); |
| 214 | m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_FOREGROUND, 1, 0x04); |
| 215 | 215 | if (m_vdp_enable && vdplayer == 2) draw_vdp(screen, bitmap, cliprect, vdppri); |
| 216 | 216 | |
| 217 | 217 | // text layer |
| 218 | | m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x04); |
| 219 | | m_segaic16vid->tilemap_draw( screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); |
| 218 | m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 0, 0x04); |
| 219 | m_segaic16vid->segaic16_tilemap_draw(screen, bitmap, cliprect, 0, SEGAIC16_TILEMAP_TEXT, 1, 0x08); |
| 220 | 220 | if (m_vdp_enable && vdplayer == 3) draw_vdp(screen, bitmap, cliprect, vdppri); |
| 221 | 221 | |
| 222 | 222 | // mix in sprites |