Previous 15994 Revisions Next

r4650 Friday 8th May, 2009 at 12:27:27 UTC by Curt Coder
[KYOCERA] Fixed RTC.
[src/mess/machine]upd1990a.c

src/mess/machine/upd1990a.c
r4649r4650
1515   - set clock mode
1616   - test mode
1717   - clock advance (currently it just reads the system time)
18   - divide frequencies from chip clock
1819
1920*/
2021
r4649r4650
156157         /* enable time counter */
157158         timer_enable(upd1990a->clock_timer, 1);
158159
160         /* disable data out pulse */
161         timer_enable(upd1990a->data_out_timer, 0);
162
163         /* output LSB of shift register */
164         upd1990a->data_out = BIT(upd1990a->shift_reg[0], 0);
165         devcb_call_write_line(&upd1990a->out_data_func, upd1990a->data_out);
166
159167         /* 32 Hz time pulse */
160168         timer_adjust_periodic(upd1990a->tp_timer, attotime_zero, 0, ATTOTIME_IN_HZ(32*2));
161169         break;
r4649r4650
170178         /* disable time counter */
171179         timer_enable(upd1990a->clock_timer, 0);
172180
181         /* disable data out pulse */
182         timer_enable(upd1990a->data_out_timer, 0);
183
184         /* output LSB of shift register */
185         upd1990a->data_out = BIT(upd1990a->shift_reg[0], 0);
186         devcb_call_write_line(&upd1990a->out_data_func, upd1990a->data_out);
187
173188         /* load shift register data into time counter */
174189         for (i = 0; i < 5; i++)
175190         {
r4649r4650
199214         upd1990a->time_counter[2] = convert_to_bcd(systime->local_time.hour);
200215         upd1990a->time_counter[3] = convert_to_bcd(systime->local_time.mday);
201216         upd1990a->time_counter[4] = systime->local_time.weekday;
202         upd1990a->time_counter[4] |= systime->local_time.month << 4;
217         upd1990a->time_counter[4] |= (systime->local_time.month + 1) << 4;
203218
204219         /* load time counter data into shift register */
205220         for (i = 0; i < 5; i++)
r4649r4650
260275   {
261276      if (upd1990a->c == UPD1990A_MODE_SHIFT)
262277      {
263         if (upd1990a->oe)
264         {
265            upd1990a->data_out = BIT(upd1990a->shift_reg[0], 0);
266
267            devcb_call_write_line(&upd1990a->out_data_func, upd1990a->data_out);
268
269            if (LOG) logerror("UPD1990A DATA OUT %u\n", upd1990a->data_out);
270         }
271
272278         upd1990a->shift_reg[0] >>= 1;
273279         upd1990a->shift_reg[0] |= (BIT(upd1990a->shift_reg[1], 0) << 7);
274280
r4649r4650
283289
284290         upd1990a->shift_reg[4] >>= 1;
285291         upd1990a->shift_reg[4] |= (upd1990a->data_in << 7);
292
293         if (upd1990a->oe)
294         {
295            upd1990a->data_out = BIT(upd1990a->shift_reg[0], 0);
296
297            logerror("UPD1990A DATA OUT %u\n", upd1990a->data_out);
298            devcb_call_write_line(&upd1990a->out_data_func, upd1990a->data_out);
299
300         }
301
286302      }
287303   }
288304
r4649r4650
298314   upd1990a_t *upd1990a = get_safe_token(device);
299315
300316   if (LOG) logerror("UPD1990A C0 %u\n", state);
317
301318   upd1990a->c = (upd1990a->c & 0x06) | state;
302319}
303320
r4649r4650
310327   upd1990a_t *upd1990a = get_safe_token(device);
311328
312329   if (LOG) logerror("UPD1990A C1 %u\n", state);
330
313331   upd1990a->c = (upd1990a->c & 0x05) | (state << 1);
314332}
315333
r4649r4650
322340   upd1990a_t *upd1990a = get_safe_token(device);
323341
324342   if (LOG) logerror("UPD1990A C2 %u\n", state);
343
325344   upd1990a->c = (upd1990a->c & 0x03) | (state << 2);
326345}
327346
r4649r4650
334353   upd1990a_t *upd1990a = get_safe_token(device);
335354
336355   if (LOG) logerror("UPD1990A DATA IN %u\n", state);
356
337357   upd1990a->data_in = state;
338358}
339359
r4649r4650
374394   const device_config *device = ptr;
375395   upd1990a_t *upd1990a = get_safe_token(device);
376396
377   if (LOG) logerror("UPD1990A DATA OUT %u\n", upd1990a->data_out);
397   logerror("UPD1990A DATA OUT TICK %u\n", upd1990a->data_out);
378398
379399   devcb_call_write_line(&upd1990a->out_data_func, upd1990a->data_out);
380400

Previous 15994 Revisions Next


© 1998-2018 The MESS Team