diff options
author | Michael Zapf <Michael.Zapf@mizapf.de> | 2016-04-03 00:10:37 +0200 |
---|---|---|
committer | Michael Zapf <Michael.Zapf@mizapf.de> | 2016-04-03 00:10:37 +0200 |
commit | d3eeb13429b91a416fde3d8d66d421a9f40e6003 (patch) | |
tree | 5b9b559de5e8f1bd911c5357fd2063b359a0e289 /src/devices/bus | |
parent | 3af8030bb6aa9d319e659f9909a2b881e0278f55 (diff) |
ti99: Unwrapped sound access
Diffstat (limited to 'src/devices/bus')
-rw-r--r-- | src/devices/bus/ti99x/datamux.cpp | 44 | ||||
-rw-r--r-- | src/devices/bus/ti99x/datamux.h | 7 | ||||
-rw-r--r-- | src/devices/bus/ti99x/genboard.cpp | 56 | ||||
-rw-r--r-- | src/devices/bus/ti99x/genboard.h | 5 | ||||
-rw-r--r-- | src/devices/bus/ti99x/videowrp.cpp | 152 | ||||
-rw-r--r-- | src/devices/bus/ti99x/videowrp.h | 91 |
6 files changed, 85 insertions, 270 deletions
diff --git a/src/devices/bus/ti99x/datamux.cpp b/src/devices/bus/ti99x/datamux.cpp index da971c4ceec..85030665b41 100644 --- a/src/devices/bus/ti99x/datamux.cpp +++ b/src/devices/bus/ti99x/datamux.cpp @@ -122,7 +122,19 @@ void ti99_datamux_device::read_all(address_space& space, UINT16 addr, UINT8 *val } // Video - if ((addr & 0xf801)==0x8800) m_video->readz(space, addr, value); + if ((addr & 0xf801)==0x8800) + { + if (addr & 2) + { + // Read VDP status + *value = m_video->register_read(space, 0); + } + else + { + // Read VDP RAM + *value = m_video->vram_read(space, 0); + } + } } // GROMport (ROMs) @@ -147,10 +159,23 @@ void ti99_datamux_device::write_all(address_space& space, UINT16 addr, UINT8 val m_gromport->write(space, addr, value); } - // Other devices + // Cartridge port and sound if ((addr & 0xe000)==0x6000) m_gromport->write(space, addr, value); - if ((addr & 0xfc01)==0x8400) m_sound->write(space, addr, value); - if ((addr & 0xf801)==0x8800) m_video->write(space, addr, value); + if ((addr & 0xfc01)==0x8400) m_sound->write(space, 0, value); + + // Video + if ((addr & 0xf801)==0x8800) + { + if (addr & 2) + { + // Write VDP address + m_video->register_write(space, 0, value); + } + else + { // Write VDP data + m_video->vram_write(space, 0, value); + } + } // PEB gets all accesses m_peb->write(space, addr, value); @@ -182,12 +207,7 @@ void ti99_datamux_device::setaddress_all(address_space& space, UINT16 addr) // GROMport (GROMs) m_gromport->set_gromlines(space, lines, select); - if (validaccess) - { - // Other devices - if ((addr & 0xfc01)==0x8400) m_sound->setaddress_dbin(space, addr, m_dbin); - if ((addr & 0xf801)==0x8800) m_video->setaddress_dbin(space, addr, m_dbin); - } + // Sound chip and video chip do not require the address to be set before access // GROMport (ROMs) m_gromport->romgq_line(iscartrom? ASSERT_LINE : CLEAR_LINE); @@ -557,8 +577,8 @@ void ti99_datamux_device::device_reset(void) void ti99_datamux_device::device_config_complete() { - m_video = downcast<bus8z_device*>(owner()->subdevice(VIDEO_SYSTEM_TAG)); - m_sound = downcast<ti_sound_sn94624_device*>(owner()->subdevice(TISOUND_TAG)); + m_video = downcast<tms9928a_device*>(owner()->subdevice(VDP_TAG)); + m_sound = downcast<sn76496_base_device*>(owner()->subdevice(TISOUNDCHIP_TAG)); m_gromport = downcast<gromport_device*>(owner()->subdevice(GROMPORT_TAG)); m_peb = downcast<peribox_device*>(owner()->subdevice(PERIBOX_TAG)); m_grom[0] = downcast<tmc0430_device*>(owner()->subdevice(GROM0_TAG)); diff --git a/src/devices/bus/ti99x/datamux.h b/src/devices/bus/ti99x/datamux.h index eaad45b7238..27908d403c6 100644 --- a/src/devices/bus/ti99x/datamux.h +++ b/src/devices/bus/ti99x/datamux.h @@ -15,10 +15,11 @@ #define __DMUX__ #include "ti99defs.h" -#include "videowrp.h" #include "machine/tmc0430.h" #include "gromport.h" #include "bus/ti99_peb/peribox.h" +#include "sound/sn76496.h" +#include "video/tms9928a.h" extern const device_type DATAMUX; @@ -54,10 +55,10 @@ protected: private: // Link to the video processor - bus8z_device* m_video; + tms9928a_device* m_video; // Link to the sound processor - ti_sound_sn94624_device* m_sound; + sn76496_base_device* m_sound; // Link to the peripheral expansion box peribox_device* m_peb; diff --git a/src/devices/bus/ti99x/genboard.cpp b/src/devices/bus/ti99x/genboard.cpp index 1abdd7c6762..10f560ce6bd 100644 --- a/src/devices/bus/ti99x/genboard.cpp +++ b/src/devices/bus/ti99x/genboard.cpp @@ -207,7 +207,10 @@ geneve_mapper_device::geneve_mapper_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) : device_t(mconfig, GENEVE_MAPPER, "Geneve Gate Array", tag, owner, clock, "geneve_mapper", __FILE__), m_gromwaddr_LSB(false), m_gromraddr_LSB(false), m_grom_address(0), m_video_waitstates(false), m_extra_waitstates(false), m_ready_asserted(false), m_read_mode(false), m_debug_no_ws(false), m_geneve_mode(false), m_direct_mode(false), m_cartridge_size(0), m_cartridge_secondpage(false), m_cartridge6_writable(false), m_cartridge7_writable(false), m_turbo(false), m_genmod(false), m_timode(false), m_pfm_mode(0), m_pfm_bank(0), m_pfm_output_enable(false), m_sram_mask(0), m_sram_val(0), - m_ready(*this), m_waitcount(0), m_ext_waitcount(0), m_clock(nullptr), m_cpu(nullptr), m_pfm512(nullptr), m_pfm512a(nullptr), m_keyboard(nullptr), m_video(nullptr), m_peribox(nullptr), m_sound(nullptr), m_sram(nullptr), m_dram(nullptr) + m_ready(*this), m_waitcount(0), m_ext_waitcount(0), + m_clock(nullptr), m_cpu(nullptr), m_pfm512(nullptr), + m_pfm512a(nullptr), m_sound(nullptr), m_keyboard(nullptr), + m_video(nullptr), m_peribox(nullptr), m_sram(nullptr), m_dram(nullptr) { m_eprom = nullptr; } @@ -466,11 +469,14 @@ READ8_MEMBER( geneve_mapper_device::readm ) switch (dec->function) { case MLGVIDEO: - m_video->readz(space, dec->offset, &value, 0xff); - if (TRACE_READ) logerror("%s: Read video %04x -> %02x\n", tag(), dec->offset, value); - // Video wait states are created *after* the access - // Accordingly, they have no effect when execution is in onchip RAM - if (m_video_waitstates) set_ext_wait(15); + if (!space.debugger_access()) + { + value = m_video->read(space, dec->offset>>1); + if (TRACE_READ) logerror("%s: Read video %04x -> %02x\n", tag(), dec->offset, value); + // Video wait states are created *after* the access + // Accordingly, they have no effect when execution is in onchip RAM + if (m_video_waitstates) set_ext_wait(15); + } break; case MLGMAPPER: @@ -523,10 +529,13 @@ READ8_MEMBER( geneve_mapper_device::readm ) // video // ++++ ++-- ---- ---+ // 1000 1000 0000 00x0 - m_video->readz(space, dec->offset, &value, 0xff); - if (TRACE_READ) logerror("%s: Read video %04x -> %02x\n", tag(), dec->offset, value); - // See above - if (m_video_waitstates) set_ext_wait(15); + if (!space.debugger_access()) + { + value = m_video->read(space, dec->offset>>1); + if (TRACE_READ) logerror("%s: Read video %04x -> %02x\n", tag(), dec->offset, value); + // See above + if (m_video_waitstates) set_ext_wait(15); + } break; case MLTSPEECH: @@ -649,10 +658,14 @@ WRITE8_MEMBER( geneve_mapper_device::writem ) // video // ++++ ++++ ++++ ---+ // 1111 0001 0000 .cc0 - m_video->write(space, dec->offset, data, 0xff); - if (TRACE_WRITE) logerror("%s: Write video %04x <- %02x\n", tag(), offset, data); - // See above - if (m_video_waitstates) set_ext_wait(15); + + if (!space.debugger_access()) + { + m_video->write(space, dec->offset>>1, data); + if (TRACE_WRITE) logerror("%s: Write video %04x <- %02x\n", tag(), offset, data); + // See above + if (m_video_waitstates) set_ext_wait(15); + } break; case MLGMAPPER: @@ -692,10 +705,13 @@ WRITE8_MEMBER( geneve_mapper_device::writem ) // ++++ ++-- ---- ---+ // 1000 1100 0000 00c0 // Initialize waitstate timer - m_video->write(space, dec->offset, data, 0xff); - if (TRACE_WRITE) logerror("%s: Write video %04x <- %02x\n", tag(), offset, data); - // See above - if (m_video_waitstates) set_ext_wait(15); + if (!space.debugger_access()) + { + m_video->write(space, dec->offset>>1, data); + if (TRACE_WRITE) logerror("%s: Write video %04x <- %02x\n", tag(), offset, data); + // See above + if (m_video_waitstates) set_ext_wait(15); + } break; case MLTSPEECH: @@ -1360,8 +1376,8 @@ void geneve_mapper_device::device_start() // Get pointers m_peribox = machine().device<peribox_device>(PERIBOX_TAG); m_keyboard = machine().device<geneve_keyboard_device>(GKEYBOARD_TAG); - m_video = machine().device<bus8z_device>(VIDEO_SYSTEM_TAG); - m_sound = machine().device<bus8z_device>(TISOUND_TAG); + m_video = machine().device<v9938_device>(VDP_TAG); + m_sound = machine().device<sn76496_base_device>(TISOUNDCHIP_TAG); m_clock = machine().device<mm58274c_device>(GCLOCK_TAG); // PFM expansion diff --git a/src/devices/bus/ti99x/genboard.h b/src/devices/bus/ti99x/genboard.h index 8f49cb6906e..4f9c5da7f27 100644 --- a/src/devices/bus/ti99x/genboard.h +++ b/src/devices/bus/ti99x/genboard.h @@ -20,6 +20,7 @@ #include "cpu/tms9900/tms9995.h" #include "machine/at29x.h" #include "bus/ti99_peb/peribox.h" +#include "sound/sn76496.h" extern const device_type GENEVE_MOUSE; extern const device_type GENEVE_KEYBOARD; @@ -205,11 +206,11 @@ private: tms9995_device* m_cpu; at29c040_device* m_pfm512; at29c040a_device* m_pfm512a; + sn76496_base_device* m_sound; geneve_keyboard_device* m_keyboard; - bus8z_device* m_video; + v9938_device* m_video; peribox_device* m_peribox; - bus8z_device* m_sound; UINT8* m_eprom; UINT8* m_sram; UINT8* m_dram; diff --git a/src/devices/bus/ti99x/videowrp.cpp b/src/devices/bus/ti99x/videowrp.cpp index 387872bba5d..a6bba316700 100644 --- a/src/devices/bus/ti99x/videowrp.cpp +++ b/src/devices/bus/ti99x/videowrp.cpp @@ -2,7 +2,7 @@ // copyright-holders:Michael Zapf /**************************************************************************** - TI-99/4(A) and /8 Video subsystem + TI-99/4A Video subsystem This device actually wraps the naked video chip implementation EVPC (Enhanced Video Processor Card) from SNUG @@ -11,18 +11,12 @@ The SGCPU ("TI-99/4P") only runs with EVPC - We also include a class wrapper for the sound chip here. - Michael Zapf - October 2010 - February 2012: Rewritten as class - *****************************************************************************/ #include "emu.h" #include "videowrp.h" -#include "sound/sn76496.h" /* Constructors @@ -45,19 +39,9 @@ ti_exp_video_device::ti_exp_video_device(const machine_config &mconfig, const ch { } -ti_sound_sn94624_device::ti_sound_sn94624_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : ti_sound_system_device(mconfig, TISOUND_94624, "Onboard sound (SN94624)", tag, owner, clock, "ti_sound_sn94624", __FILE__) -{ -} - -ti_sound_sn76496_device::ti_sound_sn76496_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock) - : ti_sound_system_device(mconfig, TISOUND_76496, "Onboard sound (SN76496)", tag, owner, clock, "ti_sound_sn76496", __FILE__) -{ -} - /*****************************************************************************/ /* - Memory access (TI-99/4A and TI-99/8) + Accessing TMS9928A (TI-99/4A) */ READ8Z_MEMBER( ti_std_video_device::readz ) { @@ -90,45 +74,18 @@ WRITE8_MEMBER( ti_std_video_device::write ) /*****************************************************************************/ /* - Memory access (EVPC) via 16 bit bus + Accessing v9938 via 16 bit bus (SGCPU) */ READ16_MEMBER( ti_exp_video_device::read16 ) { if (space.debugger_access()) return 0; - - if (offset & 1) - { /* read VDP status */ - return ((int) m_v9938->status_r()) << 8; - } - else - { /* read VDP RAM */ - return ((int) m_v9938->vram_r()) << 8; - } + return (int)(m_v9938->read(space, offset)<<8); } WRITE16_MEMBER( ti_exp_video_device::write16 ) { if (space.debugger_access()) return; - - switch (offset & 3) - { - case 0: - /* write VDP data */ - m_v9938->vram_w((data >> 8) & 0xff); - break; - case 1: - /* write VDP address */ - m_v9938->command_w((data >> 8) & 0xff); - break; - case 2: - /* write VDP palette */ - m_v9938->palette_w((data >> 8) & 0xff); - break; - case 3: - /* write VDP register pointer (indirect access) */ - m_v9938->register_w((data >> 8) & 0xff); - break; - } + m_v9938->write(space, offset, (data>>8)&0xff); } void ti_exp_video_device::device_timer(emu_timer &timer, device_timer_id id, int param, void *ptr) @@ -142,60 +99,20 @@ void ti_exp_video_device::device_timer(emu_timer &timer, device_timer_id id, int /******************************************************************************/ /* - Video read (Geneve) via 8 bit bus + Accessing v9938 via 8 bit bus (EVPC) */ READ8Z_MEMBER( ti_exp_video_device::readz ) { if (space.debugger_access()) return; - - if (offset & 2) - { /* read VDP status */ - *value = m_v9938->status_r(); - } - else - { /* read VDP RAM */ - *value = m_v9938->vram_r(); - } + *value = m_v9938->read(space, offset>>1); } -/* - Video write (Geneve) -*/ WRITE8_MEMBER( ti_exp_video_device::write ) { if (space.debugger_access()) return; - - switch (offset & 6) - { - case 0: - /* write VDP data */ - m_v9938->vram_w(data); - break; - case 2: - /* write VDP address */ - m_v9938->command_w(data); - break; - case 4: - /* write VDP palette */ - m_v9938->palette_w(data); - break; - case 6: - /* write VDP register pointer (indirect access) */ - m_v9938->register_w(data); - break; - } -} - -/**************************************************************************/ -// Interfacing to mouse attached to v9938 - -void ti_exp_video_device::video_update_mouse(int delta_x, int delta_y, int buttons) -{ - m_v9938->update_mouse_state(delta_x, delta_y, buttons & 3); + m_v9938->write(space, offset>>1, data); } -/**************************************************************************/ - void ti_video_device::device_start(void) { m_tms9928a = static_cast<tms9928a_device*>(machine().device(VDP_TAG)); @@ -215,58 +132,5 @@ void ti_exp_video_device::device_reset(void) /**************************************************************************/ -/* - Sound subsystem. - TODO: Seriously consider to simplify this by connecting to the datamux - directly. We don't do anything reasonable here. -*/ - -WRITE8_MEMBER( ti_sound_system_device::write ) -{ - if (space.debugger_access()) return; - m_sound_chip->write(space, 0, data); -} - -void ti_sound_system_device::device_start(void) -{ - m_console_ready.resolve(); - m_sound_chip = subdevice<sn76496_base_device>(TISOUNDCHIP_TAG); -} - -WRITE_LINE_MEMBER( ti_sound_system_device::sound_ready ) -{ - m_console_ready(state); -} - -MACHINE_CONFIG_FRAGMENT( sn94624 ) - MCFG_SPEAKER_STANDARD_MONO("sound_out") - - MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN94624, 3579545/8) /* 3.579545 MHz */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "sound_out", 0.75) - MCFG_SN76496_READY_HANDLER(WRITELINE(ti_sound_system_device, sound_ready)) -MACHINE_CONFIG_END - -MACHINE_CONFIG_FRAGMENT( sn76496 ) - MCFG_SPEAKER_STANDARD_MONO("sound_out") - - MCFG_SOUND_ADD(TISOUNDCHIP_TAG, SN76496, 3579545) /* 3.579545 MHz */ - MCFG_SOUND_ROUTE(ALL_OUTPUTS, "sound_out", 0.75) - MCFG_SN76496_READY_HANDLER(WRITELINE(ti_sound_system_device, sound_ready)) -MACHINE_CONFIG_END - -machine_config_constructor ti_sound_sn94624_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( sn94624 ); -} - -machine_config_constructor ti_sound_sn76496_device::device_mconfig_additions() const -{ - return MACHINE_CONFIG_NAME( sn76496 ); -} - -/**************************************************************************/ - const device_type TI99VIDEO = &device_creator<ti_std_video_device>; const device_type V9938VIDEO = &device_creator<ti_exp_video_device>; -const device_type TISOUND_94624 = &device_creator<ti_sound_sn94624_device>; -const device_type TISOUND_76496 = &device_creator<ti_sound_sn76496_device>; diff --git a/src/devices/bus/ti99x/videowrp.h b/src/devices/bus/ti99x/videowrp.h index 49c4ce73f16..ca52a99902e 100644 --- a/src/devices/bus/ti99x/videowrp.h +++ b/src/devices/bus/ti99x/videowrp.h @@ -2,7 +2,7 @@ // copyright-holders:Michael Zapf /**************************************************************************** - TI-99/4(A) and /8 Video subsystem + TI-99/4A / EVPC Video subsystem See videowrp.c for documentation Michael Zapf @@ -17,7 +17,6 @@ #include "video/tms9928a.h" #include "video/v9938.h" #include "ti99defs.h" -#include "sound/sn76496.h" class ti_video_device : public bus8z_device { @@ -49,7 +48,7 @@ public: }; /* - Used in the EVPC and Geneve + Used in the EVPC */ class ti_exp_video_device : public ti_video_device { @@ -57,7 +56,6 @@ public: ti_exp_video_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); template<class _Object> static devcb_base &set_out_gromclk_callback(device_t &device, _Object object) { return downcast<ti_exp_video_device &>(device).m_out_gromclk_cb.set_callback(object); } - void video_update_mouse(int delta_x, int delta_y, int buttons); DECLARE_READ8Z_MEMBER(readz) override; DECLARE_WRITE8_MEMBER(write) override; DECLARE_READ16_MEMBER(read16); @@ -82,64 +80,6 @@ private: extern const device_type TI99VIDEO; extern const device_type V9938VIDEO; -/****************************************************************************/ -/* - Sound device -*/ - -extern const device_type TISOUND_94624; -extern const device_type TISOUND_76496; - -#define TI_SOUND_CONFIG(name) \ - const ti_sound_config(name) = - -class ti_sound_system_device : public bus8z_device -{ -public: - ti_sound_system_device(const machine_config &mconfig, device_type type, const char *name, const char *tag, device_t *owner, UINT32 clock, const char *shortname, const char *source) - : bus8z_device(mconfig, type, name, tag, owner, clock, shortname, source), m_sound_chip(nullptr), - m_console_ready(*this) { }; - - // Cannot read from sound; just ignore silently - DECLARE_READ8Z_MEMBER(readz) override { }; - DECLARE_WRITE8_MEMBER(write) override; - DECLARE_WRITE_LINE_MEMBER( sound_ready ); // connect to console READY - - template<class _Object> static devcb_base &static_set_int_callback(device_t &device, _Object object) { return downcast<ti_sound_system_device &>(device).m_console_ready.set_callback(object); } - -protected: - virtual void device_start(void) override; - virtual machine_config_constructor device_mconfig_additions() const override =0; - -private: - sn76496_base_device* m_sound_chip; - devcb_write_line m_console_ready; -}; - -/* - The version that sits in the TI-99/4A -*/ -class ti_sound_sn94624_device : public ti_sound_system_device -{ -public: - ti_sound_sn94624_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - -protected: - virtual machine_config_constructor device_mconfig_additions() const override; -}; - -/* - The version that sits in the TI-99/8 and Geneve -*/ -class ti_sound_sn76496_device : public ti_sound_system_device -{ -public: - ti_sound_sn76496_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock); - -protected: - virtual machine_config_constructor device_mconfig_additions() const override; -}; - /****************************************************************************/ @@ -161,31 +101,4 @@ protected: MCFG_TMS9928A_SCREEN_ADD_PAL( SCREEN_TAG ) \ MCFG_SCREEN_UPDATE_DEVICE( VDP_TAG, tms9928a_device, screen_update ) -#define MCFG_TI998_ADD_NTSC(_tag, _chip, _vsize, _class, _int, _gclk) \ - MCFG_DEVICE_ADD(_tag, TI99VIDEO, 0) \ - MCFG_DEVICE_ADD( VDP_TAG, _chip, XTAL_10_738635MHz / 2 ) \ - MCFG_TMS9928A_VRAM_SIZE(_vsize) \ - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(_class,_int)) \ - MCFG_TMS9928A_OUT_GROMCLK_CB(WRITELINE(_class,_gclk)) \ - MCFG_TMS9928A_SCREEN_ADD_NTSC( SCREEN_TAG ) \ - MCFG_SCREEN_UPDATE_DEVICE( VDP_TAG, tms9928a_device, screen_update ) - -#define MCFG_TI998_ADD_PAL(_tag, _chip, _vsize, _class, _int, _gclk) \ - MCFG_DEVICE_ADD(_tag, TI99VIDEO, 0) \ - MCFG_DEVICE_ADD( VDP_TAG, _chip, XTAL_10_738635MHz / 2 ) \ - MCFG_TMS9928A_VRAM_SIZE(_vsize) \ - MCFG_TMS9928A_OUT_INT_LINE_CB(WRITELINE(_class,_int)) \ - MCFG_TMS9928A_OUT_GROMCLK_CB(WRITELINE(_class,_gclk)) \ - MCFG_TMS9928A_SCREEN_ADD_PAL( SCREEN_TAG ) \ - MCFG_SCREEN_UPDATE_DEVICE( VDP_TAG, tms9928a_device, screen_update ) - -#define MCFG_TI_SOUND_94624_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, TISOUND_94624, 0) - -#define MCFG_TI_SOUND_76496_ADD(_tag) \ - MCFG_DEVICE_ADD(_tag, TISOUND_76496, 0) - -#define MCFG_TI_SOUND_READY_HANDLER( _ready ) \ - devcb = &ti_sound_system_device::static_set_int_callback( *device, DEVCB_##_ready ); - #endif /* __TIVIDEO__ */ |