trunk/src/mess/video/isa_cga.c
| r18794 | r18795 | |
| 683 | 683 | m_chr_gen_offset[0] = m_chr_gen_offset[2] = 0x1800; |
| 684 | 684 | m_chr_gen_offset[1] = m_chr_gen_offset[3] = 0x1000; |
| 685 | 685 | m_font_selection_mask = 0x01; |
| 686 | m_start_offset = 0; |
| 686 | 687 | } |
| 687 | 688 | |
| 688 | 689 | isa8_cga_device::isa8_cga_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock) : |
| r18794 | r18795 | |
| 693 | 694 | m_chr_gen_offset[0] = m_chr_gen_offset[2] = 0x1800; |
| 694 | 695 | m_chr_gen_offset[1] = m_chr_gen_offset[3] = 0x1000; |
| 695 | 696 | m_font_selection_mask = 0x01; |
| 697 | m_start_offset = 0; |
| 696 | 698 | } |
| 697 | 699 | |
| 698 | 700 | |
| r18794 | r18795 | |
| 887 | 889 | static MC6845_UPDATE_ROW( cga_text_inten_update_row ) |
| 888 | 890 | { |
| 889 | 891 | isa8_cga_device *cga = downcast<isa8_cga_device *>(device->owner()); |
| 890 | | UINT8 *videoram = cga->m_vram; |
| 892 | UINT8 *videoram = cga->m_vram + cga->m_start_offset; |
| 891 | 893 | UINT32 *p = &bitmap.pix32(y); |
| 892 | 894 | const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); |
| 893 | 895 | int i; |
| r18794 | r18795 | |
| 928 | 930 | static MC6845_UPDATE_ROW( cga_text_inten_comp_grey_update_row ) |
| 929 | 931 | { |
| 930 | 932 | isa8_cga_device *cga = downcast<isa8_cga_device *>(device->owner()); |
| 931 | | UINT8 *videoram = cga->m_vram; |
| 933 | UINT8 *videoram = cga->m_vram + cga->m_start_offset; |
| 932 | 934 | UINT32 *p = &bitmap.pix32(y); |
| 933 | 935 | const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); |
| 934 | 936 | int i; |
| r18794 | r18795 | |
| 968 | 970 | static MC6845_UPDATE_ROW( cga_text_inten_alt_update_row ) |
| 969 | 971 | { |
| 970 | 972 | isa8_cga_device *cga = downcast<isa8_cga_device *>(device->owner()); |
| 971 | | UINT8 *videoram = cga->m_vram; |
| 973 | UINT8 *videoram = cga->m_vram + cga->m_start_offset; |
| 972 | 974 | UINT32 *p = &bitmap.pix32(y); |
| 973 | 975 | const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); |
| 974 | 976 | int i; |
| r18794 | r18795 | |
| 1008 | 1010 | static MC6845_UPDATE_ROW( cga_text_blink_update_row ) |
| 1009 | 1011 | { |
| 1010 | 1012 | isa8_cga_device *cga = downcast<isa8_cga_device *>(device->owner()); |
| 1011 | | UINT8 *videoram = cga->m_vram; |
| 1013 | UINT8 *videoram = cga->m_vram + cga->m_start_offset; |
| 1012 | 1014 | UINT32 *p = &bitmap.pix32(y); |
| 1013 | 1015 | const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); |
| 1014 | 1016 | int i; |
| r18794 | r18795 | |
| 1053 | 1055 | static MC6845_UPDATE_ROW( cga_text_blink_update_row_si ) |
| 1054 | 1056 | { |
| 1055 | 1057 | isa8_cga_device *cga = downcast<isa8_cga_device *>(device->owner()); |
| 1056 | | UINT8 *videoram = cga->m_vram; |
| 1058 | UINT8 *videoram = cga->m_vram + cga->m_start_offset; |
| 1057 | 1059 | UINT32 *p = &bitmap.pix32(y); |
| 1058 | 1060 | const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); |
| 1059 | 1061 | int i; |
| r18794 | r18795 | |
| 1106 | 1108 | static MC6845_UPDATE_ROW( cga_text_blink_alt_update_row ) |
| 1107 | 1109 | { |
| 1108 | 1110 | isa8_cga_device *cga = downcast<isa8_cga_device *>(device->owner()); |
| 1109 | | UINT8 *videoram = cga->m_vram; |
| 1111 | UINT8 *videoram = cga->m_vram + cga->m_start_offset; |
| 1110 | 1112 | UINT32 *p = &bitmap.pix32(y); |
| 1111 | 1113 | const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); |
| 1112 | 1114 | int i; |
| r18794 | r18795 | |
| 1155 | 1157 | static MC6845_UPDATE_ROW( cga_gfx_4bppl_update_row ) |
| 1156 | 1158 | { |
| 1157 | 1159 | isa8_cga_device *cga = downcast<isa8_cga_device *>(device->owner()); |
| 1158 | | UINT8 *videoram = cga->m_vram; |
| 1160 | UINT8 *videoram = cga->m_vram + cga->m_start_offset; |
| 1159 | 1161 | UINT32 *p = &bitmap.pix32(y); |
| 1160 | 1162 | const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); |
| 1161 | 1163 | int i; |
| r18794 | r18795 | |
| 1214 | 1216 | static MC6845_UPDATE_ROW( cga_gfx_4bpph_update_row ) |
| 1215 | 1217 | { |
| 1216 | 1218 | isa8_cga_device *cga = downcast<isa8_cga_device *>(device->owner()); |
| 1217 | | UINT8 *videoram = cga->m_vram; |
| 1219 | UINT8 *videoram = cga->m_vram + cga->m_start_offset; |
| 1218 | 1220 | UINT32 *p = &bitmap.pix32(y); |
| 1219 | 1221 | const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); |
| 1220 | 1222 | int i; |
| r18794 | r18795 | |
| 1259 | 1261 | static MC6845_UPDATE_ROW( cga_gfx_2bpp_update_row ) |
| 1260 | 1262 | { |
| 1261 | 1263 | isa8_cga_device *cga = downcast<isa8_cga_device *>(device->owner()); |
| 1262 | | UINT8 *videoram = cga->m_vram; |
| 1264 | UINT8 *videoram = cga->m_vram + cga->m_start_offset; |
| 1263 | 1265 | UINT32 *p = &bitmap.pix32(y); |
| 1264 | 1266 | const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); |
| 1265 | 1267 | int i; |
| r18794 | r18795 | |
| 1296 | 1298 | static MC6845_UPDATE_ROW( cga_gfx_1bpp_update_row ) |
| 1297 | 1299 | { |
| 1298 | 1300 | isa8_cga_device *cga = downcast<isa8_cga_device *>(device->owner()); |
| 1299 | | UINT8 *videoram = cga->m_vram; |
| 1301 | UINT8 *videoram = cga->m_vram + cga->m_start_offset; |
| 1300 | 1302 | UINT32 *p = &bitmap.pix32(y); |
| 1301 | 1303 | const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); |
| 1302 | 1304 | UINT8 fg = cga->m_color_select & 0x0F; |
| r18794 | r18795 | |
| 1798 | 1800 | static MC6845_UPDATE_ROW( pc1512_gfx_4bpp_update_row ) |
| 1799 | 1801 | { |
| 1800 | 1802 | isa8_cga_pc1512_device *cga = downcast<isa8_cga_pc1512_device *>(device->owner()); |
| 1801 | | UINT8 *videoram = cga->m_vram; |
| 1803 | UINT8 *videoram = cga->m_vram + cga->m_start_offset; |
| 1802 | 1804 | UINT32 *p = &bitmap.pix32(y); |
| 1803 | 1805 | const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); |
| 1804 | 1806 | UINT16 offset_base = ra << 13; |
| r18794 | r18795 | |
| 2033 | 2035 | membank("bank1")->set_base(m_vram + isa8_cga_pc1512_device::vram_offset[0]); |
| 2034 | 2036 | } |
| 2035 | 2037 | |
| 2038 | void isa8_wyse700_device::change_resolution(UINT8 mode) |
| 2039 | { |
| 2040 | int width = 0, height = 0; |
| 2041 | if (mode & 2) { |
| 2042 | machine().root_device().membank("bank_wy1")->set_base(m_vram + 0x10000); |
| 2043 | } else { |
| 2044 | machine().root_device().membank("bank_wy1")->set_base(m_vram); |
| 2045 | } |
| 2046 | if ((m_control & 0xf0) == (mode & 0xf0)) return; |
| 2047 | |
| 2048 | switch(mode & 0xf0) { |
| 2049 | case 0xc0: width = 1280; height = 800; break; |
| 2050 | case 0xa0: width = 1280; height = 400; break; |
| 2051 | case 0x80: width = 640; height = 400; break; |
| 2052 | case 0x00: width = 640; height = 400; break; // unhandled |
| 2053 | } |
| 2054 | rectangle visarea(0, width-1, 0, height-1); |
| 2055 | subdevice<screen_device>(CGA_SCREEN_NAME)->configure(width, height, visarea, HZ_TO_ATTOSECONDS(60)); |
| 2056 | |
| 2057 | } |
| 2058 | |
| 2059 | WRITE8_MEMBER( isa8_wyse700_device::io_write ) |
| 2060 | { |
| 2061 | switch (offset) |
| 2062 | { |
| 2063 | case 0xd: |
| 2064 | m_bank_offset = data; |
| 2065 | break; |
| 2066 | |
| 2067 | case 0xe: |
| 2068 | m_bank_base = data; |
| 2069 | break; |
| 2070 | |
| 2071 | case 0xf: |
| 2072 | change_resolution(data); |
| 2073 | m_control = data; |
| 2074 | break; |
| 2075 | default: |
| 2076 | isa8_cga_device::io_write(space, offset,data); |
| 2077 | break; |
| 2078 | } |
| 2079 | } |
| 2080 | |
| 2081 | |
| 2082 | READ8_MEMBER( isa8_wyse700_device::io_read ) |
| 2083 | { |
| 2084 | UINT8 data; |
| 2085 | |
| 2086 | switch (offset) |
| 2087 | { |
| 2088 | case 0xd: |
| 2089 | data = m_bank_offset; |
| 2090 | break; |
| 2091 | |
| 2092 | case 0xe: |
| 2093 | data = m_bank_base; |
| 2094 | break; |
| 2095 | |
| 2096 | case 0xf: |
| 2097 | data = m_control; |
| 2098 | break; |
| 2099 | default: |
| 2100 | data = isa8_cga_device::io_read(space, offset); |
| 2101 | break; |
| 2102 | } |
| 2103 | return data; |
| 2104 | } |
| 2105 | |
| 2106 | |
| 2107 | const device_type ISA8_WYSE700 = &device_creator<isa8_wyse700_device>; |
| 2108 | |
| 2109 | |
| 2110 | //------------------------------------------------- |
| 2111 | // isa8_wyse700_device - constructor |
| 2112 | //------------------------------------------------- |
| 2113 | |
| 2114 | isa8_wyse700_device::isa8_wyse700_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 2115 | isa8_cga_device( mconfig, ISA8_WYSE700, "Wyse 700", tag, owner, clock ) |
| 2116 | { |
| 2117 | m_vram_size = 0x20000; |
| 2118 | m_start_offset = 0x18000; |
| 2119 | } |
| 2120 | |
| 2121 | |
| 2122 | const rom_entry *isa8_wyse700_device::device_rom_region() const |
| 2123 | { |
| 2124 | return ROM_NAME( cga ); |
| 2125 | } |
| 2126 | |
| 2127 | //------------------------------------------------- |
| 2128 | // device_start - device-specific startup |
| 2129 | //------------------------------------------------- |
| 2130 | |
| 2131 | void isa8_wyse700_device::device_start() |
| 2132 | { |
| 2133 | isa8_cga_device::device_start(); |
| 2134 | |
| 2135 | m_isa->install_device(0x3d0, 0x3df, 0, 0, read8_delegate( FUNC(isa8_wyse700_device::io_read), this ), write8_delegate( FUNC(isa8_wyse700_device::io_write), this ) ); |
| 2136 | m_isa->install_bank(0xa0000, 0xaffff, 0, 0, "bank_wy1", m_vram); |
| 2137 | m_isa->install_bank(0xb0000, 0xbffff, 0, 0, "bank_cga", m_vram + 0x10000); |
| 2138 | } |
| 2139 | |
| 2140 | void isa8_wyse700_device::device_reset() |
| 2141 | { |
| 2142 | isa8_cga_device::device_reset(); |
| 2143 | m_control = 0; |
| 2144 | m_bank_offset = 0; |
| 2145 | m_bank_base = 0; |
| 2146 | } |
| 2147 | |
| 2148 | UINT32 isa8_wyse700_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) |
| 2149 | { |
| 2150 | if (m_control & 0x08) { |
| 2151 | const rgb_t *palette = palette_entry_list_raw(bitmap.palette()); |
| 2152 | UINT8 fg = m_color_select & 0x0F; |
| 2153 | UINT32 addr = 0; |
| 2154 | for (int y = 0; y < 800; y++) { |
| 2155 | UINT8 *src = m_vram + addr; |
| 2156 | |
| 2157 | if (y & 1) { |
| 2158 | src += 0x10000; |
| 2159 | addr += 160; |
| 2160 | } |
| 2161 | |
| 2162 | for (int x = 0; x < (1280 / 8); x++) { |
| 2163 | UINT8 val = src[x]; |
| 2164 | |
| 2165 | for (int i = 0; i < 8; i++) { |
| 2166 | bitmap.pix32(y,x*8+i) = (val & 0x80) ? palette[fg] : palette[0x00]; |
| 2167 | val <<= 1; |
| 2168 | } |
| 2169 | } |
| 2170 | } |
| 2171 | } else { |
| 2172 | return isa8_cga_device::screen_update(screen, bitmap, cliprect); |
| 2173 | } |
| 2174 | return 0; |
| 2175 | } |
trunk/src/mess/video/isa_cga.h
| r18794 | r18795 | |
| 48 | 48 | DECLARE_WRITE8_MEMBER( char_ram_write ); |
| 49 | 49 | DECLARE_WRITE_LINE_MEMBER( hsync_changed ); |
| 50 | 50 | DECLARE_WRITE_LINE_MEMBER( vsync_changed ); |
| 51 | | UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 51 | virtual UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 52 | 52 | |
| 53 | 53 | public: |
| 54 | 54 | int m_framecnt; |
| r18794 | r18795 | |
| 70 | 70 | bool m_superimpose; |
| 71 | 71 | UINT8 m_p3df; /* This should be moved into the appropriate subclass */ |
| 72 | 72 | UINT8 m_plantronics; /* This should be moved into the appropriate subclass */ |
| 73 | offs_t m_start_offset; |
| 73 | 74 | }; |
| 74 | 75 | |
| 75 | 76 | // device type definition |
| r18794 | r18795 | |
| 182 | 183 | // device type definition |
| 183 | 184 | extern const device_type ISA8_CGA_PC1512; |
| 184 | 185 | |
| 186 | // ======================> isa8_wyse700_device |
| 185 | 187 | |
| 188 | class isa8_wyse700_device : |
| 189 | public isa8_cga_device |
| 190 | { |
| 191 | public: |
| 192 | // construction/destruction |
| 193 | isa8_wyse700_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 194 | // optional information overrides |
| 195 | virtual const rom_entry *device_rom_region() const; |
| 196 | virtual void device_config_complete() { m_shortname = "wyse700"; } |
| 197 | |
| 198 | protected: |
| 199 | // device-level overrides |
| 200 | virtual void device_start(); |
| 201 | virtual void device_reset(); |
| 202 | |
| 203 | public: |
| 204 | virtual DECLARE_READ8_MEMBER( io_read ); |
| 205 | virtual DECLARE_WRITE8_MEMBER( io_write ); |
| 206 | virtual UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 207 | void change_resolution(UINT8 mode); |
| 208 | |
| 209 | UINT8 m_bank_offset; |
| 210 | UINT8 m_bank_base; |
| 211 | UINT8 m_control; |
| 212 | }; |
| 213 | |
| 214 | // device type definition |
| 215 | extern const device_type ISA8_WYSE700; |
| 216 | |
| 186 | 217 | #endif /* __ISA_CGA_H__ */ |
| 187 | 218 | |