diff options
Diffstat (limited to 'src/devices/bus/isa/cga.cpp')
-rw-r--r-- | src/devices/bus/isa/cga.cpp | 65 |
1 files changed, 54 insertions, 11 deletions
diff --git a/src/devices/bus/isa/cga.cpp b/src/devices/bus/isa/cga.cpp index 47f72f22121..888318f65d7 100644 --- a/src/devices/bus/isa/cga.cpp +++ b/src/devices/bus/isa/cga.cpp @@ -183,6 +183,10 @@ MC6845_UPDATE_ROW( isa8_cga_device::crtc_update_row ) if (m_update_row_type == -1) return; + y = m_y; + if(m_y >= bitmap.height()) + return; + switch (m_update_row_type) { case CGA_TEXT_INTEN: @@ -253,6 +257,8 @@ static MACHINE_CONFIG_FRAGMENT( cga ) MCFG_MC6845_UPDATE_ROW_CB(isa8_cga_device, crtc_update_row) MCFG_MC6845_OUT_HSYNC_CB(WRITELINE(isa8_cga_device, hsync_changed)) MCFG_MC6845_OUT_VSYNC_CB(WRITELINE(isa8_cga_device, vsync_changed)) + MCFG_MC6845_RECONFIGURE_CB(isa8_cga_device, reconfigure) + MCFG_VIDEO_SET_SCREEN(nullptr) MACHINE_CONFIG_END @@ -302,9 +308,10 @@ isa8_cga_device::isa8_cga_device(const machine_config &mconfig, const char *tag, device_t(mconfig, ISA8_CGA, "IBM Color/Graphics Monitor Adapter", tag, owner, clock, "cga", __FILE__), device_isa8_card_interface(mconfig, *this), m_cga_config(*this, "cga_config"), m_framecnt(0), m_mode_control(0), m_color_select(0), - m_update_row_type(-1), m_chr_gen_base(nullptr), m_chr_gen(nullptr), m_vsync(0), m_hsync(0), + m_update_row_type(-1), m_y(0), m_chr_gen_base(nullptr), m_chr_gen(nullptr), m_vsync(0), m_hsync(0), m_vram_size( 0x4000 ), m_plantronics(0), - m_palette(*this, "palette") + m_palette(*this, "palette"), + m_screen(*this, "screen") { m_chr_gen_offset[0] = m_chr_gen_offset[2] = 0x1800; m_chr_gen_offset[1] = m_chr_gen_offset[3] = 0x1000; @@ -317,9 +324,10 @@ isa8_cga_device::isa8_cga_device(const machine_config &mconfig, device_type type device_t(mconfig, type, name, tag, owner, clock, shortname, source), device_isa8_card_interface(mconfig, *this), m_cga_config(*this, "cga_config"), m_framecnt(0), m_mode_control(0), m_color_select(0), - m_update_row_type(-1), m_chr_gen_base(nullptr), m_chr_gen(nullptr), m_vsync(0), m_hsync(0), + m_update_row_type(-1), m_y(0), m_chr_gen_base(nullptr), m_chr_gen(nullptr), m_vsync(0), m_hsync(0), m_vram_size( 0x4000 ), m_plantronics(0), - m_palette(*this, "palette") + m_palette(*this, "palette"), + m_screen(*this, "screen") { m_chr_gen_offset[0] = m_chr_gen_offset[2] = 0x1800; m_chr_gen_offset[1] = m_chr_gen_offset[3] = 0x1000; @@ -335,7 +343,7 @@ isa8_cga_device::isa8_cga_device(const machine_config &mconfig, device_type type void isa8_cga_device::device_start() { - if (m_palette != NULL && !m_palette->started()) + if (m_palette != nullptr && !m_palette->started()) throw device_missing_dependencies(); set_isa_device(); @@ -346,6 +354,7 @@ void isa8_cga_device::device_start() /* Initialise the cga palette */ int i; + for ( i = 0; i < CGA_PALETTE_SETS * 16; i++ ) { m_palette->set_pen_color( i, cga_palette[i][0], cga_palette[i][1], cga_palette[i][2] ); @@ -376,6 +385,7 @@ void isa8_cga_device::device_start() save_item(NAME(m_hsync)); save_item(NAME(m_vram)); save_item(NAME(m_plantronics)); + save_item(NAME(m_y)); } @@ -390,6 +400,7 @@ void isa8_cga_device::device_reset() m_vsync = 0; m_hsync = 0; m_color_select = 0; + m_y = 0; memset(m_palette_lut_2bpp, 0, sizeof(m_palette_lut_2bpp)); } @@ -911,18 +922,33 @@ MC6845_UPDATE_ROW( isa8_cga_device::cga_gfx_1bpp_update_row ) WRITE_LINE_MEMBER( isa8_cga_device::hsync_changed ) { m_hsync = state ? 1 : 0; + if(state && !m_vsync) + { + m_screen->update_now(); + m_y++; + } } WRITE_LINE_MEMBER( isa8_cga_device::vsync_changed ) { - m_vsync = state ? 9 : 0; if ( state ) { m_framecnt++; } + else + { + m_screen->reset_origin(); + m_y = 0; + } + m_vsync = state ? 9 : 0; } +MC6845_RECONFIGURE( isa8_cga_device::reconfigure ) +{ + rectangle curvisarea = m_screen->visible_area(); + m_screen->set_visible_area(visarea.min_x, visarea.max_x, curvisarea.min_y, curvisarea.max_y); +} void isa8_cga_device::set_palette_luts(void) { @@ -1165,7 +1191,7 @@ WRITE8_MEMBER( isa8_cga_device::io_write ) // proc = cga_pgfx_4bpp; // -//INLINE void pgfx_plot_unit_4bpp(bitmap_ind16 &bitmap, +//static inline void pgfx_plot_unit_4bpp(bitmap_ind16 &bitmap, // int x, int y, int offs) //{ // int color, values[2]; @@ -1233,7 +1259,7 @@ WRITE8_MEMBER( isa8_cga_device::io_write ) // // // -//INLINE void pgfx_plot_unit_2bpp(bitmap_ind16 &bitmap, +//static inline void pgfx_plot_unit_2bpp(bitmap_ind16 &bitmap, // int x, int y, const UINT16 *palette, int offs) //{ // int i; @@ -1535,7 +1561,7 @@ isa8_cga_pc1512_device::isa8_cga_pc1512_device(const machine_config &mconfig, co const rom_entry *isa8_cga_pc1512_device::device_rom_region() const { - return NULL; + return nullptr; } @@ -1567,9 +1593,9 @@ void isa8_cga_pc1512_device::device_reset() m_write = 0x0f; m_read = 0; m_mc6845_address = 0; - for ( int i = 0; i < 31; i++ ) + for (auto & elem : m_mc6845_locked_register) { - m_mc6845_locked_register[i] = 0; + elem = 0; } membank("bank1")->set_base(&m_vram[isa8_cga_pc1512_device::vram_offset[0]]); @@ -1893,6 +1919,17 @@ const rom_entry *isa8_cga_mc1502_device::device_rom_region() const const device_type ISA8_CGA_M24 = &device_creator<isa8_cga_m24_device>; +static MACHINE_CONFIG_DERIVED( m24, cga ) + MCFG_DEVICE_MODIFY(CGA_SCREEN_NAME) + MCFG_SCREEN_RAW_PARAMS(XTAL_14_31818MHz,912,0,640,462,0,400) + MCFG_DEVICE_MODIFY(CGA_MC6845_NAME) + MCFG_MC6845_RECONFIGURE_CB(isa8_cga_m24_device, reconfigure) +MACHINE_CONFIG_END + +machine_config_constructor isa8_cga_m24_device::device_mconfig_additions() const +{ + return MACHINE_CONFIG_NAME( m24 ); +} isa8_cga_m24_device::isa8_cga_m24_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : isa8_cga_device( mconfig, ISA8_CGA_M24, "Olivetti M24 CGA", tag, owner, clock, "cga_m24", __FILE__), m_mode2(0), m_index(0) { @@ -1906,6 +1943,12 @@ void isa8_cga_m24_device::device_reset() m_start_offset = 0; } +MC6845_RECONFIGURE( isa8_cga_m24_device::reconfigure ) +{ + // just reconfigure the screen, the apb sets it to 256 lines rather than 400 + m_screen->configure(width, height, visarea, frame_period); +} + WRITE8_MEMBER( isa8_cga_m24_device::io_write ) { mc6845_device *mc6845 = subdevice<mc6845_device>(CGA_MC6845_NAME); |