trunk/src/devices/bus/isa/cga.cpp
| r250271 | r250272 | |
| 183 | 183 | if (m_update_row_type == -1) |
| 184 | 184 | return; |
| 185 | 185 | |
| 186 | y = m_y; |
| 187 | if(m_y >= bitmap.height()) |
| 188 | return; |
| 189 | |
| 186 | 190 | switch (m_update_row_type) |
| 187 | 191 | { |
| 188 | 192 | case CGA_TEXT_INTEN: |
| r250271 | r250272 | |
| 253 | 257 | MCFG_MC6845_UPDATE_ROW_CB(isa8_cga_device, crtc_update_row) |
| 254 | 258 | MCFG_MC6845_OUT_HSYNC_CB(WRITELINE(isa8_cga_device, hsync_changed)) |
| 255 | 259 | MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(isa8_cga_device, vsync_changed)) |
| 260 | MCFG_MC6845_RECONFIGURE_CB(isa8_cga_device, reconfigure) |
| 261 | MCFG_VIDEO_SET_SCREEN(NULL) |
| 256 | 262 | MACHINE_CONFIG_END |
| 257 | 263 | |
| 258 | 264 | |
| r250271 | r250272 | |
| 304 | 310 | m_cga_config(*this, "cga_config"), m_framecnt(0), m_mode_control(0), m_color_select(0), |
| 305 | 311 | m_update_row_type(-1), m_chr_gen_base(nullptr), m_chr_gen(nullptr), m_vsync(0), m_hsync(0), |
| 306 | 312 | m_vram_size( 0x4000 ), m_plantronics(0), |
| 307 | | m_palette(*this, "palette") |
| 313 | m_palette(*this, "palette"), |
| 314 | m_screen(*this, "screen") |
| 308 | 315 | { |
| 309 | 316 | m_chr_gen_offset[0] = m_chr_gen_offset[2] = 0x1800; |
| 310 | 317 | m_chr_gen_offset[1] = m_chr_gen_offset[3] = 0x1000; |
| r250271 | r250272 | |
| 319 | 326 | m_cga_config(*this, "cga_config"), m_framecnt(0), m_mode_control(0), m_color_select(0), |
| 320 | 327 | m_update_row_type(-1), m_chr_gen_base(nullptr), m_chr_gen(nullptr), m_vsync(0), m_hsync(0), |
| 321 | 328 | m_vram_size( 0x4000 ), m_plantronics(0), |
| 322 | | m_palette(*this, "palette") |
| 329 | m_palette(*this, "palette"), |
| 330 | m_screen(*this, "screen") |
| 323 | 331 | { |
| 324 | 332 | m_chr_gen_offset[0] = m_chr_gen_offset[2] = 0x1800; |
| 325 | 333 | m_chr_gen_offset[1] = m_chr_gen_offset[3] = 0x1000; |
| r250271 | r250272 | |
| 346 | 354 | /* Initialise the cga palette */ |
| 347 | 355 | int i; |
| 348 | 356 | |
| 357 | |
| 349 | 358 | for ( i = 0; i < CGA_PALETTE_SETS * 16; i++ ) |
| 350 | 359 | { |
| 351 | 360 | m_palette->set_pen_color( i, cga_palette[i][0], cga_palette[i][1], cga_palette[i][2] ); |
| r250271 | r250272 | |
| 376 | 385 | save_item(NAME(m_hsync)); |
| 377 | 386 | save_item(NAME(m_vram)); |
| 378 | 387 | save_item(NAME(m_plantronics)); |
| 388 | save_item(NAME(m_y)); |
| 379 | 389 | } |
| 380 | 390 | |
| 381 | 391 | |
| r250271 | r250272 | |
| 390 | 400 | m_vsync = 0; |
| 391 | 401 | m_hsync = 0; |
| 392 | 402 | m_color_select = 0; |
| 403 | m_y = 0; |
| 393 | 404 | memset(m_palette_lut_2bpp, 0, sizeof(m_palette_lut_2bpp)); |
| 394 | 405 | } |
| 395 | 406 | |
| r250271 | r250272 | |
| 911 | 922 | WRITE_LINE_MEMBER( isa8_cga_device::hsync_changed ) |
| 912 | 923 | { |
| 913 | 924 | m_hsync = state ? 1 : 0; |
| 925 | if(state && !m_vsync) |
| 926 | { |
| 927 | m_screen->update_now(); |
| 928 | m_y++; |
| 929 | } |
| 914 | 930 | } |
| 915 | 931 | |
| 916 | 932 | |
| 917 | 933 | WRITE_LINE_MEMBER( isa8_cga_device::vsync_changed ) |
| 918 | 934 | { |
| 919 | | m_vsync = state ? 9 : 0; |
| 920 | 935 | if ( state ) |
| 921 | 936 | { |
| 922 | 937 | m_framecnt++; |
| 923 | 938 | } |
| 939 | else |
| 940 | { |
| 941 | m_screen->reset_origin(); |
| 942 | m_y = 0; |
| 943 | } |
| 944 | m_vsync = state ? 9 : 0; |
| 924 | 945 | } |
| 925 | 946 | |
| 947 | MC6845_RECONFIGURE( isa8_cga_device::reconfigure ) |
| 948 | { |
| 949 | rectangle curvisarea = m_screen->visible_area(); |
| 950 | m_screen->set_visible_area(visarea.min_x, visarea.max_x, curvisarea.min_y, curvisarea.max_y); |
| 951 | } |
| 926 | 952 | |
| 927 | 953 | void isa8_cga_device::set_palette_luts(void) |
| 928 | 954 | { |
| r250271 | r250272 | |
| 1893 | 1919 | |
| 1894 | 1920 | const device_type ISA8_CGA_M24 = &device_creator<isa8_cga_m24_device>; |
| 1895 | 1921 | |
| 1922 | static MACHINE_CONFIG_DERIVED( m24, cga ) |
| 1923 | MCFG_DEVICE_MODIFY(CGA_SCREEN_NAME) |
| 1924 | MCFG_SCREEN_RAW_PARAMS(XTAL_14_31818MHz,912,0,640,462,0,400) |
| 1925 | MCFG_DEVICE_MODIFY(CGA_MC6845_NAME) |
| 1926 | MCFG_MC6845_RECONFIGURE_CB(isa8_cga_m24_device, reconfigure) |
| 1927 | MACHINE_CONFIG_END |
| 1928 | |
| 1929 | machine_config_constructor isa8_cga_m24_device::device_mconfig_additions() const |
| 1930 | { |
| 1931 | return MACHINE_CONFIG_NAME( m24 ); |
| 1932 | } |
| 1896 | 1933 | isa8_cga_m24_device::isa8_cga_m24_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : |
| 1897 | 1934 | isa8_cga_device( mconfig, ISA8_CGA_M24, "Olivetti M24 CGA", tag, owner, clock, "cga_m24", __FILE__), m_mode2(0), m_index(0) |
| 1898 | 1935 | { |
| r250271 | r250272 | |
| 1906 | 1943 | m_start_offset = 0; |
| 1907 | 1944 | } |
| 1908 | 1945 | |
| 1946 | MC6845_RECONFIGURE( isa8_cga_m24_device::reconfigure ) |
| 1947 | { |
| 1948 | // just reconfigure the screen, the apb sets it to 256 lines rather than 400 |
| 1949 | m_screen->configure(width, height, visarea, frame_period); |
| 1950 | } |
| 1951 | |
| 1909 | 1952 | WRITE8_MEMBER( isa8_cga_m24_device::io_write ) |
| 1910 | 1953 | { |
| 1911 | 1954 | mc6845_device *mc6845 = subdevice<mc6845_device>(CGA_MC6845_NAME); |
trunk/src/devices/bus/isa/cga.h
| r250271 | r250272 | |
| 61 | 61 | DECLARE_WRITE_LINE_MEMBER( hsync_changed ); |
| 62 | 62 | DECLARE_WRITE_LINE_MEMBER( vsync_changed ); |
| 63 | 63 | virtual UINT32 screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect); |
| 64 | | |
| 64 | MC6845_RECONFIGURE(reconfigure); |
| 65 | 65 | public: |
| 66 | 66 | int m_framecnt; |
| 67 | 67 | |
| r250271 | r250272 | |
| 69 | 69 | UINT8 m_color_select; /* wo 0x3d9 */ |
| 70 | 70 | //UINT8 m_status; //unused? /* ro 0x3da */ |
| 71 | 71 | |
| 72 | | int m_update_row_type; |
| 72 | int m_update_row_type, m_y; |
| 73 | 73 | UINT8 m_palette_lut_2bpp[4]; |
| 74 | 74 | offs_t m_chr_gen_offset[4]; |
| 75 | 75 | UINT8 m_font_selection_mask; |
| r250271 | r250272 | |
| 83 | 83 | UINT8 m_plantronics; /* This should be moved into the appropriate subclass */ |
| 84 | 84 | offs_t m_start_offset; |
| 85 | 85 | required_device<palette_device> m_palette; |
| 86 | required_device<screen_device> m_screen; |
| 86 | 87 | }; |
| 87 | 88 | |
| 88 | 89 | // device type definition |
| r250271 | r250272 | |
| 268 | 269 | public: |
| 269 | 270 | // construction/destruction |
| 270 | 271 | isa8_cga_m24_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); |
| 272 | virtual machine_config_constructor device_mconfig_additions() const; |
| 271 | 273 | // optional information overrides |
| 272 | 274 | //virtual const rom_entry *device_rom_region() const; |
| 273 | 275 | virtual DECLARE_READ8_MEMBER( io_read ); |
| 274 | 276 | virtual DECLARE_WRITE8_MEMBER( io_write ); |
| 275 | 277 | virtual MC6845_UPDATE_ROW( crtc_update_row ); |
| 276 | 278 | MC6845_UPDATE_ROW( m24_gfx_1bpp_m24_update_row ); |
| 279 | MC6845_RECONFIGURE(reconfigure); |
| 277 | 280 | protected: |
| 278 | 281 | virtual void device_reset(); |
| 279 | 282 | private: |