trunk/src/mame/drivers/segas16b.c
| r242476 | r242477 | |
| 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::sega_tileram_0_w), this)); |
| 916 | | mapper.map_as_ram(0x10000, 0x01000, 0xfef000, "textram", write16_delegate(FUNC(segas16b_state::sega_textram_0_w), this)); |
| 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)); |
| 917 | 917 | break; |
| 918 | 918 | |
| 919 | 919 | case 4: // 2k of spriteram |
| r242476 | r242477 | |
| 1003 | 1003 | WRITE16_MEMBER( segas16b_state::rom_5704_bank_w ) |
| 1004 | 1004 | { |
| 1005 | 1005 | if (ACCESSING_BITS_0_7) |
| 1006 | | m_segaic16vid->segaic16_tilemap_set_bank(0, offset & 1, data & 7); |
| 1006 | m_segaic16vid->tilemap_set_bank(0, offset & 1, data & 7); |
| 1007 | 1007 | } |
| 1008 | 1008 | |
| 1009 | 1009 | |
| r242476 | r242477 | |
| 1051 | 1051 | |
| 1052 | 1052 | case 0x2000/2: |
| 1053 | 1053 | if (ACCESSING_BITS_0_7) |
| 1054 | | m_segaic16vid->segaic16_tilemap_set_bank(0, offset & 1, data & 7); |
| 1054 | m_segaic16vid->tilemap_set_bank(0, offset & 1, data & 7); |
| 1055 | 1055 | break; |
| 1056 | 1056 | } |
| 1057 | 1057 | } |
| r242476 | r242477 | |
| 1124 | 1124 | // D1 : (Output to coin counter 2?) |
| 1125 | 1125 | // D0 : Output to coin counter 1 |
| 1126 | 1126 | // |
| 1127 | | m_segaic16vid->segaic16_tilemap_set_flip(0, data & 0x40); |
| 1127 | m_segaic16vid->tilemap_set_flip(0, data & 0x40); |
| 1128 | 1128 | m_sprites->set_flip(data & 0x40); |
| 1129 | 1129 | if (!m_disable_screen_blanking) |
| 1130 | | m_segaic16vid->segaic16_set_display_enable(data & 0x20); |
| 1130 | m_segaic16vid->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); |
| r242476 | r242477 | |
| 1288 | 1288 | synchronize(TID_INIT_I8751); |
| 1289 | 1289 | |
| 1290 | 1290 | // reset tilemap state |
| 1291 | | m_segaic16vid->segaic16_tilemap_reset(*m_screen); |
| 1291 | m_segaic16vid->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 }; |
| r242476 | r242477 | |
| 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 | | |
| 6632 | 6628 | // save state |
| 6633 | 6629 | save_item(NAME(m_atomicp_sound_count)); |
| 6634 | 6630 | save_item(NAME(m_hwc_input_value)); |
| r242476 | r242477 | |
| 6654 | 6650 | // configure special behaviors for the Korean boards |
| 6655 | 6651 | m_disable_screen_blanking = true; |
| 6656 | 6652 | m_atomicp_sound_divisor = 1; |
| 6657 | | m_segaic16vid->segaic16_display_enable = 1; |
| 6653 | m_segaic16vid->m_display_enable = 1; |
| 6658 | 6654 | |
| 6659 | 6655 | // allocate a sound timer |
| 6660 | 6656 | emu_timer *timer = timer_alloc(TID_ATOMICP_SOUND_IRQ); |
| r242476 | r242477 | |
| 7221 | 7217 | 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 |
| 7222 | 7218 | AM_RANGE(0x200000, 0x23ffff) AM_RAM // used during startup for decompression |
| 7223 | 7219 | AM_RANGE(0x3f0000, 0x3fffff) AM_WRITE(rom_5704_bank_w) |
| 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") |
| 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") |
| 7226 | 7222 | AM_RANGE(0x440000, 0x4407ff) AM_RAM AM_SHARE("sprites") |
| 7227 | 7223 | AM_RANGE(0x840000, 0x840fff) AM_RAM_WRITE(paletteram_w) AM_SHARE("paletteram") |
| 7228 | 7224 | AM_RANGE(0xc40000, 0xc43fff) AM_READWRITE(standard_io_r, standard_io_w) |
| r242476 | r242477 | |
| 7358 | 7354 | |
| 7359 | 7355 | void isgsm_state::machine_reset() |
| 7360 | 7356 | { |
| 7361 | | m_segaic16vid->segaic16_tilemap_reset(*m_screen); |
| 7357 | m_segaic16vid->tilemap_reset(*m_screen); |
| 7362 | 7358 | |
| 7363 | 7359 | // configure sprite banks |
| 7364 | 7360 | for (int i = 0; i < 16; i++) |
trunk/src/mame/video/segaic16.c
| r242476 | r242477 | |
| 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 decypher. |
| 339 | have not been able to decipher. |
| 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. Ths sprite engine, vdp1, allows for any 4-point |
| 345 | | streching of the sprites, actually giving polygonal 3D |
| 344 | the vdp2. The sprite engine, vdp1, allows for any 4-point |
| 345 | stretching 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 |
| r242476 | r242477 | |
| 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"), |
| 377 | 381 | m_gfxdecode(*this) |
| 378 | 382 | { |
| 383 | memset(m_rotate, 0, sizeof(m_rotate)); |
| 384 | memset(m_bg_tilemap, 0, sizeof(m_bg_tilemap)); |
| 379 | 385 | } |
| 380 | 386 | |
| 381 | 387 | //------------------------------------------------- |
| r242476 | r242477 | |
| 389 | 395 | } |
| 390 | 396 | |
| 391 | 397 | |
| 392 | | void segaic16_video_device::device_config_complete() |
| 393 | | { |
| 394 | | } |
| 395 | | |
| 396 | 398 | void segaic16_video_device::device_start() |
| 397 | 399 | { |
| 400 | save_item(NAME(m_display_enable)); |
| 398 | 401 | } |
| 399 | 402 | |
| 400 | 403 | void segaic16_video_device::device_reset() |
| r242476 | r242477 | |
| 402 | 405 | } |
| 403 | 406 | |
| 404 | 407 | |
| 405 | | |
| 406 | | |
| 407 | | |
| 408 | | |
| 409 | | |
| 410 | | |
| 411 | | |
| 412 | | |
| 413 | 408 | /************************************* |
| 414 | 409 | * |
| 415 | 410 | * Misc functions |
| 416 | 411 | * |
| 417 | 412 | *************************************/ |
| 418 | 413 | |
| 419 | | void segaic16_video_device::segaic16_set_display_enable(int enable) |
| 414 | void segaic16_video_device::set_display_enable(int enable) |
| 420 | 415 | { |
| 421 | 416 | enable = (enable != 0); |
| 422 | | if (segaic16_display_enable != enable) |
| 417 | if (m_display_enable != enable) |
| 423 | 418 | { |
| 424 | 419 | m_screen->update_partial(m_screen->vpos()); |
| 425 | | segaic16_display_enable = enable; |
| 420 | m_display_enable = enable; |
| 426 | 421 | } |
| 427 | 422 | } |
| 428 | 423 | |
| r242476 | r242477 | |
| 435 | 430 | * |
| 436 | 431 | *************************************/ |
| 437 | 432 | |
| 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) |
| 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) |
| 439 | 434 | { |
| 440 | 435 | int leftmin = -1, leftmax = -1, rightmin = -1, rightmax = -1; |
| 441 | 436 | int topmin = -1, topmax = -1, bottommin = -1, bottommax = -1; |
| r242476 | r242477 | |
| 637 | 632 | * |
| 638 | 633 | *******************************************************************************************/ |
| 639 | 634 | |
| 640 | | TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16a_tile_info ) |
| 635 | TILE_GET_INFO_MEMBER( segaic16_video_device::tilemap_16a_tile_info ) |
| 641 | 636 | { |
| 642 | 637 | const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data(); |
| 643 | 638 | UINT16 data = info->rambase[tile_index]; |
| r242476 | r242477 | |
| 649 | 644 | } |
| 650 | 645 | |
| 651 | 646 | |
| 652 | | TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16a_text_info ) |
| 647 | TILE_GET_INFO_MEMBER( segaic16_video_device::tilemap_16a_text_info ) |
| 653 | 648 | { |
| 654 | 649 | const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data(); |
| 655 | 650 | UINT16 data = info->rambase[tile_index]; |
| r242476 | r242477 | |
| 661 | 656 | } |
| 662 | 657 | |
| 663 | 658 | |
| 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) |
| 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) |
| 665 | 660 | { |
| 666 | 661 | UINT16 *textram = info->textram; |
| 667 | 662 | |
| r242476 | r242477 | |
| 712 | 707 | /* draw the chunk */ |
| 713 | 708 | effxscroll = (0xc8 - effxscroll + info->xoffs) & 0x3ff; |
| 714 | 709 | effyscroll = effyscroll & 0x1ff; |
| 715 | | segaic16_draw_virtual_tilemap(screen, info, bitmap, rowcolclip, pages, effxscroll, effyscroll, flags, priority); |
| 710 | draw_virtual_tilemap(screen, info, bitmap, rowcolclip, pages, effxscroll, effyscroll, flags, priority); |
| 716 | 711 | } |
| 717 | 712 | } |
| 718 | 713 | } |
| r242476 | r242477 | |
| 741 | 736 | /* draw the chunk */ |
| 742 | 737 | effxscroll = (0xc8 - effxscroll + info->xoffs) & 0x3ff; |
| 743 | 738 | effyscroll = effyscroll & 0x1ff; |
| 744 | | segaic16_draw_virtual_tilemap(screen, info, bitmap, colclip, pages, effxscroll, effyscroll, flags, priority); |
| 739 | draw_virtual_tilemap(screen, info, bitmap, colclip, pages, effxscroll, effyscroll, flags, priority); |
| 745 | 740 | } |
| 746 | 741 | } |
| 747 | 742 | else if (info->rowscroll) |
| r242476 | r242477 | |
| 770 | 765 | /* draw the chunk */ |
| 771 | 766 | effxscroll = (0xc8 - effxscroll + info->xoffs) & 0x3ff; |
| 772 | 767 | effyscroll = effyscroll & 0x1ff; |
| 773 | | segaic16_draw_virtual_tilemap(screen, info, bitmap, rowclip, pages, effxscroll, effyscroll, flags, priority); |
| 768 | draw_virtual_tilemap(screen, info, bitmap, rowclip, pages, effxscroll, effyscroll, flags, priority); |
| 774 | 769 | } |
| 775 | 770 | } |
| 776 | 771 | else |
| r242476 | r242477 | |
| 780 | 775 | xscroll += 17; |
| 781 | 776 | xscroll = (0xc8 - xscroll + info->xoffs) & 0x3ff; |
| 782 | 777 | yscroll = yscroll & 0x1ff; |
| 783 | | segaic16_draw_virtual_tilemap(screen, info, bitmap, cliprect, pages, xscroll, yscroll, flags, priority); |
| 778 | draw_virtual_tilemap(screen, info, bitmap, cliprect, pages, xscroll, yscroll, flags, priority); |
| 784 | 779 | } |
| 785 | 780 | } |
| 786 | 781 | |
| r242476 | r242477 | |
| 849 | 844 | * |
| 850 | 845 | *******************************************************************************************/ |
| 851 | 846 | |
| 852 | | TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_tile_info ) |
| 847 | TILE_GET_INFO_MEMBER( segaic16_video_device::tilemap_16b_tile_info ) |
| 853 | 848 | { |
| 854 | 849 | const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data(); |
| 855 | 850 | UINT16 data = info->rambase[tile_index]; |
| r242476 | r242477 | |
| 863 | 858 | } |
| 864 | 859 | |
| 865 | 860 | |
| 866 | | TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_text_info ) |
| 861 | TILE_GET_INFO_MEMBER( segaic16_video_device::tilemap_16b_text_info ) |
| 867 | 862 | { |
| 868 | 863 | const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data(); |
| 869 | 864 | UINT16 data = info->rambase[tile_index]; |
| r242476 | r242477 | |
| 876 | 871 | } |
| 877 | 872 | |
| 878 | 873 | |
| 879 | | TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_alt_tile_info ) |
| 874 | TILE_GET_INFO_MEMBER( segaic16_video_device::tilemap_16b_alt_tile_info ) |
| 880 | 875 | { |
| 881 | 876 | const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data(); |
| 882 | 877 | UINT16 data = info->rambase[tile_index]; |
| r242476 | r242477 | |
| 890 | 885 | } |
| 891 | 886 | |
| 892 | 887 | |
| 893 | | TILE_GET_INFO_MEMBER( segaic16_video_device::segaic16_tilemap_16b_alt_text_info ) |
| 888 | TILE_GET_INFO_MEMBER( segaic16_video_device::tilemap_16b_alt_text_info ) |
| 894 | 889 | { |
| 895 | 890 | const struct tilemap_callback_info *info = (const struct tilemap_callback_info *)tilemap.user_data(); |
| 896 | 891 | UINT16 data = info->rambase[tile_index]; |
| r242476 | r242477 | |
| 903 | 898 | } |
| 904 | 899 | |
| 905 | 900 | |
| 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) |
| 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) |
| 907 | 902 | { |
| 908 | 903 | UINT16 *textram = info->textram; |
| 909 | 904 | UINT16 xscroll, yscroll, pages; |
| r242476 | r242477 | |
| 955 | 950 | /* draw the chunk */ |
| 956 | 951 | effxscroll = (0xc0 - effxscroll + info->xoffs) & 0x3ff; |
| 957 | 952 | effyscroll = effyscroll & 0x1ff; |
| 958 | | segaic16_draw_virtual_tilemap(screen, info, bitmap, rowcolclip, effpages, effxscroll, effyscroll, flags, priority); |
| 953 | draw_virtual_tilemap(screen, info, bitmap, rowcolclip, effpages, effxscroll, effyscroll, flags, priority); |
| 959 | 954 | } |
| 960 | 955 | } |
| 961 | 956 | } |
| r242476 | r242477 | |
| 991 | 986 | /* draw the chunk */ |
| 992 | 987 | effxscroll = (0xc0 - effxscroll + info->xoffs) & 0x3ff; |
| 993 | 988 | effyscroll = effyscroll & 0x1ff; |
| 994 | | segaic16_draw_virtual_tilemap(screen, info, bitmap, rowclip, effpages, effxscroll, effyscroll, flags, priority); |
| 989 | draw_virtual_tilemap(screen, info, bitmap, rowclip, effpages, effxscroll, effyscroll, flags, priority); |
| 995 | 990 | } |
| 996 | 991 | } |
| 997 | 992 | } |
| 998 | 993 | |
| 999 | 994 | |
| 1000 | | TIMER_CALLBACK_MEMBER( segaic16_video_device::segaic16_tilemap_16b_latch_values ) |
| 995 | TIMER_CALLBACK_MEMBER( segaic16_video_device::tilemap_16b_latch_values ) |
| 1001 | 996 | { |
| 1002 | | struct tilemap_info *info = &bg_tilemap[param]; |
| 997 | struct tilemap_info *info = &m_bg_tilemap[param]; |
| 1003 | 998 | UINT16 *textram = info->textram; |
| 1004 | 999 | int i; |
| 1005 | 1000 | |
| r242476 | r242477 | |
| 1016 | 1011 | } |
| 1017 | 1012 | |
| 1018 | 1013 | |
| 1019 | | void segaic16_tilemap_16b_reset(screen_device &screen, struct tilemap_info *info) |
| 1014 | void tilemap_16b_reset(screen_device &screen, struct tilemap_info *info) |
| 1020 | 1015 | { |
| 1021 | 1016 | /* set a timer to latch values on scanline 261 */ |
| 1022 | 1017 | info->latch_timer->adjust(screen.time_until_pos(261), info->index); |
| r242476 | r242477 | |
| 1030 | 1025 | * |
| 1031 | 1026 | *************************************/ |
| 1032 | 1027 | |
| 1033 | | void segaic16_video_device::segaic16_tilemap_init(running_machine &machine, int which, int type, int colorbase, int xoffs, int numbanks) |
| 1028 | void segaic16_video_device::tilemap_init(int which, int type, int colorbase, int xoffs, int numbanks) |
| 1034 | 1029 | { |
| 1035 | | struct tilemap_info *info = &bg_tilemap[which]; |
| 1030 | struct tilemap_info *info = &m_bg_tilemap[which]; |
| 1036 | 1031 | tilemap_get_info_delegate get_text_info; |
| 1037 | 1032 | tilemap_get_info_delegate get_tile_info; |
| 1038 | 1033 | int pagenum; |
| r242476 | r242477 | |
| 1051 | 1046 | switch (which) |
| 1052 | 1047 | { |
| 1053 | 1048 | case 0: |
| 1054 | | info->textram = segaic16_textram_0; |
| 1055 | | info->tileram = segaic16_tileram_0; |
| 1049 | info->textram = m_textram; |
| 1050 | info->tileram = m_tileram; |
| 1056 | 1051 | break; |
| 1057 | 1052 | |
| 1058 | 1053 | default: |
| 1059 | | fatalerror("Invalid tilemap index specified in segaic16_tilemap_init\n"); |
| 1054 | fatalerror("Invalid tilemap index specified in tilemap_init\n"); |
| 1060 | 1055 | } |
| 1061 | 1056 | |
| 1062 | 1057 | /* determine the parameters of the tilemaps */ |
| 1063 | 1058 | switch (type) |
| 1064 | 1059 | { |
| 1065 | 1060 | case SEGAIC16_TILEMAP_HANGON: |
| 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); |
| 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); |
| 1068 | 1063 | info->numpages = 4; |
| 1069 | | info->draw_layer = segaic16_tilemap_16a_draw_layer; |
| 1064 | info->draw_layer = tilemap_16a_draw_layer; |
| 1070 | 1065 | info->reset = NULL; |
| 1071 | 1066 | info->latch_timer = NULL; |
| 1072 | 1067 | break; |
| 1073 | 1068 | |
| 1074 | 1069 | case SEGAIC16_TILEMAP_16A: |
| 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); |
| 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); |
| 1077 | 1072 | info->numpages = 8; |
| 1078 | | info->draw_layer = segaic16_tilemap_16a_draw_layer; |
| 1073 | info->draw_layer = tilemap_16a_draw_layer; |
| 1079 | 1074 | info->reset = NULL; |
| 1080 | 1075 | info->latch_timer = NULL; |
| 1081 | 1076 | break; |
| 1082 | 1077 | |
| 1083 | 1078 | case SEGAIC16_TILEMAP_16B: |
| 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); |
| 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); |
| 1086 | 1081 | info->numpages = 16; |
| 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) ); |
| 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) ); |
| 1090 | 1085 | break; |
| 1091 | 1086 | |
| 1092 | 1087 | case SEGAIC16_TILEMAP_16B_ALT: |
| 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); |
| 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); |
| 1095 | 1090 | info->numpages = 16; |
| 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) ); |
| 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) ); |
| 1099 | 1094 | break; |
| 1100 | 1095 | |
| 1101 | 1096 | default: |
| 1102 | | fatalerror("Invalid tilemap type specified in segaic16_tilemap_init\n"); |
| 1097 | fatalerror("Invalid tilemap type specified in tilemap_init\n"); |
| 1103 | 1098 | } |
| 1104 | 1099 | |
| 1105 | 1100 | /* create the tilemap for the text layer */ |
| 1106 | | info->textmap = &machine.tilemap().create(m_gfxdecode, get_text_info, TILEMAP_SCAN_ROWS, 8,8, 64,28); |
| 1101 | info->textmap = &machine().tilemap().create(m_gfxdecode, get_text_info, TILEMAP_SCAN_ROWS, 8,8, 64,28); |
| 1107 | 1102 | |
| 1108 | 1103 | /* configure it */ |
| 1109 | 1104 | info->textmap_info.rambase = info->textram; |
| r242476 | r242477 | |
| 1119 | 1114 | for (pagenum = 0; pagenum < info->numpages; pagenum++) |
| 1120 | 1115 | { |
| 1121 | 1116 | /* each page is 64x32 */ |
| 1122 | | info->tilemaps[pagenum] = &machine.tilemap().create(m_gfxdecode, get_tile_info, TILEMAP_SCAN_ROWS, 8,8, 64,32); |
| 1117 | info->tilemaps[pagenum] = &machine().tilemap().create(m_gfxdecode, get_tile_info, TILEMAP_SCAN_ROWS, 8,8, 64,32); |
| 1123 | 1118 | |
| 1124 | 1119 | /* configure the tilemap */ |
| 1125 | 1120 | info->tmap_info[pagenum].rambase = info->tileram + pagenum * 64*32; |
| r242476 | r242477 | |
| 1131 | 1126 | info->tilemaps[pagenum]->set_scrolldx(0, 22); |
| 1132 | 1127 | info->tilemaps[pagenum]->set_scrolldy(0, 38); |
| 1133 | 1128 | } |
| 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); |
| 1134 | 1137 | } |
| 1135 | 1138 | |
| 1136 | 1139 | |
| r242476 | r242477 | |
| 1141 | 1144 | * |
| 1142 | 1145 | *************************************/ |
| 1143 | 1146 | |
| 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) |
| 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) |
| 1145 | 1148 | { |
| 1146 | | struct tilemap_info *info = &bg_tilemap[which]; |
| 1149 | struct tilemap_info *info = &m_bg_tilemap[which]; |
| 1147 | 1150 | |
| 1148 | 1151 | /* text layer is a special common case */ |
| 1149 | 1152 | if (map == SEGAIC16_TILEMAP_TEXT) |
| r242476 | r242477 | |
| 1162 | 1165 | * |
| 1163 | 1166 | *************************************/ |
| 1164 | 1167 | |
| 1165 | | void segaic16_video_device::segaic16_tilemap_reset(screen_device &screen) |
| 1168 | void segaic16_video_device::tilemap_reset(screen_device &screen) |
| 1166 | 1169 | { |
| 1167 | | struct tilemap_info *info = &bg_tilemap[0]; |
| 1170 | struct tilemap_info *info = &m_bg_tilemap[0]; |
| 1168 | 1171 | |
| 1169 | 1172 | if (info->reset) |
| 1170 | 1173 | (*info->reset)(screen, info); |
| r242476 | r242477 | |
| 1178 | 1181 | * |
| 1179 | 1182 | *************************************/ |
| 1180 | 1183 | |
| 1181 | | void segaic16_video_device::segaic16_tilemap_set_bank(int which, int banknum, int offset) |
| 1184 | void segaic16_video_device::tilemap_set_bank(int which, int banknum, int offset) |
| 1182 | 1185 | { |
| 1183 | | struct tilemap_info *info = &bg_tilemap[which]; |
| 1186 | struct tilemap_info *info = &m_bg_tilemap[which]; |
| 1184 | 1187 | |
| 1185 | 1188 | if (info->bank[banknum] != offset) |
| 1186 | 1189 | { |
| r242476 | r242477 | |
| 1198 | 1201 | * |
| 1199 | 1202 | *************************************/ |
| 1200 | 1203 | |
| 1201 | | void segaic16_video_device::segaic16_tilemap_set_flip(int which, int flip) |
| 1204 | void segaic16_video_device::tilemap_set_flip(int which, int flip) |
| 1202 | 1205 | { |
| 1203 | | struct tilemap_info *info = &bg_tilemap[which]; |
| 1206 | struct tilemap_info *info = &m_bg_tilemap[which]; |
| 1204 | 1207 | int pagenum; |
| 1205 | 1208 | |
| 1206 | 1209 | flip = (flip != 0); |
| r242476 | r242477 | |
| 1222 | 1225 | * |
| 1223 | 1226 | *************************************/ |
| 1224 | 1227 | |
| 1225 | | void segaic16_video_device::segaic16_tilemap_set_rowscroll(int which, int enable) |
| 1228 | void segaic16_video_device::tilemap_set_rowscroll(int which, int enable) |
| 1226 | 1229 | { |
| 1227 | | struct tilemap_info *info = &bg_tilemap[which]; |
| 1230 | struct tilemap_info *info = &m_bg_tilemap[which]; |
| 1228 | 1231 | |
| 1229 | 1232 | enable = (enable != 0); |
| 1230 | 1233 | if (info->rowscroll != enable) |
| r242476 | r242477 | |
| 1242 | 1245 | * |
| 1243 | 1246 | *************************************/ |
| 1244 | 1247 | |
| 1245 | | void segaic16_video_device::segaic16_tilemap_set_colscroll(int which, int enable) |
| 1248 | void segaic16_video_device::tilemap_set_colscroll(int which, int enable) |
| 1246 | 1249 | { |
| 1247 | | struct tilemap_info *info = &bg_tilemap[which]; |
| 1250 | struct tilemap_info *info = &m_bg_tilemap[which]; |
| 1248 | 1251 | |
| 1249 | 1252 | enable = (enable != 0); |
| 1250 | 1253 | if (info->colscroll != enable) |
| r242476 | r242477 | |
| 1262 | 1265 | * |
| 1263 | 1266 | *************************************/ |
| 1264 | 1267 | |
| 1265 | | READ16_MEMBER( segaic16_video_device::segaic16_tileram_0_r ) |
| 1268 | READ16_MEMBER( segaic16_video_device::tileram_r ) |
| 1266 | 1269 | { |
| 1267 | | return segaic16_tileram_0[offset]; |
| 1270 | return m_tileram[offset]; |
| 1268 | 1271 | } |
| 1269 | 1272 | |
| 1270 | 1273 | |
| 1271 | | WRITE16_MEMBER( segaic16_video_device::segaic16_tileram_0_w ) |
| 1274 | WRITE16_MEMBER( segaic16_video_device::tileram_w ) |
| 1272 | 1275 | { |
| 1273 | | COMBINE_DATA(&segaic16_tileram_0[offset]); |
| 1274 | | bg_tilemap[0].tilemaps[offset / (64*32)]->mark_tile_dirty(offset % (64*32)); |
| 1276 | COMBINE_DATA(&m_tileram[offset]); |
| 1277 | m_bg_tilemap[0].tilemaps[offset / (64*32)]->mark_tile_dirty(offset % (64*32)); |
| 1275 | 1278 | } |
| 1276 | 1279 | |
| 1277 | 1280 | |
| 1278 | | READ16_MEMBER( segaic16_video_device::segaic16_textram_0_r ) |
| 1281 | READ16_MEMBER( segaic16_video_device::textram_r ) |
| 1279 | 1282 | { |
| 1280 | | return segaic16_textram_0[offset]; |
| 1283 | return m_textram[offset]; |
| 1281 | 1284 | } |
| 1282 | 1285 | |
| 1283 | 1286 | |
| 1284 | | WRITE16_MEMBER( segaic16_video_device::segaic16_textram_0_w ) |
| 1287 | WRITE16_MEMBER( segaic16_video_device::textram_w ) |
| 1285 | 1288 | { |
| 1286 | 1289 | /* certain ranges need immediate updates */ |
| 1287 | 1290 | if (offset >= 0xe80/2) |
| 1288 | 1291 | m_screen->update_partial(m_screen->vpos()); |
| 1289 | 1292 | |
| 1290 | | COMBINE_DATA(&segaic16_textram_0[offset]); |
| 1291 | | bg_tilemap[0].textmap->mark_tile_dirty(offset); |
| 1293 | COMBINE_DATA(&m_textram[offset]); |
| 1294 | m_bg_tilemap[0].textmap->mark_tile_dirty(offset); |
| 1292 | 1295 | } |
| 1293 | 1296 | |
| 1294 | 1297 | |
| r242476 | r242477 | |
| 1303 | 1306 | * |
| 1304 | 1307 | *************************************/ |
| 1305 | 1308 | |
| 1306 | | void segaic16_video_device::segaic16_rotate_init(running_machine &machine, int which, int type, int colorbase) |
| 1309 | void segaic16_video_device::rotate_init(int which, int type, int colorbase) |
| 1307 | 1310 | { |
| 1308 | | struct rotate_info *info = &segaic16_rotate[which]; |
| 1311 | struct rotate_info *info = &m_rotate[which]; |
| 1309 | 1312 | |
| 1310 | 1313 | /* reset the tilemap info */ |
| 1311 | 1314 | memset(info, 0, sizeof(*info)); |
| r242476 | r242477 | |
| 1317 | 1320 | switch (which) |
| 1318 | 1321 | { |
| 1319 | 1322 | case 0: |
| 1320 | | info->rotateram = segaic16_rotateram_0; |
| 1323 | info->rotateram = m_rotateram; |
| 1321 | 1324 | break; |
| 1322 | 1325 | |
| 1323 | 1326 | default: |
| 1324 | | fatalerror("Invalid rotate index specified in segaic16_rotate_init\n"); |
| 1327 | fatalerror("Invalid rotate index specified in rotate_init\n"); |
| 1325 | 1328 | } |
| 1326 | 1329 | |
| 1327 | 1330 | /* determine the parameters of the rotate */ |
| r242476 | r242477 | |
| 1332 | 1335 | break; |
| 1333 | 1336 | |
| 1334 | 1337 | default: |
| 1335 | | fatalerror("Invalid rotate system specified in segaic16_rotate_init\n"); |
| 1338 | fatalerror("Invalid rotate system specified in rotate_init\n"); |
| 1336 | 1339 | } |
| 1337 | 1340 | |
| 1338 | 1341 | /* allocate a buffer for swapping */ |
| 1339 | | info->buffer = auto_alloc_array(machine, UINT16, info->ramsize/2); |
| 1342 | info->buffer = auto_alloc_array(machine(), UINT16, info->ramsize/2); |
| 1340 | 1343 | |
| 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); |
| 1344 | save_item(NAME(info->colorbase), which); |
| 1345 | save_pointer(NAME((UINT8 *) info->buffer), info->ramsize, which); |
| 1343 | 1346 | } |
| 1344 | 1347 | |
| 1345 | 1348 | |
| r242476 | r242477 | |
| 1350 | 1353 | * |
| 1351 | 1354 | *************************************/ |
| 1352 | 1355 | |
| 1353 | | void segaic16_video_device::segaic16_rotate_draw(int which, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, bitmap_ind16 &srcbitmap) |
| 1356 | void segaic16_video_device::rotate_draw(int which, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, bitmap_ind16 &srcbitmap) |
| 1354 | 1357 | { |
| 1355 | | struct rotate_info *info = &segaic16_rotate[which]; |
| 1358 | struct rotate_info *info = &m_rotate[which]; |
| 1356 | 1359 | INT32 currx = (info->buffer[0x3f0] << 16) | info->buffer[0x3f1]; |
| 1357 | 1360 | INT32 curry = (info->buffer[0x3f2] << 16) | info->buffer[0x3f3]; |
| 1358 | 1361 | INT32 dyy = (info->buffer[0x3f4] << 16) | info->buffer[0x3f5]; |
| r242476 | r242477 | |
| 1413 | 1416 | * |
| 1414 | 1417 | *************************************/ |
| 1415 | 1418 | |
| 1416 | | READ16_MEMBER( segaic16_video_device::segaic16_rotate_control_0_r ) |
| 1419 | READ16_MEMBER( segaic16_video_device::rotate_control_r ) |
| 1417 | 1420 | { |
| 1418 | | struct rotate_info *info = &segaic16_rotate[0]; |
| 1421 | struct rotate_info *info = &m_rotate[0]; |
| 1419 | 1422 | |
| 1420 | 1423 | if (info->buffer) |
| 1421 | 1424 | { |
trunk/src/mame/video/segaic16.h
| r242476 | r242477 | |
| 99 | 99 | // static configuration |
| 100 | 100 | static void static_set_gfxdecode_tag(device_t &device, const char *tag); |
| 101 | 101 | |
| 102 | | UINT8 segaic16_display_enable; |
| 103 | | UINT16 *segaic16_tileram_0; |
| 104 | | UINT16 *segaic16_textram_0; |
| 105 | | UINT16 *segaic16_rotateram_0; |
| 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; |
| 106 | 106 | |
| 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); |
| 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); |
| 117 | 117 | |
| 118 | | TIMER_CALLBACK_MEMBER( segaic16_tilemap_16b_latch_values ); |
| 118 | TIMER_CALLBACK_MEMBER( tilemap_16b_latch_values ); |
| 119 | 119 | |
| 120 | | struct rotate_info segaic16_rotate[SEGAIC16_MAX_ROTATE]; |
| 121 | | struct tilemap_info bg_tilemap[SEGAIC16_MAX_TILEMAPS]; |
| 120 | struct rotate_info m_rotate[SEGAIC16_MAX_ROTATE]; |
| 121 | struct tilemap_info m_bg_tilemap[SEGAIC16_MAX_TILEMAPS]; |
| 122 | 122 | |
| 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); |
| 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); |
| 126 | 126 | |
| 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 ); |
| 127 | DECLARE_READ16_MEMBER( tileram_r ); |
| 128 | DECLARE_READ16_MEMBER( textram_r ); |
| 129 | DECLARE_WRITE16_MEMBER( tileram_w ); |
| 130 | DECLARE_WRITE16_MEMBER( textram_w ); |
| 131 | 131 | |
| 132 | | void segaic16_rotate_draw(int which, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, bitmap_ind16 &srcbitmap); |
| 132 | void rotate_draw(int which, bitmap_ind16 &bitmap, const rectangle &cliprect, bitmap_ind8 &priority_bitmap, bitmap_ind16 &srcbitmap); |
| 133 | 133 | |
| 134 | | DECLARE_READ16_MEMBER( segaic16_rotate_control_0_r ); |
| 134 | DECLARE_READ16_MEMBER( rotate_control_r ); |
| 135 | 135 | |
| 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 ); |
| 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 ); |
| 140 | 140 | |
| 141 | | TILE_GET_INFO_MEMBER( segaic16_tilemap_16a_tile_info ); |
| 142 | | TILE_GET_INFO_MEMBER( segaic16_tilemap_16a_text_info ); |
| 141 | TILE_GET_INFO_MEMBER( tilemap_16a_tile_info ); |
| 142 | TILE_GET_INFO_MEMBER( tilemap_16a_text_info ); |
| 143 | 143 | |
| 144 | 144 | protected: |
| 145 | 145 | // device-level overrides |
| 146 | | virtual void device_config_complete(); |
| 147 | 146 | virtual void device_start(); |
| 148 | 147 | virtual void device_reset(); |
| 149 | 148 | |
trunk/src/mame/video/segaorun.c
| r242476 | r242477 | |
| 20 | 20 | if (m_shangon_video) |
| 21 | 21 | { |
| 22 | 22 | // initialize the tile/text layers |
| 23 | | m_segaic16vid->segaic16_tilemap_init(machine(), 0, SEGAIC16_TILEMAP_16B_ALT, 0x000, 0, 2); |
| 23 | m_segaic16vid->tilemap_init(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); |
| r242476 | r242477 | |
| 28 | 28 | else |
| 29 | 29 | { |
| 30 | 30 | // initialize the tile/text layers |
| 31 | | m_segaic16vid->segaic16_tilemap_init(machine(), 0, SEGAIC16_TILEMAP_16B, 0x000, 0, 2); |
| 31 | m_segaic16vid->tilemap_init(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); |
| r242476 | r242477 | |
| 53 | 53 | m_segaic16road->segaic16_road_draw(0, bitmap, cliprect, SEGAIC16_ROAD_BACKGROUND); |
| 54 | 54 | |
| 55 | 55 | // draw background |
| 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); |
| 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); |
| 58 | 58 | |
| 59 | 59 | // draw foreground |
| 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); |
| 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); |
| 62 | 62 | |
| 63 | 63 | // draw the high priority road |
| 64 | 64 | m_segaic16road->segaic16_road_draw(0, bitmap, cliprect, SEGAIC16_ROAD_FOREGROUND); |
| r242476 | r242477 | |
| 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->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); |
| 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); |
| 71 | 71 | |
| 72 | 72 | // mix in sprites |
| 73 | 73 | bitmap_ind16 &sprites = m_sprites->bitmap(); |
| r242476 | r242477 | |
| 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->segaic16_display_enable) |
| 109 | if (!m_segaic16vid->m_display_enable) |
| 110 | 110 | { |
| 111 | 111 | bitmap.fill(m_palette->black_pen(), cliprect); |
| 112 | 112 | return 0; |
| r242476 | r242477 | |
| 122 | 122 | m_segaic16road->segaic16_road_draw(0, bitmap, cliprect, SEGAIC16_ROAD_BACKGROUND); |
| 123 | 123 | |
| 124 | 124 | // draw background |
| 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); |
| 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); |
| 127 | 127 | |
| 128 | 128 | // draw foreground |
| 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); |
| 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); |
| 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->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); |
| 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); |
| 138 | 138 | |
| 139 | 139 | // mix in sprites |
| 140 | 140 | bitmap_ind16 &sprites = m_sprites->bitmap(); |
trunk/src/mame/video/segas18.c
| r242476 | r242477 | |
| 34 | 34 | m_vdp_mixing = 0; |
| 35 | 35 | |
| 36 | 36 | // initialize the tile/text layers |
| 37 | | m_segaic16vid->segaic16_tilemap_init(machine(), 0, SEGAIC16_TILEMAP_16B, 0x000, 0, 8); |
| 37 | m_segaic16vid->tilemap_init( 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)); |
| r242476 | r242477 | |
| 187 | 187 | #endif |
| 188 | 188 | |
| 189 | 189 | // if no drawing is happening, fill with black and get out |
| 190 | | if (!m_segaic16vid->segaic16_display_enable) |
| 190 | if (!m_segaic16vid->m_display_enable) |
| 191 | 191 | { |
| 192 | 192 | bitmap.fill(m_palette->black_pen(), cliprect); |
| 193 | 193 | return 0; |
| r242476 | r242477 | |
| 200 | 200 | screen.priority().fill(0, cliprect); |
| 201 | 201 | |
| 202 | 202 | // draw background opaquely first, not setting any priorities |
| 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); |
| 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); |
| 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->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); |
| 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); |
| 210 | 210 | if (m_vdp_enable && vdplayer == 1) draw_vdp(screen, bitmap, cliprect, vdppri); |
| 211 | 211 | |
| 212 | 212 | // draw foreground |
| 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); |
| 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); |
| 215 | 215 | if (m_vdp_enable && vdplayer == 2) draw_vdp(screen, bitmap, cliprect, vdppri); |
| 216 | 216 | |
| 217 | 217 | // text layer |
| 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); |
| 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); |
| 220 | 220 | if (m_vdp_enable && vdplayer == 3) draw_vdp(screen, bitmap, cliprect, vdppri); |
| 221 | 221 | |
| 222 | 222 | // mix in sprites |