mirror of
https://github.com/holub/mame
synced 2025-06-06 04:43:45 +03:00
alto2: Make another thing into a callback (nw)
This commit is contained in:
parent
1792ac0b9f
commit
d15be5652a
@ -309,10 +309,7 @@ WRITE16_MEMBER( alto2_cpu_device::utilout_w )
|
||||
LOG((this,LOG_HW,2," UTILOUT wr %#o (%#o)\n", offset, data));
|
||||
}
|
||||
m_hw.utilout = data ^ 0177777;
|
||||
|
||||
// FIXME: write printer data
|
||||
// printer_write();
|
||||
m_speaker->level_w(data ? 1 : 0);
|
||||
m_utilout_callback(m_hw.utilout);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -128,6 +128,7 @@ void alto2_cpu_device::iomem_map(address_map &map)
|
||||
alto2_cpu_device::alto2_cpu_device(const machine_config& mconfig, const char* tag, device_t* owner, uint32_t clock) :
|
||||
cpu_device(mconfig, ALTO2, tag, owner, clock),
|
||||
m_kb_read_callback(*this),
|
||||
m_utilout_callback(*this),
|
||||
m_ucode_config("ucode", ENDIANNESS_BIG, 32, 12, -2, address_map_constructor(FUNC(alto2_cpu_device::ucode_map), this)),
|
||||
m_const_config("const", ENDIANNESS_BIG, 16, 8, -1, address_map_constructor(FUNC(alto2_cpu_device::const_map), this)),
|
||||
m_iomem_config("iomem", ENDIANNESS_BIG, 16, 17, -1, address_map_constructor(FUNC(alto2_cpu_device::iomem_map), this)),
|
||||
@ -207,7 +208,6 @@ alto2_cpu_device::alto2_cpu_device(const machine_config& mconfig, const char* ta
|
||||
memset(m_sysclka1, 0x00, sizeof(m_sysclka1));
|
||||
memset(m_sysclkb0, 0x00, sizeof(m_sysclkb0));
|
||||
memset(m_sysclkb1, 0x00, sizeof(m_sysclkb1));
|
||||
m_speaker = 0;
|
||||
}
|
||||
|
||||
alto2_cpu_device::~alto2_cpu_device()
|
||||
@ -241,16 +241,6 @@ void alto2_cpu_device::set_diablo(int unit, diablo_hd_device* ptr)
|
||||
m_drive[unit] = ptr;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// driver interface to set speaker_sound_device
|
||||
//-------------------------------------------------
|
||||
|
||||
void alto2_cpu_device::set_speaker(speaker_sound_device* speaker)
|
||||
{
|
||||
logerror("%s: speaker_sound_device=%p\n", __FUNCTION__, speaker);
|
||||
m_speaker = speaker;
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_rom_region - device-specific (P)ROMs
|
||||
//-------------------------------------------------
|
||||
@ -815,6 +805,7 @@ device_memory_interface::space_config_vector alto2_cpu_device::memory_space_conf
|
||||
void alto2_cpu_device::device_start()
|
||||
{
|
||||
m_kb_read_callback.resolve_safe(0177777);
|
||||
m_utilout_callback.resolve_safe();
|
||||
|
||||
// get a pointer to the IO address space
|
||||
m_iomem = &space(2);
|
||||
|
@ -11,7 +11,6 @@
|
||||
#pragma once
|
||||
|
||||
#include "machine/diablo_hd.h"
|
||||
#include "sound/spkrdev.h"
|
||||
|
||||
#include "debugger.h"
|
||||
|
||||
@ -186,13 +185,11 @@ public:
|
||||
~alto2_cpu_device();
|
||||
|
||||
auto kb_read_callback() { return m_kb_read_callback.bind(); }
|
||||
auto utilout_callback() { return m_utilout_callback.bind(); }
|
||||
|
||||
//! driver interface to set diablo_hd_device
|
||||
void set_diablo(int unit, diablo_hd_device* ptr);
|
||||
|
||||
//! driver interface to set a speaker sound device
|
||||
void set_speaker(speaker_sound_device* speaker);
|
||||
|
||||
//! call in for the next sector callback
|
||||
void next_sector(int unit);
|
||||
|
||||
@ -201,11 +198,6 @@ public:
|
||||
|
||||
//! set the vblank bit for the display to synch upon
|
||||
void screen_vblank();
|
||||
|
||||
void ucode_map(address_map &map);
|
||||
void const_map(address_map &map);
|
||||
void iomem_map(address_map &map);
|
||||
|
||||
//! register a mouse motion in x direction
|
||||
DECLARE_INPUT_CHANGED_MEMBER( mouse_motion_x );
|
||||
//! register a mouse motion in y direction
|
||||
@ -243,10 +235,10 @@ protected:
|
||||
virtual std::unique_ptr<util::disasm_interface> create_disassembler() override;
|
||||
|
||||
private:
|
||||
|
||||
void fatal(int level, const char *format, ...);
|
||||
|
||||
devcb_read16 m_kb_read_callback;
|
||||
devcb_write16 m_utilout_callback;
|
||||
|
||||
address_space_config m_ucode_config;
|
||||
address_space_config m_const_config;
|
||||
@ -265,6 +257,10 @@ private:
|
||||
std::unique_ptr<uint8_t[]> m_ucode_cram;
|
||||
uint8_t* m_const_data;
|
||||
|
||||
void ucode_map(address_map &map);
|
||||
void const_map(address_map &map);
|
||||
void iomem_map(address_map &map);
|
||||
|
||||
//! read microcode CROM or CRAM, depending on m_ucode_ram_base
|
||||
DECLARE_READ32_MEMBER ( crom_cram_r );
|
||||
|
||||
@ -282,8 +278,6 @@ private:
|
||||
|
||||
int m_icount;
|
||||
|
||||
speaker_sound_device* m_speaker;
|
||||
|
||||
//! task numbers
|
||||
enum {
|
||||
task_emu, //!< emulator task
|
||||
|
@ -8,6 +8,7 @@
|
||||
#include "emu.h"
|
||||
#include "cpu/alto2/alto2cpu.h"
|
||||
#include "machine/diablo_hd.h"
|
||||
#include "sound/spkrdev.h"
|
||||
#include "emupal.h"
|
||||
#include "screen.h"
|
||||
#include "rendlay.h"
|
||||
@ -31,6 +32,7 @@ public:
|
||||
|
||||
protected:
|
||||
u16 kb_r(offs_t offset);
|
||||
void utilout_w(u16 data);
|
||||
|
||||
required_device<alto2_cpu_device> m_maincpu;
|
||||
required_device<speaker_sound_device> m_speaker;
|
||||
@ -245,6 +247,13 @@ u16 alto2_state::kb_r(offs_t offset)
|
||||
return m_io_row[offset]->read();
|
||||
}
|
||||
|
||||
void alto2_state::utilout_w(u16 data)
|
||||
{
|
||||
// FIXME: write printer data
|
||||
// printer_write();
|
||||
m_speaker->level_w(data ^ 0177777 ? 1 : 0);
|
||||
}
|
||||
|
||||
/* ROM */
|
||||
ROM_START( alto2 )
|
||||
// dummy region for the maincpu - this is not used in any way
|
||||
@ -263,6 +272,7 @@ void alto2_state::alto2(machine_config &config)
|
||||
// 5.8MHz according to de.wikipedia.org/wiki/Xerox_Alto
|
||||
ALTO2(config, m_maincpu, XTAL(29'491'200)/5);
|
||||
m_maincpu->kb_read_callback().set(FUNC(alto2_state::kb_r));
|
||||
m_maincpu->utilout_callback().set(FUNC(alto2_state::utilout_w));
|
||||
|
||||
// Video hardware
|
||||
screen_device &screen(SCREEN(config, "screen", SCREEN_TYPE_RASTER));
|
||||
@ -291,7 +301,7 @@ void alto2_state::init_alto2()
|
||||
alto2_cpu_device* cpu = downcast<alto2_cpu_device *>(m_maincpu.target());
|
||||
cpu->set_diablo(0, downcast<diablo_hd_device *>(machine().device(DIABLO_HD_0)));
|
||||
cpu->set_diablo(1, downcast<diablo_hd_device *>(machine().device(DIABLO_HD_1)));
|
||||
cpu->set_speaker(m_speaker);
|
||||
|
||||
// Create a timer which fires twice per frame, once for each field
|
||||
m_vblank_timer = timer_alloc(TIMER_VBLANK);
|
||||
m_vblank_timer->adjust(attotime::from_hz(2*30),0,attotime::from_hz(30*2));
|
||||
|
Loading…
Reference in New Issue
Block a user