hitachi: Cleanup.

This commit is contained in:
Vas Crabb 2024-09-27 05:15:54 +10:00
parent ea48cc6cd4
commit b86767ac50
5 changed files with 53 additions and 43 deletions

View file

@ -22,9 +22,21 @@ TODO:
**************************************************************************************************/
#include "emu.h"
#include "bml3.h"
#include "bus/bml3/kanji.h"
#include "bus/bml3/mp1802.h"
#include "bus/bml3/mp1805.h"
#include "bus/bml3/rtc.h"
#include "cpu/m6809/m6809.h"
#include "machine/6821pia.h"
#include "machine/clock.h"
#include "screen.h"
#include "softlist_dev.h"
#include "speaker.h"
MC6845_UPDATE_ROW( bml3_state::crtc_update_row )
{
rgb_t const *const palette = m_palette->palette()->entry_list_raw();

View file

@ -7,26 +7,15 @@
#pragma once
#include "bus/bml3/bml3bus.h"
#include "bus/bml3/kanji.h"
#include "bus/bml3/mp1802.h"
#include "bus/bml3/mp1805.h"
#include "bus/bml3/rtc.h"
#include "cpu/m6809/m6809.h"
#include "imagedev/cassette.h"
#include "machine/6821pia.h"
#include "machine/6850acia.h"
#include "machine/clock.h"
#include "machine/timer.h"
#include "sound/spkrdev.h"
#include "sound/ymopn.h"
#include "machine/timer.h"
#include "video/mc6845.h"
#include "emupal.h"
#include "screen.h"
#include "softlist_dev.h"
#include "speaker.h"
namespace {
// System clock definitions, from the MB-6890 servce manual, p.48:
@ -61,7 +50,7 @@ namespace {
// / 6720 // 2400
// / 3360 // 4800
// / 1680 // 9600
} // anonymous namespace
class bml3_state : public driver_device
{
@ -223,6 +212,7 @@ protected:
void ig_ram_w(offs_t offset, u8 data);
memory_view m_ig_view;
private:
required_device<gfxdecode_device> m_gfxdecode;
std::unique_ptr<u8[]> m_ig_ram;

View file

@ -20,6 +20,9 @@ TODO:
#include "softlist_dev.h"
#include "speaker.h"
namespace {
class mbs1_state : public bml3mk5_state
{
public:
@ -30,16 +33,17 @@ public:
, m_system_mode(*this, "SYSTEM_MODE")
{ }
void mbs1(machine_config &config);
void mbs1(machine_config &config) ATTR_COLD;
protected:
virtual void machine_start() override ATTR_COLD;
virtual void machine_reset() override ATTR_COLD;
// virtual void main_map(address_map &map) override ATTR_COLD;
virtual void system_io(address_map &map) override ATTR_COLD;
void s1_map(address_map &map);
void s1_mmu_map(address_map &map);
void s1_ext_io(address_map &map);
void s1_map(address_map &map) ATTR_COLD;
void s1_mmu_map(address_map &map) ATTR_COLD;
void s1_ext_io(address_map &map) ATTR_COLD;
virtual MC6845_UPDATE_ROW(crtc_update_row) override;
@ -64,7 +68,7 @@ MC6845_UPDATE_ROW( mbs1_state::crtc_update_row )
u8 const bgcolor = 0; //m_hres_reg & 7;
// TODO: WIDTH80, pinpoint bit used
for(u8 x=0; x<x_count; x+= 2)
for (u8 x = 0; x < x_count; x += 2)
{
u16 mem = ((ma + x) >> 1) & 0x7ff;
@ -77,15 +81,10 @@ MC6845_UPDATE_ROW( mbs1_state::crtc_update_row )
u8 gfx_data = m_p_chargen[(tile<<4)|(ra<<1)|tile_bank];
for(u8 xi = 0; xi< 8; xi++)
for (u8 xi = 0; xi < 8; xi++)
{
u8 pen;
if(reverse)
pen = (gfx_data >> (7-xi) & 1) ? bgcolor : color;
else
pen = (gfx_data >> (7-xi) & 1) ? color : bgcolor;
const int res_x = x * 8 + xi * 2;
u8 const pen = BIT(reverse ? ~gfx_data : gfx_data, 7 - xi) ? color : bgcolor;
int const res_x = x * 8 + xi * 2;
bitmap.pix(y, res_x + 0) = palette[pen];
bitmap.pix(y, res_x + 1) = palette[pen];
}
@ -341,6 +340,7 @@ ROM_START( mbs1 )
ROM_LOAD("font.rom", 0x0000, 0x1000, CRC(d1f27c5a) SHA1(a3abbdea9f6656bd795fd35ee806a54d7be35de0) )
ROM_END
} // anonymous namespace
COMP( 1984, mbs1, 0, 0, mbs1, mbs1, mbs1_state, empty_init, "Hitachi", "MB-S1", MACHINE_NOT_WORKING )

View file

@ -20,12 +20,20 @@ TODO:
#include "emu.h"
#include "mbs1_mmu.h"
#include <algorithm>
DEFINE_DEVICE_TYPE(MBS1_MMU, mbs1_mmu_device, "mbs1_mmu", "Hitachi MB-S1 MMU")
mbs1_mmu_device::mbs1_mmu_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock)
: device_t(mconfig, MBS1_MMU, tag, owner, clock)
, device_memory_interface(mconfig, *this)
, m_space_config("memory_map", ENDIANNESS_BIG, 8, 20, 0)
{
std::fill(std::begin(m_bank_latch), std::end(m_bank_latch), 0);
}
mbs1_mmu_device::~mbs1_mmu_device()
{
}
@ -38,7 +46,7 @@ device_memory_interface::space_config_vector mbs1_mmu_device::memory_space_confi
void mbs1_mmu_device::device_start()
{
m_space = &space();
space().specific(m_space);
save_pointer(NAME(m_bank_latch), 16);
}
@ -50,10 +58,9 @@ void mbs1_mmu_device::device_reset()
// TODO: should not reset everything when in user mode
void mbs1_mmu_device::init_banks(bool system_type, bool user_mode)
{
int i;
if (system_type == true)
{
for (i = 0; i < 14; i++)
for (int i = 0; i < 14; i++)
m_bank_latch[i] = 0xf0 | i;
m_bank_latch[0xe] = 0x84;
m_bank_latch[0xf] = 0xef;
@ -61,19 +68,19 @@ void mbs1_mmu_device::init_banks(bool system_type, bool user_mode)
else
{
// Level 3 mode
for (i = 0; i < 16; i++)
for (int i = 0; i < 16; i++)
m_bank_latch[i] = 0xf0 | i;
}
}
u8 mbs1_mmu_device::read(offs_t offset)
{
return m_space->read_byte((offset & 0xfff) | (m_bank_latch[offset >> 12] << 12));
return m_space.read_byte((offset & 0xfff) | (m_bank_latch[offset >> 12] << 12));
}
void mbs1_mmu_device::write(offs_t offset, u8 data)
{
m_space->write_byte((offset & 0xfff) | (m_bank_latch[offset >> 12] << 12), data);
m_space.write_byte((offset & 0xfff) | (m_bank_latch[offset >> 12] << 12), data);
}
u8 mbs1_mmu_device::bank_r(offs_t offset)

View file

@ -1,15 +1,16 @@
// license: BSD-3-Clause
// copyright-holders: Angelo Salese
#ifndef MAME_MBS1_MMU_H
#define MAME_MBS1_MMU_H
#ifndef MAME_HITACHI_MBS1_MMU_H
#define MAME_HITACHI_MBS1_MMU_H
#pragma once
class mbs1_mmu_device : public device_t, public device_memory_interface
{
public:
mbs1_mmu_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock = 0);
virtual ~mbs1_mmu_device();
// configuration helpers
template <typename... T> mbs1_mmu_device& set_map(T &&... args) { set_addrmap(0, std::forward<T>(args)...); return *this; }
@ -23,18 +24,18 @@ public:
void init_banks(bool system_type, bool user_mode);
protected:
virtual space_config_vector memory_space_config() const override;
virtual space_config_vector memory_space_config() const override ATTR_COLD;
virtual void device_start() override ATTR_COLD;
virtual void device_reset() override ATTR_COLD;
virtual void device_start() override;
virtual void device_reset() override;
private:
const address_space_config m_space_config;
address_space *m_space;
memory_access<20, 0, 0, ENDIANNESS_BIG>::specific m_space;
u8 m_bank_latch[16]{};
u8 m_bank_latch[16];
};
DECLARE_DEVICE_TYPE(MBS1_MMU, mbs1_mmu_device)
#endif // MAME_MBS1_MMU_H