diff options
Diffstat (limited to 'src/devices/bus/ti99/internal/genboard.h')
-rw-r--r-- | src/devices/bus/ti99/internal/genboard.h | 193 |
1 files changed, 71 insertions, 122 deletions
diff --git a/src/devices/bus/ti99/internal/genboard.h b/src/devices/bus/ti99/internal/genboard.h index b0d6ba7bb1c..3e927ab70df 100644 --- a/src/devices/bus/ti99/internal/genboard.h +++ b/src/devices/bus/ti99/internal/genboard.h @@ -23,6 +23,7 @@ #include "machine/mm58274c.h" #include "machine/at29x.h" #include "machine/ram.h" +#include "bus/pc_kbd/pc_kbdc.h" enum { @@ -37,12 +38,12 @@ enum GENEVE_PFM512A }; -#define GENEVE_KEYBOARD_TAG "gkeyboard" -#define GENEVE_MAPPER_TAG "gmapper" +#define GENEVE_GATE_ARRAY_TAG "gatearray" #define GENEVE_MOUSE_TAG "gmouse" #define GENEVE_CLOCK_TAG "mm58274c" #define GENEVE_PFM512_TAG "pfm512" #define GENEVE_PFM512A_TAG "pfm512a" +#define GENEVE_KEYBOARD_CONN_TAG "keybconn" #define GENEVE_SRAM_TAG "sram" #define GENEVE_DRAM_TAG "dram" @@ -53,66 +54,10 @@ namespace bus { namespace ti99 { namespace internal { /*****************************************************************************/ -class geneve_keyboard_device : public device_t +class geneve_gate_array_device : public device_t { public: - geneve_keyboard_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); - DECLARE_WRITE_LINE_MEMBER( reset_line ); - DECLARE_WRITE_LINE_MEMBER( send_scancodes ); - DECLARE_WRITE_LINE_MEMBER( clock_control ); - uint8_t get_recent_key(); - - auto int_cb() { return m_interrupt.bind(); } - -protected: - void device_start() override; - void device_reset() override; - ioport_constructor device_input_ports() const override; - void device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) override; - - devcb_write_line m_interrupt; // Keyboard interrupt to console - required_ioport_array<8> m_keys; - -private: - static constexpr unsigned KEYQUEUESIZE = 256; - static constexpr unsigned MAXKEYMSGLENGTH = 10; - static constexpr unsigned KEYAUTOREPEATDELAY = 30; - static constexpr unsigned KEYAUTOREPEATRATE = 6; - - void post_in_key_queue(int keycode); - void signal_when_key_available(); - void poll(); - - bool m_key_reset; - int m_key_queue_length; - uint8_t m_key_queue[KEYQUEUESIZE]; - int m_key_queue_head; - bool m_key_in_buffer; - uint32_t m_key_state_save[4]; - bool m_key_numlock_state; - - int m_key_ctrl_state; - int m_key_alt_state; - int m_key_real_shift_state; - - bool m_key_fake_shift_state; - bool m_key_fake_unshift_state; - - int m_key_autorepeat_key; - int m_key_autorepeat_timer; - - bool m_keep_keybuf; - bool m_keyboard_clock; - - emu_timer* m_timer; -}; - -/*****************************************************************************/ - -class geneve_mapper_device : public device_t -{ -public: - geneve_mapper_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + geneve_gate_array_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); void set_geneve_mode(bool geneve); void set_direct_mode(bool direct); @@ -130,44 +75,24 @@ public: DECLARE_WRITE_LINE_MEMBER( clock_in ); DECLARE_WRITE_LINE_MEMBER( dbin_in ); + // Keyboard support + DECLARE_WRITE_LINE_MEMBER( set_keyboard_clock ); + DECLARE_WRITE_LINE_MEMBER( enable_shift_register ); + DECLARE_WRITE_LINE_MEMBER( kbdclk ); + DECLARE_WRITE_LINE_MEMBER( kbddata ); + // PFM support DECLARE_WRITE_LINE_MEMBER( pfm_select_lsb ); DECLARE_WRITE_LINE_MEMBER( pfm_select_msb ); DECLARE_WRITE_LINE_MEMBER( pfm_output_enable ); auto ready_cb() { return m_ready.bind(); } + auto kbdint_cb() { return m_keyint.bind(); } protected: - geneve_mapper_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); - void device_start() override; - virtual void device_reset() override; + geneve_gate_array_device(const machine_config &mconfig, device_type type, const char *tag, device_t *owner, uint32_t clock); void common_reset(); - // GROM simulation - bool m_gromwaddr_LSB; - bool m_gromraddr_LSB; - int m_grom_address; - uint8_t read_grom(offs_t offset); - void write_grom(offs_t offset, uint8_t data); - - // wait states - void set_wait(int min); - void set_video_waitcount(int min); - bool m_video_waitstates; - bool m_extra_waitstates; - bool m_ready_asserted; - - bool m_read_mode; - - bool m_debug_no_ws; - bool m_geneve_mode; - bool m_direct_mode; - int m_cartridge_size; - bool m_cartridge_secondpage; - bool m_cartridge6_writable; - bool m_cartridge7_writable; - int m_map[8]; - /* Constants for mapper decoding. Naming scheme: M=Mapper, L=Logical space; P=Physical space @@ -200,6 +125,39 @@ protected: int wait; // Wait states } decdata; + uint8_t* m_eprom; + int m_pbox_prefix; + int m_boot_rom; + +private: + void device_start() override; + virtual void device_reset() override; + + // GROM simulation + bool m_gromwaddr_LSB; + bool m_gromraddr_LSB; + int m_grom_address; + uint8_t read_grom(offs_t offset); + void write_grom(offs_t offset, uint8_t data); + + // wait states + void set_wait(int min); + void set_video_waitcount(int min); + bool m_video_waitstates; + bool m_extra_waitstates; + bool m_ready_asserted; + + bool m_read_mode; + + bool m_debug_no_ws; + bool m_geneve_mode; + bool m_direct_mode; + int m_cartridge_size; + bool m_cartridge_secondpage; + bool m_cartridge6_writable; + bool m_cartridge7_writable; + int m_map[8]; + // The result of decoding decdata m_decoded; @@ -219,17 +177,6 @@ protected: const char* description; // Good for logging } logentry_t; - logentry_t m_logmap[7] = - { - { 0xf100, 0x000e, 0x8800, 0x03fe, 0x0400, MLVIDEO, "video" }, - { 0xf110, 0x0007, 0x8000, 0x0007, 0x0000, MLMAPPER, "mapper" }, - { 0xf118, 0x0007, 0x8008, 0x0007, 0x0000, MLKEY, "keyboard" }, - { 0xf120, 0x000e, 0x8400, 0x03fe, 0x0000, MLSOUND, "sound" }, - { 0xf130, 0x000f, 0x8010, 0x000f, 0x0000, MLCLOCK, "clock" }, - { 0x0000, 0x0000, 0x9000, 0x03fe, 0x0400, MBOX, "speech (in P-Box)" }, - { 0x0000, 0x0000, 0x9800, 0x03fe, 0x0400, MLGROM, "GROM" }, - }; - // Static decoder entry for the physical space // There are no differences between native mode and TI mode. typedef struct @@ -241,13 +188,8 @@ protected: const char* description; // Good for logging } physentry_t; - physentry_t m_physmap[4] = - { - { 0x000000, 0x07ffff, MPDRAM, 1, "DRAM" }, - { 0x080000, 0x07ffff, MPEXP, 1, "on-board expansion" }, - { 0x1e0000, 0x01ffff, MPEPROM, 0, "EPROM" }, - { 0x180000, 0x07ffff, MPSRAM, 0, "SRAM" } - }; + static const geneve_gate_array_device::logentry_t s_logmap[]; + static const geneve_gate_array_device::physentry_t s_physmap[]; void decode_logical(bool reading, decdata* dec); void map_address(bool reading, decdata* dec); @@ -258,12 +200,9 @@ protected: // PFM mod (0 = none, 1 = AT29C040, 2 = AT29C040A) uint8_t boot_rom(offs_t offset); void write_to_pfm(offs_t offset, uint8_t data); - int m_boot_rom; int m_pfm_bank; bool m_pfm_output_enable; - int m_pbox_prefix; - // SRAM access int m_sram_mask; int m_sram_val; @@ -271,29 +210,40 @@ protected: // Ready line to the CPU devcb_write_line m_ready; + // Keyboard interrupt + devcb_write_line m_keyint; + // Counter for the wait states. int m_waitcount; int m_video_waitcount; + // Keyboard support + uint16_t m_keyboard_shift_reg; + line_state m_keyboard_last_clock; + line_state m_keyboard_data_in; + bool m_shift_reg_enabled; + void shift_reg_changed(); + // Devices - required_device<mm58274c_device> m_clock; required_device<tms9995_device> m_cpu; + required_device<sn76496_base_device> m_sound; + required_device<v9938_device> m_video; + required_device<mm58274c_device> m_rtc; + required_device<ram_device> m_sram; + required_device<ram_device> m_dram; + + required_device<bus::ti99::peb::peribox_device> m_peribox; + required_device<at29c040_device> m_pfm512; required_device<at29c040a_device> m_pfm512a; - required_device<sn76496_base_device> m_sound; - required_device<bus::ti99::internal::geneve_keyboard_device> m_keyboard; - required_device<v9938_device> m_video; - required_device<bus::ti99::peb::peribox_device> m_peribox; - uint8_t* m_eprom; - required_device<ram_device> m_sram; - required_device<ram_device> m_dram; + required_device<pc_kbdc_device> m_keyb_conn; }; -class genmod_mapper_device : public geneve_mapper_device +class genmod_gate_array_device : public geneve_gate_array_device { public: - genmod_mapper_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); + genmod_gate_array_device(const machine_config &mconfig, const char *tag, device_t *owner, uint32_t clock); void decode_mod(decdata* dec) override; void device_reset() override; DECLARE_INPUT_CHANGED_MEMBER( setgm_changed ); @@ -306,8 +256,7 @@ private: } } } // end namespace bus::ti99::internal -DECLARE_DEVICE_TYPE_NS(GENEVE_KEYBOARD, bus::ti99::internal, geneve_keyboard_device) -DECLARE_DEVICE_TYPE_NS(GENEVE_MAPPER, bus::ti99::internal, geneve_mapper_device) -DECLARE_DEVICE_TYPE_NS(GENMOD_MAPPER, bus::ti99::internal, genmod_mapper_device) +DECLARE_DEVICE_TYPE_NS(GENEVE_GATE_ARRAY, bus::ti99::internal, geneve_gate_array_device) +DECLARE_DEVICE_TYPE_NS(GENMOD_GATE_ARRAY, bus::ti99::internal, genmod_gate_array_device) #endif // MAME_BUS_TI99_INTERNAL_GENBOARD_H |