diff options
Diffstat (limited to 'src/devices/bus/a2bus/agat840k_hle.h')
-rw-r--r-- | src/devices/bus/a2bus/agat840k_hle.h | 103 |
1 files changed, 103 insertions, 0 deletions
diff --git a/src/devices/bus/a2bus/agat840k_hle.h b/src/devices/bus/a2bus/agat840k_hle.h new file mode 100644 index 00000000000..cab186c2c62 --- /dev/null +++ b/src/devices/bus/a2bus/agat840k_hle.h @@ -0,0 +1,103 @@ +// license:BSD-3-Clause +// copyright-holders:Sergey Svishchev +/********************************************************************* + + agat840k_hle.h + + High-level simulation of the Agat 840K floppy controller card + +*********************************************************************/ + +#ifndef MAME_BUS_A2BUS_AGAT840K_HLE_H +#define MAME_BUS_A2BUS_AGAT840K_HLE_H + +#pragma once + +#include "a2bus.h" +#include "imagedev/flopdrv.h" +#include "machine/i8255.h" + + + +//************************************************************************** +// TYPE DEFINITIONS +//************************************************************************** + +class a2bus_agat840k_hle_device: + public device_t, + public device_a2bus_card_interface +{ +public: + enum : u8 + { + MXCSR_SYNC = 0x40, + MXCSR_TR = 0x80 + }; + + // construction/destruction + a2bus_agat840k_hle_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + + DECLARE_READ8_MEMBER(d14_i_b); + DECLARE_READ8_MEMBER(d15_i_a); + DECLARE_READ8_MEMBER(d15_i_c); + DECLARE_WRITE8_MEMBER(d14_o_c); + DECLARE_WRITE8_MEMBER(d15_o_b); + DECLARE_WRITE8_MEMBER(d15_o_c); + + DECLARE_WRITE_LINE_MEMBER(index_0_w); + DECLARE_WRITE_LINE_MEMBER(index_1_w); + + void index_callback(int unit, int state); + +protected: + // construction/destruction + a2bus_agat840k_hle_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); + + virtual void device_start() override; + virtual void device_reset() override; + virtual void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; + virtual void device_add_mconfig(machine_config &config) override; + virtual const tiny_rom_entry *device_rom_region() const override; + + // overrides of standard a2bus slot functions + virtual uint8_t read_c0nx(address_space &space, uint8_t offset) override; + virtual void write_c0nx(address_space &space, uint8_t offset, uint8_t data) override; + virtual uint8_t read_cnxx(address_space &space, uint8_t offset) override; + + enum + { + TIMER_ID_WAIT = 0, + TIMER_ID_SEEK + }; + + required_device<i8255_device> m_d14; + required_device<i8255_device> m_d15; + +private: + legacy_floppy_image_device *floppy_image(int drive); + legacy_floppy_image_device *m_floppy; + bool m_side; + + std::unique_ptr<uint16_t[]> m_tracks[160]; + int m_count_read; + int m_count_write; + bool m_seen_magic; + int m_current_track; + + u8 m_mxcs; + int m_unit; + int m_state; + + int m_seektime; + int m_waittime; + + emu_timer *m_timer_wait = nullptr; + emu_timer *m_timer_seek = nullptr; + + uint8_t *m_rom; +}; + +// device type definition +DECLARE_DEVICE_TYPE(A2BUS_AGAT840K_HLE, a2bus_agat840k_hle_device) + +#endif // MAME_BUS_A2BUS_AGAT840K_HLE_H |