mirror of
https://github.com/holub/mame
synced 2025-07-05 01:48:29 +03:00
- Removed device_timer, device_timer_id, et al in favor of direct callback members. (#9788)
Primarily, this removes device_t::device_timer, device_t::timer_set, device_t::synchronize, device_t::timer_expired, and device_timer_id. Use of device_timer often resulted in unnecessary trampolining in addition to switch/case overhead on a driver/device level, and additional logic to manage delegated vs. ID-based timers on a core level. In the worst cases, devices were performing a switch/case with only one valid case. device_scheduler::timer_set is marked deprecated as the only remaining direct uses are via the Lua engine and a few drivers that need refactoring anyway. The remaining uses occur via device_scheduler::synchronize. As a middle ground between the extremely short timer_alloc() and the extremely long machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(widget_device::contoso_tick), this)), a helper function in device_t has been added which can be invoked with the following syntax: timer_alloc(FUNC(widget_device::contoso_tick), this) - Additional changes/cleanups performed along the way: - Converted to use logmacro: * src/devices/bus/ieee488/hp9895.cpp * src/devices/bus/ieee488/remote488.cpp * src/devices/bus/isa/hdc.cpp * src/devices/bus/isa/omti8621.cpp * src/devices/bus/isa/sc499.cpp * src/devices/bus/vip/vp550.cpp * src/devices/cpu/i86/i186.cpp * src/devices/cpu/lc8670/lc8670.cpp * src/devices/machine/68230pit.cpp * src/devices/machine/corvushd.cpp * src/devices/machine/ds1994.cpp * src/devices/machine/ticket.cpp * src/mame/audio/pinsnd88.cpp * src/mame/drivers/notetaker.cpp * src/mame/machine/asic65.cpp * src/mame/machine/rmnimbus.cpp * src/mame/machine/victor9k_fdc.cpp * src/mame/video/uv201.cpp - Made usage of m_member prefix consistent: * src/devices/bus/isa/hdc.cpp * src/devices/bus/isa/omti8621.cpp * src/devices/bus/vme/vme_fccpu20.cpp * src/devices/machine/ds1386.cpp * src/devices/machine/i7220.cpp - Spacing consistency pass: * src/devices/bus/isa/hdc.cpp * src/devices/bus/isa/omti8621.cpp * src/devices/bus/thomson/nanoresau.cpp * src/devices/bus/ti99/internal/992board.cpp * src/devices/bus/ti99/internal/genkbd.cpp * src/devices/bus/ti99/internal/joyport/handset.cpp * src/devices/bus/vme/vme_fccpu20.cpp * src/devices/cpu/i86/i186.cpp * src/devices/cpu/lc8670/lc8670.cpp * src/devices/machine/68230pit.cpp * src/devices/machine/cop452.cpp * src/devices/machine/corvushd.cpp * src/devices/machine/hp_dc100_tape.cpp * src/devices/machine/hp_taco.cpp * src/devices/machine/meters.cpp * src/devices/machine/microtch.cpp * src/devices/machine/phi.cpp * src/devices/video/ef9365.cpp * src/devices/video/v9938.cpp * src/mame/drivers/alphaskop41xx.cpp * src/mame/drivers/myb3k.cpp * src/mame/drivers/notetaker.cpp * src/mame/drivers/wpc_an.cpp * src/mame/machine/midikbd.cpp * src/mame/machine/rmnimbus.cpp * src/mame/machine/wpc_lamp.cpp * src/mame/machine/wpc_out.cpp - Removed string-based ioport lookups: * src/devices/bus/ti99/internal/joyport/handset.cpp * src/devices/bus/ti99/internal/joyport/mecmouse.cpp * src/devices/bus/vme/vme_hcpu30.cpp * src/mame/machine/k7659kb.cpp * src/mame/machine/ti85.cpp - Adjustments to grammar/wording in comments * src/devices/bus/sms_ctrl/lphaser.cpp * src/devices/bus/sms_ctrl/sports.cpp * src/devices/bus/snes/event.cpp * src/devices/bus/snes/sa1.cpp * src/devices/bus/thomson/nanoresau.cpp * src/devices/bus/z88/z88.cpp * src/devices/machine/ds1386.cpp * src/devices/machine/vic_pl192.cpp - Favored BIT() macro for single-bit checks * src/devices/bus/ti99/internal/992board.cpp * src/devices/bus/ti99/joyport/handset.cpp * src/mame/drivers/notetaker.cpp * src/mame/machine/wpc_lamp.cpp * src/mame/machine/wpc_out.cpp - Removed C89-style variable declarations when noticed * src/devices/bus/isa/hdc.cpp * src/devices/bus/sms_ctrl/lphaser.cpp * src/devices/bus/ti99/joyport/mecmouse.cpp * src/devices/machine/acorn_vidc.cpp * src/devices/sound/ymz280b.cpp * src/devices/video/vic4567.cpp - Removed FUNCNAME to avoid compiler-specific #define checks in devices * src/devices/bus/vme/vme_fccpu20.cpp * src/devices/bus/vme/vme_hcpu30.cpp * src/devices/machine/68230pit.cpp * src/devices/machine/mc14411.cpp * src/mame/drivers/myb3k.cpp - Removed unecessary member prefixes/suffixes * src/devices/video/ef9340_1.cpp * src/mame/drivers/fuukifg2.cpp * src/mame/drivers/fuukifg3.cpp * src/mame/drivers/intv.cpp * src/mame/drivers/simpsons.cpp * src/mame/drivers/socrates.cpp * src/mame/drivers/special_gambl.cpp * src/mame/drivers/sprint4.cpp * src/mame/drivers/ti990_10.cpp * src/mame/drivers/tubep.cpp * src/mame/drivers/vectrex.cpp * src/mame/drivers/wpc_an.cpp * src/mame/drivers/wpc_dot.cpp * src/mame/drivers/wpc_flip1.cpp * src/mame/drivers/wpc_flip2.cpp * src/mame/machine/z80ne.cpp * src/mame/video/rollerg.cpp - Switched to lower-case hex constants * src/devices/video/ef9365.cpp * src/mame/machine/rmnimbus.cpp - Re-ordered driver overrides and function members * src/mame/drivers/boxer.cpp * src/mame/drivers/eurocom2.cpp * src/mame/drivers/exidy.cpp * src/mame/drivers/gpworld.cpp * src/mame/drivers/h19.cpp * src/mame/drivers/ibmpcjr.cpp * src/mame/drivers/mekd5.cpp * src/mame/drivers/mgolf.cpp * src/mame/drivers/myb3k.cpp * src/mame/drivers/nightmare.cpp * src/mame/drivers/notetaker.cpp * src/mame/drivers/ptcsol.cpp * src/mame/drivers/pwrview.cpp * src/mame/drivers/rabbit.cpp * src/mame/drivers/sitcom.cpp * src/mame/drivers/socrates.cpp * src/mame/drivers/sprint4.cpp * src/mame/drivers/techno.cpp * src/mame/drivers/thayers.cpp * src/mame/drivers/ti990_10.cpp * src/mame/drivers/ti990_4.cpp * src/mame/drivers/tv912.cpp * src/mame/drivers/tv990.cpp * src/mame/drivers/uchroma68.cpp * src/mame/drivers/vk100.cpp * src/mame/drivers/votrhv.cpp * src/mame/drivers/wicat.cpp * src/mame/drivers/wpc_an.cpp * src/mame/includes/abc80.h * src/mame/includes/asterix.h * src/mame/includes/fuukifg2.h * src/mame/includes/fuukifg3.h * src/mame/includes/gunbustr.h * src/mame/includes/intv.h * src/mame/includes/namcona1.h * src/mame/includes/newbrain.h * src/mame/includes/poly.h * src/mame/includes/prof80.h * src/mame/includes/rollerg.h * src/mame/includes/s11.h * src/mame/includes/segahang.h * src/mame/includes/simpsons.h * src/mame/includes/spacefb.h * src/mame/includes/tandy2k.h * src/mame/includes/trucocl.h * src/mame/includes/tubebp.h * src/mame/includes/vidbrain.h * src/mame/includes/wolfpack.h * src/mame/includes/wpc_dot.h - Made capitalization consistent on class members * src/devices/machine/meters.cpp * src/mame/drivers/namcona1.cpp * src/mame/drivers/notetaker.cpp -src/devices/bus/isa/hdc.cpp: * Removed fixed-size std::vector in favor of std::unique_ptr -src/devices/bus/isa/s3virge.cpp: * Moved unusually large (for a header) functions into .cpp from header -src/devices/bus/vip/vp550.cpp * Switched to required_device_array to simplify code paths -src/devices/machine/arm_iomd.cpp * Added initializers to constructor * Favored std::size over fixed static sizes -src/devices/machine/ds1386.cpp * Moved register #defines into header enums -src/devices/machine/mc68901.cpp * Removed unnecessary parameters and emu_timer::enable calls -src/devices/machine/mccs1850.cpp * Removed inline overuse -src/devices/machine/meters.cpp * Removed unused members -src/devices/machine/mos6526.cpp * Removed inline overuse -src/devices/machine/nsc810.cpp * Converted to arrays rather than individually-numbered members -src/devices/machine/pxa255.cpp * Simplified DMA transfer code -src/devices/machine/saa1043.cpp * Removed extraneous members in favor of resolve_all_safe -src/devices/machine/vic_pl192.cpp * Shifted constructors, start-up, and maps to be at the top of the source file -src/devices/machine/z8536.cpp * Removed stray uses of device_timer_id -src/devices/sound/cdp1869.cpp * Removed inline overuse -src/devices/sound/mos7360.cpp * Converted to arrays rather than individually-numbered members -src/emu/device.cpp * Removed ID-based timer_alloc * Removed timer_set * Removed synchronize * Removed timer_expired * Added shorthand timer_alloc to avoid lengthy machine().scheduler().timer_alloc() calls -src/emu/schedule.cpp * Removed now-unused m_id and m_device members -src/mame/audio/alesis.cpp * Added initializers to constructor -src/mame/drivers/alto2.cpp * Removed custom-named driver init in favor of driver_init override * Removed octal constant in favor of more standard hex -src/mame/drivers/astinvad.cpp * Fixed 'kamizake' typo -src/mame/drivers/tm990189.cpp * Removed unnecessary machine reset override -src/mame/drivers/unichamp.cpp * Removed custom-named driver init in favor of driver_init override -src/mame/drivers/votrhv.cpp * Fixed ROM_LOAD macros and region() usage in memory maps -src/mame/machine/victor9k_fdc.cpp * Made bracing style consistent across the file -src/mame/video/gime.cpp * Removed unnecessary void specifiers in function prototypes
This commit is contained in:
parent
cd83335913
commit
1bc5484698
@ -207,8 +207,8 @@ void mcms_device::device_start()
|
||||
{
|
||||
m_write_irq.resolve();
|
||||
m_stream = stream_alloc(0, 2, 31250);
|
||||
m_timer = timer_alloc(0);
|
||||
m_clrtimer = timer_alloc(1);
|
||||
m_timer = timer_alloc(FUNC(mcms_device::set_irq_tick), this);
|
||||
m_clrtimer = timer_alloc(FUNC(mcms_device::clr_irq_tick), this);
|
||||
m_enabled = false;
|
||||
memset(m_vols, 0, sizeof(m_vols));
|
||||
memset(m_table, 0, sizeof(m_table));
|
||||
@ -238,18 +238,16 @@ void mcms_device::device_reset()
|
||||
m_enabled = false;
|
||||
}
|
||||
|
||||
void mcms_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
|
||||
TIMER_CALLBACK_MEMBER(mcms_device::set_irq_tick)
|
||||
{
|
||||
if (tid == 0)
|
||||
{
|
||||
m_write_irq(ASSERT_LINE);
|
||||
// clear this IRQ in 10 cycles (?)
|
||||
m_clrtimer->adjust(attotime::from_usec(10), 0);
|
||||
}
|
||||
else if (tid == 1)
|
||||
{
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(mcms_device::clr_irq_tick)
|
||||
{
|
||||
m_write_irq(CLEAR_LINE);
|
||||
}
|
||||
}
|
||||
|
||||
void mcms_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
|
@ -40,13 +40,16 @@ protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(set_irq_tick);
|
||||
TIMER_CALLBACK_MEMBER(clr_irq_tick);
|
||||
|
||||
private:
|
||||
sound_stream *m_stream;
|
||||
emu_timer *m_timer, *m_clrtimer;
|
||||
emu_timer *m_timer;
|
||||
emu_timer *m_clrtimer;
|
||||
a2bus_mcms1_device *m_pBusDevice;
|
||||
bool m_enabled;
|
||||
uint8_t m_vols[16];
|
||||
|
@ -213,7 +213,7 @@ ioport_constructor a2bus_parprn_device::device_input_ports() const
|
||||
|
||||
void a2bus_parprn_device::device_start()
|
||||
{
|
||||
m_strobe_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a2bus_parprn_device::update_strobe), this));
|
||||
m_strobe_timer = timer_alloc(FUNC(a2bus_parprn_device::update_strobe), this);
|
||||
|
||||
save_item(NAME(m_next_strobe));
|
||||
save_item(NAME(m_ack_latch));
|
||||
|
@ -343,7 +343,7 @@ ioport_constructor a2bus_pic_device::device_input_ports() const
|
||||
|
||||
void a2bus_pic_device::device_start()
|
||||
{
|
||||
m_strobe_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a2bus_pic_device::release_strobe), this));
|
||||
m_strobe_timer = timer_alloc(FUNC(a2bus_pic_device::release_strobe), this);
|
||||
|
||||
m_firmware_base = 0x0100U;
|
||||
m_data_latch = 0xffU;
|
||||
|
@ -101,7 +101,7 @@ a2bus_a2sd_device::a2bus_a2sd_device(const machine_config &mconfig, const char *
|
||||
|
||||
void a2bus_a2sd_device::device_start()
|
||||
{
|
||||
m_shift_timer = timer_alloc(0);
|
||||
m_shift_timer = timer_alloc(FUNC(a2bus_a2sd_device::shift_tick), this);
|
||||
|
||||
save_item(NAME(m_datain));
|
||||
save_item(NAME(m_in_latch));
|
||||
@ -119,7 +119,7 @@ void a2bus_a2sd_device::device_reset()
|
||||
m_sdcard->spi_clock_w(CLEAR_LINE);
|
||||
}
|
||||
|
||||
void a2bus_a2sd_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(a2bus_a2sd_device::shift_tick)
|
||||
{
|
||||
LOGMASKED(LOG_SPI, ">>>>>>> SHIFT %d (%c)\n", m_shift_count, (m_shift_count & 1) ? 'L' : 'S');
|
||||
if (!(m_shift_count & 1))
|
||||
|
@ -36,7 +36,6 @@ protected:
|
||||
virtual void device_reset() override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// overrides of standard a2bus slot functions
|
||||
virtual u8 read_c0nx(u8 offset) override;
|
||||
@ -49,6 +48,7 @@ protected:
|
||||
// SPI 4-wire interface
|
||||
WRITE_LINE_MEMBER(spi_miso_w) { m_in_bit = state; }
|
||||
|
||||
TIMER_CALLBACK_MEMBER(shift_tick);
|
||||
private:
|
||||
required_device<at28c64b_device> m_flash;
|
||||
required_device<spi_sdcard_device> m_sdcard;
|
||||
|
@ -89,6 +89,8 @@ a2bus_agat840k_hle_device::a2bus_agat840k_hle_device(const machine_config &mconf
|
||||
, m_floppy_image(*this, "floppy%u", 0U)
|
||||
, m_d14(*this, "d14")
|
||||
, m_d15(*this, "d15")
|
||||
, m_timer_wait(nullptr)
|
||||
, m_timer_seek(nullptr)
|
||||
, m_rom(nullptr)
|
||||
{
|
||||
}
|
||||
@ -137,8 +139,8 @@ void a2bus_agat840k_hle_device::device_start()
|
||||
|
||||
m_mxcs = MXCSR_SYNC;
|
||||
|
||||
m_timer_wait = timer_alloc(TIMER_ID_WAIT);
|
||||
m_timer_seek = timer_alloc(TIMER_ID_SEEK);
|
||||
m_timer_wait = timer_alloc(FUNC(a2bus_agat840k_hle_device::timer_wait_tick), this);
|
||||
m_timer_seek = timer_alloc(FUNC(a2bus_agat840k_hle_device::timer_seek_tick), this);
|
||||
|
||||
m_seektime = 6000; // 6 ms, per es5323.txt
|
||||
m_waittime = 32; // 16 bits x 2 us
|
||||
@ -226,29 +228,24 @@ void a2bus_agat840k_hle_device::device_reset()
|
||||
m_mxcs &= ~MXCSR_TR;
|
||||
}
|
||||
|
||||
void a2bus_agat840k_hle_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(a2bus_agat840k_hle_device::timer_wait_tick)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case TIMER_ID_WAIT:
|
||||
{
|
||||
m_count_read++;
|
||||
m_count_read %= 6250;
|
||||
m_d15->pc4_w(0);
|
||||
m_d15->pc4_w(1);
|
||||
if (BIT(m_tracks[(2 * m_floppy->floppy_drive_get_current_track()) + m_side][m_count_read], 15))
|
||||
m_mxcs &= ~MXCSR_SYNC;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case TIMER_ID_SEEK:
|
||||
TIMER_CALLBACK_MEMBER(a2bus_agat840k_hle_device::timer_seek_tick)
|
||||
{
|
||||
m_floppy->floppy_stp_w(1);
|
||||
m_floppy->floppy_stp_w(0);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
read_c0nx - called for reads from this card's c0nx space
|
||||
-------------------------------------------------*/
|
||||
|
@ -55,7 +55,6 @@ protected:
|
||||
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
|
||||
@ -64,11 +63,8 @@ protected:
|
||||
virtual void write_c0nx(uint8_t offset, uint8_t data) override;
|
||||
virtual uint8_t read_cnxx(uint8_t offset) override;
|
||||
|
||||
enum
|
||||
{
|
||||
TIMER_ID_WAIT = 0,
|
||||
TIMER_ID_SEEK
|
||||
};
|
||||
TIMER_CALLBACK_MEMBER(timer_wait_tick);
|
||||
TIMER_CALLBACK_MEMBER(timer_seek_tick);
|
||||
|
||||
required_device_array<legacy_floppy_image_device, 2> m_floppy_image;
|
||||
required_device<i8255_device> m_d14;
|
||||
@ -91,8 +87,8 @@ private:
|
||||
int m_seektime;
|
||||
int m_waittime;
|
||||
|
||||
emu_timer *m_timer_wait = nullptr;
|
||||
emu_timer *m_timer_seek = nullptr;
|
||||
emu_timer *m_timer_wait;
|
||||
emu_timer *m_timer_seek;
|
||||
|
||||
uint8_t *m_rom;
|
||||
};
|
||||
|
@ -140,8 +140,8 @@ void a2bus_agat_fdc_device::device_start()
|
||||
|
||||
m_mxcs = MXCSR_SYNC;
|
||||
|
||||
m_timer_lss = timer_alloc(TIMER_ID_LSS);
|
||||
m_timer_motor = timer_alloc(TIMER_ID_MOTOR);
|
||||
m_timer_lss = timer_alloc(FUNC(a2bus_agat_fdc_device::lss_sync), this);
|
||||
m_timer_motor = timer_alloc(FUNC(a2bus_agat_fdc_device::motor_off), this);
|
||||
|
||||
m_seektime = 6; // ms, per es5323.txt
|
||||
m_waittime = 32; // us - 16 bits x 2 us
|
||||
@ -162,19 +162,10 @@ void a2bus_agat_fdc_device::device_reset()
|
||||
m_timer_lss->adjust(attotime::from_msec(10), 0, attotime::from_msec(10));
|
||||
}
|
||||
|
||||
void a2bus_agat_fdc_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(a2bus_agat_fdc_device::motor_off)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case TIMER_ID_LSS:
|
||||
lss_sync();
|
||||
break;
|
||||
|
||||
case TIMER_ID_MOTOR:
|
||||
active = 0;
|
||||
floppy->mon_w(1);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
uint64_t a2bus_agat_fdc_device::time_to_cycles(const attotime &tm)
|
||||
@ -199,7 +190,7 @@ void a2bus_agat_fdc_device::lss_start()
|
||||
bits = 8;
|
||||
}
|
||||
|
||||
void a2bus_agat_fdc_device::lss_sync()
|
||||
TIMER_CALLBACK_MEMBER(a2bus_agat_fdc_device::lss_sync)
|
||||
{
|
||||
if(!active)
|
||||
return;
|
||||
@ -301,7 +292,7 @@ uint8_t a2bus_agat_fdc_device::read_c0nx(uint8_t offset)
|
||||
{
|
||||
u8 data;
|
||||
|
||||
lss_sync();
|
||||
lss_sync(0);
|
||||
|
||||
switch (offset)
|
||||
{
|
||||
@ -328,7 +319,7 @@ uint8_t a2bus_agat_fdc_device::read_c0nx(uint8_t offset)
|
||||
|
||||
void a2bus_agat_fdc_device::write_c0nx(uint8_t offset, uint8_t data)
|
||||
{
|
||||
lss_sync();
|
||||
lss_sync(0);
|
||||
|
||||
switch (offset)
|
||||
{
|
||||
|
@ -49,7 +49,6 @@ protected:
|
||||
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
|
||||
@ -76,7 +75,9 @@ private:
|
||||
attotime cycles_to_time(uint64_t cycles);
|
||||
|
||||
void lss_start();
|
||||
void lss_sync();
|
||||
TIMER_CALLBACK_MEMBER(lss_sync);
|
||||
|
||||
TIMER_CALLBACK_MEMBER(motor_off);
|
||||
|
||||
floppy_image_device *floppy;
|
||||
int active, bits;
|
||||
|
@ -101,7 +101,7 @@ void a2bus_corvfdc02_device::device_start()
|
||||
{
|
||||
m_rom = device().machine().root_device().memregion(this->subtag(FDC02_ROM_REGION).c_str())->base();
|
||||
|
||||
m_timer = timer_alloc(0);
|
||||
m_timer = timer_alloc(FUNC(a2bus_corvfdc02_device::tc_tick), this);
|
||||
|
||||
save_item(NAME(m_fdc_local_status));
|
||||
save_item(NAME(m_fdc_local_command));
|
||||
@ -118,7 +118,7 @@ void a2bus_corvfdc02_device::device_reset()
|
||||
m_timer->adjust(attotime::never);
|
||||
}
|
||||
|
||||
void a2bus_corvfdc02_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(a2bus_corvfdc02_device::tc_tick)
|
||||
{
|
||||
m_fdc->tc_w(true);
|
||||
m_fdc->tc_w(false);
|
||||
|
@ -35,7 +35,6 @@ protected:
|
||||
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
|
||||
@ -44,6 +43,8 @@ protected:
|
||||
virtual void write_c0nx(uint8_t offset, uint8_t data) override;
|
||||
virtual uint8_t read_cnxx(uint8_t offset) override;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(tc_tick);
|
||||
|
||||
required_device<upd765a_device> m_fdc;
|
||||
required_device<floppy_connector> m_con1;
|
||||
required_device<floppy_connector> m_con2;
|
||||
|
@ -746,7 +746,7 @@ void a2bus_grapplerplus_device::device_start()
|
||||
{
|
||||
a2bus_grapplerplus_device_base::device_start();
|
||||
|
||||
m_strobe_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a2bus_grapplerplus_device::update_strobe), this));
|
||||
m_strobe_timer = timer_alloc(FUNC(a2bus_grapplerplus_device::update_strobe), this);
|
||||
|
||||
m_next_strobe = 1U;
|
||||
|
||||
|
@ -158,7 +158,7 @@ a2bus_transwarp_device::a2bus_transwarp_device(const machine_config &mconfig, co
|
||||
|
||||
void a2bus_transwarp_device::device_start()
|
||||
{
|
||||
m_timer = timer_alloc(0);
|
||||
m_timer = timer_alloc(FUNC(a2bus_transwarp_device::clock_adjust_tick), this);
|
||||
|
||||
save_item(NAME(m_bEnabled));
|
||||
save_item(NAME(m_bReadA2ROM));
|
||||
@ -187,7 +187,7 @@ void a2bus_transwarp_device::device_reset()
|
||||
}
|
||||
}
|
||||
|
||||
void a2bus_transwarp_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(a2bus_transwarp_device::clock_adjust_tick)
|
||||
{
|
||||
if (m_bIn1MHzMode)
|
||||
{
|
||||
|
@ -33,7 +33,6 @@ protected:
|
||||
virtual void device_reset() override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
|
||||
// overrides of standard a2bus slot functions
|
||||
@ -49,6 +48,8 @@ private:
|
||||
required_region_ptr<uint8_t> m_rom;
|
||||
required_ioport m_dsw1, m_dsw2;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(clock_adjust_tick);
|
||||
|
||||
uint8_t dma_r(offs_t offset);
|
||||
void dma_w(offs_t offset, uint8_t data);
|
||||
|
||||
|
@ -185,7 +185,7 @@ ioport_constructor a2bus_uniprint_device::device_input_ports() const
|
||||
|
||||
void a2bus_uniprint_device::device_start()
|
||||
{
|
||||
m_strobe_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a2bus_uniprint_device::update_strobe), this));
|
||||
m_strobe_timer = timer_alloc(FUNC(a2bus_uniprint_device::update_strobe), this);
|
||||
|
||||
m_next_strobe = 1U;
|
||||
|
||||
|
@ -26,7 +26,6 @@ TODO:
|
||||
//**************************************************************************
|
||||
|
||||
DEFINE_DEVICE_TYPE(A8SIO_CASSETTE, a8sio_cassette_device, "a8sio_cass", "Atari 8 bit cassette")
|
||||
const device_timer_id TIMER_CASSETTE_READ = 1;
|
||||
|
||||
void a8sio_cassette_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
@ -60,7 +59,7 @@ void a8sio_cassette_device::device_start()
|
||||
save_item(NAME(m_old_cass_signal));
|
||||
save_item(NAME(m_signal_count));
|
||||
|
||||
m_read_timer = timer_alloc(TIMER_CASSETTE_READ);
|
||||
m_read_timer = timer_alloc(FUNC(a8sio_cassette_device::read_tick), this);
|
||||
}
|
||||
|
||||
void a8sio_cassette_device::device_reset()
|
||||
@ -82,11 +81,8 @@ WRITE_LINE_MEMBER( a8sio_cassette_device::motor_w )
|
||||
}
|
||||
}
|
||||
|
||||
void a8sio_cassette_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(a8sio_cassette_device::read_tick)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case TIMER_CASSETTE_READ:
|
||||
uint8_t cass_signal = m_cassette->input() < 0 ? 0 : 1;
|
||||
|
||||
if (m_signal_count < 20)
|
||||
@ -103,6 +99,4 @@ void a8sio_cassette_device::device_timer(emu_timer &timer, device_timer_id id, i
|
||||
m_signal_count = 0;
|
||||
m_old_cass_signal = cass_signal;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -36,9 +36,10 @@ protected:
|
||||
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(read_tick);
|
||||
|
||||
required_device<cassette_image_device> m_cassette;
|
||||
emu_timer *m_read_timer;
|
||||
|
||||
|
@ -382,7 +382,7 @@ inline void abc77_device::serial_output(int state)
|
||||
// serial_clock -
|
||||
//-------------------------------------------------
|
||||
|
||||
inline void abc77_device::serial_clock()
|
||||
TIMER_CALLBACK_MEMBER(abc77_device::serial_clock)
|
||||
{
|
||||
m_clock = !m_clock;
|
||||
|
||||
@ -442,10 +442,10 @@ abc77_device::abc77_device(const machine_config &mconfig, const char *tag, devic
|
||||
void abc77_device::device_start()
|
||||
{
|
||||
// allocate timers
|
||||
m_serial_timer = timer_alloc(TIMER_SERIAL);
|
||||
m_serial_timer = timer_alloc(FUNC(abc77_device::serial_clock), this);
|
||||
m_serial_timer->adjust(attotime::from_hz(19200), 0, attotime::from_hz(19200)); // ALE/32
|
||||
|
||||
m_reset_timer = timer_alloc(TIMER_RESET);
|
||||
m_reset_timer = timer_alloc(FUNC(abc77_device::reset_tick), this);
|
||||
}
|
||||
|
||||
|
||||
@ -469,21 +469,12 @@ void abc77_device::device_reset()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_timer - handler timer events
|
||||
// reset_tick - handle delayed reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void abc77_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(abc77_device::reset_tick)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case TIMER_SERIAL:
|
||||
serial_clock();
|
||||
break;
|
||||
|
||||
case TIMER_RESET:
|
||||
m_maincpu->set_input_line(INPUT_LINE_RESET, CLEAR_LINE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -40,7 +40,6 @@ protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// optional information overrides
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
@ -57,9 +56,11 @@ private:
|
||||
TIMER_RESET
|
||||
};
|
||||
|
||||
inline void serial_output(int state);
|
||||
inline void serial_clock();
|
||||
inline void key_down(int state);
|
||||
void serial_output(int state);
|
||||
void key_down(int state);
|
||||
|
||||
TIMER_CALLBACK_MEMBER(serial_clock);
|
||||
TIMER_CALLBACK_MEMBER(reset_tick);
|
||||
|
||||
required_device<i8035_device> m_maincpu;
|
||||
required_device<watchdog_timer_device> m_watchdog;
|
||||
|
@ -268,7 +268,7 @@ ioport_constructor abc800_keyboard_device::device_input_ports() const
|
||||
// serial_output -
|
||||
//-------------------------------------------------
|
||||
|
||||
inline void abc800_keyboard_device::serial_output(int state)
|
||||
void abc800_keyboard_device::serial_output(int state)
|
||||
{
|
||||
if (m_txd != state)
|
||||
{
|
||||
@ -283,7 +283,7 @@ inline void abc800_keyboard_device::serial_output(int state)
|
||||
// serial_clock -
|
||||
//-------------------------------------------------
|
||||
|
||||
inline void abc800_keyboard_device::serial_clock()
|
||||
TIMER_CALLBACK_MEMBER(abc800_keyboard_device::serial_clock)
|
||||
{
|
||||
m_clk = !m_clk;
|
||||
|
||||
@ -295,7 +295,7 @@ inline void abc800_keyboard_device::serial_clock()
|
||||
// keydown -
|
||||
//-------------------------------------------------
|
||||
|
||||
inline void abc800_keyboard_device::key_down(int state)
|
||||
void abc800_keyboard_device::key_down(int state)
|
||||
{
|
||||
if (m_keydown != state)
|
||||
{
|
||||
@ -337,7 +337,7 @@ abc800_keyboard_device::abc800_keyboard_device(const machine_config &mconfig, co
|
||||
void abc800_keyboard_device::device_start()
|
||||
{
|
||||
// allocate timers
|
||||
m_serial_timer = timer_alloc();
|
||||
m_serial_timer = timer_alloc(FUNC(abc800_keyboard_device::serial_clock), this);
|
||||
m_serial_timer->adjust(attotime::from_hz(XTAL(5'990'400)/(3*5)/20), 0, attotime::from_hz(XTAL(5'990'400)/(3*5)/20)); // ???
|
||||
|
||||
// state saving
|
||||
@ -358,15 +358,6 @@ void abc800_keyboard_device::device_reset()
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_timer - handler timer events
|
||||
//-------------------------------------------------
|
||||
|
||||
void abc800_keyboard_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
{
|
||||
serial_clock();
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// txd_w -
|
||||
|
@ -38,7 +38,6 @@ protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// optional information overrides
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
@ -46,9 +45,9 @@ protected:
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
|
||||
private:
|
||||
inline void serial_output(int state);
|
||||
inline void serial_clock();
|
||||
inline void key_down(int state);
|
||||
void serial_output(int state);
|
||||
TIMER_CALLBACK_MEMBER(serial_clock);
|
||||
void key_down(int state);
|
||||
|
||||
uint8_t kb_p1_r();
|
||||
void kb_p1_w(uint8_t data);
|
||||
|
@ -398,15 +398,11 @@ ioport_constructor abc99_device::device_input_ports() const
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// INLINE HELPERS
|
||||
//**************************************************************************
|
||||
|
||||
//-------------------------------------------------
|
||||
// serial_input -
|
||||
//-------------------------------------------------
|
||||
|
||||
inline void abc99_device::serial_input()
|
||||
void abc99_device::serial_input()
|
||||
{
|
||||
m_maincpu->set_input_line(MCS48_INPUT_IRQ, (m_si || m_si_en) ? CLEAR_LINE : ASSERT_LINE);
|
||||
m_mousecpu->set_input_line(MCS48_INPUT_IRQ, m_si ? CLEAR_LINE : ASSERT_LINE);
|
||||
@ -417,7 +413,7 @@ inline void abc99_device::serial_input()
|
||||
// serial_output -
|
||||
//-------------------------------------------------
|
||||
|
||||
inline void abc99_device::serial_output(int state)
|
||||
void abc99_device::serial_output(int state)
|
||||
{
|
||||
if (m_txd != state)
|
||||
{
|
||||
@ -432,18 +428,27 @@ inline void abc99_device::serial_output(int state)
|
||||
// serial_clock -
|
||||
//-------------------------------------------------
|
||||
|
||||
inline void abc99_device::serial_clock()
|
||||
TIMER_CALLBACK_MEMBER(abc99_device::serial_clock)
|
||||
{
|
||||
m_slot->trxc_w(1);
|
||||
m_slot->trxc_w(0);
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// scan_mouse -
|
||||
//-------------------------------------------------
|
||||
|
||||
TIMER_CALLBACK_MEMBER(abc99_device::scan_mouse)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// keydown -
|
||||
//-------------------------------------------------
|
||||
|
||||
inline void abc99_device::key_down(int state)
|
||||
void abc99_device::key_down(int state)
|
||||
{
|
||||
if (m_keydown != state)
|
||||
{
|
||||
@ -453,15 +458,6 @@ inline void abc99_device::key_down(int state)
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// scan_mouse -
|
||||
//-------------------------------------------------
|
||||
|
||||
inline void abc99_device::scan_mouse()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// LIVE DEVICE
|
||||
@ -502,10 +498,10 @@ void abc99_device::device_start()
|
||||
{
|
||||
m_leds.resolve();
|
||||
// allocate timers
|
||||
m_serial_timer = timer_alloc(TIMER_SERIAL);
|
||||
m_serial_timer = timer_alloc(FUNC(abc99_device::serial_clock), this);
|
||||
m_serial_timer->adjust(MCS48_ALE_CLOCK(XTAL(6'000'000)/3), 0, MCS48_ALE_CLOCK(XTAL(6'000'000)/3));
|
||||
|
||||
m_mouse_timer = timer_alloc(TIMER_MOUSE);
|
||||
m_mouse_timer = timer_alloc(FUNC(abc99_device::scan_mouse), this);
|
||||
|
||||
// state saving
|
||||
save_item(NAME(m_si));
|
||||
@ -535,25 +531,6 @@ void abc99_device::device_reset()
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_timer - handler timer events
|
||||
//-------------------------------------------------
|
||||
|
||||
void abc99_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case TIMER_SERIAL:
|
||||
serial_clock();
|
||||
break;
|
||||
|
||||
case TIMER_MOUSE:
|
||||
scan_mouse();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// txd_w -
|
||||
//-------------------------------------------------
|
||||
|
@ -37,7 +37,6 @@ protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// optional information overrides
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
@ -48,12 +47,6 @@ protected:
|
||||
virtual void txd_w(int state) override;
|
||||
|
||||
private:
|
||||
enum
|
||||
{
|
||||
TIMER_SERIAL,
|
||||
TIMER_MOUSE
|
||||
};
|
||||
|
||||
enum
|
||||
{
|
||||
LED_1 = 0,
|
||||
@ -69,11 +62,11 @@ private:
|
||||
LED_CAPS_LOCK
|
||||
};
|
||||
|
||||
inline void serial_input();
|
||||
inline void serial_output(int state);
|
||||
inline void serial_clock();
|
||||
inline void key_down(int state);
|
||||
inline void scan_mouse();
|
||||
void serial_input();
|
||||
void serial_output(int state);
|
||||
TIMER_CALLBACK_MEMBER(serial_clock);
|
||||
TIMER_CALLBACK_MEMBER(scan_mouse);
|
||||
void key_down(int state);
|
||||
|
||||
void z2_p1_w(uint8_t data);
|
||||
uint8_t z2_p2_r();
|
||||
|
@ -209,8 +209,8 @@ protected:
|
||||
{
|
||||
mitsumi_keyboard_base::device_start();
|
||||
|
||||
m_wd_timeout = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mitsumi_watchdog_keyboard_base::wd_timeout), this));
|
||||
m_wd_pulse = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mitsumi_watchdog_keyboard_base::wd_pulse), this));
|
||||
m_wd_timeout = timer_alloc(FUNC(mitsumi_watchdog_keyboard_base::wd_timeout), this);
|
||||
m_wd_pulse = timer_alloc(FUNC(mitsumi_watchdog_keyboard_base::wd_pulse), this);
|
||||
|
||||
m_pd7 = 0x01U;
|
||||
|
||||
@ -284,7 +284,7 @@ protected:
|
||||
{
|
||||
mitsumi_watchdog_keyboard_base::device_start();
|
||||
|
||||
m_reset_pulse = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a500_keyboard_base::reset_pulse), this));
|
||||
m_reset_pulse = timer_alloc(FUNC(a500_keyboard_base::reset_pulse), this);
|
||||
|
||||
m_reset_active = 0U;
|
||||
|
||||
@ -344,7 +344,7 @@ protected:
|
||||
{
|
||||
mitsumi_keyboard_base::device_start();
|
||||
|
||||
m_reset_pulse = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(a600_keyboard_base::reset_pulse), this));
|
||||
m_reset_pulse = timer_alloc(FUNC(a600_keyboard_base::reset_pulse), this);
|
||||
|
||||
m_reset_trigger = 0U;
|
||||
m_reset_active = 0U;
|
||||
|
@ -31,7 +31,7 @@ astrocade_lightpen_device::~astrocade_lightpen_device()
|
||||
|
||||
void astrocade_lightpen_device::device_start()
|
||||
{
|
||||
m_pen_timer = timer_alloc(TIMER_TRIGGER);
|
||||
m_pen_timer = timer_alloc(FUNC(astrocade_lightpen_device::trigger_tick), this);
|
||||
|
||||
save_item(NAME(m_retrigger));
|
||||
}
|
||||
@ -42,20 +42,17 @@ void astrocade_lightpen_device::device_reset()
|
||||
m_retrigger = false;
|
||||
}
|
||||
|
||||
void astrocade_lightpen_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(astrocade_lightpen_device::trigger_tick)
|
||||
{
|
||||
if (id == TIMER_TRIGGER)
|
||||
{
|
||||
write_ltpen(1);
|
||||
write_ltpen(0);
|
||||
if (m_retrigger)
|
||||
m_pen_timer->adjust(m_screen->time_until_pos(m_lighty->read(), m_lightx->read()));
|
||||
else
|
||||
m_pen_timer->adjust(attotime::never);
|
||||
}
|
||||
}
|
||||
|
||||
INPUT_CHANGED_MEMBER( astrocade_lightpen_device::trigger )
|
||||
INPUT_CHANGED_MEMBER(astrocade_lightpen_device::trigger)
|
||||
{
|
||||
if (newval)
|
||||
{
|
||||
|
@ -22,16 +22,15 @@ public:
|
||||
astrocade_lightpen_device(machine_config const &mconfig, char const *tag, device_t *owner, uint32_t clock = 0U);
|
||||
virtual ~astrocade_lightpen_device();
|
||||
|
||||
DECLARE_INPUT_CHANGED_MEMBER( trigger );
|
||||
DECLARE_INPUT_CHANGED_MEMBER(trigger);
|
||||
|
||||
protected:
|
||||
// device_t implementation
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
static const device_timer_id TIMER_TRIGGER = 0;
|
||||
TIMER_CALLBACK_MEMBER(trigger_tick);
|
||||
|
||||
private:
|
||||
required_ioport m_trigger;
|
||||
|
@ -110,8 +110,8 @@ void ata_hle_device::device_start()
|
||||
|
||||
save_item(NAME(m_identify_buffer));
|
||||
|
||||
m_busy_timer = timer_alloc(TID_BUSY);
|
||||
m_buffer_empty_timer = timer_alloc(TID_BUFFER_EMPTY);
|
||||
m_busy_timer = timer_alloc(FUNC(ata_hle_device::busy_tick), this);
|
||||
m_buffer_empty_timer = timer_alloc(FUNC(ata_hle_device::empty_tick), this);
|
||||
}
|
||||
|
||||
void ata_hle_device::device_reset()
|
||||
@ -151,20 +151,16 @@ void ata_hle_device::soft_reset()
|
||||
start_busy(DIAGNOSTIC_TIME, PARAM_DIAGNOSTIC);
|
||||
}
|
||||
|
||||
void ata_hle_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(ata_hle_device::busy_tick)
|
||||
{
|
||||
switch(id)
|
||||
{
|
||||
case TID_BUSY:
|
||||
m_status &= ~IDE_STATUS_BSY;
|
||||
|
||||
finished_busy(param);
|
||||
break;
|
||||
case TID_BUFFER_EMPTY:
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(ata_hle_device::empty_tick)
|
||||
{
|
||||
m_buffer_empty_timer->enable(false);
|
||||
fill_buffer();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void ata_hle_device::finished_busy(int param)
|
||||
|
@ -35,7 +35,9 @@ protected:
|
||||
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(busy_tick);
|
||||
TIMER_CALLBACK_MEMBER(empty_tick);
|
||||
|
||||
void set_irq(int state);
|
||||
void set_dmarq(int state);
|
||||
|
@ -812,7 +812,7 @@ void ide_hdd_device::device_start()
|
||||
ata_mass_storage_device::device_start();
|
||||
|
||||
/* create a timer for timing status */
|
||||
m_last_status_timer = timer_alloc(TID_NULL);
|
||||
m_last_status_timer = machine().scheduler().timer_alloc(timer_expired_delegate());
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
|
@ -247,7 +247,7 @@ void htmusic_device::device_start()
|
||||
m_stream = stream_alloc(0, 2, clock() / 128);
|
||||
|
||||
// allocate timer
|
||||
m_dsp_timer = timer_alloc(0);
|
||||
m_dsp_timer = timer_alloc(FUNC(htmusic_device::dsp_tick), this);
|
||||
|
||||
// register for save states
|
||||
save_item(NAME(m_wave_ram));
|
||||
@ -303,7 +303,7 @@ void htmusic_device::device_reset()
|
||||
#define INVERT(c) (BIT(CTL(c), 4))
|
||||
#define PAN(c) (CTL(c) & 0x0f)
|
||||
|
||||
void htmusic_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(htmusic_device::dsp_tick)
|
||||
{
|
||||
// 4-bit channel select
|
||||
uint8_t channel = (m_counter >> 3) & 0x0f;
|
||||
|
@ -41,8 +41,6 @@ public:
|
||||
|
||||
void ram_w(offs_t offset, uint8_t data) { m_wave_ram[offset & 0x7ff] = data; }
|
||||
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
@ -51,6 +49,8 @@ protected:
|
||||
// sound stream update overrides
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(dsp_tick);
|
||||
|
||||
private:
|
||||
uint16_t m_antilog[128];
|
||||
uint8_t m_wave_ram[0x800];
|
||||
|
@ -75,7 +75,7 @@ bbcmc_mouse_device::bbcmc_mouse_device(const machine_config &mconfig, const char
|
||||
|
||||
void bbcmc_mouse_device::device_start()
|
||||
{
|
||||
m_mouse_timer = timer_alloc();
|
||||
m_mouse_timer = timer_alloc(FUNC(bbcmc_mouse_device::update), this);
|
||||
}
|
||||
|
||||
|
||||
@ -100,7 +100,7 @@ void bbcmc_mouse_device::device_reset()
|
||||
// IMPLEMENTATION
|
||||
//**************************************************************************
|
||||
|
||||
void bbcmc_mouse_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(bbcmc_mouse_device::update)
|
||||
{
|
||||
int x = m_mouse_x->read();
|
||||
int y = m_mouse_y->read();
|
||||
|
@ -31,13 +31,14 @@ protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// optional information overrides
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
|
||||
virtual uint8_t pb_r() override;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(update);
|
||||
|
||||
private:
|
||||
required_ioport m_mouse_x;
|
||||
required_ioport m_mouse_y;
|
||||
|
@ -151,7 +151,7 @@ bbc_tracker_device::bbc_tracker_device(const machine_config &mconfig, const char
|
||||
|
||||
void bbc_pointer_device::device_start()
|
||||
{
|
||||
m_pointer_timer = timer_alloc();
|
||||
m_pointer_timer = timer_alloc(FUNC(bbc_pointer_device::update), this);
|
||||
}
|
||||
|
||||
|
||||
@ -176,7 +176,7 @@ void bbc_pointer_device::device_reset()
|
||||
// IMPLEMENTATION
|
||||
//**************************************************************************
|
||||
|
||||
void bbc_pointer_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(bbc_pointer_device::update)
|
||||
{
|
||||
int x = m_pointer_x->read();
|
||||
int y = m_pointer_y->read();
|
||||
|
@ -29,7 +29,8 @@ protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(update);
|
||||
|
||||
required_ioport m_pointer_x;
|
||||
required_ioport m_pointer_y;
|
||||
|
@ -98,7 +98,7 @@ c128_partner_cartridge_device::c128_partner_cartridge_device(const machine_confi
|
||||
void c128_partner_cartridge_device::device_start()
|
||||
{
|
||||
// simulate the 16.7ms pulse from CIA1 PB2 that would arrive thru the joystick port dongle
|
||||
t_joyb2 = timer_alloc();
|
||||
t_joyb2 = timer_alloc(FUNC(c128_partner_cartridge_device::update_joyb2), this);
|
||||
t_joyb2->adjust(attotime::from_msec(16), 0, attotime::from_msec(16));
|
||||
|
||||
// state saving
|
||||
@ -127,10 +127,10 @@ void c128_partner_cartridge_device::device_reset()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_timer -
|
||||
// update_joyb2 -
|
||||
//-------------------------------------------------
|
||||
|
||||
void c128_partner_cartridge_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(c128_partner_cartridge_device::update_joyb2)
|
||||
{
|
||||
if (m_ls74_cd)
|
||||
{
|
||||
|
@ -39,7 +39,6 @@ protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// device_c64_expansion_card_interface overrides
|
||||
virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
|
||||
@ -48,6 +47,8 @@ protected:
|
||||
// device_vcs_control_port_interface overrides
|
||||
virtual void vcs_joy_w(uint8_t data);
|
||||
|
||||
TIMER_CALLBACK_MEMBER(update_joyb2);
|
||||
|
||||
private:
|
||||
memory_share_creator<uint8_t> m_ram;
|
||||
|
||||
|
@ -51,7 +51,7 @@ c64_epyx_fast_load_cartridge_device::c64_epyx_fast_load_cartridge_device(const m
|
||||
void c64_epyx_fast_load_cartridge_device::device_start()
|
||||
{
|
||||
// allocate timer
|
||||
m_exrom_timer = timer_alloc();
|
||||
m_exrom_timer = timer_alloc(FUNC(c64_epyx_fast_load_cartridge_device::update_exrom), this);
|
||||
}
|
||||
|
||||
|
||||
@ -67,10 +67,10 @@ void c64_epyx_fast_load_cartridge_device::device_reset()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_timer - handler timer events
|
||||
// update_exrom - update exrom flag
|
||||
//-------------------------------------------------
|
||||
|
||||
void c64_epyx_fast_load_cartridge_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(c64_epyx_fast_load_cartridge_device::update_exrom)
|
||||
{
|
||||
m_exrom = 1;
|
||||
}
|
||||
|
@ -33,12 +33,13 @@ protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// device_c64_expansion_card_interface overrides
|
||||
virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
|
||||
virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(update_exrom);
|
||||
|
||||
private:
|
||||
emu_timer *m_exrom_timer;
|
||||
};
|
||||
|
@ -51,7 +51,7 @@ c64_super_explode_cartridge_device::c64_super_explode_cartridge_device(const mac
|
||||
void c64_super_explode_cartridge_device::device_start()
|
||||
{
|
||||
// allocate timer
|
||||
m_exrom_timer = timer_alloc();
|
||||
m_exrom_timer = timer_alloc(FUNC(c64_super_explode_cartridge_device::update_exrom), this);
|
||||
|
||||
// state saving
|
||||
save_item(NAME(m_bank));
|
||||
@ -72,10 +72,10 @@ void c64_super_explode_cartridge_device::device_reset()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_timer - handler timer events
|
||||
// update_exram - update exrom flag for banking
|
||||
//-------------------------------------------------
|
||||
|
||||
void c64_super_explode_cartridge_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(c64_super_explode_cartridge_device::update_exrom)
|
||||
{
|
||||
m_exrom = 1;
|
||||
}
|
||||
|
@ -33,12 +33,13 @@ protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// device_c64_expansion_card_interface overrides
|
||||
virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
|
||||
virtual void c64_cd_w(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(update_exrom);
|
||||
|
||||
private:
|
||||
uint8_t m_bank;
|
||||
|
||||
|
@ -81,7 +81,7 @@ c64_vizawrite_cartridge_device::c64_vizawrite_cartridge_device(const machine_con
|
||||
void c64_vizawrite_cartridge_device::device_start()
|
||||
{
|
||||
// allocate timer
|
||||
m_game_timer = timer_alloc();
|
||||
m_game_timer = timer_alloc(FUNC(c64_vizawrite_cartridge_device::update_game), this);
|
||||
}
|
||||
|
||||
|
||||
@ -98,10 +98,11 @@ void c64_vizawrite_cartridge_device::device_reset()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_timer - handler timer events
|
||||
// update_game - update mapping flags for game
|
||||
// data
|
||||
//-------------------------------------------------
|
||||
|
||||
void c64_vizawrite_cartridge_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(c64_vizawrite_cartridge_device::update_game)
|
||||
{
|
||||
m_game = 1;
|
||||
}
|
||||
|
@ -33,12 +33,13 @@ protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// device_c64_expansion_card_interface overrides
|
||||
virtual uint8_t c64_cd_r(offs_t offset, uint8_t data, int sphi2, int ba, int roml, int romh, int io1, int io2) override;
|
||||
virtual int c64_exrom_r(offs_t offset, int sphi2, int ba, int rw) override { return 0; }
|
||||
|
||||
TIMER_CALLBACK_MEMBER(update_game);
|
||||
|
||||
private:
|
||||
emu_timer *m_game_timer;
|
||||
};
|
||||
|
@ -229,7 +229,7 @@ void pc9801_86_device::device_start()
|
||||
|
||||
m_io_base = 0;
|
||||
|
||||
m_dac_timer = timer_alloc();
|
||||
m_dac_timer = timer_alloc(FUNC(pc9801_86_device::dac_tick), this);
|
||||
save_item(NAME(m_count));
|
||||
save_item(NAME(m_queue));
|
||||
save_item(NAME(m_irq_rate));
|
||||
@ -382,10 +382,8 @@ u8 pc9801_86_device::queue_pop()
|
||||
return ret;
|
||||
}
|
||||
|
||||
void pc9801_86_device::device_timer(emu_timer& timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(pc9801_86_device::dac_tick)
|
||||
{
|
||||
int16_t lsample, rsample;
|
||||
|
||||
m_pcm_clk = !m_pcm_clk;
|
||||
if((m_pcm_ctrl & 0x40) || !(m_pcm_ctrl & 0x80))
|
||||
return;
|
||||
@ -402,24 +400,24 @@ void pc9801_86_device::device_timer(emu_timer& timer, device_timer_id id, int pa
|
||||
case 0x50: // 8bit right only
|
||||
m_rdac->write(queue_pop() << 8);
|
||||
break;
|
||||
case 0x30: // 16bit stereo
|
||||
lsample = queue_pop() << 8;
|
||||
case 0x30: { // 16bit stereo
|
||||
int16_t lsample = queue_pop() << 8;
|
||||
lsample |= queue_pop();
|
||||
rsample = queue_pop() << 8;
|
||||
int16_t rsample = queue_pop() << 8;
|
||||
rsample |= queue_pop();
|
||||
m_ldac->write(lsample);
|
||||
m_rdac->write(rsample);
|
||||
break;
|
||||
case 0x20: // 16bit left only
|
||||
lsample = queue_pop() << 8;
|
||||
} break;
|
||||
case 0x20: { // 16bit left only
|
||||
int16_t lsample = queue_pop() << 8;
|
||||
lsample |= queue_pop();
|
||||
m_ldac->write(lsample);
|
||||
break;
|
||||
case 0x10: // 16bit right only
|
||||
rsample = queue_pop() << 8;
|
||||
} break;
|
||||
case 0x10: { // 16bit right only
|
||||
int16_t rsample = queue_pop() << 8;
|
||||
rsample |= queue_pop();
|
||||
m_rdac->write(rsample);
|
||||
break;
|
||||
} break;
|
||||
}
|
||||
if((queue_count() < m_irq_rate) && (m_pcm_ctrl & 0x20))
|
||||
{
|
||||
|
@ -41,10 +41,11 @@ protected:
|
||||
void opna_reset_routes_config(machine_config &config);
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
void pc9801_86_config(machine_config &config);
|
||||
virtual u16 read_io_base() override;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(dac_tick);
|
||||
|
||||
required_device<pc9801_slot_device> m_bus;
|
||||
required_device<ym2608_device> m_opna;
|
||||
|
||||
|
@ -329,7 +329,7 @@ void epson_lx810l_device::device_start()
|
||||
m_online_led.resolve();
|
||||
m_ready_led.resolve();
|
||||
|
||||
m_cr_timer = timer_alloc(TIMER_CR);
|
||||
m_cr_timer = timer_alloc(FUNC(epson_lx810l_device::cr_tick), this);
|
||||
}
|
||||
|
||||
|
||||
@ -344,13 +344,11 @@ void epson_lx810l_device::device_reset()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_timer - device-specific timer
|
||||
// cr_tick - handle a carriage return
|
||||
//-------------------------------------------------
|
||||
|
||||
void epson_lx810l_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(epson_lx810l_device::cr_tick)
|
||||
{
|
||||
switch (id) {
|
||||
case TIMER_CR:
|
||||
/* The firmware issues two half-steps in sequence, one immediately
|
||||
* after the other. At full speed, the motor does two half-steps at
|
||||
* each 833 microseconds. A timer fires the printhead twice, with
|
||||
@ -362,8 +360,6 @@ void epson_lx810l_device::device_timer(emu_timer &timer, device_timer_id id, int
|
||||
m_real_cr_steps--;
|
||||
if (m_real_cr_steps)
|
||||
m_cr_timer->adjust(attotime::from_usec(400), m_bitmap_printer->m_cr_direction);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -57,7 +57,6 @@ protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// optional information overrides
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
@ -74,6 +73,8 @@ private:
|
||||
uint8_t portc_r(offs_t offset);
|
||||
void portc_w(offs_t offset, uint8_t data);
|
||||
|
||||
TIMER_CALLBACK_MEMBER(cr_tick);
|
||||
|
||||
/* fake memory I/O to get past memory reset check */
|
||||
uint8_t fakemem_r();
|
||||
void fakemem_w(uint8_t data);
|
||||
|
@ -27,65 +27,21 @@ centronics_printer_device::centronics_printer_device(const machine_config &mconf
|
||||
m_printer(*this, "printer")
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_add_mconfig - add device configuration
|
||||
//-------------------------------------------------
|
||||
|
||||
|
||||
void centronics_printer_device::device_add_mconfig(machine_config &config)
|
||||
{
|
||||
PRINTER(config, m_printer, 0);
|
||||
m_printer->online_callback().set(FUNC(centronics_printer_device::printer_online));
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
printer_online - callback that
|
||||
sets us busy when the printer goes offline
|
||||
-------------------------------------------------*/
|
||||
|
||||
WRITE_LINE_MEMBER(centronics_printer_device::printer_online)
|
||||
{
|
||||
output_perror(!state);
|
||||
}
|
||||
|
||||
void centronics_printer_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case TIMER_ACK:
|
||||
output_ack(param);
|
||||
|
||||
if (param == false)
|
||||
{
|
||||
/* data is now ready, output it */
|
||||
m_printer->output(m_data);
|
||||
|
||||
/* ready to receive more data, return BUSY to low */
|
||||
m_busy_timer->adjust(attotime::from_usec(7), false);
|
||||
}
|
||||
break;
|
||||
|
||||
case TIMER_BUSY:
|
||||
m_busy = param;
|
||||
output_busy(m_busy);
|
||||
|
||||
if (param == true)
|
||||
{
|
||||
/* timer to turn ACK low to receive data */
|
||||
m_ack_timer->adjust(attotime::from_usec(10), false);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* timer to return ACK to high state */
|
||||
m_ack_timer->adjust(attotime::from_usec(5), true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void centronics_printer_device::device_start()
|
||||
{
|
||||
m_ack_timer = timer_alloc(TIMER_ACK);
|
||||
m_busy_timer = timer_alloc(TIMER_BUSY);
|
||||
m_ack_timer = timer_alloc(FUNC(centronics_printer_device::ack_timer_tick), this);
|
||||
m_busy_timer = timer_alloc(FUNC(centronics_printer_device::busy_timer_tick), this);
|
||||
|
||||
/* register for state saving */
|
||||
save_item(NAME(m_strobe));
|
||||
@ -102,6 +58,59 @@ void centronics_printer_device::device_reset()
|
||||
output_select(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/*-------------------------------------------------
|
||||
printer_online - callback that
|
||||
sets us busy when the printer goes offline
|
||||
-------------------------------------------------*/
|
||||
|
||||
WRITE_LINE_MEMBER(centronics_printer_device::printer_online)
|
||||
{
|
||||
output_perror(!state);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
ack_timer_tick - update the printer
|
||||
acknowledge line after an appropriate delay
|
||||
-------------------------------------------------*/
|
||||
|
||||
TIMER_CALLBACK_MEMBER(centronics_printer_device::ack_timer_tick)
|
||||
{
|
||||
output_ack(param);
|
||||
|
||||
if (!param)
|
||||
{
|
||||
/* data is now ready, output it */
|
||||
m_printer->output(m_data);
|
||||
|
||||
/* ready to receive more data, return BUSY to low */
|
||||
m_busy_timer->adjust(attotime::from_usec(7), 0);
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
busy_timer_tick - update the printer's
|
||||
busy state
|
||||
-------------------------------------------------*/
|
||||
|
||||
TIMER_CALLBACK_MEMBER(centronics_printer_device::busy_timer_tick)
|
||||
{
|
||||
m_busy = param;
|
||||
output_busy(m_busy);
|
||||
|
||||
if (param)
|
||||
{
|
||||
/* timer to turn ACK low to receive data */
|
||||
m_ack_timer->adjust(attotime::from_usec(10), 0);
|
||||
}
|
||||
else
|
||||
{
|
||||
/* timer to return ACK to high state */
|
||||
m_ack_timer->adjust(attotime::from_usec(5), 1);
|
||||
}
|
||||
}
|
||||
|
||||
/*-------------------------------------------------
|
||||
centronics_strobe_w - signal that data is
|
||||
ready
|
||||
|
@ -33,17 +33,14 @@ protected:
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
virtual bool supports_pin35_5v() override { return true; }
|
||||
|
||||
private:
|
||||
DECLARE_WRITE_LINE_MEMBER( printer_online );
|
||||
|
||||
enum
|
||||
{
|
||||
TIMER_ACK,
|
||||
TIMER_BUSY
|
||||
};
|
||||
TIMER_CALLBACK_MEMBER(ack_timer_tick);
|
||||
TIMER_CALLBACK_MEMBER(busy_timer_tick);
|
||||
|
||||
emu_timer *m_ack_timer;
|
||||
emu_timer *m_busy_timer;
|
||||
|
@ -90,14 +90,6 @@
|
||||
CONSTANTS
|
||||
***************************************************************************/
|
||||
|
||||
enum
|
||||
{
|
||||
TIMER_CART,
|
||||
TIMER_NMI,
|
||||
TIMER_HALT
|
||||
};
|
||||
|
||||
|
||||
// definitions of RPK PCBs in layout.xml
|
||||
static const char *coco_rpk_pcbdefs[] =
|
||||
{
|
||||
@ -149,11 +141,11 @@ cococart_slot_device::cococart_slot_device(const machine_config &mconfig, const
|
||||
|
||||
void cococart_slot_device::device_start()
|
||||
{
|
||||
for(int i=0; i<TIMER_POOL; i++ )
|
||||
for(int i=0; i < TIMER_POOL; i++ )
|
||||
{
|
||||
m_cart_line.timer[i] = timer_alloc(TIMER_CART);
|
||||
m_nmi_line.timer[i] = timer_alloc(TIMER_NMI);
|
||||
m_halt_line.timer[i] = timer_alloc(TIMER_HALT);
|
||||
m_cart_line.timer[i] = timer_alloc(FUNC(cococart_slot_device::cart_line_timer_tick), this);
|
||||
m_nmi_line.timer[i] = timer_alloc(FUNC(cococart_slot_device::nmi_line_timer_tick), this);
|
||||
m_halt_line.timer[i] = timer_alloc(FUNC(cococart_slot_device::halt_line_timer_tick), this);
|
||||
}
|
||||
|
||||
m_cart_line.timer_index = 0;
|
||||
@ -204,27 +196,36 @@ void cococart_slot_device::device_start()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_timer - handle timer callbacks
|
||||
// cart_line_timer_tick - update the output
|
||||
// value for the cart's line to PIA1 CB1
|
||||
//-------------------------------------------------
|
||||
|
||||
void cococart_slot_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(cococart_slot_device::cart_line_timer_tick)
|
||||
{
|
||||
switch(id)
|
||||
{
|
||||
case TIMER_CART:
|
||||
set_line(line::CART, m_cart_line, (line_value) param);
|
||||
break;
|
||||
|
||||
case TIMER_NMI:
|
||||
set_line(line::NMI, m_nmi_line, (line_value) param);
|
||||
break;
|
||||
|
||||
case TIMER_HALT:
|
||||
set_line(line::HALT, m_halt_line, (line_value) param);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// nmi_line_timer_tick - update the output
|
||||
// value sent to the CPU's NMI line
|
||||
//-------------------------------------------------
|
||||
|
||||
TIMER_CALLBACK_MEMBER(cococart_slot_device::nmi_line_timer_tick)
|
||||
{
|
||||
set_line(line::NMI, m_nmi_line, (line_value) param);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// halt_line_timer_tick - update the output
|
||||
// value sent to the CPU's HALT line
|
||||
//-------------------------------------------------
|
||||
|
||||
TIMER_CALLBACK_MEMBER(cococart_slot_device::halt_line_timer_tick)
|
||||
{
|
||||
set_line(line::HALT, m_halt_line, (line_value) param);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// cts_read
|
||||
|
@ -69,7 +69,6 @@ public:
|
||||
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// image-level overrides
|
||||
virtual image_init_result call_load() override;
|
||||
@ -121,10 +120,12 @@ private:
|
||||
coco_cartridge_line m_cart_line;
|
||||
coco_cartridge_line m_nmi_line;
|
||||
coco_cartridge_line m_halt_line;
|
||||
|
||||
public:
|
||||
devcb_write_line m_cart_callback;
|
||||
devcb_write_line m_nmi_callback;
|
||||
devcb_write_line m_halt_callback;
|
||||
|
||||
private:
|
||||
// cartridge
|
||||
device_cococart_interface *m_cart;
|
||||
@ -133,6 +134,11 @@ private:
|
||||
void set_line(line ln, coco_cartridge_line &line, line_value value);
|
||||
void set_line_timer(coco_cartridge_line &line, line_value value);
|
||||
void twiddle_line_if_q(coco_cartridge_line &line);
|
||||
|
||||
TIMER_CALLBACK_MEMBER(cart_line_timer_tick);
|
||||
TIMER_CALLBACK_MEMBER(nmi_line_timer_tick);
|
||||
TIMER_CALLBACK_MEMBER(halt_line_timer_tick);
|
||||
|
||||
public:
|
||||
static const char *line_value_string(line_value value);
|
||||
};
|
||||
|
@ -127,7 +127,7 @@ void compucolor_floppy_port_device::device_start()
|
||||
void compucolor_floppy_device::device_start()
|
||||
{
|
||||
// allocate timer
|
||||
m_timer = timer_alloc();
|
||||
m_timer = timer_alloc(FUNC(compucolor_floppy_device::rxd_tick), this);
|
||||
m_timer->adjust(attotime::from_hz(9600*8), 0, attotime::from_hz(9600*8));
|
||||
|
||||
// state saving
|
||||
@ -138,10 +138,10 @@ void compucolor_floppy_device::device_start()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_timer - handle timer events
|
||||
// rxd_tick -
|
||||
//-------------------------------------------------
|
||||
|
||||
void compucolor_floppy_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(compucolor_floppy_device::rxd_tick)
|
||||
{
|
||||
if (!m_sel && !m_rw)
|
||||
{
|
||||
|
@ -75,7 +75,6 @@ public:
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// optional information overrides
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
@ -93,6 +92,7 @@ private:
|
||||
|
||||
required_device<floppy_connector> m_floppy;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(rxd_tick);
|
||||
bool read_bit();
|
||||
void write_bit(bool bit);
|
||||
|
||||
|
@ -46,7 +46,7 @@ dmv_k210_device::dmv_k210_device(const machine_config &mconfig, const char *tag,
|
||||
|
||||
void dmv_k210_device::device_start()
|
||||
{
|
||||
m_clk1_timer = timer_alloc(0);
|
||||
m_clk1_timer = timer_alloc(FUNC(dmv_k210_device::strobe_tick), this);
|
||||
|
||||
// register for state saving
|
||||
save_item(NAME(m_portb));
|
||||
@ -65,10 +65,10 @@ void dmv_k210_device::device_reset()
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_timer - handler timer events
|
||||
// strobe_tick -
|
||||
//-------------------------------------------------
|
||||
|
||||
void dmv_k210_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
|
||||
TIMER_CALLBACK_MEMBER(dmv_k210_device::strobe_tick)
|
||||
{
|
||||
m_centronics->write_strobe(CLEAR_LINE);
|
||||
}
|
||||
|
@ -28,7 +28,6 @@ protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id tid, int param) override;
|
||||
|
||||
// optional information overrides
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
@ -53,6 +52,8 @@ private:
|
||||
DECLARE_WRITE_LINE_MEMBER(cent_autofd_w);
|
||||
DECLARE_WRITE_LINE_MEMBER(cent_init_w);
|
||||
|
||||
TIMER_CALLBACK_MEMBER(strobe_tick);
|
||||
|
||||
required_device<i8255_device> m_ppi;
|
||||
required_device<centronics_device> m_centronics;
|
||||
required_device<input_buffer_device> m_cent_data_in;
|
||||
|
@ -571,7 +571,20 @@ ecb_grip21_device::ecb_grip21_device(const machine_config &mconfig, const char *
|
||||
m_j3a(*this, "J3A"),
|
||||
m_j3b(*this, "J3B"),
|
||||
m_j7(*this, "J7"),
|
||||
m_centronics_busy(0), m_centronics_fault(0), m_vol0(0), m_vol1(0), m_ia(0), m_ib(0), m_keydata(0), m_kbf(0), m_lps(0), m_page(0), m_flash(0), m_base(0), m_ppi_pa(0), m_ppi_pc(0), m_kb_timer(nullptr)
|
||||
m_centronics_busy(0),
|
||||
m_centronics_fault(0),
|
||||
m_vol0(0),
|
||||
m_vol1(0),
|
||||
m_ia(0),
|
||||
m_ib(0),
|
||||
m_keydata(0),
|
||||
m_kbf(0),
|
||||
m_lps(0),
|
||||
m_page(0),
|
||||
m_flash(0),
|
||||
m_base(0),
|
||||
m_ppi_pa(0),
|
||||
m_ppi_pc(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -585,10 +598,6 @@ void ecb_grip21_device::device_start()
|
||||
membank("videoram")->configure_entries(0, 2, m_video_ram, 0x8000);
|
||||
membank("videoram")->set_entry(0);
|
||||
|
||||
// allocate keyboard scan timer
|
||||
m_kb_timer = timer_alloc();
|
||||
m_kb_timer->adjust(attotime::zero, 0, attotime::from_hz(2500));
|
||||
|
||||
// register for state saving
|
||||
save_item(NAME(m_vol0));
|
||||
save_item(NAME(m_vol1));
|
||||
|
@ -100,9 +100,6 @@ private:
|
||||
uint8_t m_ppi_pa; // PPI port A data
|
||||
uint8_t m_ppi_pc; // PPI port C data
|
||||
|
||||
// timers
|
||||
emu_timer *m_kb_timer;
|
||||
|
||||
void vol0_w(uint8_t data);
|
||||
void vol1_w(uint8_t data);
|
||||
void flash_w(uint8_t data);
|
||||
|
@ -426,7 +426,7 @@ void econet_e01_device::device_start()
|
||||
m_led.resolve();
|
||||
|
||||
// allocate timers
|
||||
m_clk_timer = timer_alloc();
|
||||
m_clk_timer = timer_alloc(FUNC(econet_e01_device::clk_tick), this);
|
||||
|
||||
// register for state saving
|
||||
save_item(NAME(m_adlc_ie));
|
||||
@ -451,10 +451,10 @@ void econet_e01_device::device_reset()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_timer - handler timer events
|
||||
// clk_tick - update our clock output
|
||||
//-------------------------------------------------
|
||||
|
||||
void econet_e01_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(econet_e01_device::clk_tick)
|
||||
{
|
||||
if (m_clk_en)
|
||||
{
|
||||
|
@ -44,7 +44,6 @@ protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// optional information overrides
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
@ -65,6 +64,9 @@ private:
|
||||
DECLARE_WRITE_LINE_MEMBER( fdc_drq_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( scsi_bsy_w );
|
||||
DECLARE_WRITE_LINE_MEMBER( scsi_req_w );
|
||||
|
||||
TIMER_CALLBACK_MEMBER(clk_tick);
|
||||
|
||||
uint8_t read(offs_t offset);
|
||||
void write(offs_t offset, uint8_t data);
|
||||
uint8_t ram_select_r();
|
||||
|
@ -109,7 +109,7 @@ epson_pf10_device::epson_pf10_device(const machine_config &mconfig, const char *
|
||||
|
||||
void epson_pf10_device::device_start()
|
||||
{
|
||||
m_timer = timer_alloc(0);
|
||||
m_timer = timer_alloc(FUNC(epson_pf10_device::serial_clk_tick), this);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -122,17 +122,13 @@ void epson_pf10_device::device_reset()
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_timer - handler timer events
|
||||
// serial_clk_tick - tick the CPU's external
|
||||
// serial clock
|
||||
//-------------------------------------------------
|
||||
|
||||
void epson_pf10_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER( epson_pf10_device::serial_clk_tick )
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 0:
|
||||
m_cpu->m6801_clock_serial();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -34,7 +34,6 @@ protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// optional information overrides
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
@ -63,6 +62,8 @@ private:
|
||||
uint8_t port2_r();
|
||||
void port2_w(uint8_t data);
|
||||
|
||||
TIMER_CALLBACK_MEMBER( serial_clk_tick );
|
||||
|
||||
void cpu_mem(address_map &map);
|
||||
|
||||
required_device<hd6303y_cpu_device> m_cpu;
|
||||
|
@ -149,8 +149,8 @@ void epson_tf20_device::device_start()
|
||||
if (!m_ram->started())
|
||||
throw device_missing_dependencies();
|
||||
|
||||
m_timer_serial = timer_alloc(0);
|
||||
m_timer_tc = timer_alloc(1);
|
||||
m_timer_serial = timer_alloc(FUNC(epson_tf20_device::serial_tick), this);
|
||||
m_timer_tc = timer_alloc(FUNC(epson_tf20_device::tc_tick), this);
|
||||
|
||||
// enable second half of ram
|
||||
m_cpu->space(AS_PROGRAM).install_ram(0x8000, 0xffff, m_ram->pointer() + 0x8000);
|
||||
@ -175,14 +175,11 @@ void epson_tf20_device::device_reset()
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_timer - handler timer events
|
||||
// serial_tick - update serial clocks
|
||||
//-------------------------------------------------
|
||||
|
||||
void epson_tf20_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER( epson_tf20_device::serial_tick )
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case 0:
|
||||
m_mpsc->rxca_w(1);
|
||||
m_mpsc->rxca_w(0);
|
||||
m_mpsc->txca_w(1);
|
||||
@ -191,16 +188,20 @@ void epson_tf20_device::device_timer(emu_timer &timer, device_timer_id id, int p
|
||||
m_mpsc->rxcb_w(0);
|
||||
m_mpsc->txcb_w(1);
|
||||
m_mpsc->txcb_w(0);
|
||||
break;
|
||||
}
|
||||
|
||||
case 1:
|
||||
//-------------------------------------------------
|
||||
// tc_tick - update the FDC terminal count flag
|
||||
//-------------------------------------------------
|
||||
|
||||
TIMER_CALLBACK_MEMBER( epson_tf20_device::tc_tick )
|
||||
{
|
||||
logerror("%s: tc off\n", tag());
|
||||
m_fdc->tc_w(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
//**************************************************************************
|
||||
// CPU & MEMORY
|
||||
//**************************************************************************
|
||||
|
@ -36,7 +36,6 @@ protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// optional information overrides
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
@ -60,6 +59,9 @@ private:
|
||||
uint8_t upd765_tc_r();
|
||||
void fdc_control_w(uint8_t data);
|
||||
|
||||
TIMER_CALLBACK_MEMBER( serial_tick );
|
||||
TIMER_CALLBACK_MEMBER( tc_tick );
|
||||
|
||||
void cpu_io(address_map &map);
|
||||
void cpu_mem(address_map &map);
|
||||
|
||||
|
@ -1111,7 +1111,7 @@ gio64_xl24_device::gio64_xl24_device(const machine_config &mconfig, const char *
|
||||
|
||||
void newport_base_device::device_start()
|
||||
{
|
||||
m_dcb_timeout_timer = timer_alloc(DCB_TIMEOUT);
|
||||
m_dcb_timeout_timer = timer_alloc(FUNC(newport_base_device::dcb_timeout_tick), this);
|
||||
|
||||
save_item(NAME(m_rex3.m_draw_mode0));
|
||||
save_item(NAME(m_rex3.m_color_host));
|
||||
@ -1282,12 +1282,9 @@ void newport_base_device::stop_logging()
|
||||
}
|
||||
#endif
|
||||
|
||||
void newport_base_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(newport_base_device::dcb_timeout_tick)
|
||||
{
|
||||
if (id == DCB_TIMEOUT)
|
||||
{
|
||||
m_rex3.m_status &= ~STATUS_BACKBUSY;
|
||||
}
|
||||
}
|
||||
|
||||
uint32_t newport_base_device::screen_update(screen_device &device, bitmap_rgb32 &bitmap, const rectangle &cliprect)
|
||||
|
@ -311,7 +311,6 @@ public:
|
||||
|
||||
protected:
|
||||
// device_t overrides
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
@ -319,7 +318,7 @@ protected:
|
||||
void device_add_mconfig(machine_config &config, uint32_t xmap_revision, uint32_t cmap_revision, uint32_t global_mask);
|
||||
void mem_map(address_map &map) override;
|
||||
|
||||
static constexpr device_timer_id DCB_TIMEOUT = 0;
|
||||
TIMER_CALLBACK_MEMBER(dcb_timeout_tick);
|
||||
|
||||
enum
|
||||
{
|
||||
|
@ -186,8 +186,8 @@ void hp98035_io_card_device::device_start()
|
||||
save_item(NAME(m_prev_clock_keys));
|
||||
save_item(NAME(m_clock_key_cnt));
|
||||
|
||||
m_msec_timer = timer_alloc(MSEC_TMR_ID);
|
||||
m_clock_timer = timer_alloc(CLOCK_TMR_ID);
|
||||
m_msec_timer = timer_alloc(FUNC(hp98035_io_card_device::msec_tick), this);
|
||||
m_clock_timer = timer_alloc(FUNC(hp98035_io_card_device::clock_tick), this);
|
||||
}
|
||||
|
||||
void hp98035_io_card_device::device_reset()
|
||||
@ -207,14 +207,16 @@ void hp98035_io_card_device::device_reset()
|
||||
half_init();
|
||||
}
|
||||
|
||||
void hp98035_io_card_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(hp98035_io_card_device::msec_tick)
|
||||
{
|
||||
if (id == MSEC_TMR_ID) {
|
||||
// On real hw there's a full 4-bit decimal counter, but only the LSB is used to
|
||||
// generate interrupts
|
||||
m_np_irq = !m_np_irq;
|
||||
update_dc();
|
||||
} else if (id == CLOCK_TMR_ID) {
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(hp98035_io_card_device::clock_tick)
|
||||
{
|
||||
// Update digit multiplexer
|
||||
if (m_clock_state == CLOCK_OFF) {
|
||||
m_clock_mux = 0;
|
||||
@ -251,7 +253,6 @@ void hp98035_io_card_device::device_timer(emu_timer &timer, device_timer_id id,
|
||||
advance_seconds();
|
||||
regen_clock_image();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t hp98035_io_card_device::reg_r(address_space &space, offs_t offset)
|
||||
|
@ -27,7 +27,6 @@ public:
|
||||
protected:
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// device-level overrides
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
@ -57,6 +56,9 @@ private:
|
||||
uint8_t clr_inten_r();
|
||||
void clr_inten_w(uint8_t data);
|
||||
|
||||
TIMER_CALLBACK_MEMBER(msec_tick);
|
||||
TIMER_CALLBACK_MEMBER(clock_tick);
|
||||
|
||||
void np_io_map(address_map &map);
|
||||
void np_program_map(address_map &map);
|
||||
|
||||
|
@ -336,9 +336,9 @@ void hp9885_device::device_start()
|
||||
save_item(NAME(m_am_detector));
|
||||
save_item(NAME(m_crc));
|
||||
|
||||
m_fsm_timer = timer_alloc(FSM_TMR_ID);
|
||||
m_head_timer = timer_alloc(HEAD_TMR_ID);
|
||||
m_bit_byte_timer = timer_alloc(BIT_BYTE_TMR_ID);
|
||||
m_fsm_timer = timer_alloc(FUNC(hp9885_device::fsm_tick), this);
|
||||
m_head_timer = timer_alloc(FUNC(hp9885_device::head_tick), this);
|
||||
m_bit_byte_timer = timer_alloc(FUNC(hp9885_device::bit_byte_tick), this);
|
||||
|
||||
m_drive = m_drive_connector->get_device();
|
||||
|
||||
@ -359,16 +359,15 @@ void hp9885_device::device_reset()
|
||||
set_state(FSM_IDLE);
|
||||
}
|
||||
|
||||
void hp9885_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(hp9885_device::fsm_tick)
|
||||
{
|
||||
LOG_TIMER("Tmr %.06f ID %d FSM %d HD %d\n" , machine().time().as_double() , id , m_fsm_state , m_head_state);
|
||||
|
||||
switch (id) {
|
||||
case FSM_TMR_ID:
|
||||
LOG_TIMER("Tmr %.06f ID %d FSM %d HD %d\n" , machine().time().as_double() , FSM_TMR_ID , m_fsm_state , m_head_state);
|
||||
do_FSM();
|
||||
break;
|
||||
}
|
||||
|
||||
case HEAD_TMR_ID:
|
||||
TIMER_CALLBACK_MEMBER(hp9885_device::head_tick)
|
||||
{
|
||||
LOG_TIMER("Tmr %.06f ID %d FSM %d HD %d\n" , machine().time().as_double() , HEAD_TMR_ID , m_fsm_state , m_head_state);
|
||||
if (m_head_state == HEAD_SETTLING) {
|
||||
LOG_HEAD("%.06f Head loaded\n" , machine().time().as_double());
|
||||
m_head_state = HEAD_LOADED;
|
||||
@ -379,10 +378,12 @@ void hp9885_device::device_timer(emu_timer &timer, device_timer_id id, int param
|
||||
LOG_HEAD("%.06f Head unloaded\n" , machine().time().as_double());
|
||||
m_head_state = HEAD_UNLOADED;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(hp9885_device::bit_byte_tick)
|
||||
{
|
||||
LOG_TIMER("Tmr %.06f ID %d FSM %d HD %d\n" , machine().time().as_double() , BIT_BYTE_TMR_ID , m_fsm_state , m_head_state);
|
||||
|
||||
case BIT_BYTE_TMR_ID:
|
||||
{
|
||||
switch (m_fsm_state) {
|
||||
case FSM_WAIT_ID_AM:
|
||||
case FSM_WAIT_DATA_AM:
|
||||
@ -521,10 +522,7 @@ void hp9885_device::device_timer(emu_timer &timer, device_timer_id id, int param
|
||||
set_state(FSM_IDLE);
|
||||
return;
|
||||
}
|
||||
timer.adjust(m_pll.ctime - machine().time());
|
||||
}
|
||||
break;
|
||||
}
|
||||
m_bit_byte_timer->adjust(m_pll.ctime - machine().time());
|
||||
}
|
||||
|
||||
void hp9885_device::floppy_ready_cb(floppy_image_device *floppy , int state)
|
||||
|
@ -38,7 +38,6 @@ protected:
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
private:
|
||||
// FSM states
|
||||
@ -106,6 +105,10 @@ private:
|
||||
// PLL
|
||||
fdc_pll_t m_pll;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(fsm_tick);
|
||||
TIMER_CALLBACK_MEMBER(head_tick);
|
||||
TIMER_CALLBACK_MEMBER(bit_byte_tick);
|
||||
|
||||
void floppy_ready_cb(floppy_image_device *floppy , int state);
|
||||
void floppy_index_cb(floppy_image_device *floppy , int state);
|
||||
|
||||
|
@ -111,7 +111,7 @@ void c2040_fdc_device::device_start()
|
||||
m_write_error.resolve_safe();
|
||||
|
||||
// allocate timer
|
||||
t_gen = timer_alloc(0);
|
||||
t_gen = timer_alloc(FUNC(c2040_fdc_device::update_state), this);
|
||||
|
||||
// register for state saving
|
||||
save_item(NAME(m_mtr0));
|
||||
@ -149,10 +149,10 @@ void c2040_fdc_device::device_reset()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_timer - handler timer events
|
||||
// update_state - pump our 'live' events
|
||||
//-------------------------------------------------
|
||||
|
||||
void c2040_fdc_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(c2040_fdc_device::update_state)
|
||||
{
|
||||
live_sync();
|
||||
live_run();
|
||||
|
@ -59,11 +59,12 @@ protected:
|
||||
virtual void device_start() override;
|
||||
virtual void device_clock_changed() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// optional information overrides
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(update_state);
|
||||
|
||||
void stp_w(floppy_image_device *floppy, int mtr, int &old_stp, int stp);
|
||||
|
||||
enum {
|
||||
|
@ -112,7 +112,7 @@ void c8050_fdc_device::device_start()
|
||||
m_write_error.resolve_safe();
|
||||
|
||||
// allocate timer
|
||||
t_gen = timer_alloc(0);
|
||||
t_gen = timer_alloc(FUNC(c8050_fdc_device::update_state), this);
|
||||
|
||||
// register for state saving
|
||||
save_item(NAME(m_mtr0));
|
||||
@ -141,10 +141,10 @@ void c8050_fdc_device::device_reset()
|
||||
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_timer - handler timer events
|
||||
// update_state - pump our 'live' events
|
||||
//-------------------------------------------------
|
||||
|
||||
void c8050_fdc_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(c8050_fdc_device::update_state)
|
||||
{
|
||||
live_sync();
|
||||
live_run();
|
||||
|
@ -60,11 +60,12 @@ protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// optional information overrides
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(update_state);
|
||||
|
||||
void stp_w(floppy_image_device *floppy, int mtr, int &old_stp, int stp);
|
||||
|
||||
enum {
|
||||
|
@ -86,10 +86,10 @@ grid210x_device::grid210x_device(const machine_config &mconfig, device_type type
|
||||
void grid210x_device::device_start() {
|
||||
m_bus->ndac_w(this, 1);
|
||||
m_bus->nrfd_w(this, 1);
|
||||
m_delay_timer = timer_alloc(0);
|
||||
m_delay_timer = timer_alloc(FUNC(grid210x_device::delay_tick), this);
|
||||
}
|
||||
|
||||
void grid210x_device::device_timer(emu_timer &timer, device_timer_id id, int param) {
|
||||
TIMER_CALLBACK_MEMBER(grid210x_device::delay_tick) {
|
||||
if (m_floppy_loop_state == GRID210X_STATE_READING_DATA) {
|
||||
std::unique_ptr<uint8_t[]> data(new uint8_t[io_size]);
|
||||
fseek(floppy_sector_number * 512, SEEK_SET);
|
||||
|
@ -33,7 +33,6 @@ public:
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// device_ieee488_interface overrides
|
||||
virtual void ieee488_eoi(int state) override;
|
||||
@ -56,7 +55,10 @@ protected:
|
||||
|
||||
void accept_transfer();
|
||||
void update_ndac(int atn);
|
||||
|
||||
private:
|
||||
TIMER_CALLBACK_MEMBER(delay_tick);
|
||||
|
||||
int m_gpib_loop_state;
|
||||
int m_floppy_loop_state;
|
||||
uint8_t m_last_recv_byte;
|
||||
@ -74,6 +76,7 @@ private:
|
||||
std::queue<uint8_t> m_output_data_buffer;
|
||||
uint16_t io_size;
|
||||
emu_timer *m_delay_timer;
|
||||
|
||||
protected:
|
||||
attotime read_delay;
|
||||
};
|
||||
|
@ -91,7 +91,7 @@ void hp9122c_device::device_start()
|
||||
save_item(NAME(m_ds0));
|
||||
save_item(NAME(m_ds1));
|
||||
|
||||
m_motor_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(hp9122c_device::motor_timeout), this));
|
||||
m_motor_timer = timer_alloc(FUNC(hp9122c_device::motor_timeout), this);
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(hp9122c_device::motor_timeout)
|
||||
|
@ -58,11 +58,11 @@
|
||||
#include "hp9895.h"
|
||||
#include "formats/hpi_dsk.h"
|
||||
|
||||
// Debugging
|
||||
#define VERBOSE 1
|
||||
#define LOG(x) do { if (VERBOSE) logerror x; } while (0)
|
||||
#define VERBOSE_0 0
|
||||
#define LOG_0(x) do { if (VERBOSE_0) logerror x; } while (0)
|
||||
#define LOG_LEVEL0 (0x1U << 1)
|
||||
#define LOG_LEVEL1 (0x3U << 1)
|
||||
|
||||
#define VERBOSE (LOG_LEVEL1)
|
||||
#include "logmacro.h"
|
||||
|
||||
// Macros to clear/set single bits
|
||||
#define BIT_MASK(n) (1U << (n))
|
||||
@ -116,13 +116,6 @@
|
||||
#define REG_SWITCHES_TIMEOUT_BIT 6 // TIMEOUT (1)
|
||||
#define REG_SWITCHES_AMDT_BIT 7 // Address mark detected (1)
|
||||
|
||||
// Timers
|
||||
enum {
|
||||
TIMEOUT_TMR_ID,
|
||||
BYTE_TMR_ID,
|
||||
HALF_BIT_TMR_ID
|
||||
};
|
||||
|
||||
// Timings
|
||||
#define TIMEOUT_MSEC 450 // Timeout duration (ms)
|
||||
#define HPMODE_BIT_FREQ 500000 // HP-mode bit frequency (Hz)
|
||||
@ -198,9 +191,9 @@ void hp9895_device::device_start()
|
||||
save_item(NAME(m_hiden));
|
||||
save_item(NAME(m_mgnena));
|
||||
|
||||
m_timeout_timer = timer_alloc(TIMEOUT_TMR_ID);
|
||||
m_byte_timer = timer_alloc(BYTE_TMR_ID);
|
||||
m_half_bit_timer = timer_alloc(HALF_BIT_TMR_ID);
|
||||
m_timeout_timer = timer_alloc(FUNC(hp9895_device::timeout_timer_tick), this);
|
||||
m_byte_timer = timer_alloc(FUNC(hp9895_device::byte_timer_tick), this);
|
||||
m_half_bit_timer = timer_alloc(FUNC(hp9895_device::half_bit_timer_tick), this);
|
||||
|
||||
for (auto& d : m_drives) {
|
||||
d->get_device()->setup_ready_cb(floppy_image_device::ready_cb(&hp9895_device::floppy_ready_cb , this));
|
||||
@ -236,26 +229,24 @@ void hp9895_device::device_reset()
|
||||
m_half_bit_timer->reset();
|
||||
}
|
||||
|
||||
void hp9895_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(hp9895_device::timeout_timer_tick)
|
||||
{
|
||||
switch (id) {
|
||||
case TIMEOUT_TMR_ID:
|
||||
LOG(("Timeout!\n"));
|
||||
LOGMASKED(LOG_LEVEL1, "Timeout\n");
|
||||
m_timeout = true;
|
||||
if (m_mgnena) {
|
||||
// CPU is resumed by timeout if MGNENA=1
|
||||
m_cpu->trigger(1);
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
case BYTE_TMR_ID:
|
||||
{
|
||||
TIMER_CALLBACK_MEMBER(hp9895_device::byte_timer_tick)
|
||||
{
|
||||
if (m_accdata) {
|
||||
// Resume CPU when it's waiting for SDOK
|
||||
m_cpu->trigger(1);
|
||||
} else {
|
||||
// No access to data register by CPU
|
||||
LOG(("Data overrun!\n"));
|
||||
LOGMASKED(LOG_LEVEL1, "Data overrun\n");
|
||||
m_overrun = true;
|
||||
}
|
||||
m_accdata = false;
|
||||
@ -268,7 +259,7 @@ void hp9895_device::device_timer(emu_timer &timer, device_timer_id id, int param
|
||||
}
|
||||
|
||||
attotime sdok_time{machine().time()};
|
||||
LOG_0(("SDOK @ %.06f\n" , sdok_time.as_double()));
|
||||
LOGMASKED(LOG_LEVEL0, "SDOK @ %.06f\n" , sdok_time.as_double());
|
||||
bool do_crc_upd = true;
|
||||
if (BIT(m_cntl_reg , REG_CNTL_WRITON_BIT)) {
|
||||
// Writing
|
||||
@ -284,7 +275,7 @@ void hp9895_device::device_timer(emu_timer &timer, device_timer_id id, int param
|
||||
}
|
||||
}
|
||||
|
||||
LOG_0(("WR D=%02x/C=%02x\n" , m_data_sr , m_clock_sr));
|
||||
LOGMASKED(LOG_LEVEL0, "WR D=%02x/C=%02x\n" , m_data_sr , m_clock_sr);
|
||||
do_crc_upd = false;
|
||||
for (unsigned i = 0; i < 8; i++) {
|
||||
bool clock_bit;
|
||||
@ -312,15 +303,14 @@ void hp9895_device::device_timer(emu_timer &timer, device_timer_id id, int param
|
||||
for (unsigned i = 0; i < 8; i++) {
|
||||
read_bit(do_crc_upd);
|
||||
}
|
||||
LOG_0(("RD D=%02x/C=%02x\n" , m_data_sr , m_clock_sr));
|
||||
LOGMASKED(LOG_LEVEL0, "RD D=%02x/C=%02x\n" , m_data_sr , m_clock_sr);
|
||||
}
|
||||
LOG_0(("next SDOK @ %.06f\n" , m_pll.ctime.as_double()));
|
||||
timer.adjust(m_pll.ctime - sdok_time);
|
||||
}
|
||||
break;
|
||||
LOGMASKED(LOG_LEVEL0, "next SDOK @ %.06f\n" , m_pll.ctime.as_double());
|
||||
m_byte_timer->adjust(m_pll.ctime - sdok_time);
|
||||
}
|
||||
|
||||
case HALF_BIT_TMR_ID:
|
||||
{
|
||||
TIMER_CALLBACK_MEMBER(hp9895_device::half_bit_timer_tick)
|
||||
{
|
||||
m_pll.ctime = machine().time();
|
||||
if (m_lckup) {
|
||||
// Trying to lock on synchronization bytes
|
||||
@ -332,16 +322,16 @@ void hp9895_device::device_timer(emu_timer &timer, device_timer_id id, int param
|
||||
bool half_bit1 = m_pll.feed_read_data(tm , edge , attotime::never);
|
||||
if (half_bit0 == half_bit1) {
|
||||
// If half bits are equal, no synch
|
||||
LOG_0(("Reset sync_cnt\n"));
|
||||
LOGMASKED(LOG_LEVEL0, "Reset sync_cnt\n");
|
||||
m_sync_cnt = 0;
|
||||
} else if (++m_sync_cnt >= MIN_SYNC_BITS) {
|
||||
// Synchronized, now wait for AM
|
||||
LOG_0(("Synchronized @ %.6f\n" , machine().time().as_double()));
|
||||
LOGMASKED(LOG_LEVEL0, "Synchronized @ %.6f\n" , machine().time().as_double());
|
||||
m_lckup = false;
|
||||
if (BIT(m_cntl_reg , REG_CNTL_WRITON_BIT)) {
|
||||
// When loopback is active, leave AM detection to byte timer as
|
||||
// byte boundary is already synchronized
|
||||
timer.reset();
|
||||
m_half_bit_timer->reset();
|
||||
return;
|
||||
} else {
|
||||
// Align with bit cell
|
||||
@ -375,20 +365,14 @@ void hp9895_device::device_timer(emu_timer &timer, device_timer_id id, int param
|
||||
read_bit(false);
|
||||
}
|
||||
attotime adjust{m_pll.ctime - machine().time()};
|
||||
LOG_0(("Got AM @ %.6f, ctime=%.6f, adj=%.6f, D=%02x/C=%02x\n" , machine().time().as_double() , m_pll.ctime.as_double() , adjust.as_double() , m_data_sr , m_clock_sr));
|
||||
LOGMASKED(LOG_LEVEL0, "Got AM @ %.6f, ctime=%.6f, adj=%.6f, D=%02x/C=%02x\n" , machine().time().as_double() , m_pll.ctime.as_double() , adjust.as_double() , m_data_sr , m_clock_sr);
|
||||
// Disable half-bit timer & enable byte timer
|
||||
timer.reset();
|
||||
m_half_bit_timer->reset();
|
||||
m_byte_timer->adjust(adjust);
|
||||
return;
|
||||
}
|
||||
}
|
||||
timer.adjust(m_pll.ctime - machine().time());
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
m_half_bit_timer->adjust(m_pll.ctime - machine().time());
|
||||
}
|
||||
|
||||
void hp9895_device::ieee488_eoi(int state)
|
||||
@ -514,7 +498,7 @@ void hp9895_device::z80_m1_w(uint8_t data)
|
||||
|
||||
void hp9895_device::data_w(uint8_t data)
|
||||
{
|
||||
LOG_0(("W DATA=%02x\n" , data));
|
||||
LOGMASKED(LOG_LEVEL0, "W DATA=%02x\n" , data);
|
||||
// CPU stalls until next SDOK
|
||||
m_cpu->suspend_until_trigger(1 , true);
|
||||
m_data_sr = data;
|
||||
@ -524,13 +508,13 @@ void hp9895_device::data_w(uint8_t data)
|
||||
|
||||
void hp9895_device::clock_w(uint8_t data)
|
||||
{
|
||||
LOG_0(("W CLOCK=%02x\n" , data));
|
||||
LOGMASKED(LOG_LEVEL0, "W CLOCK=%02x\n" , data);
|
||||
m_clock_reg = data;
|
||||
}
|
||||
|
||||
void hp9895_device::reset_w(uint8_t data)
|
||||
{
|
||||
LOG_0(("W RESET=%02x\n" , data));
|
||||
LOGMASKED(LOG_LEVEL0, "W RESET=%02x\n" , data);
|
||||
if (BIT(data , REG_RESET_TIMEOUT_START_BIT)) {
|
||||
m_timeout = false;
|
||||
m_timeout_timer->adjust(attotime::from_msec(TIMEOUT_MSEC));
|
||||
@ -543,14 +527,14 @@ void hp9895_device::reset_w(uint8_t data)
|
||||
|
||||
void hp9895_device::leds_w(uint8_t data)
|
||||
{
|
||||
LOG(("W LEDS=%02x %c%c%c%c%c\n" , data , BIT(data , 4) ? '.' : '*' , BIT(data , 3) ? '.' : '*' , BIT(data , 2) ? '.' : '*' , BIT(data , 1) ? '.' : '*' , BIT(data , 0) ? '.' : '*'));
|
||||
LOGMASKED(LOG_LEVEL1, "W LEDS=%02x %c%c%c%c%c\n" , data , BIT(data , 4) ? '.' : '*' , BIT(data , 3) ? '.' : '*' , BIT(data , 2) ? '.' : '*' , BIT(data , 1) ? '.' : '*' , BIT(data , 0) ? '.' : '*');
|
||||
// TODO:
|
||||
}
|
||||
|
||||
void hp9895_device::cntl_w(uint8_t data)
|
||||
{
|
||||
if (data != m_cntl_reg) {
|
||||
LOG_0(("W CNTL=%02x -> %02x\n" , m_cntl_reg , data));
|
||||
LOGMASKED(LOG_LEVEL0, "W CNTL=%02x -> %02x\n" , m_cntl_reg , data);
|
||||
uint8_t old_cntl_reg = m_cntl_reg;
|
||||
m_cntl_reg = data;
|
||||
|
||||
@ -563,11 +547,11 @@ void hp9895_device::cntl_w(uint8_t data)
|
||||
bool byte_timer_needed = new_writon || (new_readon && m_amdt);
|
||||
|
||||
if (!byte_timer_running && byte_timer_needed) {
|
||||
LOG_0(("Enable byte tmr\n"));
|
||||
LOGMASKED(LOG_LEVEL0, "Enable byte tmr\n");
|
||||
attotime byte_period = get_half_bit_cell_period() * 16;
|
||||
m_byte_timer->adjust(byte_period);
|
||||
} else if (byte_timer_running && !byte_timer_needed) {
|
||||
LOG_0(("Disable byte tmr\n"));
|
||||
LOGMASKED(LOG_LEVEL0, "Disable byte tmr\n");
|
||||
m_byte_timer->reset();
|
||||
}
|
||||
|
||||
@ -577,24 +561,24 @@ void hp9895_device::cntl_w(uint8_t data)
|
||||
|
||||
if (!old_writon && new_writon) {
|
||||
// Writing enabled
|
||||
LOG_0(("Start writing..\n"));
|
||||
LOGMASKED(LOG_LEVEL0, "Start writing\n");
|
||||
m_pll.start_writing(machine().time());
|
||||
m_wr_context = 0;
|
||||
m_had_transition = false;
|
||||
} else if (old_writon && !new_writon) {
|
||||
// Writing disabled
|
||||
LOG_0(("Stop writing..\n"));
|
||||
LOGMASKED(LOG_LEVEL0, "Stop writing\n");
|
||||
m_pll.stop_writing(get_write_device() , machine().time());
|
||||
}
|
||||
if (!old_readon && new_readon) {
|
||||
// Reading enabled
|
||||
LOG_0(("Start reading..\n"));
|
||||
LOGMASKED(LOG_LEVEL0, "Start reading\n");
|
||||
m_pll.read_reset(machine().time());
|
||||
m_sync_cnt = 0;
|
||||
m_half_bit_timer->adjust(get_half_bit_cell_period());
|
||||
} else if (old_readon && !new_readon) {
|
||||
// Reading disabled
|
||||
LOG_0(("Stop reading..\n"));
|
||||
LOGMASKED(LOG_LEVEL0, "Stop reading\n");
|
||||
m_half_bit_timer->reset();
|
||||
m_lckup = true;
|
||||
m_amdt = false;
|
||||
@ -610,7 +594,7 @@ void hp9895_device::cntl_w(uint8_t data)
|
||||
|
||||
void hp9895_device::drv_w(uint8_t data)
|
||||
{
|
||||
LOG_0(("W DRV=%02x\n" , data));
|
||||
LOGMASKED(LOG_LEVEL0, "W DRV=%02x\n" , data);
|
||||
m_mgnena = BIT(data , REG_DRV_MGNENA_BIT);
|
||||
if (m_current_drive != nullptr) {
|
||||
m_current_drive->stp_w(!BIT(data , REG_DRV_STEP_BIT));
|
||||
@ -622,11 +606,11 @@ void hp9895_device::drv_w(uint8_t data)
|
||||
|
||||
void hp9895_device::xv_w(uint8_t data)
|
||||
{
|
||||
LOG_0(("W XV=%02x\n" , data));
|
||||
LOGMASKED(LOG_LEVEL0, "W XV=%02x\n" , data);
|
||||
// Disk Changed flag is cleared when drive is ready and it is deselected
|
||||
if (m_current_drive_idx < 2 && (data & xv_drive_masks[ m_current_drive_idx ]) == 0 && !m_current_drive->ready_r()) {
|
||||
if (m_dskchg[ m_current_drive_idx ]) {
|
||||
LOG(("Dskchg %u cleared\n" , m_current_drive_idx));
|
||||
LOGMASKED(LOG_LEVEL1, "Dskchg %u cleared\n" , m_current_drive_idx);
|
||||
}
|
||||
m_dskchg[ m_current_drive_idx ] = false;
|
||||
}
|
||||
@ -648,7 +632,7 @@ uint8_t hp9895_device::data_r()
|
||||
{
|
||||
m_clock_reg = m_clock_sr;
|
||||
m_accdata = true;
|
||||
LOG_0(("R DATA=%02x\n" , m_data_sr));
|
||||
LOGMASKED(LOG_LEVEL0, "R DATA=%02x\n" , m_data_sr);
|
||||
// CPU stalls until next SDOK
|
||||
m_cpu->suspend_until_trigger(1 , true);
|
||||
return m_data_sr;
|
||||
@ -689,7 +673,7 @@ uint8_t hp9895_device::drivstat_r()
|
||||
if (m_overrun) {
|
||||
BIT_SET(res , REG_DRIVSTAT_OVERUN_BIT);
|
||||
}
|
||||
LOG_0(("R DRIVSTAT=%02x\n" , res));
|
||||
LOGMASKED(LOG_LEVEL0, "R DRIVSTAT=%02x\n" , res);
|
||||
return res;
|
||||
}
|
||||
|
||||
@ -711,7 +695,7 @@ void hp9895_device::floppy_ready_cb(floppy_image_device *floppy , int state)
|
||||
// Set Disk Changed flag when a drive is not ready
|
||||
for (unsigned i = 0; i < 2; i++) {
|
||||
if (floppy == m_drives[ i ]->get_device()) {
|
||||
LOG(("Dskchg %u set\n" , i));
|
||||
LOGMASKED(LOG_LEVEL1, "Dskchg %u set\n" , i);
|
||||
m_dskchg[ i ] = true;
|
||||
break;
|
||||
}
|
||||
|
@ -29,7 +29,6 @@ public:
|
||||
protected:
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// device-level overrides
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
@ -87,6 +86,20 @@ private:
|
||||
// Floppy drive interface
|
||||
void floppy_ready_cb(floppy_image_device *floppy , int state);
|
||||
|
||||
TIMER_CALLBACK_MEMBER(timeout_timer_tick);
|
||||
TIMER_CALLBACK_MEMBER(byte_timer_tick);
|
||||
TIMER_CALLBACK_MEMBER(half_bit_timer_tick);
|
||||
|
||||
uint8_t get_switches2(void) const;
|
||||
attotime get_half_bit_cell_period(void) const;
|
||||
floppy_image_device *get_write_device(void) const;
|
||||
void preset_crc(void);
|
||||
void update_crc(bool bit);
|
||||
bool shift_sr(uint8_t& sr , bool input_bit);
|
||||
void get_next_transition(const attotime& from_when , attotime& edge);
|
||||
void read_bit(bool crc_upd);
|
||||
void write_bit(bool data_bit , bool clock_bit);
|
||||
|
||||
void z80_io_map(address_map &map);
|
||||
void z80_program_map(address_map &map);
|
||||
|
||||
@ -123,16 +136,6 @@ private:
|
||||
|
||||
// PLL
|
||||
fdc_pll_t m_pll;
|
||||
|
||||
uint8_t get_switches2(void) const;
|
||||
attotime get_half_bit_cell_period(void) const;
|
||||
floppy_image_device *get_write_device(void) const;
|
||||
void preset_crc(void);
|
||||
void update_crc(bool bit);
|
||||
bool shift_sr(uint8_t& sr , bool input_bit);
|
||||
void get_next_transition(const attotime& from_when , attotime& edge);
|
||||
void read_bit(bool crc_upd);
|
||||
void write_bit(bool data_bit , bool clock_bit);
|
||||
};
|
||||
|
||||
// device type definition
|
||||
|
@ -188,11 +188,12 @@
|
||||
#include "remote488.h"
|
||||
|
||||
// Debugging
|
||||
#include "logmacro.h"
|
||||
#define LOG_PARSER_MASK (LOG_GENERAL << 1)
|
||||
#define LOG_PARSER_MASK (1U << 1)
|
||||
#define LOG_PARSER(...) LOGMASKED(LOG_PARSER_MASK, __VA_ARGS__)
|
||||
#undef VERBOSE
|
||||
#define VERBOSE LOG_GENERAL
|
||||
|
||||
#define VERBOSE (LOG_GENERAL)
|
||||
|
||||
#include "logmacro.h"
|
||||
|
||||
// Bit manipulation
|
||||
namespace {
|
||||
@ -231,7 +232,7 @@ constexpr char MSG_PP_REQUEST = 'Q'; // O: Request PP data
|
||||
constexpr char MSG_ECHO_REQ = 'J'; // O: Heartbeat msg: echo request
|
||||
constexpr char MSG_ECHO_REPLY = 'K'; // I: Heartbeat msg: echo reply
|
||||
constexpr char MSG_CHECKPOINT = 'X'; // I/O: Checkpoint in byte stream
|
||||
constexpr char MSG_CP_REACHED = 'Y'; // I/O: Checkpoint reached
|
||||
constexpr char MSG_CHECKPOINT_REACHED = 'Y'; // I/O: Checkpoint reached
|
||||
|
||||
// Timings
|
||||
constexpr unsigned POLL_PERIOD_US = 20; // Poll period (µs)
|
||||
@ -304,9 +305,9 @@ void remote488_device::ieee488_ren(int state)
|
||||
|
||||
void remote488_device::device_start()
|
||||
{
|
||||
m_poll_timer = timer_alloc(TMR_ID_POLL);
|
||||
m_hb_timer = timer_alloc(TMR_ID_HEARTBEAT);
|
||||
m_ah_timer = timer_alloc(TMR_ID_AH);
|
||||
m_poll_timer = timer_alloc(FUNC(remote488_device::process_input_msgs), this);
|
||||
m_hb_timer = timer_alloc(FUNC(remote488_device::heartbeat_tick), this);
|
||||
m_ah_timer = timer_alloc(FUNC(remote488_device::checkpoint_timeout_tick), this);
|
||||
}
|
||||
|
||||
void remote488_device::device_reset()
|
||||
@ -327,7 +328,7 @@ void remote488_device::device_reset()
|
||||
|
||||
m_ibf = false;
|
||||
m_flush_bytes = false;
|
||||
m_waiting_cp = false;
|
||||
m_waiting_checkpoint = false;
|
||||
bus_reset();
|
||||
}
|
||||
|
||||
@ -344,7 +345,7 @@ void remote488_device::bus_reset()
|
||||
update_pp();
|
||||
}
|
||||
|
||||
void remote488_device::process_input_msgs()
|
||||
TIMER_CALLBACK_MEMBER(remote488_device::process_input_msgs)
|
||||
{
|
||||
uint8_t data;
|
||||
char msg_ch;
|
||||
@ -383,13 +384,13 @@ void remote488_device::process_input_msgs()
|
||||
break;
|
||||
|
||||
case MSG_CHECKPOINT:
|
||||
send_update(MSG_CP_REACHED , m_flush_bytes);
|
||||
send_update(MSG_CHECKPOINT_REACHED , m_flush_bytes);
|
||||
m_flush_bytes = false;
|
||||
break;
|
||||
|
||||
case MSG_CP_REACHED:
|
||||
if (m_waiting_cp) {
|
||||
m_waiting_cp = false;
|
||||
case MSG_CHECKPOINT_REACHED:
|
||||
if (m_waiting_checkpoint) {
|
||||
m_waiting_checkpoint = false;
|
||||
update_ah_fsm();
|
||||
}
|
||||
break;
|
||||
@ -403,30 +404,20 @@ void remote488_device::process_input_msgs()
|
||||
}
|
||||
}
|
||||
|
||||
void remote488_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(remote488_device::heartbeat_tick)
|
||||
{
|
||||
switch (id) {
|
||||
case TMR_ID_POLL:
|
||||
process_input_msgs();
|
||||
break;
|
||||
|
||||
case TMR_ID_HEARTBEAT:
|
||||
if (m_connected && m_connect_cnt && --m_connect_cnt == 0) {
|
||||
set_connection(false);
|
||||
}
|
||||
send_update(MSG_ECHO_REQ , 0);
|
||||
break;
|
||||
}
|
||||
|
||||
case TMR_ID_AH:
|
||||
if (!m_waiting_cp) {
|
||||
LOG("CP T/O\n");
|
||||
TIMER_CALLBACK_MEMBER(remote488_device::checkpoint_timeout_tick)
|
||||
{
|
||||
if (!m_waiting_checkpoint) {
|
||||
LOG("Checkpoint T/O\n");
|
||||
ah_checkpoint();
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void remote488_device::set_connection(bool state)
|
||||
@ -570,7 +561,7 @@ bool remote488_device::is_msg_type(char c)
|
||||
c == MSG_PP_DATA ||
|
||||
c == MSG_ECHO_REPLY ||
|
||||
c == MSG_CHECKPOINT ||
|
||||
c == MSG_CP_REACHED;
|
||||
c == MSG_CHECKPOINT_REACHED;
|
||||
}
|
||||
|
||||
bool remote488_device::is_terminator(char c)
|
||||
@ -668,7 +659,7 @@ bool remote488_device::is_local_atn_active() const
|
||||
|
||||
void remote488_device::ah_checkpoint()
|
||||
{
|
||||
m_waiting_cp = true;
|
||||
m_waiting_checkpoint = true;
|
||||
m_ah_timer->reset();
|
||||
send_update(MSG_CHECKPOINT , 0);
|
||||
}
|
||||
@ -698,7 +689,7 @@ void remote488_device::update_ah_fsm()
|
||||
case REM_AH_ACDS:
|
||||
if (m_bus->dav_r()) {
|
||||
m_ah_state = REM_AH_ACRS;
|
||||
} else if (!m_waiting_cp) {
|
||||
} else if (!m_waiting_checkpoint) {
|
||||
uint8_t dio = ~m_bus->dio_r();
|
||||
|
||||
if (!m_bus->eoi_r()) {
|
||||
|
@ -31,18 +31,10 @@ public:
|
||||
virtual void ieee488_atn(int state) override;
|
||||
virtual void ieee488_ren(int state) override;
|
||||
|
||||
// Timers
|
||||
enum {
|
||||
TMR_ID_POLL,
|
||||
TMR_ID_HEARTBEAT,
|
||||
TMR_ID_AH
|
||||
};
|
||||
|
||||
protected:
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
private:
|
||||
// Position of signals in "S/R" msgs
|
||||
@ -101,10 +93,14 @@ private:
|
||||
bool m_pp_requested;
|
||||
uint8_t m_pp_dio;
|
||||
uint8_t m_sh_dio;
|
||||
bool m_waiting_cp;
|
||||
bool m_waiting_checkpoint;
|
||||
|
||||
|
||||
TIMER_CALLBACK_MEMBER(process_input_msgs);
|
||||
TIMER_CALLBACK_MEMBER(heartbeat_tick);
|
||||
TIMER_CALLBACK_MEMBER(checkpoint_timeout_tick);
|
||||
|
||||
void bus_reset();
|
||||
void process_input_msgs();
|
||||
void set_connection(bool state);
|
||||
void recvd_data_byte(uint8_t data , bool eoi);
|
||||
void flush_data();
|
||||
|
@ -85,7 +85,7 @@ void imm4_90_device::call_unload()
|
||||
|
||||
void imm4_90_device::device_start()
|
||||
{
|
||||
m_step_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(imm4_90_device::step), this));
|
||||
m_step_timer = timer_alloc(FUNC(imm4_90_device::step), this);
|
||||
|
||||
save_item(NAME(m_data));
|
||||
save_item(NAME(m_ready));
|
||||
|
@ -285,7 +285,7 @@ void hle_device_base::device_add_mconfig(machine_config &config)
|
||||
|
||||
void hle_device_base::device_start()
|
||||
{
|
||||
m_click_timer = timer_alloc(CLICK_TIMER_ID);
|
||||
m_click_timer = timer_alloc(FUNC(hle_device_base::click_tick), this);
|
||||
|
||||
save_item(NAME(m_make_count));
|
||||
save_item(NAME(m_rx_state));
|
||||
@ -316,18 +316,10 @@ void hle_device_base::device_reset()
|
||||
start_processing(attotime::from_hz(1'200));
|
||||
}
|
||||
|
||||
void hle_device_base::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(hle_device_base::click_tick)
|
||||
{
|
||||
switch (id)
|
||||
{
|
||||
case CLICK_TIMER_ID:
|
||||
m_beeper_state &= ~u8(BEEPER_CLICK);
|
||||
m_beeper->set_state(m_beeper_state ? 1 : 0);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void hle_device_base::tra_callback()
|
||||
|
@ -31,7 +31,6 @@ protected:
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// device_buffered_serial_interface overrides
|
||||
virtual void tra_callback() override;
|
||||
@ -87,6 +86,8 @@ private:
|
||||
COMMAND_LAYOUT = 0x0fU
|
||||
};
|
||||
|
||||
TIMER_CALLBACK_MEMBER(click_tick);
|
||||
|
||||
// device_buffered_serial_interface overrides
|
||||
virtual void received_byte(u8 byte) override;
|
||||
|
||||
|
@ -616,9 +616,9 @@ void gt_device_base::device_start()
|
||||
save_item(NAME(m_control));
|
||||
|
||||
// allocate timers
|
||||
m_blit_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gt_device_base::blit), this));
|
||||
m_line_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gt_device_base::line), this));
|
||||
m_done_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(gt_device_base::done), this));
|
||||
m_blit_timer = timer_alloc(FUNC(gt_device_base::blit), this);
|
||||
m_line_timer = timer_alloc(FUNC(gt_device_base::line), this);
|
||||
m_done_timer = timer_alloc(FUNC(gt_device_base::done), this);
|
||||
}
|
||||
|
||||
void gt_device_base::control_w(offs_t offset, u32 data, u32 mem_mask)
|
||||
|
@ -52,8 +52,15 @@ iq151_staper_device::iq151_staper_device(const machine_config &mconfig, const ch
|
||||
|
||||
void iq151_staper_device::device_start()
|
||||
{
|
||||
m_printer_timer = timer_alloc(TIMER_PRINTER);
|
||||
m_printer_timer->reset();
|
||||
m_printer_timer = timer_alloc(FUNC(iq151_staper_device::pc2_low_tick), this);
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_reset - device-specific reset
|
||||
//-------------------------------------------------
|
||||
|
||||
void iq151_staper_device::device_reset()
|
||||
{
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
@ -71,12 +78,11 @@ void iq151_staper_device::device_add_mconfig(machine_config &config)
|
||||
}
|
||||
|
||||
//-------------------------------------------------
|
||||
// device_timer - handler timer events
|
||||
// pc2_low_tick - lower PPI Port C bit 2
|
||||
//-------------------------------------------------
|
||||
|
||||
void iq151_staper_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(iq151_staper_device::pc2_low_tick)
|
||||
{
|
||||
if (id == TIMER_PRINTER)
|
||||
m_ppi->pc2_w(0);
|
||||
}
|
||||
|
||||
|
@ -26,7 +26,7 @@ public:
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
// optional information overrides
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
@ -41,7 +41,7 @@ private:
|
||||
void ppi_portb_w(uint8_t data);
|
||||
void ppi_portc_w(uint8_t data);
|
||||
|
||||
static const device_timer_id TIMER_PRINTER = 0;
|
||||
TIMER_CALLBACK_MEMBER(pc2_low_tick);
|
||||
|
||||
required_device<i8255_device> m_ppi;
|
||||
required_device<printer_image_device> m_printer;
|
||||
|
@ -140,7 +140,7 @@ void gf1_device::adlib_w(offs_t offset, uint8_t data)
|
||||
}
|
||||
}
|
||||
|
||||
void gf1_device::update_volume_ramps()
|
||||
TIMER_CALLBACK_MEMBER(gf1_device::update_volume_ramps)
|
||||
{
|
||||
int x;
|
||||
|
||||
@ -207,11 +207,8 @@ void gf1_device::update_volume_ramps()
|
||||
}
|
||||
}
|
||||
|
||||
void gf1_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(gf1_device::adlib_timer1_tick)
|
||||
{
|
||||
switch(id)
|
||||
{
|
||||
case ADLIB_TIMER1:
|
||||
if(m_adlib_timer1_enable != 0)
|
||||
{
|
||||
if(m_timer1_count == 0xff)
|
||||
@ -223,8 +220,10 @@ void gf1_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
}
|
||||
m_timer1_count++;
|
||||
}
|
||||
break;
|
||||
case ADLIB_TIMER2:
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(gf1_device::adlib_timer2_tick)
|
||||
{
|
||||
if(m_adlib_timer2_enable != 0)
|
||||
{
|
||||
if(m_timer2_count == 0xff)
|
||||
@ -236,14 +235,11 @@ void gf1_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
}
|
||||
m_timer2_count++;
|
||||
}
|
||||
break;
|
||||
case DMA_TIMER:
|
||||
}
|
||||
|
||||
TIMER_CALLBACK_MEMBER(gf1_device::dma_tick)
|
||||
{
|
||||
m_drq1_handler(1);
|
||||
break;
|
||||
case VOL_RAMP_TIMER:
|
||||
update_volume_ramps();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
void gf1_device::sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs)
|
||||
@ -406,10 +402,10 @@ void gf1_device::device_start()
|
||||
m_stream = stream_alloc(0,2,clock() / (14 * 16));
|
||||
|
||||
// init timers
|
||||
m_timer1 = timer_alloc(ADLIB_TIMER1);
|
||||
m_timer2 = timer_alloc(ADLIB_TIMER2);
|
||||
m_dmatimer = timer_alloc(DMA_TIMER);
|
||||
m_voltimer = timer_alloc(VOL_RAMP_TIMER);
|
||||
m_timer1 = timer_alloc(FUNC(gf1_device::adlib_timer1_tick), this);
|
||||
m_timer2 = timer_alloc(FUNC(gf1_device::adlib_timer2_tick), this);
|
||||
m_dmatimer = timer_alloc(FUNC(gf1_device::dma_tick), this);
|
||||
m_voltimer = timer_alloc(FUNC(gf1_device::update_volume_ramps), this);
|
||||
|
||||
save_item(NAME(m_wave_ram));
|
||||
|
||||
|
@ -121,11 +121,18 @@ public:
|
||||
void dack_w(int line,uint8_t data);
|
||||
void eop_w(int state);
|
||||
|
||||
// optional information overrides
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
// device_sound_interface overrides
|
||||
virtual void sound_stream_update(sound_stream &stream, std::vector<read_stream_view> const &inputs, std::vector<write_stream_view> &outputs) override;
|
||||
|
||||
protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_stop() override;
|
||||
virtual void device_clock_changed() override;
|
||||
|
||||
virtual void update_irq() override;
|
||||
|
||||
// voice-specific registers
|
||||
gus_voice m_voice[32];
|
||||
|
||||
@ -147,18 +154,13 @@ protected:
|
||||
|
||||
void set_irq(uint8_t source, uint8_t voice);
|
||||
void reset_irq(uint8_t source);
|
||||
void update_volume_ramps();
|
||||
|
||||
TIMER_CALLBACK_MEMBER(adlib_timer1_tick);
|
||||
TIMER_CALLBACK_MEMBER(adlib_timer2_tick);
|
||||
TIMER_CALLBACK_MEMBER(dma_tick);
|
||||
TIMER_CALLBACK_MEMBER(update_volume_ramps);
|
||||
|
||||
std::vector<uint8_t> m_wave_ram;
|
||||
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_stop() override;
|
||||
virtual void device_clock_changed() override;
|
||||
|
||||
virtual void update_irq() override;
|
||||
|
||||
private:
|
||||
// internal state
|
||||
sound_stream* m_stream;
|
||||
@ -199,11 +201,6 @@ private:
|
||||
uint32_t m_dma_current;
|
||||
uint16_t m_volume_table[4096];
|
||||
|
||||
static const device_timer_id ADLIB_TIMER1 = 0;
|
||||
static const device_timer_id ADLIB_TIMER2 = 1;
|
||||
static const device_timer_id DMA_TIMER = 2;
|
||||
static const device_timer_id VOL_RAMP_TIMER = 3;
|
||||
|
||||
int m_txirq;
|
||||
int m_rxirq;
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -35,15 +35,14 @@ public:
|
||||
void dack_w(int data);
|
||||
void dack_ws(int data);
|
||||
|
||||
virtual void command();
|
||||
void data_w(int data);
|
||||
void reset_w(int data);
|
||||
void select_w(int data);
|
||||
void control_w(int data);
|
||||
void data_w(uint8_t data);
|
||||
void reset_w(uint8_t data);
|
||||
void select_w(uint8_t data);
|
||||
void control_w(uint8_t data);
|
||||
uint8_t data_r();
|
||||
uint8_t status_r();
|
||||
void set_ready();
|
||||
uint8_t get_command() { return buffer[0]; }
|
||||
uint8_t get_command() { return m_buffer[0]; }
|
||||
bool install_rom() { return (m_type != EC1841); }
|
||||
|
||||
protected:
|
||||
@ -52,10 +51,10 @@ protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
hard_disk_file *pc_hdc_file(int id);
|
||||
void pc_hdc_result(int set_error_info);
|
||||
int no_dma(void);
|
||||
void pc_hdc_result(bool set_error_info);
|
||||
bool no_dma();
|
||||
int get_lbasector();
|
||||
void execute_read();
|
||||
void execute_readsbuff();
|
||||
@ -63,13 +62,15 @@ protected:
|
||||
void execute_writesbuff();
|
||||
void get_drive();
|
||||
void get_chsn();
|
||||
int test_ready();
|
||||
bool test_ready();
|
||||
|
||||
std::vector<uint8_t> buffer; /* data buffer */
|
||||
uint8_t *buffer_ptr; /* data pointer */
|
||||
int csb; /* command status byte */
|
||||
int status; /* drive status */
|
||||
int error; /* error code */
|
||||
TIMER_CALLBACK_MEMBER(process_command);
|
||||
|
||||
std::unique_ptr<uint8_t[]> m_buffer; /* data buffer */
|
||||
uint8_t *m_buffer_ptr; /* data pointer */
|
||||
int m_csb; /* command status byte */
|
||||
int m_status; /* drive status */
|
||||
int m_error; /* error code */
|
||||
|
||||
enum {
|
||||
STANDARD,
|
||||
@ -82,31 +83,31 @@ protected:
|
||||
devcb_write_line m_drq_handler;
|
||||
|
||||
private:
|
||||
int drv; /* 0 master, 1 slave drive */
|
||||
int cylinders[2]; /* number of cylinders */
|
||||
int rwc[2]; /* reduced write current from cyl */
|
||||
int wp[2]; /* write precompensation from cyl */
|
||||
int heads[2]; /* heads */
|
||||
int ecc[2]; /* ECC bytes */
|
||||
int m_drv; /* 0 master, 1 slave drive */
|
||||
int m_cylinders[2]; /* number of cylinders */
|
||||
int m_rwc[2]; /* reduced write current from cyl */
|
||||
int m_wp[2]; /* write precompensation from cyl */
|
||||
int m_heads[2]; /* heads */
|
||||
int m_ecc[2]; /* ECC bytes */
|
||||
|
||||
/* indexes */
|
||||
int cylinder[2]; /* current cylinder */
|
||||
int head[2]; /* current head */
|
||||
int sector[2]; /* current sector */
|
||||
int sector_cnt[2]; /* sector count */
|
||||
int control[2]; /* control */
|
||||
int m_cylinder[2]; /* current cylinder */
|
||||
int m_head[2]; /* current head */
|
||||
int m_sector[2]; /* current sector */
|
||||
int m_sector_cnt[2]; /* sector count */
|
||||
int m_control[2]; /* control */
|
||||
|
||||
emu_timer *timer;
|
||||
emu_timer *m_timer;
|
||||
|
||||
int data_cnt; /* data count */
|
||||
uint8_t hdc_control;
|
||||
int m_data_cnt; /* data count */
|
||||
uint8_t m_hdc_control;
|
||||
|
||||
uint8_t hdcdma_data[512];
|
||||
uint8_t *hdcdma_src;
|
||||
uint8_t *hdcdma_dst;
|
||||
int hdcdma_read;
|
||||
int hdcdma_write;
|
||||
int hdcdma_size;
|
||||
uint8_t m_hdcdma_data[512];
|
||||
uint8_t *m_hdcdma_src;
|
||||
uint8_t *m_hdcdma_dst;
|
||||
int m_hdcdma_read;
|
||||
int m_hdcdma_write;
|
||||
int m_hdcdma_size;
|
||||
};
|
||||
|
||||
class ec1841_device : public xt_hdc_device
|
||||
@ -166,7 +167,7 @@ public:
|
||||
virtual void dack_w(int line,uint8_t data) override;
|
||||
uint8_t pc_hdc_dipswitch_r();
|
||||
|
||||
int dip; /* dip switches */
|
||||
int m_dip; /* dip switches */
|
||||
};
|
||||
|
||||
|
||||
|
@ -217,7 +217,7 @@ void mc1502_fdc_device::device_start()
|
||||
m_isa->install_device(0x0048, 0x004b, read8sm_delegate(*m_fdc, FUNC(fd1793_device::read)), write8sm_delegate(*m_fdc, FUNC(fd1793_device::write)));
|
||||
m_isa->install_device(0x004c, 0x004f, read8sm_delegate(*this, FUNC(mc1502_fdc_device::mc1502_fdcv2_r)), write8sm_delegate(*this, FUNC(mc1502_fdc_device::mc1502_fdc_w)));
|
||||
|
||||
motor_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(mc1502_fdc_device::motor_callback),this));
|
||||
motor_timer = timer_alloc(FUNC(mc1502_fdc_device::motor_callback), this);
|
||||
motor_on = 0;
|
||||
m_control = 0;
|
||||
}
|
||||
|
@ -20,14 +20,13 @@
|
||||
#include "formats/naslite_dsk.h"
|
||||
#include "formats/apollo_dsk.h"
|
||||
|
||||
#define VERBOSE 0
|
||||
#define LOG_LEVEL0 (0x1U << 1)
|
||||
#define LOG_LEVEL1 (0x3U << 1)
|
||||
#define LOG_LEVEL2 (0x7U << 1)
|
||||
#define LOG_LEVEL3 (0xfU << 1)
|
||||
|
||||
static int verbose = VERBOSE;
|
||||
|
||||
#define LOG(x) { logerror ("%s: ", cpu_context()); logerror x; logerror ("\n"); }
|
||||
#define LOG1(x) { if (verbose > 0) LOG(x)}
|
||||
#define LOG2(x) { if (verbose > 1) LOG(x)}
|
||||
#define LOG3(x) { if (verbose > 2) LOG(x)}
|
||||
#define VERBOSE (LOG_LEVEL0)
|
||||
#include "logmacro.h"
|
||||
|
||||
#define OMTI_DISK_SECTOR_SIZE 1056
|
||||
|
||||
@ -105,7 +104,7 @@ public:
|
||||
|
||||
#define OMTI_STATUS_REQ 0x01 // Request (1 = request transfer of data via data in/out register)
|
||||
#define OMTI_STATUS_IO 0x02 // In/Out (1 = direction of transfer is from controller to host)
|
||||
#define OMTI_STATUS_CD 0x04 // Command/Data ( 1 = byte transferred is command or status byte)
|
||||
#define OMTI_STATUS_CD 0x04 // Command/Data (1 = byte transferred is command or status byte)
|
||||
#define OMTI_STATUS_BUSY 0x08 // Busy (0 = controller is idle, 1 = controller selected)
|
||||
#define OMTI_STATUS_DREQ 0x10 // Data Request (0 = no DMA request, 1 = DMA cycle requested)
|
||||
#define OMTI_STATUS_IREQ 0x20 // Interrupt Request (0 = no interrupt, 1 = command complete)
|
||||
@ -281,15 +280,15 @@ ioport_constructor omti8621_device::device_input_ports() const
|
||||
|
||||
void omti8621_device::device_start()
|
||||
{
|
||||
LOG2(("device_start"));
|
||||
LOGMASKED(LOG_LEVEL2, "device_start");
|
||||
|
||||
set_isa_device();
|
||||
|
||||
m_installed = false;
|
||||
|
||||
sector_buffer.resize(OMTI_DISK_SECTOR_SIZE*OMTI_MAX_BLOCK_COUNT);
|
||||
m_sector_buffer.resize(OMTI_DISK_SECTOR_SIZE*OMTI_MAX_BLOCK_COUNT);
|
||||
|
||||
m_timer = timer_alloc(0);
|
||||
m_timer = timer_alloc(FUNC(omti8621_device::trigger_interrupt), this);
|
||||
|
||||
our_disks[0] = subdevice<omti_disk_image_device>(OMTI_DISK0_TAG);
|
||||
our_disks[1] = subdevice<omti_disk_image_device>(OMTI_DISK1_TAG);
|
||||
@ -303,7 +302,7 @@ void omti8621_device::device_reset()
|
||||
{
|
||||
static const int io_bases[8] = { 0x320, 0x324, 0x328, 0x32c, 0x1a0, 0x1a4, 0x1a8, 0x1ac };
|
||||
|
||||
LOG2(("device_reset"));
|
||||
LOGMASKED(LOG_LEVEL2, "device_reset");
|
||||
|
||||
// you can't read I/O ports in device_start() even if they're required_ioport<> in your class!
|
||||
if (!m_installed)
|
||||
@ -331,38 +330,38 @@ void omti8621_device::device_reset()
|
||||
set_jumper(our_disks[0]->m_type);
|
||||
|
||||
// should go from reset to idle after 100 us
|
||||
// state->omti_state = OMTI_STATE_RESET;
|
||||
omti_state = OMTI_STATE_IDLE;
|
||||
// m_omti_state = OMTI_STATE_RESET;
|
||||
m_omti_state = OMTI_STATE_IDLE;
|
||||
|
||||
status_port = OMTI_STATUS_NU6 | OMTI_STATUS_NU7;
|
||||
config_port = ~jumper;
|
||||
mask_port = 0;
|
||||
m_status_port = OMTI_STATUS_NU6 | OMTI_STATUS_NU7;
|
||||
m_config_port = ~m_jumper;
|
||||
m_mask_port = 0;
|
||||
|
||||
// default the sector data buffer with model and status information
|
||||
// (i.e. set sector data buffer for cmd=0x0e READ SECTOR BUFFER)
|
||||
|
||||
memset(§or_buffer[0], 0, OMTI_DISK_SECTOR_SIZE);
|
||||
memcpy(§or_buffer[0], "8621VB.4060487xx", 0x10);
|
||||
sector_buffer[0x10] = 0; // ROM Checksum error
|
||||
sector_buffer[0x11] = 0; // Processor Register error
|
||||
sector_buffer[0x12] = 0; // Buffer RAM error
|
||||
sector_buffer[0x13] = 0; // Sequencer Register File error
|
||||
sector_buffer[0x14] = 0xc0; // 32K buffer size
|
||||
memset(&m_sector_buffer[0], 0, OMTI_DISK_SECTOR_SIZE);
|
||||
memcpy(&m_sector_buffer[0], "8621VB.4060487xx", 0x10);
|
||||
m_sector_buffer[0x10] = 0; // ROM Checksum error
|
||||
m_sector_buffer[0x11] = 0; // Processor Register error
|
||||
m_sector_buffer[0x12] = 0; // Buffer RAM error
|
||||
m_sector_buffer[0x13] = 0; // Sequencer Register File error
|
||||
m_sector_buffer[0x14] = 0xc0; // 32K buffer size
|
||||
// TODO: add missing Default values for LUN 0, 1 and 3
|
||||
|
||||
command_length = 0;
|
||||
command_index = 0;
|
||||
command_status = 0;
|
||||
m_command_length = 0;
|
||||
m_command_index = 0;
|
||||
m_command_status = 0;
|
||||
|
||||
data_index = 0;
|
||||
data_length = 0;
|
||||
m_data_index = 0;
|
||||
m_data_length = 0;
|
||||
|
||||
clear_sense_data();
|
||||
|
||||
diskaddr_ecc_error = 0;
|
||||
diskaddr_format_bad_track = 0;
|
||||
alternate_track_address[0] = 0;
|
||||
alternate_track_address[1] = 0;
|
||||
m_diskaddr_ecc_error = 0;
|
||||
m_diskaddr_format_bad_track = 0;
|
||||
m_alternate_track_address[0] = 0;
|
||||
m_alternate_track_address[1] = 0;
|
||||
|
||||
fd_moten_w(0);
|
||||
fd_rate_w(0);
|
||||
@ -395,8 +394,22 @@ omti8621_device::omti8621_device(
|
||||
, m_floppy(*this, OMTI_FDC_TAG":%u", 0U)
|
||||
, m_iobase(*this, "IO_BASE")
|
||||
, m_biosopts(*this, "BIOS_OPTS")
|
||||
, jumper(0), omti_state(0), status_port(0), config_port(0), mask_port(0), command_length(0), command_index(0), command_status(0), data_buffer(nullptr)
|
||||
, data_length(0), data_index(0), diskaddr_ecc_error(0), diskaddr_format_bad_track(0), m_timer(nullptr), m_moten(0), m_installed(false)
|
||||
, m_jumper(0)
|
||||
, m_omti_state(0)
|
||||
, m_status_port(0)
|
||||
, m_config_port(0)
|
||||
, m_mask_port(0)
|
||||
, m_command_length(0)
|
||||
, m_command_index(0)
|
||||
, m_command_status(0)
|
||||
, m_data_buffer(nullptr)
|
||||
, m_data_length(0)
|
||||
, m_data_index(0)
|
||||
, m_diskaddr_ecc_error(0)
|
||||
, m_diskaddr_format_bad_track(0)
|
||||
, m_timer(nullptr)
|
||||
, m_moten(0)
|
||||
, m_installed(false)
|
||||
{
|
||||
}
|
||||
|
||||
@ -404,13 +417,13 @@ omti8621_device::omti8621_device(
|
||||
set_interrupt - update the IRQ state
|
||||
-------------------------------------------------*/
|
||||
|
||||
void omti8621_device::set_interrupt(enum line_state line_state)
|
||||
void omti8621_device::set_interrupt(line_state state)
|
||||
{
|
||||
LOG2(("set_interrupt: status_port=%x, line_state %d", status_port, line_state));
|
||||
m_isa->irq14_w(line_state);
|
||||
LOGMASKED(LOG_LEVEL2, "%s: set_interrupt: status_port=%x, line_state %d", cpu_context(), m_status_port, state);
|
||||
m_isa->irq14_w(state);
|
||||
}
|
||||
|
||||
void omti8621_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(omti8621_device::trigger_interrupt)
|
||||
{
|
||||
set_interrupt(ASSERT_LINE);
|
||||
}
|
||||
@ -420,8 +433,8 @@ void omti8621_device::device_timer(emu_timer &timer, device_timer_id id, int par
|
||||
***************************************************************************/
|
||||
|
||||
void omti8621_device::clear_sense_data() {
|
||||
LOG2(("clear_sense_data"));
|
||||
memset(sense_data, 0, sizeof(sense_data));
|
||||
LOGMASKED(LOG_LEVEL2, "%s: clear_sense_data", cpu_context());
|
||||
std::fill_n(m_sense_data, std::size(m_sense_data), 0);
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -429,11 +442,11 @@ void omti8621_device::clear_sense_data() {
|
||||
***************************************************************************/
|
||||
|
||||
void omti8621_device::set_sense_data(uint8_t code, const uint8_t * cdb) {
|
||||
LOG2(("set_sense_data code=%x", code));
|
||||
sense_data[0]=code;
|
||||
sense_data[1]=cdb[1];
|
||||
sense_data[2]=cdb[2];
|
||||
sense_data[3]=cdb[3];
|
||||
LOGMASKED(LOG_LEVEL2, "%s: set_sense_data code=%x", cpu_context(), code);
|
||||
m_sense_data[0] = code;
|
||||
m_sense_data[1] = cdb[1];
|
||||
m_sense_data[2] = cdb[2];
|
||||
m_sense_data[3] = cdb[3];
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
@ -441,7 +454,7 @@ void omti8621_device::set_sense_data(uint8_t code, const uint8_t * cdb) {
|
||||
***************************************************************************/
|
||||
|
||||
void omti8621_device::set_configuration_data(uint8_t lun) {
|
||||
LOG2(("set_configuration_data lun=%x", lun));
|
||||
LOGMASKED(LOG_LEVEL2, "%s: set_configuration_data lun=%x", cpu_context(), lun);
|
||||
|
||||
// initialize the configuration data
|
||||
omti_disk_image_device *disk = our_disks[lun];
|
||||
@ -485,7 +498,7 @@ uint8_t omti8621_device::check_disk_address(const uint8_t *cdb)
|
||||
uint32_t disk_addr = (disk_track * disk->m_sectors) + sector;
|
||||
|
||||
if (block_count > OMTI_MAX_BLOCK_COUNT) {
|
||||
LOG(("########### check_disk_address: unexpected block count %x", block_count));
|
||||
LOGMASKED(LOG_LEVEL0, "%s: ########### check_disk_address: unexpected block count %x", cpu_context(), block_count);
|
||||
sense_code = OMTI_SENSE_CODE_ILLEGAL_ADDRESS | OMTI_SENSE_CODE_ADDRESS_VALID;
|
||||
}
|
||||
|
||||
@ -499,18 +512,18 @@ uint8_t omti8621_device::check_disk_address(const uint8_t *cdb)
|
||||
sense_code = OMTI_SENSE_CODE_ILLEGAL_ADDRESS | OMTI_SENSE_CODE_ADDRESS_VALID;
|
||||
} else if (cylinder >= disk->m_cylinders) {
|
||||
sense_code = OMTI_SENSE_CODE_ILLEGAL_ADDRESS | OMTI_SENSE_CODE_ADDRESS_VALID;
|
||||
} else if ( disk_track == diskaddr_format_bad_track && disk_track != 0) {
|
||||
} else if (disk_track == m_diskaddr_format_bad_track && disk_track != 0) {
|
||||
sense_code = OMTI_SENSE_CODE_BAD_TRACK;
|
||||
} else if (disk_addr == diskaddr_ecc_error && disk_addr != 0) {
|
||||
} else if (disk_addr == m_diskaddr_ecc_error && disk_addr != 0) {
|
||||
sense_code = OMTI_SENSE_CODE_ECC_ERROR;
|
||||
} else if (disk_track == alternate_track_address[1] && disk_track != 0) {
|
||||
} else if (disk_track == m_alternate_track_address[1] && disk_track != 0) {
|
||||
sense_code = OMTI_SENSE_CODE_ALTERNATE_TRACK;
|
||||
}
|
||||
|
||||
if (sense_code == OMTI_SENSE_CODE_NO_ERROR) {
|
||||
clear_sense_data();
|
||||
} else {
|
||||
command_status |= OMTI_COMMAND_STATUS_ERROR;
|
||||
m_command_status |= OMTI_COMMAND_STATUS_ERROR;
|
||||
set_sense_data(sense_code, cdb);
|
||||
}
|
||||
return sense_code == OMTI_SENSE_CODE_NO_ERROR;
|
||||
@ -544,29 +557,29 @@ uint32_t omti8621_device::get_disk_address(const uint8_t * cdb) {
|
||||
void omti8621_device::set_data_transfer(uint8_t *data, uint16_t length)
|
||||
{
|
||||
// set controller for read data transfer
|
||||
omti_state = OMTI_STATE_DATA;
|
||||
status_port |= OMTI_STATUS_REQ | OMTI_STATUS_IO | OMTI_STATUS_BUSY;
|
||||
status_port &= ~OMTI_STATUS_CD;
|
||||
m_omti_state = OMTI_STATE_DATA;
|
||||
m_status_port |= OMTI_STATUS_REQ | OMTI_STATUS_IO | OMTI_STATUS_BUSY;
|
||||
m_status_port &= ~OMTI_STATUS_CD;
|
||||
|
||||
data_buffer = data;
|
||||
data_length = length;
|
||||
data_index = 0;
|
||||
m_data_buffer = data;
|
||||
m_data_length = length;
|
||||
m_data_index = 0;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
read_sectors_from_disk - read sectors starting at diskaddr into sector_buffer
|
||||
read_sectors_from_disk - read sectors starting at diskaddr into m_sector_buffer
|
||||
***************************************************************************/
|
||||
|
||||
void omti8621_device::read_sectors_from_disk(int32_t diskaddr, uint8_t count, uint8_t lun)
|
||||
{
|
||||
uint8_t *data_buffer = §or_buffer[0];
|
||||
uint8_t *data_buffer = &m_sector_buffer[0];
|
||||
device_image_interface *image = our_disks[lun]->m_image;
|
||||
|
||||
while (count-- > 0) {
|
||||
LOG2(("read_sectors_from_disk lun=%d diskaddr=%x", lun, diskaddr));
|
||||
LOGMASKED(LOG_LEVEL2, "%s: read_sectors_from_disk lun=%d diskaddr=%x", cpu_context(), lun, diskaddr);
|
||||
|
||||
image->fseek( diskaddr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
|
||||
image->fread( data_buffer, OMTI_DISK_SECTOR_SIZE);
|
||||
image->fseek(diskaddr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
|
||||
image->fread(data_buffer, OMTI_DISK_SECTOR_SIZE);
|
||||
|
||||
diskaddr++;
|
||||
data_buffer += OMTI_DISK_SECTOR_SIZE;
|
||||
@ -574,23 +587,23 @@ void omti8621_device::read_sectors_from_disk(int32_t diskaddr, uint8_t count, ui
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
write_sectors_to_disk - write sectors starting at diskaddr from sector_buffer
|
||||
write_sectors_to_disk - write sectors starting at diskaddr from m_sector_buffer
|
||||
***************************************************************************/
|
||||
|
||||
void omti8621_device::write_sectors_to_disk(int32_t diskaddr, uint8_t count, uint8_t lun)
|
||||
{
|
||||
uint8_t *data_buffer = §or_buffer[0];
|
||||
uint8_t *data_buffer = &m_sector_buffer[0];
|
||||
device_image_interface *image = our_disks[lun]->m_image;
|
||||
|
||||
while (count-- > 0) {
|
||||
LOG2(("write_sectors_to_disk lun=%d diskaddr=%x", lun, diskaddr));
|
||||
LOGMASKED(LOG_LEVEL2, "%s: write_sectors_to_disk lun=%d diskaddr=%x", cpu_context(), lun, diskaddr);
|
||||
|
||||
image->fseek( diskaddr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
|
||||
image->fwrite( data_buffer, OMTI_DISK_SECTOR_SIZE);
|
||||
image->fseek(diskaddr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
|
||||
image->fwrite(data_buffer, OMTI_DISK_SECTOR_SIZE);
|
||||
|
||||
if (diskaddr == diskaddr_ecc_error) {
|
||||
if (diskaddr == m_diskaddr_ecc_error) {
|
||||
// reset previous ECC error
|
||||
diskaddr_ecc_error = 0;
|
||||
m_diskaddr_ecc_error = 0;
|
||||
}
|
||||
|
||||
diskaddr++;
|
||||
@ -606,18 +619,18 @@ void omti8621_device::copy_sectors(int32_t dst_addr, int32_t src_addr, uint8_t c
|
||||
{
|
||||
device_image_interface *image = our_disks[lun]->m_image;
|
||||
|
||||
LOG2(("copy_sectors lun=%d src_addr=%x dst_addr=%x count=%x", lun, src_addr, dst_addr, count));
|
||||
LOGMASKED(LOG_LEVEL2, "%s: copy_sectors lun=%d src_addr=%x dst_addr=%x count=%x", cpu_context(), lun, src_addr, dst_addr, count);
|
||||
|
||||
while (count-- > 0) {
|
||||
image->fseek( src_addr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
|
||||
image->fread( §or_buffer[0], OMTI_DISK_SECTOR_SIZE);
|
||||
image->fseek(src_addr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
|
||||
image->fread(&m_sector_buffer[0], OMTI_DISK_SECTOR_SIZE);
|
||||
|
||||
image->fseek( dst_addr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
|
||||
image->fwrite( §or_buffer[0], OMTI_DISK_SECTOR_SIZE);
|
||||
image->fseek(dst_addr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
|
||||
image->fwrite(&m_sector_buffer[0], OMTI_DISK_SECTOR_SIZE);
|
||||
|
||||
if (dst_addr == diskaddr_ecc_error) {
|
||||
if (dst_addr == m_diskaddr_ecc_error) {
|
||||
// reset previous ECC error
|
||||
diskaddr_ecc_error = 0;
|
||||
m_diskaddr_ecc_error = 0;
|
||||
}
|
||||
|
||||
src_addr++;
|
||||
@ -635,29 +648,29 @@ void omti8621_device::format_track(const uint8_t * cdb)
|
||||
uint32_t disk_addr = get_disk_address(cdb);
|
||||
uint32_t disk_track = get_disk_track(cdb);
|
||||
|
||||
if (diskaddr_ecc_error == disk_addr) {
|
||||
if (m_diskaddr_ecc_error == disk_addr) {
|
||||
// reset previous ECC error
|
||||
diskaddr_ecc_error = 0;
|
||||
m_diskaddr_ecc_error = 0;
|
||||
}
|
||||
|
||||
if (diskaddr_format_bad_track == disk_track) {
|
||||
if (m_diskaddr_format_bad_track == disk_track) {
|
||||
// reset previous bad track formatting
|
||||
diskaddr_format_bad_track = 0;
|
||||
m_diskaddr_format_bad_track = 0;
|
||||
}
|
||||
|
||||
if (alternate_track_address[0] == disk_track) {
|
||||
if (m_alternate_track_address[0] == disk_track) {
|
||||
// reset source of alternate track address
|
||||
alternate_track_address[0] = 0;
|
||||
m_alternate_track_address[0] = 0;
|
||||
}
|
||||
|
||||
if (alternate_track_address[1] == disk_track) {
|
||||
if (m_alternate_track_address[1] == disk_track) {
|
||||
// reset alternate track address
|
||||
alternate_track_address[1] = 0;
|
||||
m_alternate_track_address[1] = 0;
|
||||
}
|
||||
|
||||
if (check_disk_address(cdb) ) {
|
||||
if ((cdb[5] & 0x40) == 0) {
|
||||
memset(§or_buffer[0], 0x6C, OMTI_DISK_SECTOR_SIZE * our_disks[lun]->m_sectors);
|
||||
memset(&m_sector_buffer[0], 0x6C, OMTI_DISK_SECTOR_SIZE * our_disks[lun]->m_sectors);
|
||||
}
|
||||
write_sectors_to_disk(disk_addr, our_disks[lun]->m_sectors, lun);
|
||||
}
|
||||
@ -696,8 +709,7 @@ void omti8621_device::logerror(Format &&fmt, Params &&... args) const
|
||||
|
||||
void omti8621_device::log_command(const uint8_t cdb[], const uint16_t cdb_length)
|
||||
{
|
||||
if (verbose > 0) {
|
||||
int i;
|
||||
if (VERBOSE & (LOG_LEVEL1 | LOG_LEVEL2 | LOG_LEVEL3)) {
|
||||
logerror("%s: OMTI command ", cpu_context());
|
||||
switch (cdb[0]) {
|
||||
case OMTI_CMD_TEST_DRIVE_READY: // 0x00
|
||||
@ -770,7 +782,7 @@ void omti8621_device::log_command(const uint8_t cdb[], const uint16_t cdb_length
|
||||
logerror("!!! Unexpected Command !!!");
|
||||
}
|
||||
// logerror(" (%02x, length=%02x)", cdb[0], cdb_length);
|
||||
for (i = 0; i < cdb_length; i++) {
|
||||
for (int i = 0; i < cdb_length; i++) {
|
||||
logerror(" %02x", cdb[i]);
|
||||
}
|
||||
|
||||
@ -795,15 +807,14 @@ void omti8621_device::log_command(const uint8_t cdb[], const uint16_t cdb_length
|
||||
|
||||
void omti8621_device::log_data()
|
||||
{
|
||||
if (verbose > 0) {
|
||||
int i;
|
||||
logerror("%s: OMTI data (length=%02x)", cpu_context(),
|
||||
data_length);
|
||||
for (i = 0; i < data_length && i < OMTI_DISK_SECTOR_SIZE; i++) {
|
||||
logerror(" %02x", data_buffer[i]);
|
||||
if (VERBOSE & LOG_LEVEL1) {
|
||||
logerror("%s: OMTI data (length=%02x)", cpu_context(), m_data_length);
|
||||
uint16_t i;
|
||||
for (i = 0; i < m_data_length && i < OMTI_DISK_SECTOR_SIZE; i++) {
|
||||
logerror(" %02x", m_data_buffer[i]);
|
||||
}
|
||||
|
||||
if (i < data_length) {
|
||||
if (i < m_data_length) {
|
||||
logerror(" ...");
|
||||
}
|
||||
logerror("\n");
|
||||
@ -820,19 +831,19 @@ void omti8621_device::do_command(const uint8_t cdb[], const uint16_t cdb_length)
|
||||
omti_disk_image_device *disk = our_disks[lun];
|
||||
int command_duration = 0; // ms
|
||||
|
||||
log_command( cdb, cdb_length);
|
||||
log_command(cdb, cdb_length);
|
||||
|
||||
// default to read status and status is successful completion
|
||||
omti_state = OMTI_STATE_STATUS;
|
||||
status_port |= OMTI_STATUS_IO | OMTI_STATUS_CD;
|
||||
command_status = lun ? OMTI_COMMAND_STATUS_LUN : 0;
|
||||
m_omti_state = OMTI_STATE_STATUS;
|
||||
m_status_port |= OMTI_STATUS_IO | OMTI_STATUS_CD;
|
||||
m_command_status = lun ? OMTI_COMMAND_STATUS_LUN : 0;
|
||||
|
||||
if (mask_port & OMTI_MASK_INTE) {
|
||||
if (m_mask_port & OMTI_MASK_INTE) {
|
||||
set_interrupt(CLEAR_LINE);
|
||||
}
|
||||
|
||||
if (!disk->m_image->exists()) {
|
||||
command_status |= OMTI_COMMAND_STATUS_ERROR; // no such drive
|
||||
m_command_status |= OMTI_COMMAND_STATUS_ERROR; // no such drive
|
||||
}
|
||||
|
||||
switch (cdb[0]) {
|
||||
@ -847,7 +858,7 @@ void omti8621_device::do_command(const uint8_t cdb[], const uint16_t cdb_length)
|
||||
break;
|
||||
|
||||
case OMTI_CMD_REQUEST_SENSE: // 0x03
|
||||
set_data_transfer(sense_data, sizeof(sense_data));
|
||||
set_data_transfer(m_sense_data, sizeof(m_sense_data));
|
||||
break;
|
||||
|
||||
case OMTI_CMD_READ_VERIFY: // 0x05
|
||||
@ -859,14 +870,14 @@ void omti8621_device::do_command(const uint8_t cdb[], const uint16_t cdb_length)
|
||||
break;
|
||||
|
||||
case OMTI_CMD_FORMAT_BAD_TRACK: // 0x07
|
||||
diskaddr_format_bad_track = get_disk_address(cdb);
|
||||
m_diskaddr_format_bad_track = get_disk_address(cdb);
|
||||
break;
|
||||
|
||||
case OMTI_CMD_READ: // 0x08
|
||||
if (check_disk_address(cdb)) {
|
||||
// read data from controller
|
||||
read_sectors_from_disk(get_disk_address(cdb), cdb[4], lun);
|
||||
set_data_transfer(§or_buffer[0], OMTI_DISK_SECTOR_SIZE*cdb[4]);
|
||||
set_data_transfer(&m_sector_buffer[0], OMTI_DISK_SECTOR_SIZE*cdb[4]);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -882,7 +893,7 @@ void omti8621_device::do_command(const uint8_t cdb[], const uint16_t cdb_length)
|
||||
break;
|
||||
|
||||
case OMTI_CMD_READ_SECTOR_BUFFER: // 0x0E
|
||||
set_data_transfer(§or_buffer[0], OMTI_DISK_SECTOR_SIZE*cdb[4]);
|
||||
set_data_transfer(&m_sector_buffer[0], OMTI_DISK_SECTOR_SIZE*cdb[4]);
|
||||
break;
|
||||
|
||||
case OMTI_CMD_WRITE_SECTOR_BUFFER: // 0x0F
|
||||
@ -904,8 +915,8 @@ void omti8621_device::do_command(const uint8_t cdb[], const uint16_t cdb_length)
|
||||
#if 0 // this command seems unused by Domain/OS, and it's unclear what the intent of the code is (it makes some versions of GCC quite unhappy)
|
||||
case OMTI_CMD_ASSIGN_ALTERNATE_TRACK: // 0x11
|
||||
log_data();
|
||||
alternate_track_address[0] = get_disk_track(cdb);
|
||||
alternate_track_address[1] = get_disk_track(alternate_track_buffer-1);
|
||||
m_alternate_track_address[0] = get_disk_track(cdb);
|
||||
m_alternate_track_address[1] = get_disk_track(m_alternate_track_buffer - 1);
|
||||
break;
|
||||
#endif
|
||||
|
||||
@ -935,7 +946,7 @@ void omti8621_device::do_command(const uint8_t cdb[], const uint16_t cdb_length)
|
||||
if (check_disk_address(cdb)) {
|
||||
// read data from controller
|
||||
read_sectors_from_disk(get_disk_address(cdb), cdb[4], lun);
|
||||
set_data_transfer(§or_buffer[0], OMTI_DISK_SECTOR_SIZE+6);
|
||||
set_data_transfer(&m_sector_buffer[0], OMTI_DISK_SECTOR_SIZE+6);
|
||||
}
|
||||
break;
|
||||
|
||||
@ -945,7 +956,7 @@ void omti8621_device::do_command(const uint8_t cdb[], const uint16_t cdb_length)
|
||||
uint32_t diskaddr = get_disk_address(cdb);
|
||||
write_sectors_to_disk(diskaddr, cdb[4], lun);
|
||||
// this will spoil the ECC code
|
||||
diskaddr_ecc_error = diskaddr;
|
||||
m_diskaddr_ecc_error = diskaddr;
|
||||
}
|
||||
break;
|
||||
|
||||
@ -956,28 +967,28 @@ void omti8621_device::do_command(const uint8_t cdb[], const uint16_t cdb_length)
|
||||
|
||||
case OMTI_CMD_INVALID_COMMAND: // 0xFF
|
||||
set_sense_data(OMTI_SENSE_CODE_INVALID_COMMAND, cdb);
|
||||
command_status |= OMTI_COMMAND_STATUS_ERROR;
|
||||
m_command_status |= OMTI_COMMAND_STATUS_ERROR;
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG(("do_command: UNEXPECTED command %02x",cdb[0]));
|
||||
LOGMASKED(LOG_LEVEL0, "%s: do_command: UNEXPECTED command %02x", cpu_context(), cdb[0]);
|
||||
set_sense_data(OMTI_SENSE_CODE_INVALID_COMMAND, cdb);
|
||||
command_status |= OMTI_COMMAND_STATUS_ERROR;
|
||||
m_command_status |= OMTI_COMMAND_STATUS_ERROR;
|
||||
break;
|
||||
}
|
||||
|
||||
if (mask_port & OMTI_MASK_INTE) {
|
||||
// if (omti_state != OMTI_STATE_STATUS) {
|
||||
// LOG(("do_command: UNEXPECTED omti_state %02x",omti_state));
|
||||
if (m_mask_port & OMTI_MASK_INTE) {
|
||||
// if (m_omti_state != OMTI_STATE_STATUS) {
|
||||
// LOGMASKED(LOG_LEVEL0, "%s: do_command: UNEXPECTED omti_state %02x", cpu_context(), m_omti_state));
|
||||
// }
|
||||
status_port |= OMTI_STATUS_IREQ;
|
||||
m_status_port |= OMTI_STATUS_IREQ;
|
||||
if (command_duration == 0)
|
||||
{
|
||||
set_interrupt(ASSERT_LINE);
|
||||
}
|
||||
else
|
||||
{
|
||||
// FIXME: should delay omti_state and status_port as well
|
||||
// FIXME: should delay m_omti_state and m_status_port as well
|
||||
m_timer->adjust(attotime::from_msec(command_duration), 0);
|
||||
}
|
||||
}
|
||||
@ -999,16 +1010,16 @@ uint8_t omti8621_device::get_command_length(uint8_t command_byte)
|
||||
uint16_t omti8621_device::get_data()
|
||||
{
|
||||
uint16_t data = 0xff;
|
||||
if (data_index < data_length) {
|
||||
data = data_buffer[data_index++];
|
||||
data |= data_buffer[data_index++] << 8;
|
||||
if (data_index >= data_length) {
|
||||
omti_state = OMTI_STATE_STATUS;
|
||||
status_port |= OMTI_STATUS_IO | OMTI_STATUS_CD;
|
||||
if (m_data_index < m_data_length) {
|
||||
data = m_data_buffer[m_data_index++];
|
||||
data |= m_data_buffer[m_data_index++] << 8;
|
||||
if (m_data_index >= m_data_length) {
|
||||
m_omti_state = OMTI_STATE_STATUS;
|
||||
m_status_port |= OMTI_STATUS_IO | OMTI_STATUS_CD;
|
||||
log_data();
|
||||
}
|
||||
} else {
|
||||
LOG(("UNEXPECTED reading OMTI 8621 data (buffer length exceeded)"));
|
||||
LOGMASKED(LOG_LEVEL0, "%s: UNEXPECTED reading OMTI 8621 data (buffer length exceeded)", cpu_context());
|
||||
}
|
||||
return data;
|
||||
}
|
||||
@ -1019,14 +1030,14 @@ uint16_t omti8621_device::get_data()
|
||||
|
||||
void omti8621_device::set_data(uint16_t data)
|
||||
{
|
||||
if (data_index < data_length) {
|
||||
data_buffer[data_index++] = data & 0xff;
|
||||
data_buffer[data_index++] = data >> 8;
|
||||
if (data_index >= data_length) {
|
||||
do_command(command_buffer, command_index);
|
||||
if (m_data_index < m_data_length) {
|
||||
m_data_buffer[m_data_index++] = data & 0xff;
|
||||
m_data_buffer[m_data_index++] = data >> 8;
|
||||
if (m_data_index >= m_data_length) {
|
||||
do_command(m_command_buffer, m_command_index);
|
||||
}
|
||||
} else {
|
||||
LOG(("UNEXPECTED writing OMTI 8621 data (buffer length exceeded)"));
|
||||
LOGMASKED(LOG_LEVEL0, "%s: UNEXPECTED writing OMTI 8621 data (buffer length exceeded)", cpu_context());
|
||||
}
|
||||
}
|
||||
|
||||
@ -1057,91 +1068,89 @@ void omti8621_device::write8(offs_t offset, uint8_t data)
|
||||
switch (offset)
|
||||
{
|
||||
case OMTI_PORT_DATA_OUT: // 0x00
|
||||
switch (omti_state) {
|
||||
switch (m_omti_state) {
|
||||
case OMTI_STATE_COMMAND:
|
||||
LOG2(("writing OMTI 8621 Command Register at offset %02x = %02x", offset, data));
|
||||
if (command_index == 0) {
|
||||
command_length = get_command_length(data);
|
||||
LOGMASKED(LOG_LEVEL2, "%s: writing OMTI 8621 Command Register at offset %02x = %02x", cpu_context(), offset, data);
|
||||
if (m_command_index == 0) {
|
||||
m_command_length = get_command_length(data);
|
||||
}
|
||||
|
||||
if (command_index < command_length) {
|
||||
command_buffer[command_index++] = data;
|
||||
if (m_command_index < m_command_length) {
|
||||
m_command_buffer[m_command_index++] = data;
|
||||
} else {
|
||||
LOG(("UNEXPECTED writing OMTI 8621 Data Register at offset %02x = %02x (command length exceeded)", offset, data));
|
||||
LOGMASKED(LOG_LEVEL0, "%s: UNEXPECTED writing OMTI 8621 Data Register at offset %02x = %02x (command length exceeded)", cpu_context(), offset, data);
|
||||
}
|
||||
|
||||
if (command_index == command_length) {
|
||||
switch (command_buffer[0]) {
|
||||
if (m_command_index == m_command_length) {
|
||||
switch (m_command_buffer[0]) {
|
||||
case OMTI_CMD_WRITE: // 0x0A
|
||||
// TODO: check diskaddr
|
||||
// Fall through
|
||||
[[fallthrough]];
|
||||
case OMTI_CMD_WRITE_SECTOR_BUFFER: // 0x0F
|
||||
set_data_transfer(§or_buffer[0],
|
||||
OMTI_DISK_SECTOR_SIZE * command_buffer[4]);
|
||||
status_port &= ~OMTI_STATUS_IO;
|
||||
set_data_transfer(&m_sector_buffer[0], OMTI_DISK_SECTOR_SIZE * m_command_buffer[4]);
|
||||
m_status_port &= ~OMTI_STATUS_IO;
|
||||
break;
|
||||
|
||||
case OMTI_CMD_ASSIGN_ALTERNATE_TRACK: // 0x11
|
||||
set_data_transfer(alternate_track_buffer, sizeof(alternate_track_buffer));
|
||||
status_port &= ~OMTI_STATUS_IO;
|
||||
set_data_transfer(m_alternate_track_buffer, sizeof(m_alternate_track_buffer));
|
||||
m_status_port &= ~OMTI_STATUS_IO;
|
||||
break;
|
||||
|
||||
case OMTI_CMD_WRITE_LONG: // 0xE6
|
||||
// TODO: check diskaddr
|
||||
set_data_transfer(§or_buffer[0],
|
||||
(OMTI_DISK_SECTOR_SIZE +6) * command_buffer[4]);
|
||||
status_port &= ~OMTI_STATUS_IO;
|
||||
set_data_transfer(&m_sector_buffer[0], (OMTI_DISK_SECTOR_SIZE +6) * m_command_buffer[4]);
|
||||
m_status_port &= ~OMTI_STATUS_IO;
|
||||
break;
|
||||
|
||||
default:
|
||||
do_command(command_buffer, command_index);
|
||||
do_command(m_command_buffer, m_command_index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case OMTI_STATE_DATA:
|
||||
LOG(("UNEXPECTED: writing OMTI 8621 Data Register at offset %02x = %02x", offset, data));
|
||||
LOGMASKED(LOG_LEVEL0, "%s: UNEXPECTED: writing OMTI 8621 Data Register at offset %02x = %02x", cpu_context(), offset, data);
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG(("UNEXPECTED writing OMTI 8621 Data Register at offset %02x = %02x (omti state = %02x)", offset, data, omti_state));
|
||||
LOGMASKED(LOG_LEVEL0, "%s: UNEXPECTED writing OMTI 8621 Data Register at offset %02x = %02x (omti state = %02x)", cpu_context(), offset, data, m_omti_state);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case OMTI_PORT_RESET: // 0x01
|
||||
LOG2(("writing OMTI 8621 Reset Register at offset %02x = %02x", offset, data));
|
||||
LOGMASKED(LOG_LEVEL2, "%s: writing OMTI 8621 Reset Register at offset %02x = %02x", cpu_context(), offset, data);
|
||||
device_reset();
|
||||
break;
|
||||
|
||||
case OMTI_PORT_SELECT: // 0x02
|
||||
LOG2(("writing OMTI 8621 Select Register at offset %02x = %02x (omti state = %02x)", offset, data, omti_state));
|
||||
omti_state = OMTI_STATE_COMMAND;
|
||||
LOGMASKED(LOG_LEVEL2, "%s: writing OMTI 8621 Select Register at offset %02x = %02x (omti state = %02x)", cpu_context(), offset, data, m_omti_state);
|
||||
m_omti_state = OMTI_STATE_COMMAND;
|
||||
|
||||
status_port |= OMTI_STATUS_BUSY | OMTI_STATUS_REQ | OMTI_STATUS_CD;
|
||||
status_port &= ~OMTI_STATUS_IO;
|
||||
m_status_port |= OMTI_STATUS_BUSY | OMTI_STATUS_REQ | OMTI_STATUS_CD;
|
||||
m_status_port &= ~OMTI_STATUS_IO;
|
||||
|
||||
command_status = 0;
|
||||
command_index = 0;
|
||||
m_command_status = 0;
|
||||
m_command_index = 0;
|
||||
break;
|
||||
|
||||
case OMTI_PORT_MASK: // 0x03
|
||||
LOG2(("writing OMTI 8621 Mask Register at offset %02x = %02x", offset, data));
|
||||
mask_port = data;
|
||||
LOGMASKED(LOG_LEVEL2, "%s: writing OMTI 8621 Mask Register at offset %02x = %02x", cpu_context(), offset, data);
|
||||
m_mask_port = data;
|
||||
|
||||
if ((data & OMTI_MASK_INTE) == 0) {
|
||||
status_port &= ~OMTI_STATUS_IREQ;
|
||||
m_status_port &= ~OMTI_STATUS_IREQ;
|
||||
set_interrupt(CLEAR_LINE);
|
||||
}
|
||||
|
||||
if ((data & OMTI_MASK_DMAE) == 0) {
|
||||
status_port &= ~OMTI_STATUS_DREQ;
|
||||
m_status_port &= ~OMTI_STATUS_DREQ;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG(("UNEXPECTED writing OMTI 8621 Register at offset %02x = %02x", offset, data));
|
||||
LOGMASKED(LOG_LEVEL0, "%s: UNEXPECTED writing OMTI 8621 Register at offset %02x = %02x", cpu_context(), offset, data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -1166,69 +1175,64 @@ uint8_t omti8621_device::read8(offs_t offset)
|
||||
|
||||
switch (offset) {
|
||||
case OMTI_PORT_DATA_IN: // 0x00
|
||||
if (status_port & OMTI_STATUS_CD)
|
||||
if (m_status_port & OMTI_STATUS_CD)
|
||||
{
|
||||
data = command_status;
|
||||
switch (omti_state)
|
||||
data = m_command_status;
|
||||
switch (m_omti_state)
|
||||
{
|
||||
case OMTI_STATE_COMMAND:
|
||||
LOG2(("reading OMTI 8621 Data Status Register 1 at offset %02x = %02x (omti state = %02x)", offset, data, omti_state));
|
||||
LOGMASKED(LOG_LEVEL2, "%s: reading OMTI 8621 Data Status Register 1 at offset %02x = %02x (omti state = %02x)", cpu_context(), offset, data, m_omti_state);
|
||||
break;
|
||||
case OMTI_STATE_STATUS:
|
||||
omti_state = OMTI_STATE_IDLE;
|
||||
status_port &= ~(OMTI_STATUS_BUSY | OMTI_STATUS_CD | OMTI_STATUS_IO | OMTI_STATUS_REQ);
|
||||
LOG2(("reading OMTI 8621 Data Status Register 2 at offset %02x = %02x", offset, data));
|
||||
m_omti_state = OMTI_STATE_IDLE;
|
||||
m_status_port &= ~(OMTI_STATUS_BUSY | OMTI_STATUS_CD | OMTI_STATUS_IO | OMTI_STATUS_REQ);
|
||||
LOGMASKED(LOG_LEVEL2, "%s: reading OMTI 8621 Data Status Register 2 at offset %02x = %02x", cpu_context(), offset, data);
|
||||
break;
|
||||
default:
|
||||
LOG(("UNEXPECTED reading OMTI 8621 Data Status Register 3 at offset %02x = %02x (omti state = %02x)", offset, data, omti_state));
|
||||
LOGMASKED(LOG_LEVEL0, "%s: UNEXPECTED reading OMTI 8621 Data Status Register 3 at offset %02x = %02x (omti state = %02x)", cpu_context(), offset, data, m_omti_state);
|
||||
break;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
LOG(("UNEXPECTED reading OMTI 8621 Data Register 4 at offset %02x = %02x (status bit C/D = 0)", offset, data));
|
||||
LOGMASKED(LOG_LEVEL0, "%s: UNEXPECTED reading OMTI 8621 Data Register 4 at offset %02x = %02x (status bit C/D = 0)", cpu_context(), offset, data);
|
||||
}
|
||||
break;
|
||||
|
||||
case OMTI_PORT_STATUS: // 0x01
|
||||
data = status_port;
|
||||
data = m_status_port;
|
||||
// omit excessive logging
|
||||
if (data != last_data)
|
||||
{
|
||||
LOG2(("reading OMTI 8621 Status Register 5 at offset %02x = %02x", offset, data));
|
||||
LOGMASKED(LOG_LEVEL2, "%s: reading OMTI 8621 Status Register 5 at offset %02x = %02x", cpu_context(), offset, data);
|
||||
// last_data = data;
|
||||
}
|
||||
break;
|
||||
|
||||
case OMTI_PORT_CONFIG: // 0x02
|
||||
data = config_port;
|
||||
LOG2(("reading OMTI 8621 Configuration Register at offset %02x = %02x", offset, data));
|
||||
data = m_config_port;
|
||||
LOGMASKED(LOG_LEVEL2, "%s: reading OMTI 8621 Configuration Register at offset %02x = %02x", cpu_context(), offset, data);
|
||||
break;
|
||||
|
||||
case OMTI_PORT_MASK: // 0x03
|
||||
data = mask_port ;
|
||||
data = m_mask_port;
|
||||
// win.dex will update the mask register with read-modify-write
|
||||
// LOG2(("reading OMTI 8621 Mask Register at offset %02x = %02x (UNEXPECTED!)", offset, data));
|
||||
// LOGMASKED(LOG_LEVEL2, "%s: reading OMTI 8621 Mask Register at offset %02x = %02x (UNEXPECTED!)", cpu_context(), offset, data);
|
||||
break;
|
||||
|
||||
default:
|
||||
LOG(("UNEXPECTED reading OMTI 8621 Register at offset %02x = %02x", offset, data));
|
||||
LOGMASKED(LOG_LEVEL0, "%s: UNEXPECTED reading OMTI 8621 Register at offset %02x = %02x", cpu_context(), offset, data);
|
||||
break;
|
||||
}
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
void omti8621_device::set_verbose(int on_off)
|
||||
{
|
||||
verbose = on_off == 0 ? 0 : VERBOSE > 1 ? VERBOSE : 1;
|
||||
}
|
||||
|
||||
/***************************************************************************
|
||||
get_sector - get sector diskaddr of logical unit lun into data_buffer
|
||||
***************************************************************************/
|
||||
|
||||
uint32_t omti8621_apollo_device::get_sector(int32_t diskaddr, uint8_t *data_buffer, uint32_t length, uint8_t lun)
|
||||
uint32_t omti8621_apollo_device::get_sector(int32_t diskaddr, uint8_t *buffer, uint32_t length, uint8_t lun)
|
||||
{
|
||||
omti_disk_image_device *disk = our_disks[lun];
|
||||
|
||||
@ -1238,13 +1242,13 @@ uint32_t omti8621_apollo_device::get_sector(int32_t diskaddr, uint8_t *data_buff
|
||||
}
|
||||
else
|
||||
{
|
||||
// LOG1(("omti8621_get_sector %x on lun %d", diskaddr, lun));
|
||||
// LOGMASKED(LOG_LEVEL1, "%s: omti8621_get_sector %x on lun %d", cpu_context(), diskaddr, lun);
|
||||
|
||||
// restrict length to size of 1 sector (i.e. 1024 Byte)
|
||||
length = length < OMTI_DISK_SECTOR_SIZE ? length : OMTI_DISK_SECTOR_SIZE;
|
||||
|
||||
disk->m_image->fseek(diskaddr * OMTI_DISK_SECTOR_SIZE, SEEK_SET);
|
||||
disk->m_image->fread(data_buffer, length);
|
||||
disk->m_image->fread(buffer, length);
|
||||
|
||||
return length;
|
||||
}
|
||||
@ -1256,17 +1260,17 @@ uint32_t omti8621_apollo_device::get_sector(int32_t diskaddr, uint8_t *data_buff
|
||||
|
||||
void omti8621_device::set_jumper(uint16_t disk_type)
|
||||
{
|
||||
LOG1(("set_jumper: disk type=%x", disk_type));
|
||||
LOGMASKED(LOG_LEVEL1, "%s: set_jumper: disk type=%x", cpu_context(), disk_type);
|
||||
|
||||
switch (disk_type)
|
||||
{
|
||||
case OMTI_DISK_TYPE_348_MB: // Maxtor 380 MB (348-MB FA formatted)
|
||||
jumper = OMTI_CONFIG_W22 | OMTI_CONFIG_W23;
|
||||
m_jumper = OMTI_CONFIG_W22 | OMTI_CONFIG_W23;
|
||||
break;
|
||||
|
||||
case OMTI_DISK_TYPE_155_MB: // Micropolis 170 MB (155-MB formatted)
|
||||
default:
|
||||
jumper = OMTI_CONFIG_W20;
|
||||
m_jumper = OMTI_CONFIG_W20;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -33,8 +33,6 @@ public:
|
||||
uint16_t read(offs_t offset, uint16_t mem_mask = 0xffff);
|
||||
void write(offs_t offset, uint16_t data, uint16_t mem_mask = 0xffff);
|
||||
|
||||
static void set_verbose(int on_off);
|
||||
|
||||
protected:
|
||||
static constexpr unsigned OMTI_MAX_LUN = 1;
|
||||
static constexpr unsigned CDB_SIZE = 10;
|
||||
@ -50,7 +48,6 @@ protected:
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
virtual ioport_constructor device_input_ports() const override;
|
||||
|
||||
@ -59,7 +56,9 @@ protected:
|
||||
virtual void dack_line_w(int line, int state) override;
|
||||
virtual void eop_w(int state) override;
|
||||
|
||||
void set_interrupt(enum line_state line_state);
|
||||
void set_interrupt(line_state state);
|
||||
|
||||
TIMER_CALLBACK_MEMBER(trigger_interrupt);
|
||||
|
||||
required_device<upd765a_device> m_fdc;
|
||||
optional_device_array<floppy_connector, 2> m_floppy;
|
||||
@ -82,34 +81,34 @@ private:
|
||||
|
||||
void fdc_map(address_map &map);
|
||||
|
||||
uint16_t jumper;
|
||||
uint16_t m_jumper;
|
||||
|
||||
uint8_t omti_state;
|
||||
uint8_t m_omti_state;
|
||||
|
||||
uint8_t status_port;
|
||||
uint8_t config_port;
|
||||
uint8_t mask_port;
|
||||
uint8_t m_status_port;
|
||||
uint8_t m_config_port;
|
||||
uint8_t m_mask_port;
|
||||
|
||||
// command descriptor block
|
||||
uint8_t command_buffer[CDB_SIZE];
|
||||
int command_length;
|
||||
int command_index;
|
||||
int command_status;
|
||||
uint8_t m_command_buffer[CDB_SIZE];
|
||||
uint8_t m_command_length;
|
||||
uint16_t m_command_index;
|
||||
uint8_t m_command_status;
|
||||
|
||||
// data buffer
|
||||
std::vector<uint8_t> sector_buffer;
|
||||
uint8_t *data_buffer;
|
||||
int data_length;
|
||||
int data_index;
|
||||
std::vector<uint8_t> m_sector_buffer;
|
||||
uint8_t *m_data_buffer;
|
||||
uint16_t m_data_length;
|
||||
uint16_t m_data_index;
|
||||
|
||||
// sense data
|
||||
uint8_t sense_data[4];
|
||||
uint8_t m_sense_data[4];
|
||||
|
||||
// these are used only to satisfy dex
|
||||
uint32_t diskaddr_ecc_error;
|
||||
uint32_t diskaddr_format_bad_track;
|
||||
uint8_t alternate_track_buffer[4];
|
||||
uint32_t alternate_track_address[2];
|
||||
uint32_t m_diskaddr_ecc_error;
|
||||
uint32_t m_diskaddr_format_bad_track;
|
||||
uint8_t m_alternate_track_buffer[4];
|
||||
uint32_t m_alternate_track_address[2];
|
||||
|
||||
emu_timer *m_timer;
|
||||
|
||||
@ -162,7 +161,7 @@ public:
|
||||
omti8621_apollo_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
// get sector diskaddr of logical unit lun into data_buffer
|
||||
uint32_t get_sector(int32_t diskaddr, uint8_t *data_buffer, uint32_t length, uint8_t lun);
|
||||
uint32_t get_sector(int32_t diskaddr, uint8_t *buffer, uint32_t length, uint8_t lun);
|
||||
|
||||
protected:
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
|
@ -83,8 +83,8 @@ void s3virge_vga_device::device_start()
|
||||
save_item(vga.sequencer.data,"Sequencer Registers");
|
||||
save_item(vga.attribute.data,"Attribute Registers");
|
||||
|
||||
m_vblank_timer = machine().scheduler().timer_alloc(timer_expired_delegate(FUNC(vga_device::vblank_timer_cb),this));
|
||||
m_draw_timer = timer_alloc(TIMER_DRAW_STEP);
|
||||
m_vblank_timer = timer_alloc(FUNC(vga_device::vblank_timer_cb), this);
|
||||
m_draw_timer = timer_alloc(FUNC(s3virge_vga_device::draw_step_tick), this);
|
||||
|
||||
memset(&s3, 0, sizeof(s3));
|
||||
memset(&s3virge, 0, sizeof(s3virge));
|
||||
@ -1427,11 +1427,9 @@ void s3virge_vga_device::bitblt_monosrc_step()
|
||||
s3virge.s3d.bitblt_step_count++;
|
||||
}
|
||||
|
||||
void s3virge_vga_device::device_timer(emu_timer &timer, device_timer_id id, int param)
|
||||
TIMER_CALLBACK_MEMBER(s3virge_vga_device::draw_step_tick)
|
||||
{
|
||||
// TODO: S3D state timing
|
||||
if(id == TIMER_DRAW_STEP)
|
||||
{
|
||||
switch(s3virge.s3d.state)
|
||||
{
|
||||
case S3D_STATE_IDLE:
|
||||
@ -1453,7 +1451,70 @@ void s3virge_vga_device::device_timer(emu_timer &timer, device_timer_id id, int
|
||||
bitblt_step();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
inline void s3virge_vga_device::write_pixel32(uint32_t base, uint16_t x, uint16_t y, uint32_t val)
|
||||
{
|
||||
if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000002)
|
||||
if(x < s3virge.s3d.clip_l || x > s3virge.s3d.clip_r || y < s3virge.s3d.clip_t || y > s3virge.s3d.clip_b)
|
||||
return;
|
||||
vga.memory[(base + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] = val & 0xff;
|
||||
vga.memory[(base + 1 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 8) & 0xff;
|
||||
vga.memory[(base + 2 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 16) & 0xff;
|
||||
vga.memory[(base + 3 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 24) & 0xff;
|
||||
}
|
||||
|
||||
inline void s3virge_vga_device::write_pixel24(uint32_t base, uint16_t x, uint16_t y, uint32_t val)
|
||||
{
|
||||
if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000002)
|
||||
if(x < s3virge.s3d.clip_l || x > s3virge.s3d.clip_r || y < s3virge.s3d.clip_t || y > s3virge.s3d.clip_b)
|
||||
return;
|
||||
vga.memory[(base + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] = val & 0xff;
|
||||
vga.memory[(base + 1 + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 8) & 0xff;
|
||||
vga.memory[(base + 2 + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 16) & 0xff;
|
||||
}
|
||||
|
||||
inline void s3virge_vga_device::write_pixel16(uint32_t base, uint16_t x, uint16_t y, uint16_t val)
|
||||
{
|
||||
if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000002)
|
||||
if(x < s3virge.s3d.clip_l || x > s3virge.s3d.clip_r || y < s3virge.s3d.clip_t || y > s3virge.s3d.clip_b)
|
||||
return;
|
||||
vga.memory[(base + (x*2) + (y*dest_stride())) % vga.svga_intf.vram_size] = val & 0xff;
|
||||
vga.memory[(base + 1 + (x*2) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 8) & 0xff;
|
||||
}
|
||||
|
||||
inline void s3virge_vga_device::write_pixel8(uint32_t base, uint16_t x, uint16_t y, uint8_t val)
|
||||
{
|
||||
if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000002)
|
||||
if(x < s3virge.s3d.clip_l || x > s3virge.s3d.clip_r || y < s3virge.s3d.clip_t || y > s3virge.s3d.clip_b)
|
||||
return;
|
||||
vga.memory[(base + x + (y*dest_stride())) % vga.svga_intf.vram_size] = val;
|
||||
}
|
||||
|
||||
inline uint32_t s3virge_vga_device::read_pixel32(uint32_t base, uint16_t x, uint16_t y)
|
||||
{
|
||||
return (vga.memory[(base + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] << 24) |
|
||||
(vga.memory[(base + 1 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] << 16) |
|
||||
(vga.memory[(base + 2 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] << 8) |
|
||||
vga.memory[(base + 3 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size];
|
||||
}
|
||||
|
||||
inline uint32_t s3virge_vga_device::read_pixel24(uint32_t base, uint16_t x, uint16_t y)
|
||||
{
|
||||
return (vga.memory[(base + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size]) |
|
||||
(vga.memory[(base + 1 + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] << 8) |
|
||||
(vga.memory[(base + 2 + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] << 16);
|
||||
}
|
||||
|
||||
inline uint16_t s3virge_vga_device::read_pixel16(uint32_t base, uint16_t x, uint16_t y)
|
||||
{
|
||||
return (vga.memory[(base + (x*2) + (y*dest_stride()) % vga.svga_intf.vram_size)]) |
|
||||
(vga.memory[(base + 1 + (x*2) + (y*dest_stride())) % vga.svga_intf.vram_size] << 8);
|
||||
}
|
||||
|
||||
inline uint8_t s3virge_vga_device::read_pixel8(uint32_t base, uint16_t x, uint16_t y)
|
||||
{
|
||||
return vga.memory[(base + x + (y*dest_stride())) % vga.svga_intf.vram_size];
|
||||
}
|
||||
|
||||
// 2D command register format - A500 (BitBLT), A900 (2D line), AD00 (2D Polygon)
|
||||
|
@ -74,12 +74,6 @@ public:
|
||||
|
||||
ibm8514a_device* get_8514() { fatalerror("s3virge requested non-existent 8514/A device\n"); return nullptr; }
|
||||
|
||||
enum
|
||||
{
|
||||
TIMER_DRAW_STEP = 10
|
||||
};
|
||||
|
||||
|
||||
protected:
|
||||
s3virge_vga_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
|
||||
|
||||
@ -184,59 +178,17 @@ protected:
|
||||
} s3d;
|
||||
} s3virge;
|
||||
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
void write_pixel32(uint32_t base, uint16_t x, uint16_t y, uint32_t val)
|
||||
{
|
||||
if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000002)
|
||||
if(x < s3virge.s3d.clip_l || x > s3virge.s3d.clip_r || y < s3virge.s3d.clip_t || y > s3virge.s3d.clip_b)
|
||||
return;
|
||||
vga.memory[(base + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] = val & 0xff;
|
||||
vga.memory[(base + 1 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 8) & 0xff;
|
||||
vga.memory[(base + 2 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 16) & 0xff;
|
||||
vga.memory[(base + 3 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 24) & 0xff;
|
||||
}
|
||||
void write_pixel24(uint32_t base, uint16_t x, uint16_t y, uint32_t val)
|
||||
{
|
||||
if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000002)
|
||||
if(x < s3virge.s3d.clip_l || x > s3virge.s3d.clip_r || y < s3virge.s3d.clip_t || y > s3virge.s3d.clip_b)
|
||||
return;
|
||||
vga.memory[(base + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] = val & 0xff;
|
||||
vga.memory[(base + 1 + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 8) & 0xff;
|
||||
vga.memory[(base + 2 + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 16) & 0xff;
|
||||
}
|
||||
void write_pixel16(uint32_t base, uint16_t x, uint16_t y, uint16_t val)
|
||||
{
|
||||
if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000002)
|
||||
if(x < s3virge.s3d.clip_l || x > s3virge.s3d.clip_r || y < s3virge.s3d.clip_t || y > s3virge.s3d.clip_b)
|
||||
return;
|
||||
vga.memory[(base + (x*2) + (y*dest_stride())) % vga.svga_intf.vram_size] = val & 0xff;
|
||||
vga.memory[(base + 1 + (x*2) + (y*dest_stride())) % vga.svga_intf.vram_size] = (val >> 8) & 0xff;
|
||||
}
|
||||
void write_pixel8(uint32_t base, uint16_t x, uint16_t y, uint8_t val)
|
||||
{
|
||||
if(s3virge.s3d.cmd_fifo[s3virge.s3d.cmd_fifo_current_ptr].reg[S3D_REG_COMMAND] & 0x00000002)
|
||||
if(x < s3virge.s3d.clip_l || x > s3virge.s3d.clip_r || y < s3virge.s3d.clip_t || y > s3virge.s3d.clip_b)
|
||||
return;
|
||||
vga.memory[(base + x + (y*dest_stride())) % vga.svga_intf.vram_size] = val;
|
||||
}
|
||||
uint32_t read_pixel32(uint32_t base, uint16_t x, uint16_t y)
|
||||
{
|
||||
return (vga.memory[(base + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] << 24) | (vga.memory[(base + 1 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] << 16)
|
||||
| (vga.memory[(base + 2 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size] << 8) | vga.memory[(base + 3 + (x*4) + (y*dest_stride())) % vga.svga_intf.vram_size];
|
||||
}
|
||||
uint32_t read_pixel24(uint32_t base, uint16_t x, uint16_t y)
|
||||
{
|
||||
return (vga.memory[(base + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size]) | (vga.memory[(base + 1 + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] << 8)
|
||||
| (vga.memory[(base + 2 + (x*3) + (y*dest_stride())) % vga.svga_intf.vram_size] << 16);
|
||||
}
|
||||
uint16_t read_pixel16(uint32_t base, uint16_t x, uint16_t y)
|
||||
{
|
||||
return (vga.memory[(base + (x*2) + (y*dest_stride()) % vga.svga_intf.vram_size)]) | (vga.memory[(base + 1 + (x*2) + (y*dest_stride())) % vga.svga_intf.vram_size] << 8);
|
||||
}
|
||||
uint8_t read_pixel8(uint32_t base, uint16_t x, uint16_t y)
|
||||
{
|
||||
return vga.memory[(base + x + (y*dest_stride())) % vga.svga_intf.vram_size];
|
||||
}
|
||||
TIMER_CALLBACK_MEMBER(draw_step_tick);
|
||||
|
||||
inline void write_pixel32(uint32_t base, uint16_t x, uint16_t y, uint32_t val);
|
||||
inline void write_pixel24(uint32_t base, uint16_t x, uint16_t y, uint32_t val);
|
||||
inline void write_pixel16(uint32_t base, uint16_t x, uint16_t y, uint16_t val);
|
||||
inline void write_pixel8(uint32_t base, uint16_t x, uint16_t y, uint8_t val);
|
||||
inline uint32_t read_pixel32(uint32_t base, uint16_t x, uint16_t y);
|
||||
inline uint32_t read_pixel24(uint32_t base, uint16_t x, uint16_t y);
|
||||
inline uint16_t read_pixel16(uint32_t base, uint16_t x, uint16_t y);
|
||||
inline uint8_t read_pixel8(uint32_t base, uint16_t x, uint16_t y);
|
||||
|
||||
uint32_t GetROP(uint8_t rop, uint32_t src, uint32_t dst, uint32_t pat);
|
||||
bool advance_pixel();
|
||||
|
||||
|
@ -717,7 +717,7 @@ void sb16_lle_device::device_start()
|
||||
m_isa->install_device(0x0228, 0x0229, read8sm_delegate(ymf262, FUNC(ymf262_device::read)), write8sm_delegate(ymf262, FUNC(ymf262_device::write)));
|
||||
m_isa->set_dma_channel(1, this, false);
|
||||
m_isa->set_dma_channel(5, this, false);
|
||||
m_timer = timer_alloc();
|
||||
m_timer = timer_alloc(FUNC(sb16_lle_device::timer_tick), this);
|
||||
}
|
||||
|
||||
|
||||
@ -742,7 +742,7 @@ void sb16_lle_device::device_reset()
|
||||
m_dma8_done = m_dma16_done = false;
|
||||
}
|
||||
|
||||
void sb16_lle_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
|
||||
TIMER_CALLBACK_MEMBER(sb16_lle_device::timer_tick)
|
||||
{
|
||||
uint16_t dacl = 0, dacr = 0, adcl = 0, adcr = 0;
|
||||
if(m_mode & 2)
|
||||
|
@ -27,8 +27,6 @@ protected:
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
|
||||
// optional information overrides
|
||||
virtual const tiny_rom_entry *device_rom_region() const override;
|
||||
virtual void device_add_mconfig(machine_config &config) override;
|
||||
@ -88,6 +86,8 @@ private:
|
||||
|
||||
void control_timer(bool start);
|
||||
|
||||
TIMER_CALLBACK_MEMBER(timer_tick);
|
||||
|
||||
required_device<dac_word_interface> m_ldac;
|
||||
required_device<dac_word_interface> m_rdac;
|
||||
required_device<pc_joy_device> m_joy;
|
||||
|
@ -1341,7 +1341,7 @@ void isa16_sblaster16_device::device_start()
|
||||
|
||||
void sb_device::device_start()
|
||||
{
|
||||
m_timer = timer_alloc(0);
|
||||
m_timer = timer_alloc(FUNC(sb_device::timer_tick), this);
|
||||
|
||||
save_item(NAME(m_dack_out));
|
||||
save_item(NAME(m_onebyte_midi));
|
||||
@ -1559,11 +1559,8 @@ void sb_device::dack_w(int line, uint8_t data)
|
||||
}
|
||||
}
|
||||
|
||||
void sb_device::device_timer(emu_timer &timer, device_timer_id tid, int param)
|
||||
TIMER_CALLBACK_MEMBER(sb_device::timer_tick)
|
||||
{
|
||||
if (tid)
|
||||
return;
|
||||
|
||||
// printf("DMA timer expire\n");
|
||||
uint16_t lsample, rsample;
|
||||
switch (m_dsp.flags) {
|
||||
|
@ -110,13 +110,13 @@ protected:
|
||||
// device-level overrides
|
||||
virtual void device_start() override;
|
||||
virtual void device_reset() override;
|
||||
|
||||
uint8_t dack_r(int line);
|
||||
void dack_w(int line, uint8_t data);
|
||||
virtual void device_timer(emu_timer &timer, device_timer_id id, int param) override;
|
||||
virtual void drq16_w(int state) { }
|
||||
virtual void drq_w(int state) { }
|
||||
virtual void irq_w(int state, int source) { }
|
||||
virtual void mixer_reset() {}
|
||||
virtual void mixer_reset() { }
|
||||
void adpcm_decode(uint8_t sample, int size);
|
||||
|
||||
// serial overrides
|
||||
@ -126,6 +126,8 @@ protected:
|
||||
|
||||
static constexpr unsigned MIDI_RING_SIZE = 2048;
|
||||
|
||||
TIMER_CALLBACK_MEMBER(timer_tick);
|
||||
|
||||
required_device<dac_16bit_r2r_device> m_ldac;
|
||||
required_device<dac_16bit_r2r_device> m_rdac;
|
||||
required_device<pc_joy_device> m_joy;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user