Previous 15994 Revisions Next

r10064 Sunday 16th January, 2011 at 22:33:49 UTC by Angelo Salese
[PC-8801] Added i8214 irq hook-up, taken from the old driver
[src/mess/drivers]pc8801.c

src/mess/drivers/pc8801.c
r10063r10064
22
33    PC-8801 (c) 1981 NEC
44
5    preliminary driver by Angelo Salese
5    preliminary driver by Angelo Salese, original MESS PC-88SR by ???
66
77    TODO:
88   - used to do more, currently under rewriting stage. We are currently using plain PC-8801 as the base, will add differences for the
r10063r10064
116116static UINT8 vrtc_irq_mask,sound_irq_mask;
117117static UINT8 window_offset_bank;
118118static UINT8 layer_mask;
119static UINT8 i8214_irq_level,i8214_irq_state;
119120
121static void pc8801_update_irq(running_machine *machine)
122{
123   int level, i;
124
125   level = -1;
126   for (i = 0; i < 8; i++)
127   {
128      if ((i8214_irq_state & (1<<i)) != 0)
129         level = i;
130   }
131
132   if (level >= 0 && level < i8214_irq_level)
133      cputag_set_input_line(machine, "maincpu", 0, HOLD_LINE);
134}
135
136static void pc8801_raise_irq(running_machine *machine, int level)
137{
138   i8214_irq_state |= (1<<level);
139   pc8801_update_irq(machine);
140}
141
120142/*
121143CRTC command params:
1221440. CRTC reset
r10063r10064
503525   bankw[4] = pc8801_bankswitch_4_w(space->machine);
504526}
505527
528static WRITE8_HANDLER( pc8801_irq_level_w )
529{
530   if(data & 8)
531      i8214_irq_level = 7;
532   else
533      i8214_irq_level = data & 7;
534}
535
536
506537static WRITE8_HANDLER( pc8801_irq_mask_w )
507538{
508539   vrtc_irq_mask = data & 2;
r10063r10064
537568{
538569   misc_ctrl = data;
539570
540   if(!(data & 0x80))
541      sound_irq_mask = ((data & 0x80) == 0);
571   sound_irq_mask = ((data & 0x80) == 0);
542572}
543573
544574static WRITE8_HANDLER( pc8801_palram_w )
r10063r10064
655685//  AM_RANGE(0xd8, 0xd8) AM_NOP                                     /* GP-IB */
656686//  AM_RANGE(0xdc, 0xdf) AM_NOP                                     /* MODEM */
657687//   AM_RANGE(0xe2, 0xe3) AM_READWRITE(pc88_extmem_r, pc88_extmem_w) /* expand RAM select */
658   AM_RANGE(0xe4, 0xe4) AM_WRITENOP //AM_WRITE(pc8801_write_interrupt_level)
688   AM_RANGE(0xe4, 0xe4) AM_WRITE(pc8801_irq_level_w)
659689   AM_RANGE(0xe6, 0xe6) AM_WRITE(pc8801_irq_mask_w)
660690//  AM_RANGE(0xe7, 0xe7) AM_NOP                                     /* (unknown) */
661691//   AM_RANGE(0xe8, 0xeb) AM_READWRITE(pc88_kanji_r, pc88_kanji_w)
r10063r10064
10451075   printf("%02x\n",sound_irq_mask);
10461076
10471077   if(sound_irq_mask)
1048      cputag_set_input_line_and_vector(device->machine, "maincpu", 0, HOLD_LINE, 4*2);
1078      pc8801_raise_irq(device->machine,4);
10491079}
10501080
10511081
r10063r10064
10881118   NULL
10891119};
10901120
1091static MACHINE_START( pc8801 )
1121static IRQ_CALLBACK( pc8801_irq_callback )
10921122{
1123   int level, i;
10931124
1125   level = 0;
1126   for (i = 0; i < 8; i++)
1127   {
1128      if ((i8214_irq_state & (1<<i))!=0)
1129         level = i;
1130   }
1131
1132   i8214_irq_state &= ~(1<<level);
1133   return level*2;
10941134}
10951135
1136static MACHINE_START( pc8801 )
1137{
1138   cpu_set_irq_callback(machine->device("maincpu"), pc8801_irq_callback);
1139}
1140
10961141static MACHINE_RESET( pc8801 )
10971142{
10981143   ext_rom_bank = 0xff;
r10063r10064
11161161
11171162   fdc_irq_opcode = 0; //TODO: copied from PC-88VA, could be wrong here ... should be 0x7f ld a,a in the latter case
11181163
1119   vrtc_irq_mask = 0;
1120   sound_irq_mask = 0;
1121
11221164   cpu_set_input_line_vector(machine->device("fdccpu"), 0, 0);
11231165
11241166   {
r10063r10064
11361178
11371179   beep_set_frequency(machine->device("beeper"),2400);
11381180   beep_set_state(machine->device("beeper"),0);
1181
1182   {
1183      vrtc_irq_mask = 0;
1184      sound_irq_mask = 0;
1185
1186      i8214_irq_level = 0;
1187      i8214_irq_state = 0;
1188   }
11391189}
11401190
11411191static PALETTE_INIT( pc8801 )
r10063r10064
11591209static INTERRUPT_GEN( pc8801_vrtc_irq )
11601210{
11611211   if(vrtc_irq_mask)
1162      cputag_set_input_line_and_vector(device->machine, "maincpu", 0, HOLD_LINE, 2);
1212      pc8801_raise_irq(device->machine,1);
11631213}
11641214
11651215static MACHINE_CONFIG_START( pc8801, driver_device )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team