From d5b919eae30903a1800eb3c8e1f491ec1aac621a Mon Sep 17 00:00:00 2001 From: Joakim Larsson Edstrom Date: Thu, 21 Nov 2019 12:15:12 +0100 Subject: mc6854.cpp: small cleanup for readability --- src/devices/machine/mc6854.cpp | 86 ++++++++++++------------------------------ 1 file changed, 24 insertions(+), 62 deletions(-) diff --git a/src/devices/machine/mc6854.cpp b/src/devices/machine/mc6854.cpp index 2cb16191140..488d3872745 100644 --- a/src/devices/machine/mc6854.cpp +++ b/src/devices/machine/mc6854.cpp @@ -57,92 +57,54 @@ constexpr unsigned mc6854_device::MAX_FRAME_LENGTH; /* control register 1 */ -#define AC ( m_cr1 & 1 ) +#define AC ( m_cr1 & 1 ) /* extra register select bits */ #define FCTDRA ( m_cr2 & 8 ) -/* extra register select bits */ -#define RRESET ( m_cr1 & 0x40 ) +#define RRESET ( m_cr1 & 0x40 ) /* transmit / reset condition */ #define TRESET ( m_cr1 & 0x80 ) -/* transmit / reset condition */ -#define RIE ( m_cr1 & 2 ) +#define RIE ( m_cr1 & 2 ) /* interrupt enable */ #define TIE ( m_cr1 & 4 ) -/* interrupt enable */ - -#define DISCONTINUE ( m_cr1 & 0x20 ) -/* discontinue received frame */ +#define DISCONTINUE ( m_cr1 & 0x20 ) /* discontinue received frame */ /* control register 2 */ -#define PSE ( m_cr2 & 1 ) -/* prioritize status bits (TODO) */ - -#define TWOBYTES ( m_cr2 & 2 ) -/* two-bytes mode */ - -#define FMIDLE ( m_cr2 & 4 ) -/* flag time fill (vs. mark idle) */ - -#define TLAST ( m_cr2 & 0x10 ) -/* transmit last byte of frame */ - -#define RTS ( m_cr2 & 0x80 ) -/* request-to-send */ - +#define PSE ( m_cr2 & 1 ) /* prioritize status bits (TODO) */ +#define TWOBYTES ( m_cr2 & 2 ) /* two-bytes mode */ +#define FMIDLE ( m_cr2 & 4 ) /* flag time fill (vs. mark idle) */ +#define TLAST ( m_cr2 & 0x10 ) /* transmit last byte of frame */ +#define RTS ( m_cr2 & 0x80 ) /* request-to-send */ /* control register 3 */ -#define LCF ( m_cr3 & 1 ) -/* logical control field select */ - -#define CEX ( m_cr3 & 2 ) -/* control field is 16 bits instead of 8 */ - -#define AEX ( m_cr3 & 4 ) -/* extended address mode (vs normal 8-bit address mode) */ - -#define IDL0 ( m_cr3 & 8 ) -/* idle condition begins with a '0' instead of a '1" */ - -#define FDSE ( m_cr3 & 0x10 ) -/* enable the flag detect status in SR1 */ - -#define LOOP ( m_cr3 & 0x20 ) -/* loop mode */ - -#define TST ( m_cr3 & 0x40 ) -/* test mode (or go active on poll) */ - -#define DTR ( m_cr3 & 0x80 ) -/* data-transmit-ready (or loop on-line control) */ - +#define LCF ( m_cr3 & 1 ) /* logical control field select */ +#define CEX ( m_cr3 & 2 ) /* control field is 16 bits instead of 8 */ +#define AEX ( m_cr3 & 4 ) /* extended address mode (vs normal 8-bit address mode) */ +#define IDL0 ( m_cr3 & 8 ) /* idle condition begins with a '0' instead of a '1" */ +#define FDSE ( m_cr3 & 0x10 ) /* enable the flag detect status in SR1 */ +#define LOOP ( m_cr3 & 0x20 ) /* loop mode */ +#define TST ( m_cr3 & 0x40 ) /* test mode (or go active on poll) */ +#define DTR ( m_cr3 & 0x80 ) /* data-transmit-ready (or loop on-line control) */ /* control register 4 */ -#define TWOINTER ( m_cr4 & 1 ) -/* both an openning and a closing inter-frame are sent */ +#define TWOINTER ( m_cr4 & 1 ) /* both an openning and a closing inter-frame are sent */ -static const int word_length[4] = { 5, 6, 7, 8 }; +static const int word_length[4] = { 5, 6, 7, 8 }; /* transmit / receive word length */ #define TWL word_length[ ( m_cr4 >> 1 ) & 3 ] #define RWL word_length[ ( m_cr4 >> 3 ) & 3 ] -/* transmit / receive word length */ - -#define ABT ( m_cr4 & 0x20 ) -/* aborts */ - -#define ABTEX ( m_cr4 & 0x40 ) -/* abort generates 16 '1' bits instead of 8 */ - -#define NRZ ( m_cr4 & 0x80 ) -/* zero complement / non-zero complement data format */ +#define ABT ( m_cr4 & 0x20 ) /* aborts */ +#define ABTEX ( m_cr4 & 0x40 ) /* abort generates 16 '1' bits instead of 8 */ +#define NRZ ( m_cr4 & 0x80 ) /* zero complement / non-zero complement data format */ /* status register 1 */ + #define RDA 0x01 /* receiver data available */ #define S2RQ 0x02 /* status register #2 read request */ #define FD 0x04 /* flag detect */ @@ -153,6 +115,7 @@ static const int word_length[4] = { 5, 6, 7, 8 }; /* status register 2 */ + #define AP 0x01 /* address present */ #define FV 0x02 /* frame valid */ #define RIDLE 0x04 /* receiver idle */ @@ -163,7 +126,6 @@ static const int word_length[4] = { 5, 6, 7, 8 }; #define RDA2 0x80 /* copy of RDA */ - DEFINE_DEVICE_TYPE(MC6854, mc6854_device, "mc6854", "Motorola MC6854 ADLC") mc6854_device::mc6854_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock) : -- cgit v1.2.3 From 3ed0c5c22e76a721d5c90a7ae3fc5ad0b56973ca Mon Sep 17 00:00:00 2001 From: Joakim Larsson Edstrom Date: Thu, 21 Nov 2019 12:17:18 +0100 Subject: alfaskop41xx.cpp: Added three skeleton drivers for various parts of Alfaskop 41 system. The 4110 prints a boot prompt but that's it --- scripts/target/mame/mess.lua | 1 + src/mame/drivers/alfaskop41xx.cpp | 283 ++++++++++++++++++++++++++++++++++++++ src/mame/mame.lst | 5 + 3 files changed, 289 insertions(+) create mode 100644 src/mame/drivers/alfaskop41xx.cpp diff --git a/scripts/target/mame/mess.lua b/scripts/target/mame/mess.lua index fb3f1aede1e..41fa1b443c2 100644 --- a/scripts/target/mame/mess.lua +++ b/scripts/target/mame/mess.lua @@ -3976,6 +3976,7 @@ files { MAME_DIR .. "src/mame/drivers/akaiax80.cpp", MAME_DIR .. "src/mame/drivers/alcat7100.cpp", MAME_DIR .. "src/mame/drivers/alesis_qs.cpp", + MAME_DIR .. "src/mame/drivers/alfaskop41xx.cpp", MAME_DIR .. "src/mame/drivers/alphasma.cpp", MAME_DIR .. "src/mame/drivers/am1000.cpp", MAME_DIR .. "src/mame/drivers/ampex.cpp", diff --git a/src/mame/drivers/alfaskop41xx.cpp b/src/mame/drivers/alfaskop41xx.cpp new file mode 100644 index 00000000000..52a0ce52f0a --- /dev/null +++ b/src/mame/drivers/alfaskop41xx.cpp @@ -0,0 +1,283 @@ +// license:BSD-3-Clause +// copyright-holders: Joakim Larsson Edström +/*************************************************************************** + +Alfaskop 41 series + +This driver is a part of a revivel project for Alfaskop 41 series where +no known working system exists today because of the distributed nature. +All parts network boots over SS3 (SDLC) from a Floppy Disk unit and nothing +works unless there is a floppy in that unit. These floppies are rare and +many parts have been discarded because they are useless stand alone. + +The goal is to emulate missing parts so a full system can be demonstrated again. + +Links and credits +----------------- +Project home page: https://github.com/MattisLind/alfaskop_emu +Dalby Datormusem - http://www.datormuseum.se/peripherals/terminals/alfaskop +Bitsavers - http://bitsavers.org/pdf/ericsson/alfaskop/ +Dansk Datahistorisk Forening - http://datamuseum.dk/ + +****************************************************************************/ + +#include "emu.h" +#include "cpu/m6800/m6800.h" +#include "machine/6850acia.h" +#include "machine/6821pia.h" +#include "video/mc6845.h" +#include "screen.h" + +//#include "bus/rs232/rs232.h" +//#include "machine/clock.h" + +#define LOG_IO (1U << 1) +#define LOG_NVRAM (1U << 2) +#define LOG_MIC (1U << 3) +#define LOG_DIA (1U << 4) + +//#define VERBOSE (LOG_IO|LOG_NVRAM|LOG_MIC|LOG_DIA) +//#define LOG_OUTPUT_STREAM std::cout + +#include "logmacro.h" + +#define LOGIO(...) LOGMASKED(LOG_IO, __VA_ARGS__) +#define LOGNVRAM(...) LOGMASKED(LOG_NVRAM, __VA_ARGS__) +#define LOGMIC(...) LOGMASKED(LOG_MIC, __VA_ARGS__) +#define LOGDIA(...) LOGMASKED(LOG_DIA, __VA_ARGS__) + +class alfaskop4110_state : public driver_device +{ +public: + alfaskop4110_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_kbdacia(*this, "kbdacia") + , m_micpia(*this, "micpia") + , m_diapia(*this, "diapia") + , m_crtc(*this, "crtc") + , m_screen(*this, "screen") + , m_vram(*this, "vram") + { } + + void alfaskop4110(machine_config &config); +private: + virtual void machine_start() override; + void mem_map(address_map &map); + + required_device m_maincpu; + required_device m_kbdacia; + required_device m_micpia; + required_device m_diapia; + required_device m_crtc; + required_device m_screen; + required_shared_ptr m_vram; + + /* Video controller */ + uint8_t *m_chargen; + MC6845_UPDATE_ROW(crtc_update_row); +}; + +class alfaskop4120_state : public driver_device +{ +public: + alfaskop4120_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_micpia(*this, "micpia") + , m_fdapia(*this, "diapia") + { } + + void alfaskop4120(machine_config &config); +private: + void mem_map(address_map &map); + + required_device m_maincpu; + required_device m_micpia; + required_device m_fdapia; +}; + +class alfaskop4101_state : public driver_device +{ +public: + alfaskop4101_state(const machine_config &mconfig, device_type type, const char *tag) + : driver_device(mconfig, type, tag) + , m_maincpu(*this, "maincpu") + , m_micpia(*this, "micpia") + { } + + void alfaskop4101(machine_config &config); +private: + void mem_map(address_map &map); + + required_device m_maincpu; + required_device m_micpia; +}; + +void alfaskop4110_state::mem_map(address_map &map) +{ + map.unmap_value_high(); + map(0x0000, 0x7fff).ram(); + map(0x7800, 0x7fff).ram().share(m_vram); + map(0x8000, 0xefff).ram(); + + map(0xf600, 0xf6ff).lrw8(NAME([this](offs_t offset) -> uint8_t { LOGNVRAM("nvram_r %04x: %02x\n", offset, 0); return (uint8_t) 0; }),// TODO: Move to MRO board + NAME( [this](offs_t offset, uint8_t data) { LOGNVRAM("nvram_w %04x: %02x\n", offset, data); })); + map(0xf7d9, 0xf7d9).mirror(0x06).lrw8(NAME([this](offs_t offset) -> uint8_t { LOGIO("CRTC reg r %04x: %02x\n", offset, 0); return m_crtc->register_r(); }), + NAME([this](offs_t offset, uint8_t data) { LOGIO("CRTC reg w %04x: %02x\n", offset, data); m_crtc->register_w(data);})); + map(0xf7d8, 0xf7d8).mirror(0x06).lw8(NAME([this](offs_t offset, uint8_t data) { LOGIO("CRTC adr w %04x: %02x\n", offset, data); m_crtc->address_w(data); })); + map(0xf7d0, 0xf7d3).mirror(0x04).lrw8(NAME([this](offs_t offset) -> uint8_t { LOGIO("DIA pia_r %04x: %02x\n", offset, 0); return m_diapia->read(offset & 3); }), + NAME([this](offs_t offset, uint8_t data) { LOGIO("DIA pia_w %04x: %02x\n", offset, data); m_diapia->write(offset & 3, data); })); + map(0xf7c4, 0xf7c7).mirror(0x00).lrw8(NAME([this](offs_t offset) -> uint8_t { LOGIO("MIC pia_r %04x: %02x\n", offset, 0); return m_micpia->read(offset & 3); }), + NAME( [this](offs_t offset, uint8_t data) { LOGIO("MIC pia_w %04x: %02x\n", offset, data); m_micpia->write(offset & 3, data); })); + map(0xf7c0, 0xf7c1).mirror(0x02).lrw8(NAME([this](offs_t offset) -> uint8_t { LOGIO("KBD acia_r %04x: %02x\n", offset, 0); return m_kbdacia->read(offset & 1); }), + NAME( [this](offs_t offset, uint8_t data) { LOGIO("KBD acia_w %04x: %02x\n", offset, data); m_kbdacia->write(offset & 1, data); })); + + map(0xf7fc, 0xf7fc).mirror(0x00).lr8(NAME([this](offs_t offset) -> uint8_t { LOGIO("Address Switch 0-7\n"); return 0; })); + + map(0xf800, 0xffff).rom().region("roms", 0); +} + +void alfaskop4120_state::mem_map(address_map &map) +{ + map.unmap_value_high(); + map(0x0000, 0xefff).ram(); + map(0xf600, 0xf6ff).lrw8(NAME([this](offs_t offset) -> uint8_t { LOGNVRAM("nvram_r %04x: %02x\n", offset, 0); return (uint8_t) 0; }), // TODO: Move to MRO board + NAME([this](offs_t offset, uint8_t data) { LOGNVRAM("nvram_w %04x: %02x\n", offset, data); })); + map(0xf740, 0xf743).mirror(0x0c).lrw8(NAME([this](offs_t offset) -> uint8_t { LOGIO("FDA pia_r %04x: %02x\n", offset, 0); return m_fdapia->read(offset & 3); }), + NAME([this](offs_t offset, uint8_t data) { LOGIO("FDA pia_w %04x: %02x\n", offset, data); m_fdapia->write(offset & 3, data); })); + map(0xf7c4, 0xf7c7).mirror(0x00).lrw8(NAME([this](offs_t offset) -> uint8_t { LOGIO("MIC pia_r %04x: %02x\n", offset, 0); return m_micpia->read(offset & 3); }), + NAME([this](offs_t offset, uint8_t data) { LOGIO("MIC pia_w %04x: %02x\n", offset, data); m_micpia->write(offset & 3, data); })); + map(0xf800, 0xffff).rom().region("roms", 0); +} + +void alfaskop4101_state::mem_map(address_map &map) +{ + map.unmap_value_high(); + map(0x0000, 0xefff).ram(); + map(0xf600, 0xf6ff).lrw8(NAME([this](offs_t offset) -> uint8_t { LOGNVRAM("nvram_r %04x: %02x\n", offset, 0); return (uint8_t) 0; }), + NAME([this](offs_t offset, uint8_t data) { LOGNVRAM("nvram_w %04x: %02x\n", offset, data); })); + map(0xf7c4, 0xf7c7).mirror(0x00).lrw8(NAME([this](offs_t offset) -> uint8_t { LOGIO("MIC pia_r %04x: %02x\n", offset, 0); return m_micpia->read(offset & 3); }), + NAME([this](offs_t offset, uint8_t data) { LOGIO("MIC pia_w %04x: %02x\n", offset, data); m_micpia->write(offset & 3, data); })); + map(0xf800, 0xffff).rom().region("roms", 0); +} + +/* Input ports */ +static INPUT_PORTS_START( alfaskop4110 ) +INPUT_PORTS_END + +static INPUT_PORTS_START( alfaskop4120 ) +INPUT_PORTS_END + +static INPUT_PORTS_START( alfaskop4101 ) +INPUT_PORTS_END + +void alfaskop4110_state::machine_start() +{ + m_chargen = memregion("roms")->base(); +} + +/* Simplified chargen, no attributes or special formats/features yet */ +MC6845_UPDATE_ROW( alfaskop4110_state::crtc_update_row ) +{ + offs_t base = ma + 0x4000; + u32 *px = &bitmap.pix32(y); + + for (int i = 0; i < x_count; i++) + { + u8 chr = m_vram[(base + i) & 0x07ff] & 0x7f; + rgb_t bg = rgb_t::white(); + rgb_t fg = rgb_t::black(); + + u8 dots = m_chargen[0x800 + chr * 16 + ra]; + + for (int n = 8; n > 0; n--, dots <<= 1) + *px++ = BIT(dots, 7) ? fg : bg; + } +} + +void alfaskop4110_state::alfaskop4110(machine_config &config) +{ + /* basic machine hardware */ + M6800(config, m_maincpu, XTAL(19'170'000) / 18); // Verified from service manual + m_maincpu->set_addrmap(AS_PROGRAM, &alfaskop4110_state::mem_map); + + MC6845(config, m_crtc, XTAL(19'170'000) / 9); + m_crtc->set_screen("screen"); + m_crtc->set_show_border_area(false); + m_crtc->set_char_width(8); + m_crtc->set_update_row_callback(FUNC(alfaskop4110_state::crtc_update_row)); + + SCREEN(config, m_screen, SCREEN_TYPE_RASTER); + m_screen->set_raw(19'170'000, 80 * 8, 0, 80 * 8, 400, 0, 400); + m_screen->set_screen_update("crtc", FUNC(mc6845_device::screen_update)); + + PIA6821(config, m_micpia, 0); // Main board PIA + m_micpia->readcb1_handler().set([this](offs_t offset) -> uint8_t { LOGMIC("MIC PIA: CB1_r\n"); return 0;}); + m_micpia->cb2_handler().set([this](offs_t offset, uint8_t data) { LOGMIC("MIC PIA: CB2_w\n"); }); + m_micpia->writepa_handler().set([this](offs_t offset, uint8_t data) { LOGMIC("MIC PIA: PA_w\n"); }); + m_micpia->writepb_handler().set([this](offs_t offset, uint8_t data) { LOGMIC("MIC PIA: PB_w\n"); }); + m_micpia->readpa_handler().set([this](offs_t offset) -> uint8_t { LOGMIC("MIC PIA: PA_r\n"); return 0;}); + m_micpia->readpb_handler().set([this](offs_t offset) -> uint8_t { LOGMIC("MIC PIA: PB_r\n"); return 0;}); + m_micpia->readca1_handler().set([this](offs_t offset) -> uint8_t { LOGMIC("MIC PIA: CA1_r\n"); return 0;}); + m_micpia->readca2_handler().set([this](offs_t offset) -> uint8_t { LOGMIC("MIC PIA: CA2_r\n"); return 0;}); + + PIA6821(config, m_diapia, 0); // Display PIA, controls how the CRTC accesses memory etc + m_diapia->readcb1_handler().set([this](offs_t offset) -> uint8_t { LOGDIA("DIA PIA: CB1_r\n"); return 0;}); + m_diapia->cb2_handler().set([this](offs_t offset, uint8_t data) { LOGDIA("DIA PIA: CB2_w\n"); }); + m_diapia->writepa_handler().set([this](offs_t offset, uint8_t data) { LOGDIA("DIA PIA: PA_w\n"); }); + m_diapia->writepb_handler().set([this](offs_t offset, uint8_t data) { LOGDIA("DIA PIA: PB_w\n"); }); + m_diapia->readpa_handler().set([this](offs_t offset) -> uint8_t { LOGDIA("DIA PIA: PA_r\n"); return 0;}); + m_diapia->readpb_handler().set([this](offs_t offset) -> uint8_t { LOGDIA("DIA PIA: PB_r\n"); return 0;}); + m_diapia->readca1_handler().set([this](offs_t offset) -> uint8_t { LOGDIA("DIA PIA: CA1_r\n"); return 0;}); + m_diapia->readca2_handler().set([this](offs_t offset) -> uint8_t { LOGDIA("DIA PIA: CA2_r\n"); return 0;}); + + ACIA6850(config, m_kbdacia, 0); + //CLOCK(config, "acia_clock", ACIA_CLOCK).signal_handler().set(FUNC(alfaskop4110_state::write_acia_clock)); +} + +void alfaskop4120_state::alfaskop4120(machine_config &config) +{ + /* basic machine hardware */ + M6800(config, m_maincpu, XTAL(19'170'000) / 18); // Verified from service manual + m_maincpu->set_addrmap(AS_PROGRAM, &alfaskop4120_state::mem_map); + + PIA6821(config, m_micpia, 0); // Main board PIA + PIA6821(config, m_fdapia, 0); // Floppy Disk PIA +} + +void alfaskop4101_state::alfaskop4101(machine_config &config) +{ + /* basic machine hardware */ + M6800(config, m_maincpu, XTAL(19'170'000) / 18); // Verified from service manual + m_maincpu->set_addrmap(AS_PROGRAM, &alfaskop4101_state::mem_map); + + PIA6821(config, m_micpia, 0); // Main board PIA +} + +/* ROM definitions */ +ROM_START( alfaskop4110 ) // Display Unit + ROM_REGION( 0x1000, "roms", ROMREGION_ERASEFF ) + ROM_LOAD( "e3405870205201.bin", 0x0000, 0x0800, CRC(23f20f7f) SHA1(6ed008e309473ab966c6b0d42a4f87c76a7b1d6e)) + ROM_LOAD( "e3405972067500.bin", 0x0800, 0x0400, CRC(fb12b549) SHA1(53783f62c5e51320a53e053fbcf8b3701d8a805f)) + ROM_LOAD( "e3405972067600.bin", 0x0c00, 0x0400, CRC(c7069d65) SHA1(587efcbee036d4c0c5b936cc5d7b1f97b6fe6dba)) +ROM_END + +ROM_START( alfaskop4120 ) // Flexible Disk Unit + ROM_REGION( 0x800, "roms", ROMREGION_ERASEFF ) + ROM_LOAD( "alfaskop4120.bin", 0x0000, 0x0800, NO_DUMP) +ROM_END + +ROM_START( alfaskop4101 ) // Communication Processor Unit + ROM_REGION( 0x800, "roms", ROMREGION_ERASEFF ) + ROM_LOAD( "alfaskop4101.bin", 0x0000, 0x0800, NO_DUMP) +ROM_END + +/* Driver(S) */ + +// Only 4101 may exist as a driver in the end making the 4110 and 4120 as slots devices on the SS3 bus, time will tell + +// YEAR NAME PARENT COMPAT MACHINE INPUT CLASS INIT COMPANY FULLNAME FLAGS +COMP( 1984, alfaskop4110, 0, 0, alfaskop4110, alfaskop4110, alfaskop4110_state, empty_init, "Ericsson", "Alfaskop Display Unit 4110", MACHINE_IS_SKELETON) +COMP( 1984, alfaskop4120, 0, 0, alfaskop4120, alfaskop4120, alfaskop4120_state, empty_init, "Ericsson", "Alfaskop Flexible Disk Unit 4120", MACHINE_IS_SKELETON) +COMP( 1984, alfaskop4101, 0, 0, alfaskop4101, alfaskop4101, alfaskop4101_state, empty_init, "Ericsson", "Alfaskop Communication Processor 4101", MACHINE_IS_SKELETON) diff --git a/src/mame/mame.lst b/src/mame/mame.lst index 334fc0714ad..c17a1457843 100644 --- a/src/mame/mame.lst +++ b/src/mame/mame.lst @@ -1044,6 +1044,11 @@ sr16 // @source:alesis_qs.cpp alesqs7 // +@source:alfaskop41xx.cpp +alfaskop4110 // +alfaskop4120 // +alfaskop4101 // + @source:alg.cpp alg_bios // aplatoon // (c) 199? Nova? -- cgit v1.2.3 From 476f0fd84347097a7d0fafed5af056e2b7a39bb4 Mon Sep 17 00:00:00 2001 From: Joakim Larsson Edstrom Date: Thu, 21 Nov 2019 21:46:02 +0100 Subject: alfaskop4110, kron180, e100: clean up of vram and chargen handlings + kron180: some modernization of LOG printouts --- src/mame/drivers/alfaskop41xx.cpp | 18 ++++----- src/mame/drivers/e100.cpp | 19 ++++----- src/mame/drivers/kron.cpp | 84 +++++++++++++++++---------------------- 3 files changed, 51 insertions(+), 70 deletions(-) diff --git a/src/mame/drivers/alfaskop41xx.cpp b/src/mame/drivers/alfaskop41xx.cpp index 52a0ce52f0a..9aa9d7692a2 100644 --- a/src/mame/drivers/alfaskop41xx.cpp +++ b/src/mame/drivers/alfaskop41xx.cpp @@ -58,11 +58,11 @@ public: , m_crtc(*this, "crtc") , m_screen(*this, "screen") , m_vram(*this, "vram") + , m_chargen(*this, "chargen") { } void alfaskop4110(machine_config &config); private: - virtual void machine_start() override; void mem_map(address_map &map); required_device m_maincpu; @@ -74,7 +74,7 @@ private: required_shared_ptr m_vram; /* Video controller */ - uint8_t *m_chargen; + required_region_ptr m_chargen; MC6845_UPDATE_ROW(crtc_update_row); }; @@ -172,11 +172,6 @@ INPUT_PORTS_END static INPUT_PORTS_START( alfaskop4101 ) INPUT_PORTS_END -void alfaskop4110_state::machine_start() -{ - m_chargen = memregion("roms")->base(); -} - /* Simplified chargen, no attributes or special formats/features yet */ MC6845_UPDATE_ROW( alfaskop4110_state::crtc_update_row ) { @@ -189,7 +184,7 @@ MC6845_UPDATE_ROW( alfaskop4110_state::crtc_update_row ) rgb_t bg = rgb_t::white(); rgb_t fg = rgb_t::black(); - u8 dots = m_chargen[0x800 + chr * 16 + ra]; + u8 dots = m_chargen[chr * 16 + ra]; for (int n = 8; n > 0; n--, dots <<= 1) *px++ = BIT(dots, 7) ? fg : bg; @@ -257,10 +252,11 @@ void alfaskop4101_state::alfaskop4101(machine_config &config) /* ROM definitions */ ROM_START( alfaskop4110 ) // Display Unit - ROM_REGION( 0x1000, "roms", ROMREGION_ERASEFF ) + ROM_REGION( 0x800, "roms", ROMREGION_ERASEFF ) ROM_LOAD( "e3405870205201.bin", 0x0000, 0x0800, CRC(23f20f7f) SHA1(6ed008e309473ab966c6b0d42a4f87c76a7b1d6e)) - ROM_LOAD( "e3405972067500.bin", 0x0800, 0x0400, CRC(fb12b549) SHA1(53783f62c5e51320a53e053fbcf8b3701d8a805f)) - ROM_LOAD( "e3405972067600.bin", 0x0c00, 0x0400, CRC(c7069d65) SHA1(587efcbee036d4c0c5b936cc5d7b1f97b6fe6dba)) + ROM_REGION( 0x800, "chargen", ROMREGION_ERASEFF ) + ROM_LOAD( "e3405972067500.bin", 0x0000, 0x0400, CRC(fb12b549) SHA1(53783f62c5e51320a53e053fbcf8b3701d8a805f)) + ROM_LOAD( "e3405972067600.bin", 0x0400, 0x0400, CRC(c7069d65) SHA1(587efcbee036d4c0c5b936cc5d7b1f97b6fe6dba)) ROM_END ROM_START( alfaskop4120 ) // Flexible Disk Unit diff --git a/src/mame/drivers/e100.cpp b/src/mame/drivers/e100.cpp index 39e5d0c617d..708c0e7e87d 100644 --- a/src/mame/drivers/e100.cpp +++ b/src/mame/drivers/e100.cpp @@ -129,17 +129,17 @@ */ /* Esselte 100 driver class */ -class e100_state : public driver_device // public didact_state +class e100_state : public driver_device { public: e100_state(const machine_config &mconfig, device_type type, const char * tag) - // : didact_state(mconfig, type, tag) : driver_device(mconfig, type, tag) ,m_maincpu(*this, "maincpu") ,m_kbd_74145(*this, "kbd_74145") - ,m_videoram(*this, "videoram") + ,m_vram(*this, "vram") ,m_cassette(*this, "cassette") ,m_rs232(*this, "rs232") + ,m_chargen(*this, "chargen") ,m_io_line0(*this, "LINE0") ,m_io_line1(*this, "LINE1") ,m_io_line2(*this, "LINE2") @@ -161,11 +161,10 @@ public: private: required_device m_maincpu; required_device m_kbd_74145; - required_shared_ptr m_videoram; + required_shared_ptr m_vram; required_device m_cassette; optional_device m_rs232; - uint8_t *m_char_ptr; - uint8_t *m_vram; + required_region_ptr m_chargen; uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); virtual void machine_reset() override { m_maincpu->reset(); LOG("--->%s()\n", FUNCNAME); }; virtual void machine_start() override; @@ -206,12 +205,8 @@ TIMER_DEVICE_CALLBACK_MEMBER(e100_state::rtc_w) void e100_state::machine_start() { LOG("%s()\n", FUNCNAME); - m_char_ptr = memregion("chargen")->base(); - m_vram = (uint8_t *)m_videoram.target(); /* register for state saving */ - save_pointer (NAME (m_char_ptr), sizeof(m_char_ptr)); - save_pointer (NAME (m_vram), sizeof(m_vram)); save_item(NAME(m_50hz)); save_item(NAME(m_pia1_B)); } @@ -232,7 +227,7 @@ uint32_t e100_state::screen_update(screen_device &screen, bitmap_ind16 &bitmap, /* look up the character data */ charcode = m_vram[vramad]; if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN("\n %c at X=%d Y=%d: ", charcode, col, row); - chardata = &m_char_ptr[(charcode * 8)]; + chardata = &m_chargen[(charcode * 8)]; /* plot the character */ for (y = 0; y < 8; y++) { @@ -424,7 +419,7 @@ void e100_state::e100_map(address_map &map) { map(0x0000, 0x1fff).ram(); map(0x8000, 0x87ff).rom().region("roms", 0); - map(0xc000, 0xc3ff).ram().share("videoram"); + map(0xc000, 0xc3ff).ram().share(m_vram); map(0xc800, 0xc81f).rw(FUNC(e100_state::pia_r), FUNC(e100_state::pia_w)).mirror(0x07e0); map(0xd000, 0xffff).rom().region("roms", 0x1000); } diff --git a/src/mame/drivers/kron.cpp b/src/mame/drivers/kron.cpp index ba5f4ea4253..15bd855a8f6 100644 --- a/src/mame/drivers/kron.cpp +++ b/src/mame/drivers/kron.cpp @@ -104,20 +104,24 @@ #include "emupal.h" #include "screen.h" -#define VERBOSE 2 +#define LOG_IO (1U << 1) +#define LOG_SCAN (1U << 2) +#define LOG_SCREEN (1U << 3) +#define LOG_KBD (1U << 4) +#define LOG_READ (1U << 5) +#define LOG_CS (1U << 6) -#define LOGPRINT(x) do { if (VERBOSE) logerror x; } while (0) -#define LOG(x) {} -#define LOGIO(x) {} -#define LOGSCAN(x) {} -#define LOGSCREEN(x) {} -#define LOGKBD(x) LOGPRINT(x) -#define RLOG(x) {} -#define LOGCS(x) {} +//#define VERBOSE (LOG_IO) +//#define LOG_OUTPUT_STREAM std::cout -#if VERBOSE >= 2 -#define logerror printf -#endif +#include "logmacro.h" + +#define LOGIO(...) LOGMASKED(LOG_IO, __VA_ARGS__) +#define LOGSCAN(...) LOGMASKED(LOG_SCAN, __VA_ARGS__) +#define LOGSCREEN(...) LOGMASKED(LOG_SCREEN, __VA_ARGS__) +#define LOGKBD(...) LOGMASKED(LOG_KBD, __VA_ARGS__) +#define LOGR(...) LOGMASKED(LOG_READ, __VA_ARGS__) +#define LOGCS(...) LOGMASKED(LOG_CS, __VA_ARGS__) #ifdef _MSC_VER #define FUNCNAME __func__ @@ -131,35 +135,33 @@ public: kron180_state(const machine_config &mconfig, device_type type, const char *tag) : driver_device(mconfig, type, tag) , m_maincpu(*this, "maincpu") - , m_videoram(*this, "videoram") + , m_chargen(*this, "chargen") + , m_vram(*this, "videoram") , m_keyboard(*this, "pc_keyboard") { } void kron180(machine_config &config); private: - uint8_t * m_char_ptr; - uint8_t *m_vram; uint32_t screen_update(screen_device &screen, bitmap_ind16 &bitmap, const rectangle &cliprect); DECLARE_WRITE_LINE_MEMBER(keyb_interrupt); - DECLARE_WRITE8_MEMBER(sn74259_w) { LOGIO(("%s %02x = %02x\n", FUNCNAME, offset & 0x07, offset & 0x08 ? 1 : 0)); } - DECLARE_WRITE8_MEMBER(ap5_w) { LOGIO(("%s %02x = %02x\n", FUNCNAME, offset, data)); } - DECLARE_READ8_MEMBER(ap5_r) { LOGIO(("%s() %02x = %02x\n", FUNCNAME, offset, 1)); return 1; } - DECLARE_WRITE8_MEMBER(wkb_w) { LOGIO(("%s %02x = %02x\n", FUNCNAME, offset, data)); } - DECLARE_WRITE8_MEMBER(sn74299_w) { LOGIO(("%s %02x = %02x\n", FUNCNAME, offset, data)); } - DECLARE_READ8_MEMBER(sn74299_r) { LOGIO(("%s() %02x = %02x\n", FUNCNAME, offset, 1)); return 1; } - DECLARE_WRITE8_MEMBER(txen_w) { LOGIO(("%s %02x = %02x\n", FUNCNAME, offset, data)); } - DECLARE_WRITE8_MEMBER(kbd_reset_w) { LOGIO(("%s %02x = %02x\n", FUNCNAME, offset, data)); } - DECLARE_WRITE8_MEMBER(dreq_w) { LOGIO(("%s %02x = %02x\n", FUNCNAME, offset, data)); } + DECLARE_WRITE8_MEMBER(sn74259_w) { LOGIO("%s %02x = %02x\n", FUNCNAME, offset & 0x07, offset & 0x08 ? 1 : 0); } + DECLARE_WRITE8_MEMBER(ap5_w) { LOGIO("%s %02x = %02x\n", FUNCNAME, offset, data); } + DECLARE_READ8_MEMBER(ap5_r) { LOGIO("%s() %02x = %02x\n", FUNCNAME, offset, 1); return 1; } + DECLARE_WRITE8_MEMBER(wkb_w) { LOGIO("%s %02x = %02x\n", FUNCNAME, offset, data); } + DECLARE_WRITE8_MEMBER(sn74299_w) { LOGIO("%s %02x = %02x\n", FUNCNAME, offset, data); } + DECLARE_READ8_MEMBER(sn74299_r) { LOGIO("%s() %02x = %02x\n", FUNCNAME, offset, 1); return 1; } + DECLARE_WRITE8_MEMBER(txen_w) { LOGIO("%s %02x = %02x\n", FUNCNAME, offset, data); } + DECLARE_WRITE8_MEMBER(kbd_reset_w) { LOGIO("%s %02x = %02x\n", FUNCNAME, offset, data); } + DECLARE_WRITE8_MEMBER(dreq_w) { LOGIO("%s %02x = %02x\n", FUNCNAME, offset, data); } void kron180_iomap(address_map &map); void kron180_mem(address_map &map); required_device m_maincpu; - required_shared_ptr m_videoram; + required_region_ptr m_chargen; + required_shared_ptr m_vram; required_device m_keyboard; uint8_t m_kbd_data; - - virtual void machine_start() override; }; void kron180_state::kron180_mem(address_map &map) @@ -167,7 +169,7 @@ void kron180_state::kron180_mem(address_map &map) map.unmap_value_high(); map(0x0000, 0x7fff).rom().region("roms", 0x8000); map(0x8000, 0x85ff).ram().mirror(0x6000); - map(0x8600, 0x95ff).ram().share("videoram").mirror(0x6000); + map(0x8600, 0x95ff).ram().share(m_vram).mirror(0x6000); map(0x9600, 0x9fff).ram().mirror(0x6000); } @@ -227,7 +229,7 @@ uint32_t kron180_state::screen_update(screen_device &screen, bitmap_ind16 &bitma uint8_t *chardata; uint8_t charcode; - LOGSCREEN(("%s()\n", FUNCNAME)); + LOGSCREEN("%s()\n", FUNCNAME); vramad = 0; for (int row = 0; row < 25 * 8; row += 8) { @@ -235,40 +237,28 @@ uint32_t kron180_state::screen_update(screen_device &screen, bitmap_ind16 &bitma { /* look up the character data */ charcode = m_vram[vramad]; - if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN(("\n %c at X=%d Y=%d: ", charcode, col, row)); - chardata = &m_char_ptr[(charcode * 8) + 8]; + if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN("\n %c at X=%d Y=%d: ", charcode, col, row); + chardata = &m_chargen[(charcode * 8) + 8]; /* plot the character */ for (y = 0; y < 8; y++) { chardata--; - if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN(("\n %02x: ", *chardata)); + if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN("\n %02x: ", *chardata); for (x = 0; x < 8; x++) { - if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN((" %02x: ", *chardata)); + if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN(" %02x: ", *chardata); bitmap.pix16(row + (8 - y), col + (8 - x)) = (*chardata & (1 << x)) ? 1 : 0; } } vramad += 2; } - if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN(("\n")); + if (VERBOSE && charcode != 0x20 && charcode != 0) LOGSCREEN("\n"); vramad += 96; // Each row is aligned at a 128 byte boundary } return 0; } -/* Start it up */ -void kron180_state::machine_start () -{ - LOG(("%s()\n", FUNCNAME)); - m_char_ptr = memregion("chargen")->base(); - m_vram = (uint8_t *)m_videoram.target(); - - /* register for state saving */ - save_pointer (NAME (m_char_ptr), sizeof(m_char_ptr)); - save_pointer (NAME (m_vram), sizeof(m_vram)); -} - /* Interrupt Handling */ #if 0 WRITE8_MEMBER(kron180_state::irq0_ack_w) @@ -291,7 +281,7 @@ WRITE_LINE_MEMBER(kron180_state::keyb_interrupt) { if(state && (m_kbd_data = m_keyboard->read(machine().dummy_space(), 0))) { - LOGKBD(("%s(%02x)\n", FUNCNAME, m_kbd_data)); + LOGKBD("%s(%02x)\n", FUNCNAME, m_kbd_data); m_maincpu->set_input_line(2, ASSERT_LINE); /* TODO: store and present this to K180 in a good way. */ } -- cgit v1.2.3