Previous 15994 Revisions Next

r15674 Wednesday 25th July, 2012 at 21:15:43 UTC by Angelo Salese
[PC-8801]: Improved irq related functions, less prone to spurious by now
[src/mess/drivers]pc8801.c

src/mess/drivers/pc8801.c
r15673r15674
2222
2323    per-game specific TODO:
2424    - 177: gameplay is too fast (parent pc8801 only);
25    - Acro Jet: hangs waiting for an irq;
25    - Acro Jet: hangs waiting for an irq (floppy issue);
2626    - Advanced Fantasian: wants an irq that can't happen (I is equal to 0x3f)
2727    - American Success: reads the light pen?
28    - Alpha (demo): crashes with "illegal function" msg;
29    - Aploon: crashes because it doesn't clear irqs when it's supposed to do so;
28    - Alpha (demo): stuck note in title screen, doesn't seem to go further;
3029    - Balance of Power: attempt to use the SIO port for mouse polling, worked around for now;
3130    - Battle Entry: moans with a JP msg then dies if you try to press either numpad 1 or 2 (asks if the user wants to use the sound board (yes 1 / no 2)
3231    - Bishoujo Baseball Gakuen: checks ym2608 after intro screen;
r15673r15674
162161
163162//#define USE_PROPER_I8214
164163
164
165#define IRQ_DEBUG      (0)
166#define IRQ_LOG(x) do { if (IRQ_DEBUG) printf x; } while (0)
167
165168#define MASTER_CLOCK XTAL_4MHz
166169
167170#define I8214_TAG      "i8214"
r15673r15674
10491052      m_i8214_irq_level = 7;
10501053   else
10511054      m_i8214_irq_level = data & 7;
1055
1056   IRQ_LOG(("%02x LV\n",m_i8214_irq_level));
10521057}
10531058
10541059
r15673r15674
10631068   if(m_vrtc_irq_mask == 0)
10641069      m_vrtc_irq_latch = 0;
10651070
1071   if(m_timer_irq_mask == 0 && m_vrtc_irq_mask == 0)
1072      cputag_set_input_line(machine(),"maincpu",0,CLEAR_LINE);
1073
1074   IRQ_LOG(("%02x MASK\n",data));
1075
10661076   //if(data & 4)
10671077   //  printf("IRQ mask %02x\n",data);
10681078}
r15673r15674
12741284WRITE8_MEMBER(pc8801_state::pc8801_pcg8100_w)
12751285{
12761286   if(data)
1277   printf("Write to PCG-8100 %02x %02x\n",offset,data);
1287      printf("Write to PCG-8100 %02x %02x\n",offset,data);
12781288}
12791289
12801290/* Balance of Power temp work-around */
r15673r15674
15661576   ADDRESS_MAP_GLOBAL_MASK(0xff)
15671577   AM_RANGE(0xf0, 0xf0) AM_WRITE(fdc_irq_vector_w) // Interrupt Opcode Port
15681578   AM_RANGE(0xf4, 0xf4) AM_WRITE(fdc_drive_mode_w) // Drive mode, 2d, 2dd, 2hd
1569//  AM_RANGE(0xf7, 0xf7) AM_WRITENOP // printer port output
1579   AM_RANGE(0xf7, 0xf7) AM_WRITENOP // printer port output
15701580   AM_RANGE(0xf8, 0xf8) AM_READWRITE(upd765_tc_r,upd765_mc_w) // (R) Terminal Count Port (W) Motor Control Port
15711581   AM_RANGE(0xfa, 0xfa) AM_DEVREAD_LEGACY("upd765", upd765_status_r )
15721582   AM_RANGE(0xfb, 0xfb) AM_DEVREADWRITE_LEGACY("upd765", upd765_data_r, upd765_data_w )
r15673r15674
19841994}
19851995
19861996#else
1997
1998#include "debugger.h"
1999
19872000static IRQ_CALLBACK( pc8801_irq_callback )
19882001{
19892002   pc8801_state *state = device->machine().driver_data<pc8801_state>();
1990   if(state->m_i8214_irq_level >= 5 && state->m_sound_irq_latch)
2003   if(state->m_sound_irq_latch)
19912004   {
19922005      state->m_sound_irq_latch = 0;
19932006      return 4*2;
19942007   }
1995   else if(state->m_i8214_irq_level >= 2 && state->m_vrtc_irq_latch)
2008   else if(state->m_vrtc_irq_latch)
19962009   {
19972010      state->m_vrtc_irq_latch = 0;
19982011      return 1*2;
19992012   }
2000   else if(state->m_i8214_irq_level >= 3 && state->m_timer_irq_latch)
2013   else if(state->m_timer_irq_latch)
20012014   {
20022015      state->m_timer_irq_latch = 0;
20032016      return 2*2;
20042017   }
20052018
20062019   printf("IRQ triggered but no vector on the bus! %02x %02x %02x %02x\n",state->m_i8214_irq_level,state->m_sound_irq_latch,state->m_vrtc_irq_latch,state->m_timer_irq_latch);
2020   debugger_break(device->machine());
20072021
2008   return 2*2; //TODO: mustn't happen, it does if you press shift on N88-BASIC
2022   return 4*2; //TODO: mustn't happen
20092023}
20102024
20112025static void pc8801_sound_irq( device_t *device, int irq )
20122026{
20132027   pc8801_state *state = device->machine().driver_data<pc8801_state>();
2014   if(state->m_sound_irq_mask)
2028   if(state->m_sound_irq_mask && state->m_i8214_irq_level >= 5 && irq)
20152029   {
2016      state->m_sound_irq_latch = irq;
2017      cputag_set_input_line(device->machine(),"maincpu",0,irq);
2030      state->m_sound_irq_latch = 1;
2031      //IRQ_LOG(("sound\n"));
2032      cputag_set_input_line(device->machine(),"maincpu",0,HOLD_LINE);
20182033   }
20192034}
20202035
20212036static TIMER_DEVICE_CALLBACK( pc8801_rtc_irq )
20222037{
20232038   pc8801_state *state = timer.machine().driver_data<pc8801_state>();
2024   if(state->m_timer_irq_mask)
2039   if(state->m_timer_irq_mask && state->m_i8214_irq_level >= 3)
20252040   {
20262041      state->m_timer_irq_latch = 1;
2042      //IRQ_LOG(("timer\n"));
20272043      cputag_set_input_line(timer.machine(),"maincpu",0,HOLD_LINE);
20282044   }
20292045}
r15673r15674
20312047static INTERRUPT_GEN( pc8801_vrtc_irq )
20322048{
20332049   pc8801_state *state = device->machine().driver_data<pc8801_state>();
2034   if(state->m_vrtc_irq_mask)
2050   if(state->m_vrtc_irq_mask && state->m_i8214_irq_level >= 2)
20352051   {
20362052      state->m_vrtc_irq_latch = 1;
2053      //IRQ_LOG(("vrtc\n"));
20372054      device_set_input_line(device,0,HOLD_LINE);
20382055   }
20392056}

Previous 15994 Revisions Next


© 1998-2018 The MESS Team