Previous 15994 Revisions Next

r14019 Saturday 14th January, 2012 at 01:30:31 UTC by Barry Rodewald
fmtowns: Properly implemented freerun timer, and added the second PIT. (no whatsnew)
[src/mess/drivers]fmtowns.c
[src/mess/includes]fmtowns.h

src/mess/includes/fmtowns.h
r14018r14019
2222#include "machine/scsi.h"
2323#include "machine/fm_scsi.h"
2424
25#define IRQ_LOG 1  // set to 1 to log IRQ line activity
25#define IRQ_LOG 0  // set to 1 to log IRQ line activity
2626
2727READ8_HANDLER( towns_gfx_high_r );
2828WRITE8_HANDLER( towns_gfx_high_w );
src/mess/drivers/fmtowns.c
r14018r14019
234234         return 0x00;
235235      case 0x06:
236236         //logerror("SYS: (0x26) timer read\n");
237         m_ftimer -= 0x13;
238         return m_ftimer;
237         return m_freerun_timer;
239238      case 0x07:
240         return m_ftimer >> 8;
239         return m_freerun_timer >> 8;
241240      case 0x08:
242241         //logerror("SYS: (0x28) NMI mask read\n");
243242         return m_nmi_mask & 0x01;
r14018r14019
359358
360359WRITE8_MEMBER(towns_state::towns_sys6c_w)
361360{
362//  logerror("SYS: (0x6c) write to timer (0x%02x)\n",data);
363   m_ftimer -= 0x54;
364361   // halts the CPU for a period of time (exact length unknown)
365362   device_set_input_line(m_maincpu,INPUT_LINE_HALT,ASSERT_LINE);
366363   m_towns_wait_timer->adjust(attotime::from_usec(1),0,attotime::never);
r14018r14019
20072004   if(tstate->m_towns_timer_mask & 0x01)
20082005   {
20092006      pic8259_ir0_w(dev, state);
2010      if(IRQ_LOG) logerror("PIC: IRQ0 (PIT Timer) set to %i\n",state);
2007      if(IRQ_LOG) logerror("PIC: IRQ0 (PIT Timer ch0) set to %i\n",state);
20112008   }
20122009}
20132010
20142011static WRITE_LINE_DEVICE_HANDLER( towns_pit_out1_changed )
20152012{
20162013   towns_state* tstate = device->machine().driver_data<towns_state>();
2017//  device_t* dev = tstate->m_pic_master;
2014   device_t* dev = tstate->m_pic_master;
20182015
20192016   if(tstate->m_towns_timer_mask & 0x02)
20202017   {
2021      //pic8259_ir0_w(dev, state);
2018      pic8259_ir0_w(dev, state);
2019      if(IRQ_LOG) logerror("PIC: IRQ0 (PIT Timer ch1) set to %i\n",state);
20222020   }
20232021}
20242022
r14018r14019
21162114  AM_RANGE(0x0010,0x0013) AM_DEVREADWRITE8_LEGACY("pic8259_slave", pic8259_r, pic8259_w, 0x00ff00ff)
21172115  AM_RANGE(0x0020,0x0033) AM_READWRITE8(towns_system_r,towns_system_w, 0xffffffff)
21182116  AM_RANGE(0x0040,0x0047) AM_DEVREADWRITE8_LEGACY("pit",pit8253_r, pit8253_w, 0x00ff00ff)
2117  AM_RANGE(0x0050,0x0057) AM_DEVREADWRITE8_LEGACY("pit2",pit8253_r, pit8253_w, 0x00ff00ff)
21192118  AM_RANGE(0x0060,0x0063) AM_READWRITE8(towns_port60_r, towns_port60_w, 0x000000ff)
21202119  AM_RANGE(0x0068,0x006b) AM_READWRITE8(towns_intervaltimer2_r, towns_intervaltimer2_w, 0xffffffff)
21212120  AM_RANGE(0x006c,0x006f) AM_READWRITE8(towns_sys6c_r,towns_sys6c_w, 0x000000ff)
r14018r14019
24922491   m_intervaltimer2_irqmask = 1;  // masked
24932492   m_towns_rtc_timer->adjust(attotime::zero,0,attotime::from_hz(1));
24942493   m_towns_kb_timer->adjust(attotime::zero,0,attotime::from_msec(10));
2495   /* Why does enabling this timer break the driver? */
2496   //m_towns_freerun_counter->adjust(attotime::zero,0,attotime::from_usec(1));
2494   m_towns_freerun_counter->adjust(attotime::zero,0,attotime::from_usec(1));
24972495}
24982496
24992497static const struct pit8253_config towns_pit8253_config =
r14018r14019
25172515   }
25182516};
25192517
2518static const struct pit8253_config towns_pit8253_config_2 =
2519{
2520   {
2521      {
2522         307200,
2523         DEVCB_NULL,
2524         DEVCB_NULL  // reserved
2525      },
2526      {
2527         307200,
2528         DEVCB_NULL,
2529         DEVCB_NULL  // RS-232
2530      },
2531      {
2532         307200,
2533         DEVCB_NULL,
2534         DEVCB_NULL  // reserved
2535      }
2536   }
2537};
2538
25202539static READ8_DEVICE_HANDLER( get_slave_ack )
25212540{
25222541   towns_state* state = device->machine().driver_data<towns_state>();
r14018r14019
26732692   MCFG_SOUND_ROUTE(ALL_OUTPUTS, "mono", 0.50)
26742693
26752694   MCFG_PIT8253_ADD("pit",towns_pit8253_config)
2695   MCFG_PIT8253_ADD("pit2",towns_pit8253_config_2)
26762696
26772697   MCFG_PIC8259_ADD( "pic8259_master", towns_pic8259_master_config )
26782698

Previous 15994 Revisions Next


© 1998-2018 The MESS Team