summaryrefslogtreecommitdiffstatshomepage
path: root/src/devices/bus/wswan/rom.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/devices/bus/wswan/rom.h')
-rw-r--r--src/devices/bus/wswan/rom.h101
1 files changed, 67 insertions, 34 deletions
diff --git a/src/devices/bus/wswan/rom.h b/src/devices/bus/wswan/rom.h
index 916562ab6e2..9a47ebf8023 100644
--- a/src/devices/bus/wswan/rom.h
+++ b/src/devices/bus/wswan/rom.h
@@ -13,38 +13,38 @@ class ws_rom_device : public device_t,
{
public:
// construction/destruction
- ws_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ ws_rom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
// reading and writing
- virtual uint8_t read_rom20(offs_t offset) override;
- virtual uint8_t read_rom30(offs_t offset) override;
- virtual uint8_t read_rom40(offs_t offset) override;
- virtual uint8_t read_io(offs_t offset) override;
- virtual void write_io(offs_t offset, uint8_t data) override;
+ virtual u16 read_rom20(offs_t offset, u16 mem_mask) override;
+ virtual u16 read_rom30(offs_t offset, u16 mem_mask) override;
+ virtual u16 read_rom40(offs_t offset, u16 mem_mask) override;
+ virtual u16 read_io(offs_t offset, u16 mem_mask) override;
+ virtual void write_io(offs_t offset, u16 data, u16 mem_mask) override;
protected:
- static constexpr device_timer_id TIMER_RTC = 0;
-
- ws_rom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock);
+ ws_rom_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
// 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, void *ptr) override;
- uint8_t m_io_regs[0x10];
- uint32_t m_base20, m_base30, m_base40;
+ TIMER_CALLBACK_MEMBER(rtc_tick);
+
+ u16 m_io_regs[8];
+ u32 m_base20, m_base30, m_base40;
+ u32 m_rom_mask;
// RTC
- uint8_t m_rtc_setting; /* Timer setting byte */
- uint8_t m_rtc_year; /* Year */
- uint8_t m_rtc_month; /* Month */
- uint8_t m_rtc_day; /* Day */
- uint8_t m_rtc_day_of_week; /* Day of the week */
- uint8_t m_rtc_hour; /* Hour, high bit = 0 => AM, high bit = 1 => PM */
- uint8_t m_rtc_minute; /* Minute */
- uint8_t m_rtc_second; /* Second */
- uint8_t m_rtc_index; /* index for reading/writing of current of alarm time */
+ u8 m_rtc_setting; /* Timer setting byte */
+ u8 m_rtc_year; /* Year */
+ u8 m_rtc_month; /* Month */
+ u8 m_rtc_day; /* Day */
+ u8 m_rtc_day_of_week; /* Day of the week */
+ u8 m_rtc_hour; /* Hour, high bit = 0 => AM, high bit = 1 => PM */
+ u8 m_rtc_minute; /* Minute */
+ u8 m_rtc_second; /* Second */
+ u8 m_rtc_index; /* index for reading/writing of current of alarm time */
emu_timer *rtc_timer;
};
@@ -56,20 +56,22 @@ class ws_rom_sram_device : public ws_rom_device
{
public:
// construction/destruction
- ws_rom_sram_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ ws_rom_sram_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
// reading and writing
- virtual uint8_t read_ram(offs_t offset) override;
- virtual void write_ram(offs_t offset, uint8_t data) override;
- virtual void write_io(offs_t offset, uint8_t data) override;
+ virtual u16 read_ram(offs_t offset, u16 mem_mask) override;
+ virtual void write_ram(offs_t offset, u16 data, u16 mem_mask) override;
+ virtual void write_io(offs_t offset, u16 data, u16 mem_mask) override;
protected:
+ ws_rom_sram_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, u32 clock);
+
// device-level overrides
virtual void device_start() override;
virtual void device_reset() override;
private:
- uint32_t m_nvram_base;
+ u32 m_nvram_base;
};
@@ -79,11 +81,11 @@ class ws_rom_eeprom_device : public ws_rom_device
{
public:
// construction/destruction
- ws_rom_eeprom_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock);
+ ws_rom_eeprom_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
// reading and writing
- virtual uint8_t read_io(offs_t offset) override;
- virtual void write_io(offs_t offset, uint8_t data) override;
+ virtual u16 read_io(offs_t offset, u16 mem_mask) override;
+ virtual void write_io(offs_t offset, u16 data, u16 mem_mask) override;
protected:
// device-level overrides
@@ -91,18 +93,49 @@ protected:
virtual void device_reset() override;
private:
- uint8_t m_eeprom_mode; /* eeprom mode */
- uint16_t m_eeprom_address; /* Read/write address */
- uint8_t m_eeprom_command; /* Commands: 00, 01, 02, 03, 04, 08, 0C */
- uint8_t m_eeprom_start; /* start bit */
- uint8_t m_eeprom_write_enabled; /* write enabled yes/no */
+ u8 m_eeprom_mode; /* eeprom mode */
+ u16 m_eeprom_address; /* Read/write address */
+ u8 m_eeprom_command; /* Commands: 00, 01, 02, 03, 04, 08, 0C */
+ u8 m_eeprom_start; /* start bit */
+ u8 m_eeprom_write_enabled; /* write enabled yes/no */
};
+class ws_wwitch_device : public ws_rom_sram_device
+{
+public:
+ // construction/destruction
+ ws_wwitch_device(const machine_config &mconfig, const char *tag, device_t *owner, u32 clock);
+
+ // reading and writing
+ virtual u16 read_ram(offs_t offset, u16 mem_mask) override;
+ virtual void write_ram(offs_t offset, u16 data, u16 mem_mask) override;
+
+protected:
+ // device-level overrides
+ virtual void device_start() override;
+ virtual void device_reset() override;
+
+private:
+ enum {
+ READ_MODE = 0,
+ COMMAND_MODE
+ };
+ u8 m_flash_seq;
+ u8 m_flash_command;
+ bool m_write_flash;
+ bool m_writing_flash;
+ bool m_write_resetting;
+ u8 m_flash_mode;
+ u8 m_flash_status;
+ u8 m_flash_count;
+};
+
// device type definition
DECLARE_DEVICE_TYPE(WS_ROM_STD, ws_rom_device)
DECLARE_DEVICE_TYPE(WS_ROM_SRAM, ws_rom_sram_device)
DECLARE_DEVICE_TYPE(WS_ROM_EEPROM, ws_rom_eeprom_device)
+DECLARE_DEVICE_TYPE(WS_ROM_WWITCH, ws_wwitch_device)
#endif // MAME_BUS_WSWAN_ROM_H