Previous 199869 Revisions Next

r32626 Friday 10th October, 2014 at 15:56:23 UTC by hap
some notes from charles
[src/mame/drivers]segac2.c
[src/mame/machine]315-5296.c

trunk/src/mame/machine/315-5296.c
r32625r32626
33    Sega 315-5296 I/O chip
44   
55    Sega 100-pin QFP, with 8 bidirectional I/O ports, and 3 output pins.
6    It also has chip select(/FMCS) and clock(CKOT) for a peripheral device.
67    Commonly used from the late 80s up until Sega Model 2.
78
9    The I/O chip has 64 addresses:
10    $00-0F : I/O ports, security, configuration registers
11    $10-1F : Unused (no effect when read or written)
12    $20-3F : Unused (enables /FMCS output, eg. to YM2151 /CS)
13
14    On System 16 derivatives, the unused locations return the 68000 prefetch
15    value off the bus when read.
16
17
18    TODO:
19    - complete emulation of CNT register
20
821**********************************************************************/
922
1023#include "machine/315-5296.h"
r32625r32626
1629//  sega_315_5296_device - constructor
1730//-------------------------------------------------
1831
19
2032sega_315_5296_device::sega_315_5296_device(const machine_config &mconfig, const char *tag, device_t *owner, UINT32 clock)
2133   : device_t(mconfig, SEGA_315_5296, "Sega 315-5296", tag, owner, clock, "315-5296", __FILE__),
2234   m_in_pa_cb(*this),
r32625r32626
100112
101113READ8_MEMBER( sega_315_5296_device::read )
102114{
103   offset &= 0xf;
115   offset &= 0x3f;
104116   
105117   switch (offset)
106118   {
r32625r32626
109121         // if the port is configured as an output, return the last thing written
110122         if (m_dir & 1 << offset)
111123            return m_output_latch[offset];
112
124         
113125         // otherwise, return an input port
114126         return (*m_in_port_cb[offset])(offset);
115127     
r32625r32626
130142      // port direction register & mirror
131143      case 0xd: case 0xf:
132144         return m_dir;
145     
146      default:
147         break;
133148   }
134149   
135150   return 0xff;
r32625r32626
138153
139154WRITE8_MEMBER( sega_315_5296_device::write )
140155{
141   offset &= 0xf;
156   offset &= 0x3f;
142157
143158   switch (offset)
144159   {
r32625r32626
153168     
154169      // CNT register
155170      case 0xe:
156         // d0-2: CNT0-2, other bits: ?
171         // d0-2: CNT0-2 output pins
172         // note: When CNT2 is configured as clock output, bit 2 of this register has
173         // no effect on the output level of CNT2.
157174         for (int i = 0; i < 3; i++)
158175            (*m_out_cnt_cb[i])(data >> i & 1);
159176         
177         // d3: CNT2 output mode (1= Clock output, 0= Programmable output)
178         // d4,5: CNT2 clock divider (0= CLK/4, 1= CLK/8, 2= CLK/16, 3= CLK/2)
179         // d6,7: CKOT clock divider (0= CLK/4, 1= CLK/8, 2= CLK/16, 3= CLK/2)
180         // TODO..
160181         m_cnt = data;
161182         break;
162183
trunk/src/mame/drivers/segac2.c
r32625r32626
417417   // D6 : From uPD7759 pin 18. (/BUSY output)
418418   int busy = (m_upd7759 != NULL) ? (m_upd7759->busy_r() << 6) : 0x40;
419419   return 0xbf | busy;
420   
421420}
422421
423422WRITE8_MEMBER(segac2_state::io_portd_w)
r32625r32626
13751374   MCFG_MACHINE_RESET_OVERRIDE(segac2_state,segac2)
13761375   MCFG_NVRAM_ADD_1FILL("nvram") // borencha requires 0xff fill or there is no sound (it lacks some of the init code of the borench set)
13771376
1378   MCFG_DEVICE_ADD("io", SEGA_315_5296, 0)
1377   MCFG_DEVICE_ADD("io", SEGA_315_5296, XL2_CLOCK/6) // clock divider guessed
13791378   MCFG_315_5296_IN_PORTA_CB(IOPORT("P1"))
13801379   MCFG_315_5296_IN_PORTB_CB(IOPORT("P2"))
13811380   MCFG_315_5296_IN_PORTC_CB(READ8(segac2_state, io_portc_r))

Previous 199869 Revisions Next


© 1997-2024 The MAME Team