Previous 15994 Revisions Next

r4134 Thursday 15th January, 2009 at 11:10:04 UTC by Dirk Best
Removed more bogus asserts
[src/mess/audio]cdp1863.c lmc1992.c
[src/mess/machine]6530miot.c 6883sam.c 68901mfp.c 74145.c abc77.c adc080x.c cdp1871.c conkort.c e0516.c hd63450.c i8271.c ins8154.c mm58274c.c nec765.c rp5c15.c tms9901.c tms9902.c upd7002.c x68k_hdc.c zx8302.c
[src/mess/video]cdp1861.c cdp1862.c cdp1864.c crtc_ega.c i8275.c msm6255.c zx8301.c

src/mess/audio/lmc1992.c
r4133r4134
140140   /* validate arguments */
141141   assert(device != NULL);
142142   assert(device->tag != NULL);
143   assert(strlen(device->tag) < 20);
144143
145144   lmc1992->intf = device->static_config;
146145
src/mess/audio/cdp1863.c
r4133r4134
136136   /* validate arguments */
137137   assert(device != NULL);
138138   assert(device->tag != NULL);
139   assert(strlen(device->tag) < 20);
140139
141140   cdp1863->intf = device->static_config;
142141
src/mess/video/i8275.c
r4133r4134
113113   UINT8 char_blink_cnt;
114114
115115   UINT8 next_in_fifo;
116   
116
117117   UINT8 lineattr;
118118   UINT8 rvv;
119119   UINT8 gpa;
120120   UINT8 hlgt;
121121   UINT8 underline;
122122   UINT8 blink;
123   
123
124124   UINT8 last_data;
125125};
126126
r4133r4134
164164      i8275->status_reg &= ~I8275_STATUS_DMA_UNDERRUN;
165165      i8275->status_reg &= ~I8275_STATUS_IMPROPER_COMMAND;
166166      i8275->status_reg &= ~I8275_STATUS_LIGHT_PEN;
167      i8275->status_reg &= ~I8275_STATUS_INTERRUPT_REQUEST;     
167      i8275->status_reg &= ~I8275_STATUS_INTERRUPT_REQUEST;
168168   }
169169   else
170170   {
r4133r4134
354354               i8275->rvv = (chr >> 4) & 1;
355355               i8275->underline = (chr >> 5) & 1;
356356            }
357                       
358            if (i8275->field_attribute_mode==0) {               
359               chr = (i8275->buffer_used==0) ? i8275->fifo_buffer_2[fifo_read] : i8275->fifo_buffer_1[fifo_read];                 
357
358            if (i8275->field_attribute_mode==0) {
359               chr = (i8275->buffer_used==0) ? i8275->fifo_buffer_2[fifo_read] : i8275->fifo_buffer_1[fifo_read];
360360               fifo_read = (fifo_read + 1 ) % 16;
361            } else {           
361            } else {
362362               vsp = 1;
363            }           
363            }
364364         }
365365         if (vsp==0 && i8275->blink) {
366366            vsp = (i8275->char_blink_cnt < 32)  ? 1: 0;
367         }         
367         }
368368         if ((i8275->current_row == i8275->cursor_row) && (xpos ==  i8275->cursor_col - i8275->intf->char_delay)) {
369369            int vis = 1;
370370            if ((i8275->cursor_format & 2)==0) {
r4133r4134
392392            i8275->hlgt  // highlight
393393         );
394394         vsp = 0;
395      }     
395      }
396396      i8275->ypos++;
397397   }
398398   i8275->current_row++;
r4133r4134
400400
401401void i8275_dack_set_data(const device_config *device, UINT8 data)
402402{
403   i8275_t *i8275 = get_safe_token(device);   
404   
405   if (i8275->next_in_fifo == 1)
406   {   
403   i8275_t *i8275 = get_safe_token(device);
404
405   if (i8275->next_in_fifo == 1)
406   {
407407      i8275->next_in_fifo = 0;
408     
409      if(i8275->buffer_used == 0)
408
409      if(i8275->buffer_used == 0)
410410      {
411         i8275->fifo_buffer_1[i8275->fifo_write] = data & 0x7f;                 
412      }
413      else
411         i8275->fifo_buffer_1[i8275->fifo_write] = data & 0x7f;
412      }
413      else
414414      {
415415         i8275->fifo_buffer_2[i8275->fifo_write] = data & 0x7f;
416416      }
417417      i8275->fifo_write = (i8275->fifo_write + 1) % 16;
418           
418
419419      if (i8275->last_data == 0xf1) {
420420         i8275->row_pos = i8275->chars_per_row + 1;
421421      }
422422   }
423   else
424   {     
425      if(i8275->buffer_used == 0)
423   else
424   {
425      if(i8275->buffer_used == 0)
426426      {
427427         i8275->row_buffer_1[i8275->row_pos++] = data;
428      }
429      else
428      }
429      else
430430      {
431431         i8275->row_buffer_2[i8275->row_pos++] = data;
432432      }
433      if (i8275->field_attribute_mode==0)
433      if (i8275->field_attribute_mode==0)
434434      {
435         if ((data & 0x80)==0x80)
435         if ((data & 0x80)==0x80)
436436         {
437437            i8275->last_data = data;
438438            i8275->next_in_fifo = 1;
439439         }
440440      }
441441   }
442   
443   if ((i8275->row_pos - 1)==i8275->chars_per_row )
442
443   if ((i8275->row_pos - 1)==i8275->chars_per_row )
444444   {
445445      i8275->buffer_used = (i8275->buffer_used==0) ? 1 : 0;
446446      i8275->row_pos = 0;
447447      i8275->fifo_write = 0;
448448      i8275_draw_char_line(device);
449449   }
450   if (i8275->current_row == (i8275->rows_per_frame + 1))
450   if (i8275->current_row == (i8275->rows_per_frame + 1))
451451   {
452452      i8275->ypos = 0;
453453      i8275->current_row = 0;
r4133r4134
463463   i8275->lineattr = 0;
464464   i8275->rvv = 0;
465465   i8275->gpa = 0;
466   i8275->hlgt = 0;   
466   i8275->hlgt = 0;
467467   i8275->underline = 0;
468468   i8275->blink = 0;
469469   i8275->row_pos = 0;
r4133r4134
494494
495495   assert(device != NULL);
496496   assert(device->tag != NULL);
497   assert(strlen(device->tag) < 20);
498497   assert(device->static_config != NULL);
499498
500499   i8275->intf = device->static_config;
r4133r4134
575574   i8275->cursor_blink_cnt = 0;
576575   i8275->char_blink_cnt = 0;
577576   i8275->next_in_fifo = 0;
578   
577
579578   i8275->lineattr = 0;
580579   i8275->rvv = 0;
581580   i8275->gpa = 0;
582   i8275->hlgt = 0;   
581   i8275->hlgt = 0;
583582   i8275->underline = 0;
584583   i8275->blink = 0;
585584}
src/mess/video/cdp1862.c
r4133r4134
8888      /* enable color data input latch */
8989      cdp1862->con = ASSERT_LINE;
9090   }
91   
91
9292   if (cdp1862->con == CLEAR_LINE)
9393   {
9494      /* latch white dot color */
r4133r4134
131131   /* validate arguments */
132132   assert(device != NULL);
133133   assert(device->tag != NULL);
134   assert(strlen(device->tag) < 20);
135134   assert(device->clock > 0);
136135
137136   cdp1862->intf = device->static_config;
src/mess/video/crtc_ega.c
r4133r4134
723723   /* validate arguments */
724724   assert(device != NULL);
725725   assert(device->tag != NULL);
726   assert(strlen(device->tag) < 20);
727726   assert(device->clock > 0);
728727
729728   crtc_ega->intf = device->static_config;
src/mess/video/zx8301.c
r4133r4134
3434   int flash;                  /* flash */
3535   int vsync;                  /* vertical sync */
3636   int vda;                  /* valid data address */
37   
37
3838   /* timers */
3939   emu_timer *flash_timer;         /* flash timer */
4040   emu_timer *vsync_timer;         /* vertical sync timer */
r4133r4134
235235   /* validate arguments */
236236   assert(device != NULL);
237237   assert(device->tag != NULL);
238   assert(strlen(device->tag) < 20);
239238   assert(device->clock > 0);
240239
241240   zx8301->intf = device->static_config;
src/mess/video/msm6255.c
r4133r4134
262262   msm6255_t *msm6255 = get_safe_token(device);
263263
264264   UINT8 hn = (msm6255->hnr & MSM6255_HNR_HN_MASK) + 1;
265   UINT8 nx = (msm6255->dvr & MSM6255_DVR_DN_MASK) + 1;
265   UINT8 nx = (msm6255->dvr & MSM6255_DVR_DN_MASK) + 1;
266266   UINT16 sar = (msm6255->sur << 8) | msm6255->slr;
267267
268268   int y;
r4133r4134
292292
293293   UINT8 hn = (msm6255->hnr & MSM6255_HNR_HN_MASK) + 1;
294294   UINT8 vp = (msm6255->pr & MSM6255_PR_VP_MASK) + 1;
295   UINT8 nx = (msm6255->dvr & MSM6255_DVR_DN_MASK) + 1;
295   UINT8 nx = (msm6255->dvr & MSM6255_DVR_DN_MASK) + 1;
296296   UINT16 sar = (msm6255->sur << 8) | msm6255->slr;
297297
298298   int sy, y;
r4133r4134
349349
350350   assert(device != NULL);
351351   assert(device->tag != NULL);
352   assert(strlen(device->tag) < 20);
353352   assert(device->static_config != NULL);
354353
355354   msm6255->intf = device->static_config;
src/mess/video/cdp1864.c
r4133r4134
205205   }
206206
207207   cdp1864->audio = level;
208   
208
209209   beep_set_state(0, level); // TODO: remove this
210210}
211211
r4133r4134
359359   /* validate arguments */
360360   assert(device != NULL);
361361   assert(device->tag != NULL);
362   assert(strlen(device->tag) < 20);
363362   assert(device->clock > 0);
364363
365364   cdp1864->intf = device->static_config;
r4133r4134
406405   timer_adjust_oneshot(cdp1864->int_timer, video_screen_get_time_until_pos(cdp1864->screen, CDP1864_SCANLINE_INT_START, 0), 0);
407406   timer_adjust_oneshot(cdp1864->efx_timer, video_screen_get_time_until_pos(cdp1864->screen, CDP1864_SCANLINE_EFX_TOP_START, 0), 0);
408407   timer_adjust_oneshot(cdp1864->dma_timer, cpu_clocks_to_attotime(device->machine->cpu[0], CDP1864_CYCLES_DMA_START), 0);
409   
408
410409   cdp1864->disp = 0;
411410   cdp1864->dmaout = 0;
412411   cdp1864->bgcolor = 0;
src/mess/video/cdp1861.c
r4133r4134
191191   /* validate arguments */
192192   assert(device != NULL);
193193   assert(device->tag != NULL);
194   assert(strlen(device->tag) < 20);
195194   assert(device->clock > 0);
196195
197196   cdp1861->intf = device->static_config;
r4133r4134
228227   timer_adjust_oneshot(cdp1861->int_timer, video_screen_get_time_until_pos(cdp1861->screen, CDP1861_SCANLINE_INT_START, 0), 0);
229228   timer_adjust_oneshot(cdp1861->efx_timer, video_screen_get_time_until_pos(cdp1861->screen, CDP1861_SCANLINE_EFX_TOP_START, 0), 0);
230229   timer_adjust_oneshot(cdp1861->dma_timer, cpu_clocks_to_attotime(device->machine->cpu[0], CDP1861_CYCLES_DMA_START), 0);
231   
230
232231   cdp1861->disp = 0;
233232   cdp1861->dmaout = 0;
234233
src/mess/machine/conkort.c
r4133r4134
4848    SAB1793 - Siemens SAB1793-02P Floppy Disc Controller
4949    FDC9229 - SMC FDC9229BT Floppy Disc Interface Circuit
5050    DM8131  - National Semiconductor DM8131N 6-Bit Unified Bus Comparator
51    CON1   -
51    CON1   -
5252    CON2   - AMP4284
53    CON3   -
54    SW1      -
55    SW2      -
56    SW3      -
57    S1      -
58      S3      -
59    S5      -
53    CON3   -
54    SW1      -
55    SW2      -
56    SW3      -
57    S1      -
58      S3      -
59    S5      -
6060    S6      - Amount of RAM installed (A:2KB, B:8KB)
6161    S7      - Number of drives connected (0:3, 1:?) *located on solder side
6262    S8      - 0:8", 1:5.25"
r4133r4134
219219   if (data == 0x2d) // TODO: bit 0 of this is configurable with S1
220220   {
221221      const address_space *io = cpu_get_address_space(device->machine->cpu[0], ADDRESS_SPACE_IO);
222         
222
223223      memory_install_readwrite8_handler(io, ABCBUS_INP, ABCBUS_OUT, 0x18, 0, slow_bus_data_r, slow_bus_data_w);
224224      memory_install_read8_handler(io, ABCBUS_STAT, ABCBUS_STAT, 0x18, 0, slow_bus_stat_r);
225225      memory_install_write8_handler(io, ABCBUS_C1, ABCBUS_C1, 0x18, 0, slow_bus_c1_w);
r4133r4134
277277      bit      description
278278
279279      0      _INT to main Z80
280      1     
281      2     
282      3     
283      4     
284      5     
280      1
281      2
282      3
283      4
284      5
285285      6      LS245 DIR
286      7     
286      7
287287
288288   */
289289
r4133r4134
749749   MDRV_CPU_CONFIG(slow_daisy_chain)
750750
751751   MDRV_Z80PIO_ADD(CONKORT_Z80PIO_TAG, conkort_pio_intf)
752   MDRV_WD179X_ADD("wd179x", slow_wd17xx_interface )     
752   MDRV_WD179X_ADD("wd179x", slow_wd17xx_interface )
753753MACHINE_DRIVER_END
754754
755755static MACHINE_DRIVER_START( luxor_55_21046 )
r4133r4134
759759   MDRV_CPU_CONFIG(fast_daisy_chain)
760760
761761   MDRV_Z80DMA_ADD(CONKORT_Z80DMA_TAG, XTAL_16MHz/4, dma_intf)
762   
763   MDRV_WD1793_ADD("wd1793", fast_wd17xx_interface )   
762
763   MDRV_WD1793_ADD("wd1793", fast_wd17xx_interface )
764764MACHINE_DRIVER_END
765765
766766/* ROMs */
r4133r4134
818818   astring *tempstring = astring_alloc();
819819
820820   /* validate arguments */
821   assert(device->machine != NULL);
822821   assert(device->tag != NULL);
823   assert(strlen(device->tag) < 20);
824822
825823   /* find our CPU */
826824   astring_printf(tempstring, "%s:%s", device->tag, CONKORT_Z80_TAG);
r4133r4134
889887   astring *tempstring = astring_alloc();
890888
891889   /* validate arguments */
892   assert(device->machine != NULL);
893890   assert(device->tag != NULL);
894   assert(strlen(device->tag) < 20);
895891
896892   /* find our CPU */
897893   astring_printf(tempstring, "%s:%s", device->tag, CONKORT_Z80_TAG);
src/mess/machine/rp5c15.c
r4133r4134
119119{
120120   const device_config* device = ptr;
121121   rp5c15_t* rtc = device->token;
122   
122
123123   if(rtc->pulse16_state == 0)  // low
124124   {
125125      rtc->pulse16_state = 1;  // make high
r4133r4134
148148   mame_system_time systm;
149149   mame_system_tm time;
150150
151   assert(device->machine != NULL);
152151   rtc->intf = device->static_config;
153152
154153   rtc->alarm_callback = rtc->intf->alarm_irq_callback;
r4133r4134
186185
187186   rtc_timer = timer_alloc(device->machine, rtc_alarm_pulse, (void*)device);
188187   timer_adjust_periodic(rtc_timer, attotime_zero, 0, ATTOTIME_IN_HZ(32));
189   
188
190189   return DEVICE_START_OK;
191190}
192191
r4133r4134
360359void rtc_add_second(const device_config* device)  // add one second to current time
361360{
362361   rp5c15_t* rtc = device->token;
363   
362
364363   if((rtc->mode & 0x08) == 0x00) // if timer is not enabled
365364      return;
366365   rtc->systime.sec_1++;
r4133r4134
377376void rtc_add_minute(const device_config* device)
378377{
379378   rp5c15_t* rtc = device->token;
380   
379
381380   rtc->systime.min_1++;
382381   if(rtc->systime.min_1 < 10)
383382      return;
r4133r4134
470469void rtc_add_month(const device_config* device)
471470{
472471   rp5c15_t* rtc = device->token;
473   
472
474473   rtc->systime.month_1++;
475474   if(rtc->systime.month_1 < 10 && rtc->systime.month_10 < 1)
476475      return;
src/mess/machine/ins8154.c
r4133r4134
11/*****************************************************************************
22 *
33 * machine/ins8154.h
4 *
4 *
55 * INS8154 N-Channel 128-by-8 Bit RAM Input/Output (RAM I/O)
6 *
6 *
77 * Written by Dirk Best, January 2008
88 *
99 * TODO: Strobed modes
10 *
10 *
1111 ****************************************************************************/
1212
1313#include "driver.h"
r4133r4134
4747   ins8154_t *ins8154 = device->token;
4848
4949   /* validate arguments */
50   assert(device->machine != NULL);
5150   assert(device->tag != NULL);
52   assert(strlen(device->tag) < 20);
5351
5452   /* assign interface */
5553   ins8154->intf = device->static_config;
r4133r4134
6967static DEVICE_RESET( ins8154 )
7068{
7169   ins8154_t *ins8154 = device->token;
72   
70
7371   ins8154->in_a = 0;
7472   ins8154->in_b = 0;
7573   ins8154->out_a = 0;
r4133r4134
9189         cpu_get_pc( device->machine->cpu[0] ), offset);
9290      return 0xff;
9391   }
94   
92
9593   switch (offset)
9694   {
9795   case 0x20:
r4133r4134
9997         val = i->intf->in_a_func(device, 0);
10098      i->in_a = val;
10199      break;
102     
100
103101   case 0x21:
104102      if (i->intf->in_b_func)
105103         val = i->intf->in_b_func(device, 0);
106104      i->in_b = val;
107105      break;
108     
106
109107   default:
110108      if (offset < 0x08)
111109      {
r4133r4134
121119      }
122120      break;
123121   }
124   
122
125123   return val;
126124}
127125
128126WRITE8_DEVICE_HANDLER( ins8154_porta_w )
129127{
130128   ins8154_t *i = device->token;
131   
129
132130   i->out_a = data;
133131
134132   /* Test if any pins are set as outputs */
r4133r4134
146144WRITE8_DEVICE_HANDLER( ins8154_portb_w )
147145{
148146   ins8154_t *i = device->token;
149   
147
150148   i->out_b = data;
151   
149
152150   /* Test if any pins are set as outputs */
153151   if (i->odrb)
154152   {
r4133r4134
164162WRITE8_DEVICE_HANDLER( ins8154_w )
165163{
166164   ins8154_t *i = device->token;
167   
165
168166   if (offset > 0x24)
169167   {
170168      logerror("INS8154 (%04x): Write %02x to invalid offset %02x!\n",
171169         cpu_get_pc( device->machine->cpu[0] ), data, offset);
172170      return;
173171   }
174   
172
175173   switch (offset)
176174   {
177175   case 0x20:
178176      ins8154_porta_w(device, 0, data);
179177      break;
180     
178
181179   case 0x21:
182180      ins8154_portb_w(device, 0, data);
183181      break;
184     
182
185183   case 0x22:
186184      LOG(("INS8154 (%04x): ODR for port A set to %02x\n",
187185         cpu_get_pc( device->machine->cpu[0] ), data));
188186      i->odra = data;
189187      break;
190     
188
191189   case 0x23:
192190      LOG(("INS8154 (%04x): ODR for port B set to %02x\n",
193191         cpu_get_pc( device->machine->cpu[0] ), data));
194192      i->odrb = data;
195193      break;
196     
194
197195   case 0x24:
198196      LOG(("INS8154 (%04x): MDR set to %02x\n",
199197         cpu_get_pc( device->machine->cpu[0] ), data));
200198      i->mdr = data;
201199      break;
202     
200
203201   default:
204202      if (offset & 0x10)
205203      {
r4133r4134
225223            ins8154_portb_w(device, 0, i->out_b & ~((offset >> 4) & 0x07));
226224         }
227225      }
228     
226
229227      break;
230228   }
231229}
src/mess/machine/74145.c
r4133r4134
7373   return (ttl74145_t *)device->token;
7474}
7575
76WRITE8_DEVICE_HANDLER( ttl74145_w ) {
76WRITE8_DEVICE_HANDLER( ttl74145_w ) {
7777   /* Decode number */
7878   ttl74145_t *ttl74145 = get_safe_token(device);
7979   UINT16 new_number = bcd_2_dec(data & 0x0f);
80   
80
8181   /* Call output callbacks if the number changed */
8282   if (new_number != ttl74145->number)
8383   {
8484      const ttl74145_interface *i = ttl74145->intf;
85   
85
8686      if (i->output_line_0) i->output_line_0(device, new_number == 0);
8787      if (i->output_line_1) i->output_line_1(device, new_number == 1);
8888      if (i->output_line_2) i->output_line_2(device, new_number == 2);
r4133r4134
9494      if (i->output_line_8) i->output_line_8(device, new_number == 8);
9595      if (i->output_line_9) i->output_line_9(device, new_number == 9);
9696   }
97   
97
9898   /* Update state */
99   ttl74145->number = new_number;     
99   ttl74145->number = new_number;
100100}
101101
102READ16_DEVICE_HANDLER( ttl74145_r ) {
102READ16_DEVICE_HANDLER( ttl74145_r ) {
103103   ttl74145_t *ttl74145 = get_safe_token(device);
104   
105   return ttl74145->number;
104
105   return ttl74145->number;
106106}
107107
108108/* Device Interface */
r4133r4134
114114
115115   assert(device != NULL);
116116   assert(device->tag != NULL);
117   assert(strlen(device->tag) < 20);
118117   assert(device->static_config != NULL);
119118
120119   ttl74145->intf = device->static_config;
121120   ttl74145->number = 0;
122   
121
123122   // register for state saving
124123   state_save_register_item(device->machine, "ttl74145", device->tag, 0, ttl74145->number);
125124   return DEVICE_START_OK;
src/mess/machine/cdp1871.c
r4133r4134
8282   int sense;                  /* sense input scan counter */
8383   int drive;                  /* drive output scan counter */
8484   int modifiers;               /* modifier inputs */
85   
85
8686   int da;                     /* data available flag */
8787   int next_da;               /* next value of data available flag */
8888   int rpt;                  /* repeat flag */
r4133r4134
206206   PORT_BIT( 0x10, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_4) PORT_CHAR('4') PORT_CHAR('$')
207207   PORT_BIT( 0x20, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_5) PORT_CHAR('5') PORT_CHAR('%')
208208   PORT_BIT( 0x40, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_6) PORT_CHAR('6') PORT_CHAR('&')
209   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('´')
209   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_7) PORT_CHAR('7') PORT_CHAR('�')
210210
211211   PORT_START("D2")
212212   PORT_BIT( 0x01, IP_ACTIVE_HIGH, IPT_KEYBOARD ) PORT_CODE(KEYCODE_8) PORT_CHAR('8') PORT_CHAR('(')
r4133r4134
295295   /* validate arguments */
296296   assert(device != NULL);
297297   assert(device->tag != NULL);
298   assert(strlen(device->tag) < 20);
299298
300299   cdp1871->intf = device->static_config;
301300
r4133r4134
306305   cdp1871->next_da = 1;
307306   cdp1871->next_rpt = 1;
308307   change_output_lines(device);
309   
308
310309   /* create the timers */
311310   cdp1871->scan_timer = timer_alloc(device->machine, cdp1871_scan_tick, (void *)device);
312311   timer_adjust_periodic(cdp1871->scan_timer, attotime_zero, 0, ATTOTIME_IN_HZ(cdp1871->intf->clock));
src/mess/machine/6883sam.c
r4133r4134
117117static void update_sam(const device_config *device)
118118{
119119   sam6883_t *sam = get_safe_token(device);
120   UINT16 xorval;   
120   UINT16 xorval;
121121
122122   xorval = sam->old_state ^ sam->state;
123123   sam->old_state = sam->state;
r4133r4134
159159{
160160   UINT16 mask;
161161   sam6883_t *sam = get_safe_token(device);
162   
162
163163   if (offset < 32)
164164   {
165165      mask = 1 << (offset / 2);
r4133r4134
235235
236236/* Device Interface */
237237static device_start_err common_start(const device_config *device, SAM6883_VERSION device_type)
238{   
238{
239239   sam6883_t *sam = get_safe_token(device);
240240   // validate arguments
241241   assert(device != NULL);
242242   assert(device->tag != NULL);
243   assert(strlen(device->tag) < 20);
244243   assert(device->static_config != NULL);
245244
246245   sam->intf = device->static_config;
247246
248247   sam->type = device_type;
249   
248
250249   sam->state = 0;
251250   sam->old_state = ~0;
252   
251
253252   /* save state registration */
254253   state_save_register_item(device->machine, "6883sam", NULL, 0, sam->state);
255254   state_save_register_item(device->machine, "6883sam", NULL, 0, sam->video_position);
src/mess/machine/6530miot.c
r4133r4134
382382   /* validate arguments */
383383   assert(device != NULL);
384384   assert(device->tag != NULL);
385   assert(strlen(device->tag) < 20);
386385
387386   /* set static values */
388387   miot->intf = device->static_config;
src/mess/machine/tms9901.c
r4133r4134
128128   double clock_rate;
129129
130130   /* Pointer to interface */
131   const tms9901_interface *intf;   
131   const tms9901_interface *intf;
132132};
133133
134134
r4133r4134
263263{
264264   const device_config *device = (const device_config *) ptr;
265265   tms9901_t *tms = get_token(device);
266   
266
267267   tms->timer_int_pending = TRUE;         /* decrementer interrupt requested */
268268
269269   tms9901_field_interrupts(device);
r4133r4134
542542static DEVICE_STOP( tms9901 )
543543{
544544   tms9901_t *tms = get_token(device);
545   
545
546546   if (tms->timer)
547547   {
548548      timer_reset(tms->timer, attotime_never);   /* FIXME - timers should only be allocated once */
r4133r4134
585585
586586   assert(device != NULL);
587587   assert(device->tag != NULL);
588   assert(strlen(device->tag) < 20);
589588   assert(device->static_config != NULL);
590589
591590   tms->intf = device->static_config;
r4133r4134
593592   tms->timer = timer_alloc(device->machine, decrementer_callback, (void *) device);
594593
595594   tms->supported_int_mask = tms->intf->supported_int_mask;
596   
595
597596   tms->clock_rate = tms->intf->clock_rate;
598597
599598   tms->int_state = 0;
src/mess/machine/68901mfp.c
r4133r4134
251251   UINT8 tbcr;                     /* timer B control register */
252252   UINT8 tcdcr;                  /* timers C and D control register */
253253   UINT8 tdr[MC68901_MAX_TIMERS];      /* timer data registers */
254   
254
255255   UINT8 scr;                     /* synchronous character register */
256256   UINT8 ucr;                     /* USART control register */
257257   UINT8 tsr;                     /* transmitter status register */
258258   UINT8 rsr;                     /* receiver status register */
259259   UINT8 udr;                     /* USART data register */
260   
260
261261   /* counter timer state */
262262   UINT8 tmc[MC68901_MAX_TIMERS];      /* timer main counters */
263263   int ti[MC68901_MAX_TIMERS];         /* timer in latch */
r4133r4134
265265
266266   /* interrupt state */
267267   int irqlevel;                  /* interrupt level latch */
268   
268
269269   /* serial state */
270270   UINT8 next_rsr;                  /* receiver status register latch */
271271   int rsr_read;                  /* receiver status register read flag */
r4133r4134
288288
289289   /* timers */
290290   emu_timer *timer[MC68901_MAX_TIMERS]; /* counter timers */
291   
291
292292   emu_timer *rx_timer;            /* receive timer */
293293   emu_timer *tx_timer;            /* transmit timer */
294294
r4133r4134
13781378   mc68901_t *mc68901 = device->token;
13791379
13801380   /* validate arguments */
1381   assert(device->machine != NULL);
13821381   assert(device->tag != NULL);
1383   assert(strlen(device->tag) < 20);
1382
13841383   mc68901->intf = device->static_config;
13851384
13861385   /* set initial values */
src/mess/machine/tms9902.c
r4133r4134
9393   void *timer;         /* MESS timer, used to emulate the decrementer register */
9494
9595   /* Pointer to interface */
96   const tms9902_interface *intf;   
96   const tms9902_interface *intf;
9797};
9898
9999/* bits in register_select */
r4133r4134
146146   function device should be called by the driver when the state of CTS changes
147147
148148   state == 0: CTS* is inactive (high)
149   state != 0: CTS* is active (low)
149   state != 0: CTS* is active (low)
150150*/
151151void tms9902_set_cts(const device_config *device, int state)
152152{
r4133r4134
213213{
214214   const device_config *device = (const device_config *) ptr;
215215   tms9902_t *tms9902 = get_token(device);
216   
216
217217   if (tms9902->TIMELP)
218218      tms9902->TIMERR = 1;
219219   else
r4133r4134
273273static void initiate_transmit(const device_config *device)
274274{
275275   tms9902_t *tms9902 = get_token(device);
276   
276
277277   /* Load transmit register */
278278   tms9902->XSR = tms9902->XBR;
279279   tms9902->XSRE = 0;
r4133r4134
369369WRITE8_DEVICE_HANDLER( tms9902_cru_w )
370370{
371371   tms9902_t *tms9902 = get_token(device);
372   
372
373373   data &= 1;   /* clear extra bits */
374374   offset &= 0x01F;
375375
r4133r4134
578578static DEVICE_STOP( tms9902 )
579579{
580580   tms9902_t *tms9902 = get_token(device);
581   
581
582582   if (tms9902->timer)
583583   {
584584      timer_reset(tms9902->timer, attotime_never);   /* FIXME - timers should only be allocated once */
r4133r4134
634634
635635   assert(device != NULL);
636636   assert(device->tag != NULL);
637   assert(strlen(device->tag) < 20);
638637   assert(device->static_config != NULL);
639638
640639   tms9902->intf = device->static_config;
src/mess/machine/nec765.c
r4133r4134
128128   int timer_type;
129129
130130   emu_timer *command_timer;
131   
131
132132   char *data_buffer;
133133   const nec765_interface *intf;
134134};
r4133r4134
223223}
224224
225225static void nec765_seek_complete(const device_config *device)
226{   
226{
227227   /* tested on Amstrad CPC */
228228
229229   /* if a seek is done without drive connected: */
r4133r4134
279279
280280   const device_config *img = current_image(device);
281281   nec765_t *fdc = get_safe_token(device);
282   
282
283283   if (!img)
284284      return;
285285
r4133r4134
410410}
411411
412412static TIMER_CALLBACK(nec765_timer_callback)
413{   
413{
414414   const device_config *device = ptr;
415415   nec765_timer_func(device,param);
416416}
r4133r4134
424424static void nec765_setup_timed_generic(const device_config *device, int timer_type, attotime duration)
425425{
426426   nec765_t *fdc = get_safe_token(device);
427   
427
428428   fdc->timer_type = timer_type;
429429
430430   if (!(fdc->nec765_flags & NEC765_DMA_MODE))
r4133r4134
578578static void nec765_setup_execution_phase_write(const device_config *device, char *ptr, int size)
579579{
580580   nec765_t *fdc = get_safe_token(device);
581   
581
582582   fdc->FDC_main &= ~0x040;                     /* FDC->CPU */
583583
584584   fdc->nec765_transfer_bytes_count = 0;
r4133r4134
594594static void nec765_setup_result_phase(const device_config *device, int byte_count)
595595{
596596   nec765_t *fdc = get_safe_token(device);
597   
597
598598   fdc->FDC_main |= 0x040;                     /* FDC->CPU */
599599   fdc->FDC_main &= ~0x020;                    /* not execution phase */
600600
r4133r4134
608608void nec765_idle(const device_config *device)
609609{
610610   nec765_t *fdc = get_safe_token(device);
611   
611
612612   fdc->FDC_main &= ~0x040;                     /* CPU->FDC */
613613   fdc->FDC_main &= ~0x020;                    /* not execution phase */
614614   fdc->FDC_main &= ~0x010;                     /* not busy */
r4133r4134
625625   unsigned int new_flags;
626626   unsigned int changed_flags;
627627   nec765_t *fdc = get_safe_token(device);
628   
628
629629   assert((flags & ~mask) == 0);
630630
631631   /* compute the new flags and which ones have changed */
r4133r4134
17161716READ8_DEVICE_HANDLER(nec765_data_r)
17171717{
17181718   nec765_t *fdc = get_safe_token(device);
1719   
1719
17201720   if ((fdc->FDC_main & 0x0c0) == 0x0c0)
17211721   {
17221722      if (
r4133r4134
17441744WRITE8_DEVICE_HANDLER(nec765_data_w)
17451745{
17461746   nec765_t *fdc = get_safe_token(device);
1747   
1747
17481748   if (LOG_EXTRA)
17491749      logerror("DATA W: %02x\n", data);
17501750
r4133r4134
17731773static void nec765_setup_invalid(const device_config *device)
17741774{
17751775   nec765_t *fdc = get_safe_token(device);
1776   
1776
17771777   fdc->command = 0;
17781778   fdc->nec765_result_bytes[0] = 0x080;
17791779   nec765_setup_result_phase(device,1);
r4133r4134
17821782static void nec765_setup_command(const device_config *device)
17831783{
17841784   nec765_t *fdc = get_safe_token(device);
1785   
1785
17861786   static const char *const commands[] =
17871787   {
17881788      NULL,                  /* [00] */
r4133r4134
21502150void nec765_reset(const device_config *device, int offset)
21512151{
21522152   nec765_t *fdc = get_safe_token(device);
2153   
2153
21542154   /* nec765 in idle state - ready to accept commands */
21552155   nec765_idle(device);
21562156
r4133r4134
21972197void nec765_set_reset_state(const device_config *device, int state)
21982198{
21992199   nec765_t *fdc = get_safe_token(device);
2200   
2200
22012201   int flags;
22022202
22032203   /* get previous reset state */
r4133r4134
22332233void nec765_set_ready_state(const device_config *device, int state)
22342234{
22352235   nec765_t *fdc = get_safe_token(device);
2236   
2236
22372237   /* clear ready state */
22382238   fdc->nec765_flags &= ~NEC765_FDD_READY;
22392239
r4133r4134
22532253
22542254   assert(device != NULL);
22552255   assert(device->tag != NULL);
2256   assert(strlen(device->tag) < 20);
22572256   assert(device->static_config != NULL);
2258   
2257
22592258   fdc->intf = device->static_config;
22602259
22612260   fdc->version = device_type;
r4133r4134
22952294static DEVICE_RESET( nec765 )
22962295{
22972296   int i;
2298     
2297
22992298   for (i = 0; i < device_count(device->machine, IO_FLOPPY); i++) {
23002299      const device_config *img = image_from_devtype_and_index(device->machine, IO_FLOPPY, i);
23012300      floppy_drive_set_controller(img, device);
23022301      floppy_drive_set_ready_state_change_callback(img, nec765_set_ready_change_callback);
23032302   }
2304   
2303
23052304   nec765_reset(device,0);
23062305}
23072306
src/mess/machine/x68k_hdc.c
r4133r4134
3434   unsigned char val;
3535
3636   /*ret = */image_fread(device,&val,1);
37   
37
3838   return val;
3939}
4040
r4133r4134
4747{
4848   sasi_ctrl_t* sasi = device->token;
4949
50   assert(device->machine != NULL);
51
5250   sasi->status = 0x00;
5351   sasi->status_port = 0x00;
5452   sasi->phase = SASI_PHASE_BUSFREE;
r4133r4134
386384               sasi->transfer_byte_total = 0;
387385            }
388386         }
389         
387
390388         switch(sasi->command[0])
391389         {
392390         case SASI_CMD_REQUEST_SENSE:
src/mess/machine/i8271.c
r4133r4134
15541554
15551555   assert(device != NULL);
15561556   assert(device->tag != NULL);
1557   assert(strlen(device->tag) < 20);
15581557   assert(device->static_config != NULL);
15591558
15601559   i8271->intf = device->static_config;
src/mess/machine/upd7002.c
r4133r4134
2828      D7 0 = conversion completed, 1 = conversion not completed  (~EOC)
2929   */
3030   int status;
31   
31
3232   /* High data byte
3333      This byte contains the 8 most significant bits of the analogue to digital conversion. */
3434   int data1;
35   
35
3636   /* Low data byte
3737      In 12 bit mode: Bits 7 to 4 define the four low order bits of the conversion.
3838      In  8 bit mode. All bits 7 to 4 are inaccurate.
3939      Bits 3 to 0 are always set to low. */
4040   int data0;
41   
42   
41
42
4343   /* temporary store of the next A to D conversion */
4444   int digitalvalue;
4545
r4133r4134
4747   if the uPD7002 is half way through one conversion and a new conversion is requested
4848   the counter at the end of the first conversion will not match and not be processed
4949   only then at the end of the second conversion will the conversion complete function run */
50   int conversion_counter;   
50   int conversion_counter;
5151};
5252
5353
r4133r4134
182182
183183   assert(device != NULL);
184184   assert(device->tag != NULL);
185   assert(strlen(device->tag) < 20);
186185   assert(device->static_config != NULL);
187186
188187   uPD7002->intf = device->static_config;
r4133r4134
191190   uPD7002->data0 = 0;
192191   uPD7002->digitalvalue = 0;
193192   uPD7002->conversion_counter = 0;
194   
193
195194   // register for state saving
196195   state_save_register_item(device->machine, "uPD7002", device->tag, 0, uPD7002->status);
197196   state_save_register_item(device->machine, "uPD7002", device->tag, 0, uPD7002->data1);
src/mess/machine/adc080x.c
r4133r4134
2020   int start;                     /* start conversion pin */
2121   int eoc;                     /* end of conversion pin */
2222   int next_eoc;                  /* next value end of conversion pin */
23   
23
2424   UINT8 sar;                     /* successive approximation register */
2525
2626   int cycle;                     /* clock cycle counter */
r4133r4134
139139   /* validate arguments */
140140   assert(device != NULL);
141141   assert(device->tag != NULL);
142   assert(strlen(device->tag) < 20);
143142
144143   adc080x->intf = device->static_config;
145144
src/mess/machine/mm58274c.c
r4133r4134
194194WRITE8_DEVICE_HANDLER (mm58274c_w)
195195{
196196   mm58274c_t *mm58274c = get_safe_token(device);
197   
197
198198   offset &= 0xf;
199199   data &= 0xf;
200200
r4133r4134
444444static DEVICE_START( mm58274c )
445445{
446446   mm58274c_t *mm58274c = get_safe_token(device);
447   
447
448448   // validate arguments
449449   assert(device != NULL);
450450   assert(device->tag != NULL);
451   assert(strlen(device->tag) < 20);
452451   assert(device->static_config != NULL);
453452
454453   mm58274c->intf = device->static_config;
r4133r4134
470469   state_save_register_item(device->machine, "mm58274c", device->tag, 0, mm58274c->minutes2);
471470   state_save_register_item(device->machine, "mm58274c", device->tag, 0, mm58274c->seconds1);
472471   state_save_register_item(device->machine, "mm58274c", device->tag, 0, mm58274c->seconds2);
473   state_save_register_item(device->machine, "mm58274c", device->tag, 0, mm58274c->tenths);     
472   state_save_register_item(device->machine, "mm58274c", device->tag, 0, mm58274c->tenths);
474473
475474   mm58274c->increment_rtc = timer_alloc(device->machine, increment_rtc, ((void*)device));
476475   timer_adjust_periodic(mm58274c->increment_rtc, attotime_zero, 0, ATTOTIME_IN_MSEC(100));
r4133r4134
491490   mm58274c->clk_set = systime.local_time.year & 3 << 2;
492491   if (mm58274c->intf->mode24)
493492      mm58274c->clk_set |= clk_set_24;
494               
493
495494   /* The clock count starts on 1st January 1900 */
496495   mm58274c->wday = 1 + ((systime.local_time.weekday - mm58274c->intf->day1)%7);
497496   mm58274c->years1 = (systime.local_time.year / 10) % 10;
src/mess/machine/e0516.c
r4133r4134
1616struct _e0516_t
1717{
1818   const e0516_interface *intf;   /* interface */
19   
19
2020   int cs;                     /* chip select */
2121   int data_latch;               /* data latch */
2222   int reg_latch;               /* register latch */
r4133r4134
4747   e0516_t *e0516 = get_safe_token(device);
4848
4949   e0516->reg[E0516_REGISTER_SECOND]++;
50   
50
5151   if (e0516->reg[E0516_REGISTER_SECOND] == 60)
5252   {
5353      e0516->reg[E0516_REGISTER_SECOND] = 0;
r4133r4134
150150            e0516->data_latch |= e0516->dio << 7;
151151            e0516->data_latch >>= 1;
152152         }
153         
153
154154         if (e0516->bits == 8)
155155         {
156156            e0516->state = 0;
r4133r4134
192192   /* validate arguments */
193193   assert(device != NULL);
194194   assert(device->tag != NULL);
195   assert(strlen(device->tag) < 20);
196195
197196   e0516->intf = device->static_config;
198197
src/mess/machine/abc77.c
r4133r4134
7979
8080      cpu_set_input_line(abc77->cpu, INPUT_LINE_RESET, ASSERT_LINE);
8181      timer_adjust_oneshot(abc77->reset_timer, ATTOTIME_IN_MSEC(t), 0);
82     
82
8383      cpu_set_input_line(abc77->cpu, MCS48_INPUT_EA, ea ? CLEAR_LINE : ASSERT_LINE);
8484   }
8585
r4133r4134
322322
323323   /* validate arguments */
324324
325   assert(device->machine != NULL);
326325   assert(device->tag != NULL);
327   assert(strlen(device->tag) < 20);
326
328327   abc77->intf = device->static_config;
329328   assert(abc77->intf != NULL);
330329   assert(abc77->intf->txd_w != NULL);
src/mess/machine/zx8302.c
r4133r4134
102102
103103   int mdv_motor;               /* selected motor */
104104   int mdv_offset[8];            /* image offset */
105   
105
106106   UINT8 *mdv_image[8];         /* image */
107107
108108   /* timers */
r4133r4134
224224void zx8302_comctl_w(const device_config *device, int level)
225225{
226226   if (LOG) logerror("IPC COMCTL W: %x\n", level);
227   
227
228228   if (level == 1)
229229   {
230230      zx8302_ipc_comm_tick(device);
r4133r4134
573573   /* validate arguments */
574574   assert(device != NULL);
575575   assert(device->tag != NULL);
576   assert(strlen(device->tag) < 20);
577576   assert(device->clock > 0);
578577
579578   zx8302->intf = device->static_config;
r4133r4134
619618   state_save_register_item(device->machine, "zx8302", device->tag, 0, zx8302->ipc_rx);
620619   state_save_register_item(device->machine, "zx8302", device->tag, 0, zx8302->ipc_busy);
621620   state_save_register_item(device->machine, "zx8302", device->tag, 0, zx8302->baudx4);
622   
621
623622   state_save_register_item(device->machine, "zx8302", device->tag, 0, zx8302->tx_bits);
624623   state_save_register_item(device->machine, "zx8302", device->tag, 0, zx8302->ser1_rxd);
625624   state_save_register_item(device->machine, "zx8302", device->tag, 0, zx8302->ser1_cts);
r4133r4134
632631   state_save_register_item(device->machine, "zx8302", device->tag, 0, zx8302->mdselck);
633632   state_save_register_item(device->machine, "zx8302", device->tag, 0, zx8302->mdseld);
634633   state_save_register_item(device->machine, "zx8302", device->tag, 0, zx8302->erase);
635   
634
636635   state_save_register_item(device->machine, "zx8302", device->tag, 0, zx8302->mdv_motor);
637636   state_save_register_item_array(device->machine, "zx8302", device->tag, 0, zx8302->mdv_offset);
638637   return DEVICE_START_OK;
src/mess/machine/hd63450.c
r4133r4134
5252   hd63450_t* dmac = device->token;
5353   int x;
5454
55   assert(device->machine != NULL);
5655   dmac->intf = device->static_config;
5756
5857   // Initialise timers and registers

Previous 15994 Revisions Next


© 1998-2018 The MESS Team