trunk/src/mess/drivers/x68k.c
| r30730 | r30731 | |
| 921 | 921 | { |
| 922 | 922 | COMBINE_DATA(m_video.gfx_pal+offset); |
| 923 | 923 | val = m_video.gfx_pal[offset]; |
| 924 | | m_palette->set_pen_color(offset,(val & 0x07c0) >> 3,(val & 0xf800) >> 8,(val & 0x003e) << 2); |
| 924 | m_gfxpalette->set_pen_color(offset, pal555(val, 6, 11, 1)); |
| 925 | 925 | return; |
| 926 | 926 | } |
| 927 | 927 | |
| 928 | 928 | if(offset >= 0x100 && offset < 0x200) // Text / Sprites / Tilemap palette |
| 929 | 929 | { |
| 930 | | COMBINE_DATA(m_video.text_pal+(offset-0x100)); |
| 931 | | val = m_video.text_pal[offset-0x100]; |
| 932 | | m_palette->set_pen_color(offset,(val & 0x07c0) >> 3,(val & 0xf800) >> 8,(val & 0x003e) << 2); |
| 930 | offset -= 0x100; |
| 931 | COMBINE_DATA(m_video.text_pal + offset); |
| 932 | val = m_video.text_pal[offset]; |
| 933 | m_pcgpalette->set_pen_color(offset, pal555(val, 6, 11, 1)); |
| 933 | 934 | return; |
| 934 | 935 | } |
| 935 | 936 | |
| r30730 | r30731 | |
| 1649 | 1650 | |
| 1650 | 1651 | m_sysport.cputype = 0xff; // 68000, 10MHz |
| 1651 | 1652 | m_is_32bit = false; |
| 1653 | |
| 1654 | save_item(NAME(m_tvram)); |
| 1655 | save_item(NAME(m_gvram)); |
| 1656 | save_item(NAME(m_spritereg)); |
| 1652 | 1657 | } |
| 1653 | 1658 | |
| 1654 | 1659 | DRIVER_INIT_MEMBER(x68k_state,x68kxvi) |
| r30730 | r30731 | |
| 1724 | 1729 | /* video hardware */ |
| 1725 | 1730 | MCFG_SCREEN_ADD("screen", RASTER) |
| 1726 | 1731 | MCFG_SCREEN_REFRESH_RATE(55.45) |
| 1727 | | MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 1732 | // MCFG_SCREEN_VBLANK_TIME(ATTOSECONDS_IN_USEC(2500)) /* not accurate */ |
| 1728 | 1733 | // MCFG_GFXDECODE_ADD("gfxdecode", "palette", x68k) |
| 1729 | 1734 | MCFG_SCREEN_SIZE(1096, 568) // inital setting |
| 1730 | 1735 | MCFG_SCREEN_VISIBLE_AREA(0, 767, 0, 511) |
| 1731 | 1736 | MCFG_SCREEN_UPDATE_DRIVER(x68k_state, screen_update_x68000) |
| 1732 | | MCFG_SCREEN_PALETTE("palette") |
| 1737 | // MCFG_SCREEN_PALETTE("palette") |
| 1733 | 1738 | |
| 1734 | | MCFG_GFXDECODE_ADD("gfxdecode", "palette", empty) |
| 1739 | MCFG_GFXDECODE_ADD("gfxdecode", "pcgpalette", empty) |
| 1735 | 1740 | |
| 1736 | | MCFG_PALETTE_ADD("palette", 65536) |
| 1737 | | MCFG_PALETTE_INIT_OWNER(x68k_state, x68000 ) |
| 1741 | MCFG_PALETTE_ADD("gfxpalette", 256) |
| 1742 | MCFG_PALETTE_FORMAT(GGGGGRRRRRBBBBBx) |
| 1743 | MCFG_PALETTE_ADD("pcgpalette", 256) |
| 1744 | MCFG_PALETTE_FORMAT(GGGGGRRRRRBBBBBx) |
| 1738 | 1745 | |
| 1739 | 1746 | MCFG_VIDEO_START_OVERRIDE(x68k_state, x68000 ) |
| 1740 | 1747 | |
trunk/src/mess/includes/x68k.h
| r30730 | r30731 | |
| 53 | 53 | m_hd63450(*this, "hd63450"), |
| 54 | 54 | m_ram(*this, RAM_TAG), |
| 55 | 55 | m_gfxdecode(*this, "gfxdecode"), |
| 56 | | m_palette(*this, "palette"), |
| 56 | m_gfxpalette(*this, "gfxpalette"), |
| 57 | m_pcgpalette(*this, "pcgpalette"), |
| 57 | 58 | m_mfpdev(*this, MC68901_TAG), |
| 58 | 59 | m_rtc(*this, RP5C15_TAG), |
| 59 | 60 | m_scc(*this, "scc"), |
| r30730 | r30731 | |
| 81 | 82 | required_device<hd63450_device> m_hd63450; |
| 82 | 83 | required_device<ram_device> m_ram; |
| 83 | 84 | required_device<gfxdecode_device> m_gfxdecode; |
| 84 | | required_device<palette_device> m_palette; |
| 85 | required_device<palette_device> m_gfxpalette; |
| 86 | required_device<palette_device> m_pcgpalette; |
| 85 | 87 | required_device<mc68901_device> m_mfpdev; |
| 86 | 88 | required_device<rp5c15_device> m_rtc; |
| 87 | 89 | required_device<scc8530_t> m_scc; |
| r30730 | r30731 | |
| 250 | 252 | DECLARE_MACHINE_START(x68000); |
| 251 | 253 | DECLARE_VIDEO_START(x68000); |
| 252 | 254 | DECLARE_PALETTE_INIT(x68000); |
| 253 | | UINT32 screen_update_x68000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); |
| 255 | UINT32 screen_update_x68000(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 254 | 256 | TIMER_CALLBACK_MEMBER(x68k_led_callback); |
| 255 | 257 | TIMER_CALLBACK_MEMBER(x68k_scc_ack); |
| 256 | 258 | TIMER_CALLBACK_MEMBER(md_6button_port1_timeout); |
| r30730 | r30731 | |
| 330 | 332 | IRQ_CALLBACK_MEMBER(x68k_int_ack); |
| 331 | 333 | |
| 332 | 334 | private: |
| 333 | | inline void x68k_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color); |
| 335 | inline void x68k_plot_pixel(bitmap_rgb32 &bitmap, int x, int y, UINT32 color); |
| 334 | 336 | void x68k_crtc_text_copy(int src, int dest); |
| 335 | 337 | void x68k_crtc_refresh_mode(); |
| 336 | | void x68k_draw_text(bitmap_ind16 &bitmap, int xscr, int yscr, rectangle rect); |
| 337 | | void x68k_draw_gfx_scanline(bitmap_ind16 &bitmap, rectangle cliprect, UINT8 priority); |
| 338 | | void x68k_draw_gfx(bitmap_ind16 &bitmap,rectangle cliprect); |
| 339 | | void x68k_draw_sprites(bitmap_ind16 &bitmap, int priority, rectangle cliprect); |
| 338 | void x68k_draw_text(bitmap_rgb32 &bitmap, int xscr, int yscr, rectangle rect); |
| 339 | void x68k_draw_gfx_scanline(bitmap_rgb32 &bitmap, rectangle cliprect, UINT8 priority); |
| 340 | void x68k_draw_gfx(bitmap_rgb32 &bitmap,rectangle cliprect); |
| 341 | void x68k_draw_sprites(bitmap_rgb32 &bitmap, int priority, rectangle cliprect); |
| 340 | 342 | |
| 341 | 343 | public: |
| 342 | | bitmap_ind16* x68k_get_gfx_page(int pri,int type); |
| 344 | bitmap_rgb32* x68k_get_gfx_page(int pri,int type); |
| 343 | 345 | attotime prescale(int val); |
| 344 | 346 | void mfp_trigger_irq(int irq); |
| 345 | 347 | void mfp_set_timer(int timer, unsigned char data); |
trunk/src/mess/video/x68k.c
| r30730 | r30731 | |
| 33 | 33 | |
| 34 | 34 | |
| 35 | 35 | |
| 36 | | inline void x68k_state::x68k_plot_pixel(bitmap_ind16 &bitmap, int x, int y, UINT32 color) |
| 36 | inline void x68k_state::x68k_plot_pixel(bitmap_rgb32 &bitmap, int x, int y, UINT32 color) |
| 37 | 37 | { |
| 38 | | bitmap.pix16(y, x) = (UINT16)color; |
| 38 | bitmap.pix32(y, x) = (UINT16)color; |
| 39 | 39 | } |
| 40 | 40 | /* |
| 41 | | bitmap_ind16* ::x68k_get_gfx_page(int pri,int type) |
| 41 | bitmap_rgb32* ::x68k_get_gfx_page(int pri,int type) |
| 42 | 42 | { |
| 43 | 43 | if(type == GFX16) |
| 44 | 44 | { |
| r30730 | r30731 | |
| 696 | 696 | return m_spriteram[offset]; |
| 697 | 697 | } |
| 698 | 698 | |
| 699 | | void x68k_state::x68k_draw_text(bitmap_ind16 &bitmap, int xscr, int yscr, rectangle rect) |
| 699 | void x68k_state::x68k_draw_text(bitmap_rgb32 &bitmap, int xscr, int yscr, rectangle rect) |
| 700 | 700 | { |
| 701 | 701 | unsigned int line,pixel; // location on screen |
| 702 | 702 | UINT32 loc; // location in TVRAM |
| r30730 | r30731 | |
| 720 | 720 | { |
| 721 | 721 | // Colour 0 is displayable if the text layer is at the priority level 2 |
| 722 | 722 | if(colour == 0 && (m_video.reg[1] & 0x0c00) == 0x0800) |
| 723 | | bitmap.pix16(line, pixel) = 512 + (m_video.text_pal[colour] >> 1); |
| 723 | bitmap.pix32(line, pixel) = m_pcgpalette->pen(colour); |
| 724 | 724 | else |
| 725 | 725 | if(colour != 0) |
| 726 | | bitmap.pix16(line, pixel) = 512 + (m_video.text_pal[colour] >> 1); |
| 726 | bitmap.pix32(line, pixel) = m_pcgpalette->pen(colour); |
| 727 | 727 | } |
| 728 | 728 | bit--; |
| 729 | 729 | if(bit < 0) |
| r30730 | r30731 | |
| 736 | 736 | } |
| 737 | 737 | } |
| 738 | 738 | |
| 739 | | void x68k_state::x68k_draw_gfx_scanline( bitmap_ind16 &bitmap, rectangle cliprect, UINT8 priority) |
| 739 | void x68k_state::x68k_draw_gfx_scanline( bitmap_rgb32 &bitmap, rectangle cliprect, UINT8 priority) |
| 740 | 740 | { |
| 741 | 741 | int pixel; |
| 742 | 742 | int page; |
| r30730 | r30731 | |
| 776 | 776 | break; |
| 777 | 777 | } |
| 778 | 778 | if(colour != 0) |
| 779 | | bitmap.pix16(scanline, pixel) = 512 + (m_video.gfx_pal[colour] >> 1); |
| 779 | { |
| 780 | bitmap.pix32(scanline, pixel) = m_gfxpalette->pen(colour); |
| 781 | } |
| 780 | 782 | loc++; |
| 781 | 783 | loc &= 0x3ff; |
| 782 | 784 | } |
| r30730 | r30731 | |
| 800 | 802 | { |
| 801 | 803 | colour = ((m_gvram[lineoffset + loc] >> page*shift) & 0x000f); |
| 802 | 804 | if(colour != 0) |
| 803 | | bitmap.pix16(scanline, pixel) = 512 + (m_video.gfx_pal[colour & 0x0f] >> 1); |
| 805 | { |
| 806 | bitmap.pix32(scanline, pixel) = m_gfxpalette->pen(colour); |
| 807 | } |
| 804 | 808 | loc++; |
| 805 | 809 | loc &= 0x1ff; |
| 806 | 810 | } |
| r30730 | r30731 | |
| 817 | 821 | { |
| 818 | 822 | colour = ((m_gvram[lineoffset + loc] >> page*shift) & 0x00ff); |
| 819 | 823 | if(colour != 0) |
| 820 | | bitmap.pix16(scanline, pixel) = 512 + (m_video.gfx_pal[colour & 0xff] >> 1); |
| 824 | { |
| 825 | bitmap.pix32(scanline, pixel) = m_gfxpalette->pen(colour); |
| 826 | } |
| 821 | 827 | loc++; |
| 822 | 828 | loc &= 0x1ff; |
| 823 | 829 | } |
| r30730 | r30731 | |
| 832 | 838 | { |
| 833 | 839 | colour = m_gvram[lineoffset + loc]; |
| 834 | 840 | if(colour != 0) |
| 835 | | bitmap.pix16(scanline, pixel) = 512 + (colour >> 1); |
| 841 | { |
| 842 | bitmap.pix32(scanline, pixel) = pal555(colour, 6, 11, 1); |
| 843 | } |
| 836 | 844 | loc++; |
| 837 | 845 | loc &= 0x1ff; |
| 838 | 846 | } |
| r30730 | r30731 | |
| 843 | 851 | } |
| 844 | 852 | } |
| 845 | 853 | |
| 846 | | void x68k_state::x68k_draw_gfx(bitmap_ind16 &bitmap,rectangle cliprect) |
| 854 | void x68k_state::x68k_draw_gfx(bitmap_rgb32 &bitmap,rectangle cliprect) |
| 847 | 855 | { |
| 848 | 856 | int priority; |
| 849 | 857 | //rectangle rect; |
| r30730 | r30731 | |
| 860 | 868 | } |
| 861 | 869 | |
| 862 | 870 | // Sprite controller "Cynthia" at 0xeb0000 |
| 863 | | void x68k_state::x68k_draw_sprites(bitmap_ind16 &bitmap, int priority, rectangle cliprect) |
| 871 | void x68k_state::x68k_draw_sprites(bitmap_rgb32 &bitmap, int priority, rectangle cliprect) |
| 864 | 872 | { |
| 865 | 873 | /* |
| 866 | 874 | 0xeb0000 - 0xeb07ff - Sprite registers (up to 128) |
| r30730 | r30731 | |
| 917 | 925 | sx += m_crtc.bg_hshift; |
| 918 | 926 | sx += m_sprite_shift; |
| 919 | 927 | |
| 920 | | m_gfxdecode->gfx(1)->zoom_transpen(bitmap,cliprect,code,colour+0x10,xflip,yflip,m_crtc.hbegin+sx,m_crtc.vbegin+(sy*m_crtc.bg_double),0x10000,0x10000*m_crtc.bg_double,0x00); |
| 928 | m_gfxdecode->gfx(1)->zoom_transpen(bitmap,cliprect,code,colour,xflip,yflip,m_crtc.hbegin+sx,m_crtc.vbegin+(sy*m_crtc.bg_double),0x10000,0x10000*m_crtc.bg_double,0x00); |
| 921 | 929 | } |
| 922 | 930 | } |
| 923 | 931 | } |
| 924 | 932 | |
| 925 | | PALETTE_INIT_MEMBER(x68k_state,x68000) |
| 926 | | { |
| 927 | | int pal; |
| 928 | | int r,g,b; |
| 929 | | |
| 930 | | for(pal=0;pal<32768;pal++) |
| 931 | | { // create 64k colour lookup |
| 932 | | g = (pal & 0x7c00) >> 7; |
| 933 | | r = (pal & 0x03e0) >> 2; |
| 934 | | b = (pal & 0x001f) << 3; |
| 935 | | palette.set_pen_color(pal+512,r,g,b); |
| 936 | | } |
| 937 | | } |
| 938 | | |
| 939 | 933 | static const gfx_layout x68k_pcg_8 = |
| 940 | 934 | { |
| 941 | 935 | 8,8, |
| r30730 | r30731 | |
| 964 | 958 | int code = m_spriteram[0x3000+tile_index] & 0x00ff; |
| 965 | 959 | int colour = (m_spriteram[0x3000+tile_index] & 0x0f00) >> 8; |
| 966 | 960 | int flags = (m_spriteram[0x3000+tile_index] & 0xc000) >> 14; |
| 967 | | SET_TILE_INFO_MEMBER(0,code,colour+16,flags); |
| 961 | SET_TILE_INFO_MEMBER(0,code,colour,flags); |
| 968 | 962 | } |
| 969 | 963 | |
| 970 | 964 | TILE_GET_INFO_MEMBER(x68k_state::x68k_get_bg1_tile) |
| r30730 | r30731 | |
| 972 | 966 | int code = m_spriteram[0x2000+tile_index] & 0x00ff; |
| 973 | 967 | int colour = (m_spriteram[0x2000+tile_index] & 0x0f00) >> 8; |
| 974 | 968 | int flags = (m_spriteram[0x2000+tile_index] & 0xc000) >> 14; |
| 975 | | SET_TILE_INFO_MEMBER(0,code,colour+16,flags); |
| 969 | SET_TILE_INFO_MEMBER(0,code,colour,flags); |
| 976 | 970 | } |
| 977 | 971 | |
| 978 | 972 | TILE_GET_INFO_MEMBER(x68k_state::x68k_get_bg0_tile_16) |
| r30730 | r30731 | |
| 980 | 974 | int code = m_spriteram[0x3000+tile_index] & 0x00ff; |
| 981 | 975 | int colour = (m_spriteram[0x3000+tile_index] & 0x0f00) >> 8; |
| 982 | 976 | int flags = (m_spriteram[0x3000+tile_index] & 0xc000) >> 14; |
| 983 | | SET_TILE_INFO_MEMBER(1,code,colour+16,flags); |
| 977 | SET_TILE_INFO_MEMBER(1,code,colour,flags); |
| 984 | 978 | } |
| 985 | 979 | |
| 986 | 980 | TILE_GET_INFO_MEMBER(x68k_state::x68k_get_bg1_tile_16) |
| r30730 | r30731 | |
| 988 | 982 | int code = m_spriteram[0x2000+tile_index] & 0x00ff; |
| 989 | 983 | int colour = (m_spriteram[0x2000+tile_index] & 0x0f00) >> 8; |
| 990 | 984 | int flags = (m_spriteram[0x2000+tile_index] & 0xc000) >> 14; |
| 991 | | SET_TILE_INFO_MEMBER(1,code,colour+16,flags); |
| 985 | SET_TILE_INFO_MEMBER(1,code,colour,flags); |
| 992 | 986 | } |
| 993 | 987 | |
| 994 | 988 | VIDEO_START_MEMBER(x68k_state,x68000) |
| r30730 | r30731 | |
| 1000 | 994 | break; |
| 1001 | 995 | |
| 1002 | 996 | /* create the char set (gfx will then be updated dynamically from RAM) */ |
| 1003 | | m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_palette, x68k_pcg_8, memregion("user1")->base(), 0, 32, 0))); |
| 997 | m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_pcgpalette, x68k_pcg_8, memregion("user1")->base(), 0, 32, 0))); |
| 1004 | 998 | |
| 1005 | 999 | gfx_index++; |
| 1006 | 1000 | |
| 1007 | | m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_palette, x68k_pcg_16, memregion("user1")->base(), 0, 32, 0))); |
| 1001 | m_gfxdecode->set_gfx(gfx_index, global_alloc(gfx_element(m_pcgpalette, x68k_pcg_16, memregion("user1")->base(), 0, 32, 0))); |
| 1008 | 1002 | m_gfxdecode->gfx(gfx_index)->set_colors(32); |
| 1009 | 1003 | |
| 1010 | 1004 | /* Tilemaps */ |
| r30730 | r30731 | |
| 1021 | 1015 | // m_scanline_timer->adjust(attotime::zero, 0, attotime::from_hz(55.45)/568); |
| 1022 | 1016 | } |
| 1023 | 1017 | |
| 1024 | | UINT32 x68k_state::screen_update_x68000(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect) |
| 1018 | UINT32 x68k_state::screen_update_x68000(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 1025 | 1019 | { |
| 1026 | 1020 | rectangle rect(0,0,0,0); |
| 1027 | 1021 | int priority; |