ega: fix colors

This commit is contained in:
cracyc 2023-07-27 19:44:34 -05:00
parent 5a5cc86bee
commit f3eb1f4689
2 changed files with 21 additions and 15 deletions

View file

@ -446,8 +446,6 @@ located at I/O port 0x3CE, and a data register located at I/O port 0x3CF.
#include "emu.h"
#include "ega.h"
#include "screen.h"
#define LOG_READ (1U << 1)
#define LOG_SETUP (1U << 2)
#define LOG_MODE (1U << 3)
@ -539,10 +537,10 @@ DEFINE_DEVICE_TYPE(ISA8_EGA, isa8_ega_device, "ega", "IBM Enhanced Graphics Adap
void isa8_ega_device::device_add_mconfig(machine_config &config)
{
screen_device &screen(SCREEN(config, EGA_SCREEN_NAME, SCREEN_TYPE_RASTER));
screen.set_raw(16.257_MHz_XTAL, 912, 0, 640, 262, 0, 200);
screen.set_screen_update(EGA_CRTC_NAME, FUNC(crtc_ega_device::screen_update));
screen.set_palette(m_palette);
SCREEN(config, m_screen, SCREEN_TYPE_RASTER);
m_screen->set_raw(16.257_MHz_XTAL, 912, 0, 640, 262, 0, 200);
m_screen->set_screen_update(EGA_CRTC_NAME, FUNC(crtc_ega_device::screen_update));
m_screen->set_palette(m_palette);
PALETTE(config, m_palette).set_entries(64);
@ -589,7 +587,7 @@ isa8_ega_device::isa8_ega_device(const machine_config &mconfig, device_type type
device_isa8_card_interface(mconfig, *this),
m_crtc_ega(*this, EGA_CRTC_NAME), m_videoram(nullptr), m_charA(nullptr), m_charB(nullptr),
m_misc_output(0), m_feature_control(0), m_frame_cnt(0), m_hsync(0), m_vsync(0), m_vblank(0), m_display_enable(0), m_irq(0), m_video_mode(0),
m_palette(*this, "palette")
m_palette(*this, "palette"), m_screen(*this, EGA_SCREEN_NAME)
{
}
@ -863,21 +861,27 @@ CRTC_EGA_PIXEL_UPDATE( isa8_ega_device::pc_ega_text )
uint8_t chr = m_plane[0][ offset ];
uint8_t attr = m_plane[1][ offset ];
uint8_t data;
uint16_t fg = m_attribute.data[ attr & 0x07 ];
uint16_t bg = m_attribute.data[ ( attr >> 4 ) & 0x07 ];
uint8_t blink = m_attribute.data[0x10] & 0x08;
uint16_t fg = m_attribute.data[ attr & 0x0f ];
uint16_t bg = m_attribute.data[ ( attr >> 4 ) & (blink ? 0x07 : 0x0f) ];
/* If character set A and B are equal attribute bit 3 is used as intensity */
if ( m_charA == m_charB )
{
/* intensity selector */
data = m_charB[ chr * 32 + ra ];
if ( !( m_attribute.data[0x10] & 0x08 ) )
fg = m_attribute.data[ attr & 0x0f ];
}
else
{
/* character set selector */
data = ( attr & 0x08 ) ? m_charA[ chr * 32 + ra ] : m_charB[ chr * 32 + ra ];
fg &= 0x07;
}
if(m_screen->visible_area().height() == 200) // the ibm 5154 forces cga compatibility in 200 line modes
{
fg = fg | (BIT(fg, 4) ? 0x38 : 0);
if ( fg == 6 )
fg = 0x14;
bg = bg | (BIT(bg, 4) ? 0x38 : 0);
if ( bg == 6 )
bg = 0x14;
}
if ( x == cursor_x )

View file

@ -7,6 +7,7 @@
#include "isa.h"
#include "video/crtc_ega.h"
#include "screen.h"
#include "emupal.h"
//**************************************************************************
@ -107,6 +108,7 @@ public:
uint8_t m_irq;
int m_video_mode;
required_device<palette_device> m_palette;
required_device<screen_device> m_screen;
};