i8244: use device rom instead of lookup table for character set [Kevin Horton]

This commit is contained in:
hap 2020-08-03 13:14:35 +02:00
parent 0a657cb32f
commit 2f06decdbf
4 changed files with 22 additions and 78 deletions

View File

@ -2,8 +2,6 @@
// copyright-holders:Wilbert Pol
/***************************************************************************
ef9340_1.h
Thomson EF9340 + EF9341 teletext graphics chips with 1KB external
character ram.

View File

@ -2,8 +2,6 @@
// copyright-holders:Wilbert Pol
/***************************************************************************
ef9340_1.h
Thomson EF9340 + EF9341 teletext graphics chips with 1KB external
character ram.

View File

@ -5,8 +5,6 @@
Intel 8244 (NTSC)/8245 (PAL) Graphics and sound chip
TODO:
- make the character rom external, but first verify it is correct (the table
below has 0x3f characters, it is missing 8 bytes)
- NTSC has 263 scanlines, PAL has 313 scanlines, a quick fix will probably
cause small regressions here and there
- PAL has 228 clocks per line (so, 456 half clocks)
@ -25,76 +23,6 @@ DEFINE_DEVICE_TYPE(I8244, i8244_device, "i8244", "Intel 8244")
DEFINE_DEVICE_TYPE(I8245, i8245_device, "i8245", "Intel 8245")
// Kevtris verified that the data below matches a dump
// taken from a real chip.
static const uint8_t c_shape[0x40 * 8] =
{
0x7C,0xC6,0xC6,0xC6,0xC6,0xC6,0x7C,0x00, // 0
0x18,0x38,0x18,0x18,0x18,0x18,0x3C,0x00,
0x3C,0x66,0x0C,0x18,0x30,0x60,0x7E,0x00,
0x7C,0xC6,0x06,0x3C,0x06,0xC6,0x7C,0x00,
0xCC,0xCC,0xCC,0xFE,0x0C,0x0C,0x0C,0x00,
0xFE,0xC0,0xC0,0x7C,0x06,0xC6,0x7C,0x00,
0x7C,0xC6,0xC0,0xFC,0xC6,0xC6,0x7C,0x00,
0xFE,0x06,0x0C,0x18,0x30,0x60,0xC0,0x00,
0x7C,0xC6,0xC6,0x7C,0xC6,0xC6,0x7C,0x00,
0x7C,0xC6,0xC6,0x7E,0x06,0xC6,0x7C,0x00,
0x00,0x18,0x18,0x00,0x18,0x18,0x00,0x00,
0x18,0x7E,0x58,0x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0xEE,0xFE,0xD6,0xC6,0xC6,0xC6,0x00,
0x00,0x00,0x00,0x00,0x00,0x18,0x18,0x00,
0x00,0x00,0x00,0x7E,0x00,0x00,0x00,0x00,
0x00,0x66,0x3C,0x18,0x3C,0x66,0x00,0x00,
0x00,0x18,0x00,0x7E,0x00,0x18,0x00,0x00,
0x00,0x00,0x7E,0x00,0x7E,0x00,0x00,0x00,
0x66,0x66,0x66,0x3C,0x18,0x18,0x18,0x00,
0xC6,0xE6,0xF6,0xFE,0xDE,0xCE,0xC6,0x00,
0x03,0x06,0x0C,0x18,0x30,0x60,0xC0,0x00,
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0x00,
0xCE,0xDB,0xDB,0xDB,0xDB,0xDB,0xCE,0x00,
0x00,0x00,0x3C,0x7E,0x7E,0x7E,0x3C,0x00,
0x1C,0x1C,0x18,0x1E,0x18,0x18,0x1C,0x00,
0x1C,0x1C,0x18,0x1E,0x18,0x34,0x26,0x00,
0x38,0x38,0x18,0x78,0x18,0x2C,0x64,0x00,
0x38,0x38,0x18,0x78,0x18,0x18,0x38,0x00,
0x00,0x18,0x0C,0xFE,0x0C,0x18,0x00,0x00,
0x18,0x3C,0x7E,0xFF,0xFF,0x18,0x18,0x00,
0x03,0x07,0x0F,0x1F,0x3F,0x7F,0xFF,0x00,
0xC0,0xE0,0xF0,0xF8,0xFC,0xFE,0xFF,0x00,
0x38,0x38,0x12,0xFE,0xB8,0x28,0x6C,0x00,
0xC0,0x60,0x30,0x18,0x0C,0x06,0x03,0x00,
0x00,0x00,0x0C,0x08,0x08,0x7F,0x3E,0x00,
0x00,0x03,0x63,0xFF,0xFF,0x18,0x08,0x00,
0x00,0x00,0x00,0x10,0x38,0xFF,0x7E,0x00
};
// Background and grid information is stored in RGB format
// while the character and sprite colors are stored in BGR
// format.
@ -120,6 +48,7 @@ i8244_device::i8244_device(const machine_config &mconfig, device_type type, cons
, device_video_interface(mconfig, *this)
, m_irq_func(*this)
, m_postprocess_func(*this)
, m_charset(*this, "cgrom")
, m_start_vpos(START_Y)
, m_start_vblank(START_Y + SCREEN_HEIGHT)
, m_screen_lines(lines)
@ -133,6 +62,22 @@ i8245_device::i8245_device(const machine_config &mconfig, const char *tag, devic
}
//-------------------------------------------------
// internal character set rom
//-------------------------------------------------
ROM_START( i8244 )
ROM_REGION( 0x200, "cgrom", 0 )
ROM_LOAD( "charset_i8244.bin", 0x0000, 0x0200, CRC(b46a3f31) SHA1(415382715455b47b69401b3d60bd8f0036dd7fef) )
ROM_END
const tiny_rom_entry *i8244_device::device_rom_region() const
{
return ROM_NAME( i8244 );
}
//-------------------------------------------------
// device_config_complete - perform any
// operations now that the configuration is
@ -525,7 +470,7 @@ void i8244_device::render_scanline(int vpos)
{
uint16_t color = 8 + bgr2rgb[ ( ( m_vdc.s.foreground[i].color >> 1 ) & 0x07 ) ];
int offset = ( m_vdc.s.foreground[i].ptr | ( ( m_vdc.s.foreground[i].color & 0x01 ) << 8 ) ) + ( y >> 1 ) + ( ( scanline - y ) >> 1 );
uint8_t chr = c_shape[ offset & 0x1FF ];
uint8_t chr = m_charset[ offset & 0x1FF ];
int x = m_vdc.s.foreground[i].x;
for ( uint8_t m = 0x80; m > 0; m >>= 1, x++ )
@ -572,7 +517,7 @@ void i8244_device::render_scanline(int vpos)
{
uint16_t color = 8 + bgr2rgb[ ( ( m_vdc.s.quad[i].single[j].color >> 1 ) & 0x07 ) ];
int offset = ( m_vdc.s.quad[i].single[j].ptr | ( ( m_vdc.s.quad[i].single[j].color & 0x01 ) << 8 ) ) + ( y >> 1 ) + ( ( scanline - y ) >> 1 );
uint8_t chr = c_shape[ offset & 0x1FF ];
uint8_t chr = m_charset[ offset & 0x1FF ];
for ( uint8_t m = 0x80; m > 0; m >>= 1, x++ )
{

View File

@ -92,6 +92,7 @@ protected:
virtual void device_start() override;
virtual void device_reset() override;
virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override;
virtual const tiny_rom_entry *device_rom_region() const override;
// device_sound_interface overrides
virtual void sound_stream_update(sound_stream &stream, stream_sample_t **inputs, stream_sample_t **outputs, int samples) override;
@ -112,6 +113,8 @@ protected:
devcb_write_line m_irq_func;
devcb_write16 m_postprocess_func;
required_region_ptr<uint8_t> m_charset;
bitmap_ind16 m_tmp_bitmap;
emu_timer *m_line_timer;
emu_timer *m_hblank_timer;