Previous 199869 Revisions Next

r19918 Saturday 29th December, 2012 at 12:25:41 UTC by Wilbert Pol
(MESS) Cleaned up formatting a bit; no functional change (nw)
[src/mess/machine]odyssey2.c

trunk/src/mess/machine/odyssey2.c
r19917r19918
1616static void odyssey2_switch_banks(running_machine &machine)
1717{
1818   odyssey2_state *state = machine.driver_data<odyssey2_state>();
19   switch ( state->m_cart_size ) {
20   case 12288:
21      /* 12KB cart support (for instance, KTAA as released) */
22      state->membank( "bank1" )->set_base( machine.root_device().memregion("user1")->base() + (state->m_p1 & 0x03) * 0xC00 );
23      state->membank( "bank2" )->set_base( machine.root_device().memregion("user1")->base() + (state->m_p1 & 0x03) * 0xC00 + 0x800 );
24      break;
25   case 16384:
26      /* 16KB cart support (for instance, full sized version KTAA) */
27      state->membank( "bank1" )->set_base( machine.root_device().memregion("user1")->base() + (state->m_p1 & 0x03) * 0x1000 + 0x400 );
28      state->membank( "bank2" )->set_base( machine.root_device().memregion("user1")->base() + (state->m_p1 & 0x03) * 0x1000 + 0xC00 );
29      break;
30   default:
31      state->membank("bank1")->set_base(machine.root_device().memregion("user1")->base() + (state->m_p1 & 0x03) * 0x800);
32      state->membank("bank2")->set_base(state->memregion("user1")->base() + (state->m_p1 & 0x03) * 0x800 );
33      break;
19   switch ( state->m_cart_size )
20   {
21      case 12288:
22         /* 12KB cart support (for instance, KTAA as released) */
23         state->membank( "bank1" )->set_base( machine.root_device().memregion("user1")->base() + (state->m_p1 & 0x03) * 0xC00 );
24         state->membank( "bank2" )->set_base( machine.root_device().memregion("user1")->base() + (state->m_p1 & 0x03) * 0xC00 + 0x800 );
25         break;
26
27      case 16384:
28         /* 16KB cart support (for instance, full sized version KTAA) */
29         state->membank( "bank1" )->set_base( machine.root_device().memregion("user1")->base() + (state->m_p1 & 0x03) * 0x1000 + 0x400 );
30         state->membank( "bank2" )->set_base( machine.root_device().memregion("user1")->base() + (state->m_p1 & 0x03) * 0x1000 + 0xC00 );
31         break;
32
33      default:
34         state->membank("bank1")->set_base(machine.root_device().memregion("user1")->base() + (state->m_p1 & 0x03) * 0x800);
35         state->membank("bank2")->set_base(state->memregion("user1")->base() + (state->m_p1 & 0x03) * 0x800 );
36         break;
3437   }
3538}
3639
37void odyssey2_the_voice_lrq_callback(device_t *device, int state) {
40void odyssey2_the_voice_lrq_callback(device_t *device, int state)
41{
3842   odyssey2_state *drvstate = device->machine().driver_data<odyssey2_state>();
3943   drvstate->m_the_voice_lrq_state = state;
4044}
4145
42READ8_MEMBER(odyssey2_state::odyssey2_t0_r){
46READ8_MEMBER(odyssey2_state::odyssey2_t0_r)
47{
4348   return ( m_the_voice_lrq_state == ASSERT_LINE ) ? 0 : 1;
4449}
4550
r19917r19918
8489
8590READ8_MEMBER(odyssey2_state::odyssey2_bus_r)
8691{
87    if ((m_p1 & (P1_VDC_COPY_MODE_ENABLE | P1_VDC_ENABLE)) == 0)
92   if ((m_p1 & (P1_VDC_COPY_MODE_ENABLE | P1_VDC_ENABLE)) == 0)
93   {
8894      return odyssey2_video_r(space, offset); /* seems to have higher priority than ram??? */
89
90    else if (!(m_p1 & P1_EXT_RAM_ENABLE))
95   }
96   if (!(m_p1 & P1_EXT_RAM_ENABLE))
97   {
9198      return m_ram[offset];
99   }
92100
93    return 0;
101   return 0;
94102}
95103
96104WRITE8_MEMBER(odyssey2_state::odyssey2_bus_w)
97105{
98    if ((m_p1 & (P1_EXT_RAM_ENABLE | P1_VDC_COPY_MODE_ENABLE)) == 0x00) {
106   if ((m_p1 & (P1_EXT_RAM_ENABLE | P1_VDC_COPY_MODE_ENABLE)) == 0x00)
107   {
99108      m_ram[offset] = data;
100      if ( offset & 0x80 ) {
101         if ( data & 0x20 ) {
109      if ( offset & 0x80 )
110      {
111         if ( data & 0x20 )
112         {
102113            logerror("voice write %02X, data = %02X (p1 = %02X)\n", offset, data, m_p1 );
103114            sp0256_ALD_w( machine().device("sp0256_speech"), space, 0, offset & 0x7F );
104         } else {
115         }
116         else
117         {
105118            /* TODO: Reset sp0256 in this case */
106119         }
107120      }
108121   }
109
110    else if (!(m_p1 & P1_VDC_ENABLE))
122   else if (!(m_p1 & P1_VDC_ENABLE))
123   {
111124      odyssey2_video_w(space, offset, data);
125   }
112126}
113127
114128READ8_MEMBER(odyssey2_state::g7400_bus_r)
115129{
116   if ((m_p1 & (P1_VDC_COPY_MODE_ENABLE | P1_VDC_ENABLE)) == 0) {
130   if ((m_p1 & (P1_VDC_COPY_MODE_ENABLE | P1_VDC_ENABLE)) == 0)
131   {
117132      return odyssey2_video_r(space, offset); /* seems to have higher priority than ram??? */
118133   }
119   else if (!(m_p1 & P1_EXT_RAM_ENABLE)) {
134   else if (!(m_p1 & P1_EXT_RAM_ENABLE))
135   {
120136      return m_ram[offset];
121   } else {
122//      return ef9341_r( offset & 0x02, offset & 0x01 );
123137   }
138   else
139   {
140      //return ef9341_r( offset & 0x02, offset & 0x01 );
141   }
124142
125143   return 0;
126144}
127145
128146WRITE8_MEMBER(odyssey2_state::g7400_bus_w)
129147{
130   if ((m_p1 & (P1_EXT_RAM_ENABLE | P1_VDC_COPY_MODE_ENABLE)) == 0x00) {
148   if ((m_p1 & (P1_EXT_RAM_ENABLE | P1_VDC_COPY_MODE_ENABLE)) == 0x00)
149   {
131150      m_ram[offset] = data;
132151   }
133   else if (!(m_p1 & P1_VDC_ENABLE)) {
152   else if (!(m_p1 & P1_VDC_ENABLE))
153   {
134154      odyssey2_video_w(space, offset, data);
135   } else {
136//      ef9341_w( offset & 0x02, offset & 0x01, data );
137155   }
156   else
157   {
158      //ef9341_w( offset & 0x02, offset & 0x01, data );
159   }
138160}
139161
140162/***** 8048 Ports ************************/
r19917r19918
160182
161183READ8_MEMBER(odyssey2_state::odyssey2_getp2)
162184{
163    UINT8 h = 0xFF;
164    int i, j;
185   UINT8 h = 0xFF;
186   int i, j;
165187   static const char *const keynames[] = { "KEY0", "KEY1", "KEY2", "KEY3", "KEY4", "KEY5" };
166188
167    if (!(m_p1 & P1_KEYBOARD_SCAN_ENABLE))
189   if (!(m_p1 & P1_KEYBOARD_SCAN_ENABLE))
168190   {
169191      if ((m_p2 & P2_KEYBOARD_SELECT_MASK) <= 5)  /* read keyboard */
170192      {
r19917r19918
182204         }
183205      }
184206
185        if (h == 0xFF)  /* active low inputs, so no keypresses */
186            m_p2 = m_p2 | 0xF0;
207      if (h == 0xFF)  /* active low inputs, so no keypresses */
208      {
209         m_p2 = m_p2 | 0xF0;
210      }
187211    }
188
189212    else
190        m_p2 = m_p2 | 0xF0;
213   {
214      m_p2 = m_p2 | 0xF0;
215   }
191216
192    logerror("%.6f p2 read %.2x\n", machine().time().as_double(), m_p2);
193    return m_p2;
217   logerror("%.6f p2 read %.2x\n", machine().time().as_double(), m_p2);
218   return m_p2;
194219}
195220
196221WRITE8_MEMBER(odyssey2_state::odyssey2_putp2)
197222{
198    m_p2 = data;
223   m_p2 = data;
199224
200    logerror("%.6f p2 written %.2x\n", machine().time().as_double(), data);
225   logerror("%.6f p2 written %.2x\n", machine().time().as_double(), data);
201226}
202227
203228READ8_MEMBER(odyssey2_state::odyssey2_getbus)
204229{
205    UINT8 data = 0xff;
230   UINT8 data = 0xff;
206231
207    if ((m_p2 & P2_KEYBOARD_SELECT_MASK) == 1)
232   if ((m_p2 & P2_KEYBOARD_SELECT_MASK) == 1)
233   {
208234      data &= ioport("JOY0")->read();       /* read joystick 1 */
235   }
209236
210    if ((m_p2 & P2_KEYBOARD_SELECT_MASK) == 0)
237   if ((m_p2 & P2_KEYBOARD_SELECT_MASK) == 0)
238   {
211239      data &= ioport("JOY1")->read();       /* read joystick 2 */
240   }
212241
213    logerror("%.6f bus read %.2x\n", machine().time().as_double(), data);
214    return data;
242   logerror("%.6f bus read %.2x\n", machine().time().as_double(), data);
243   return data;
215244}
216245
217246WRITE8_MEMBER(odyssey2_state::odyssey2_putbus)
218247{
219    logerror("%.6f bus written %.2x\n", machine().time().as_double(), data);
248   logerror("%.6f bus written %.2x\n", machine().time().as_double(), data);
220249}
221250
222251///////////////////////////////////
r19917r19918
226255{
227256   odyssey2_state *state = machine.driver_data<odyssey2_state>();
228257   state->m_cart_size = size;
229    if (   (size == 2048)
230        || (size == 4096)
231        || (size == 8192)
258   if (   (size == 2048)
259       || (size == 4096)
260       || (size == 8192)
232261      || (size == 12288)
233262      || (size == 16384))
234    {
263   {
235264      return IMAGE_VERIFY_PASS;
236    }
265   }
237266
238    return IMAGE_VERIFY_FAIL;
267   return IMAGE_VERIFY_FAIL;
239268}
240269#endif

Previous 199869 Revisions Next


© 1997-2024 The MAME Team