Previous 15994 Revisions Next

r4877 Friday 29th May, 2009 at 06:24:02 UTC by Barry Rodewald
[FM7] Added sub-CPU timer NMI.
[src/mess/drivers]fm7.c

src/mess/drivers/fm7.c
r4876r4877
4747static UINT8 irq_flags;  // active IRQ flags
4848static UINT8 irq_mask;  // IRQ mask
4949emu_timer* fm7_timer;  // main timer, triggered every 2.0345ms?
50emu_timer* fm7_subtimer;  // sub-CPU timer, every 1 second?
5051static UINT8 sub_busy;
5152static UINT8 basic_rom_en;
5253static UINT8 attn_irq;
r4876r4877
158159
159160READ8_HANDLER( fm7_subintf_r )
160161{
161   return sub_busy & 0x80;
162   UINT8 ret = 0;
163   
164   if(sub_busy != 0)
165      ret |= 0x80;
166     
167   return ret;
162168}
163169
164170WRITE8_HANDLER( fm7_subintf_w )
r4876r4877
251257   crt_enable = 0;
252258}
253259
260READ8_HANDLER( fm7_fdc_r )
261{
262   switch(offset)
263   {
264      case 0:
265         return 0x80;  // drive not ready
266      default:
267         logerror("FDC: read from 0x%04x\n",offset+0xfd18);
268   }
269   return 0x00;
270}
271
272WRITE8_HANDLER( fm7_fdc_w )
273{
274   switch(offset)
275   {
276      default:
277         logerror("FDC: wrote %02x to 0x%04x\n",data,offset+0xfd18);
278   }
279}
280
254281static TIMER_CALLBACK( fm7_timer_irq )
255282{
256   if(~irq_mask & IRQ_FLAG_TIMER)
283   if(irq_mask & IRQ_FLAG_TIMER)
257284   {
258285      irq_flags |= IRQ_FLAG_TIMER;
259286      cputag_set_input_line(machine,"maincpu",M6809_IRQ_LINE,ASSERT_LINE);
260287   }
261288}
262289
290static TIMER_CALLBACK( fm7_subtimer_irq )
291{
292   cputag_set_input_line(machine,"sub",INPUT_LINE_NMI,PULSE_LINE);
293}
294
263295static IRQ_CALLBACK(fm7_irq_ack)
264296{
265297   cputag_set_input_line(device->machine,"maincpu",irqline,CLEAR_LINE);
r4876r4877
294326   AM_RANGE(0xfd0d,0xfd0d) AM_DEVWRITE("psg",ay8910_address_w)
295327   AM_RANGE(0xfd0e,0xfd0e) AM_DEVREADWRITE("psg",ay8910_r,ay8910_data_w)
296328   AM_RANGE(0xfd0f,0xfd0f) AM_READWRITE(fm7_rom_en_r,fm7_rom_en_w)
329   AM_RANGE(0xfd18,0xfd1f) AM_READWRITE(fm7_fdc_r,fm7_fdc_w)
297330   // Boot ROM
298331   AM_RANGE(0xfe00,0xffef) AM_ROM AM_REGION("basic",0x0000)
299332   AM_RANGE(0xfff0,0xffff) AM_READWRITE(vector_r,vector_w)
r4876r4877
341374   shared_ram = auto_alloc_array(machine,UINT8,0x80);
342375   fm7_video_ram = auto_alloc_array(machine,UINT8,0xc000);
343376   fm7_timer = timer_alloc(machine,fm7_timer_irq,NULL);
377   fm7_subtimer = timer_alloc(machine,fm7_subtimer_irq,NULL);
344378   cpu_set_irq_callback(cputag_get_cpu(machine,"maincpu"),fm7_irq_ack);
345379   cpu_set_irq_callback(cputag_get_cpu(machine,"sub"),fm7_sub_irq_ack);
346380}
r4876r4877
361395{
362396   UINT8* RAM = memory_region(machine,"maincpu");
363397   
364   timer_adjust_periodic(fm7_timer,attotime_zero,0,ATTOTIME_IN_USEC(2034));
398   timer_adjust_periodic(fm7_timer,ATTOTIME_IN_USEC(2034),0,ATTOTIME_IN_USEC(2034));
399   timer_adjust_periodic(fm7_subtimer,ATTOTIME_IN_MSEC(20),0,ATTOTIME_IN_MSEC(20));
365400   irq_mask = 0xff;
366401   irq_flags = 0x00;
367402   attn_irq = 0;

Previous 15994 Revisions Next


© 1998-2018 The MESS Team