From 30e34256b1d967dee59551a3ae3ca2725dc74f1a Mon Sep 17 00:00:00 2001 From: Curt Coder Date: Tue, 28 Mar 2023 13:26:55 +0300 Subject: abc80: Devicify the SN74S263 character generator. [Curt Coder] --- scripts/src/video.lua | 12 +++++ src/devices/video/sn74s262.cpp | 103 +++++++++++++++++++++++++++++++++++++++++ src/devices/video/sn74s262.h | 73 +++++++++++++++++++++++++++++ src/mame/luxor/abc80.cpp | 3 -- src/mame/luxor/abc80.h | 6 ++- src/mame/luxor/abc80_v.cpp | 35 ++------------ 6 files changed, 195 insertions(+), 37 deletions(-) create mode 100644 src/devices/video/sn74s262.cpp create mode 100644 src/devices/video/sn74s262.h diff --git a/scripts/src/video.lua b/scripts/src/video.lua index 6635543366e..b4c27394006 100644 --- a/scripts/src/video.lua +++ b/scripts/src/video.lua @@ -897,6 +897,18 @@ if (VIDEOS["SAA5240"]~=null) then } end +-------------------------------------------------- +-- +--@src/devices/video/sn74s262.h,VIDEOS["SN74S262"] = true +-------------------------------------------------- + +if (VIDEOS["SN74S262"]~=null) then + files { + MAME_DIR .. "src/devices/video/sn74s262.cpp", + MAME_DIR .. "src/devices/video/sn74s262.h", + } +end + -------------------------------------------------- -- --@src/devices/video/pwm.h,VIDEOS["PWM_DISPLAY"] = true diff --git a/src/devices/video/sn74s262.cpp b/src/devices/video/sn74s262.cpp new file mode 100644 index 00000000000..5aed0d378f3 --- /dev/null +++ b/src/devices/video/sn74s262.cpp @@ -0,0 +1,103 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Texas Instruments SN74S262N Row Output Character Generator emulation + +**********************************************************************/ + +#include "emu.h" +#include "sn74s262.h" + + +//************************************************************************** +// DEVICE DEFINITIONS +//************************************************************************** + +DEFINE_DEVICE_TYPE(SN74S262, sn74s262_device, "sn74s262", "SN74S262N Row Output Character Generator") +DEFINE_DEVICE_TYPE(SN74S263, sn74s263_device, "sn74s263", "SN74S263N Row Output Character Generator") + + +//------------------------------------------------- +// ROM( sn74s262 ) +//------------------------------------------------- + +ROM_START( sn74s262 ) + ROM_REGION( 0xa00, "chargen", 0 ) + ROM_LOAD( "sn74s262.h2", 0x000, 0xa00, NO_DUMP ) +ROM_END + + +//------------------------------------------------- +// ROM( sn74s263 ) +//------------------------------------------------- + +ROM_START( sn74s263 ) + ROM_REGION( 0xa00, "chargen", 0 ) + ROM_LOAD( "sn74s263.h2", 0x000, 0xa00, BAD_DUMP CRC(9e064e91) SHA1(354783c8f2865f73dc55918c9810c66f3aca751f) ) // created by hand +ROM_END + + +//------------------------------------------------- +// rom_region - device-specific ROM region +//------------------------------------------------- + +const tiny_rom_entry *sn74s262_device::device_rom_region() const +{ + return ROM_NAME( sn74s262 ); +} + +const tiny_rom_entry *sn74s263_device::device_rom_region() const +{ + return ROM_NAME( sn74s263 ); +} + + +//------------------------------------------------- +// device_start - device-specific startup +//------------------------------------------------- + +void sn74s262_device::device_start() +{ +} + + + +//************************************************************************** +// LIVE DEVICE +//************************************************************************** + +//------------------------------------------------- +// sn74s262_device - constructor +//------------------------------------------------- + +sn74s262_device::sn74s262_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock) : + device_t(mconfig, type, tag, owner, clock), + m_char_rom(*this, "chargen") +{ +} + +sn74s262_device::sn74s262_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + sn74s262_device(mconfig, SN74S262, tag, owner, clock) +{ +} + +sn74s263_device::sn74s263_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : + sn74s262_device(mconfig, SN74S263, tag, owner, clock) +{ +} + + +//------------------------------------------------- +// read - +//------------------------------------------------- + +u8 sn74s262_device::read(u8 character, u8 row) +{ + if ((row & 0xf) > 8) + { + return 0; + } + + return m_char_rom[((character & 0x7f) * 10) + (row & 0xf)]; +} diff --git a/src/devices/video/sn74s262.h b/src/devices/video/sn74s262.h new file mode 100644 index 00000000000..703eb90de43 --- /dev/null +++ b/src/devices/video/sn74s262.h @@ -0,0 +1,73 @@ +// license:BSD-3-Clause +// copyright-holders:Curt Coder +/********************************************************************** + + Texas Instruments SN74S262N Row Output Character Generator emulation + +********************************************************************** + _____ _____ + CHAR E 1 |* \_/ | 20 Vcc + CHAR F 2 | | 19 CHAR D + CHAR G 3 | | 18 CHAR C + ROW A 4 | | 17 CHAR B + ROW B 5 | SN74S262N | 16 CHAR A + ROW C 6 | SN74S263N | 15 _Me1 + ROW D 7 | | 14 _Me2 + Y1 8 | | 13 Y5 + Y2 9 | | 12 Y4 + GND 10 |_____________| 11 Y3 + +**********************************************************************/ + +#ifndef MAME_VIDEO_SN74S262_H +#define MAME_VIDEO_SN74S262_H + +#pragma once + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +// ======================> sn74s262_device + +class sn74s262_device : public device_t +{ +public: + // construction/destruction + sn74s262_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // optional information overrides + virtual const tiny_rom_entry *device_rom_region() const override; + + u8 read(u8 character, u8 row); + +protected: + sn74s262_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + + // device-level overrides + virtual void device_start() override; + +private: + required_region_ptr m_char_rom; +}; + + +// ======================> sn74s263_device + +class sn74s263_device : public sn74s262_device +{ +public: + // construction/destruction + sn74s263_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + // optional information overrides + virtual const tiny_rom_entry *device_rom_region() const override; +}; + + +// device type definition +DECLARE_DEVICE_TYPE(SN74S262, sn74s262_device) // English +DECLARE_DEVICE_TYPE(SN74S263, sn74s263_device) // Swedish/Finnish + +#endif // MAME_VIDEO_SN74S262_H diff --git a/src/mame/luxor/abc80.cpp b/src/mame/luxor/abc80.cpp index d59d54d6ac4..8549997f764 100644 --- a/src/mame/luxor/abc80.cpp +++ b/src/mame/luxor/abc80.cpp @@ -576,9 +576,6 @@ ROM_START( abc80 ) ROMX_LOAD( "3508_3_v2.a4", 0x2000, 0x1000, CRC(1502ba5b) SHA1(5df45909c2c4296e5701c6c99dfaa9b10b3a729b), ROM_BIOS(1) ) ROMX_LOAD( "3509_3_v2.a2", 0x3000, 0x1000, CRC(bc8860b7) SHA1(28b6cf7f5a4f81e017c2af091c3719657f981710), ROM_BIOS(1) ) - ROM_REGION( 0xa00, "chargen", 0 ) - ROM_LOAD( "sn74s263.h2", 0x0000, 0x0a00, BAD_DUMP CRC(9e064e91) SHA1(354783c8f2865f73dc55918c9810c66f3aca751f) ) // created by hand - ROM_REGION( 0x100, "hsync", 0 ) ROM_LOAD( "abc80_11.k5", 0x0000, 0x0100, CRC(e4f7e018) SHA1(63e718a39537f37286ea183e6469808c271dbfa5) ) // "64 40029-01" 82S129 256x4 horizontal sync diff --git a/src/mame/luxor/abc80.h b/src/mame/luxor/abc80.h index 9ee36503bc5..49398e0566b 100644 --- a/src/mame/luxor/abc80.h +++ b/src/mame/luxor/abc80.h @@ -22,6 +22,7 @@ #include "machine/ram.h" #include "machine/z80pio.h" #include "sound/sn76477.h" +#include "video/sn74s262.h" #include "emupal.h" #define ABC80_HTOTAL 384 @@ -61,6 +62,7 @@ #define CASSETTE_TAG "cassette" #define KEYBOARD_TAG "keyboard" #define TIMER_CASSETTE_TAG "cass" +#define SN74S263_TAG "h2" class abc80_state : public driver_device { @@ -73,13 +75,13 @@ public: m_cassette(*this, "cassette"), m_bus(*this, "bus"), m_kb(*this, KEYBOARD_TAG), + m_rocg(*this, SN74S263_TAG), m_ram(*this, RAM_TAG), m_rs232(*this, RS232_TAG), m_palette(*this, "palette"), m_screen(*this, SCREEN_TAG), m_rom(*this, Z80_TAG), m_mmu_rom(*this, "mmu"), - m_char_rom(*this, "chargen"), m_hsync_prom(*this, "hsync"), m_vsync_prom(*this, "vsync"), m_line_prom(*this, "line"), @@ -149,13 +151,13 @@ protected: required_device m_cassette; required_device m_bus; required_device m_kb; + required_device m_rocg; required_device m_ram; required_device m_rs232; required_device m_palette; required_device m_screen; required_memory_region m_rom; required_memory_region m_mmu_rom; - required_memory_region m_char_rom; required_memory_region m_hsync_prom; required_memory_region m_vsync_prom; required_memory_region m_line_prom; diff --git a/src/mame/luxor/abc80_v.cpp b/src/mame/luxor/abc80_v.cpp index 0a33d12390f..0b19f452169 100644 --- a/src/mame/luxor/abc80_v.cpp +++ b/src/mame/luxor/abc80_v.cpp @@ -10,34 +10,6 @@ #include "abc80.h" #include "screen.h" - - -//------------------------------------------------- -// gfx_layout charlayout -//------------------------------------------------- - -static const gfx_layout charlayout = -{ - 6, 10, - 128, - 1, - { 0 }, - { 0, 1, 2, 3, 4, 5 }, - { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8, 8*8, 9*8 }, - 10*8 -}; - - -//------------------------------------------------- -// GFXDECODE( abc80 ) -//------------------------------------------------- - -static GFXDECODE_START( gfx_abc80 ) - GFXDECODE_ENTRY( "chargen", 0, charlayout, 0, 1 ) // normal characters - GFXDECODE_ENTRY( "chargen", 0x500, charlayout, 0, 1 ) // graphics characters -GFXDECODE_END - - void abc80_state::draw_scanline(bitmap_rgb32 &bitmap, int y) { uint8_t vsync_data = m_vsync_prom->base()[y]; @@ -114,9 +86,7 @@ void abc80_state::draw_scanline(bitmap_rgb32 &bitmap, int y) else { // text mode - uint16_t chargen_addr = ((videoram_data & 0x7f) * 10) + l; - - data = m_char_rom->base()[chargen_addr]; + data = m_rocg->read(videoram_data & 0x7f, l); } // shift out pixels @@ -191,10 +161,11 @@ uint32_t abc80_state::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, void abc80_state::abc80_video(machine_config &config) { + SN74S263(config, m_rocg, 0); + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); m_screen->set_screen_update(FUNC(abc80_state::screen_update)); m_screen->set_raw(XTAL(11'980'800)/2, ABC80_HTOTAL, ABC80_HBEND, ABC80_HBSTART, ABC80_VTOTAL, ABC80_VBEND, ABC80_VBSTART); - GFXDECODE(config, "gfxdecode", m_palette, gfx_abc80); PALETTE(config, m_palette, palette_device::MONOCHROME); } -- cgit v1.2.3