alfaskop4110, kron180, e100: clean up of vram and chargen handlings + kron180: some modernization of LOG printouts

This commit is contained in:
Joakim Larsson Edstrom 2019-11-21 21:46:02 +01:00
parent 3ed0c5c22e
commit 476f0fd843
3 changed files with 51 additions and 70 deletions

View File

@ -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<cpu_device> m_maincpu;
@ -74,7 +74,7 @@ private:
required_shared_ptr<uint8_t> m_vram;
/* Video controller */
uint8_t *m_chargen;
required_region_ptr<uint8_t> 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

View File

@ -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<m6802_cpu_device> m_maincpu;
required_device<ttl74145_device> m_kbd_74145;
required_shared_ptr<uint8_t> m_videoram;
required_shared_ptr<uint8_t> m_vram;
required_device<cassette_image_device> m_cassette;
optional_device<rs232_port_device> m_rs232;
uint8_t *m_char_ptr;
uint8_t *m_vram;
required_region_ptr<uint8_t> 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);
}

View File

@ -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<cpu_device> m_maincpu;
required_shared_ptr<uint8_t> m_videoram;
required_region_ptr<uint8_t> m_chargen;
required_shared_ptr<uint8_t> m_vram;
required_device<pc_keyboard_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. */
}