Previous 15994 Revisions Next

r8796 Tuesday 17th August, 2010 at 13:40:18 UTC by Angelo Salese
[A7000]: Improved Flyback (VBLANK) behaviour
[src/mess/drivers]a7000.c

src/mess/drivers/a7000.c
r8795r8796
2424static UINT8 vidc20_pal_index;
2525static UINT16 vidc20_horz_reg[0x10],vidc20_vert_reg[0x10];
2626static UINT8 vidc20_bpp_mode;
27static emu_timer *flyback_timer;
2728
2829static const char *const vidc20_regnames[] =
2930{
r8795r8796
218219         if(vert_reg == 0 || vert_reg == 2 || vert_reg == 5)
219220            vidc20_dynamic_screen_change(space->machine);
220221
222         if(vert_reg == 4)
223         {
224            if(vidc20_vert_reg[VDER] != 0)
225               timer_adjust_oneshot(flyback_timer, space->machine->primary_screen->time_until_pos(vidc20_vert_reg[VDER]),0);
226            else
227               timer_adjust_oneshot(flyback_timer, attotime_never,0);
228         }
229
221230         // logerror("VIDC20: %s Register write = %08x (%d)\n",vidc20_vert_regnames[vert_reg],val,val);
222231
223232      }
r8795r8796
517526#define IOMD_T0GO      0x048/4
518527#define IOMD_T0LATCH   0x04c/4
519528
529#define IOMD_T1LOW      0x050/4
530#define IOMD_T1HIGH    0x054/4
531#define IOMD_T1GO      0x058/4
532#define IOMD_T1LATCH   0x05c/4
533
520534#define IOMD_ID0       0x094/4
521535#define IOMD_ID1       0x098/4
536#define IOMD_VERSION   0x09c/4
522537
523538#define IOMD_VIDCUR      0x1d0/4
524539#define IOMD_VIDEND      0x1d4/4
r8795r8796
557572
558573static TIMER_CALLBACK( IOMD_timer1_callback )
559574{
560   /*
561   PS7500_IO[IRQSTA]|=0x40;
562   if(PS7500_IO[IRQMSKA]&0x40)
575   IRQ_status_A|=0x40;
576   if(IRQ_mask_A&0x40)
563577   {
564578      generic_pulse_irq_line(machine->device("maincpu"), ARM7_IRQ_LINE);
565579   }
566   */
567580}
568581
582static TIMER_CALLBACK( flyback_timer_callback )
583{
584   IRQ_status_A|=0x08;
585   if(IRQ_mask_A&0x08)
586   {
587      generic_pulse_irq_line(machine->device("maincpu"), ARM7_IRQ_LINE);
588   }
589
590   timer_adjust_oneshot(flyback_timer, machine->primary_screen->time_until_pos(vidc20_vert_reg[VDER]),0);
591}
592
569593static void viddma_transfer_start(const address_space *space)
570594{
571595   UINT32 src = viddma_addr_start;
r8795r8796
594618   {
595619      case IOMD_IOCR:
596620      {
597         static UINT8 vblank = input_port_read(space->machine, "VBLANK") & 0x80;
621         static UINT8 flyback;
622         int vert_pos;
598623
599         return IOMD_IO_ctrl | 0x34 | vblank;
624         vert_pos = space->machine->primary_screen->vpos();
625         flyback = (vert_pos <= vidc20_vert_reg[VDSR] || vert_pos >= vidc20_vert_reg[VDER]) ? 0x80 : 0x00;
626
627         return IOMD_IO_ctrl | 0x34 | flyback;
600628      }
601629      case IOMD_KBDCR:    return IOMD_keyb_ctrl | 0x80; //IOMD Keyb status
602630
r8795r8796
617645      case IOMD_T0LOW:   return timer_out[0] & 0xff;
618646      case IOMD_T0HIGH:   return (timer_out[0] >> 8) & 0xff;
619647
648      case IOMD_T1LOW:   return timer_out[1] & 0xff;
649      case IOMD_T1HIGH:   return (timer_out[1] >> 8) & 0xff;
650
620651      case IOMD_ID0:       return io_id & 0xff; // IOMD ID low
621652      case IOMD_ID1:       return (io_id >> 8) & 0xff; // IOMD ID high
653      case IOMD_VERSION:   return 0;
622654
623655      case IOMD_VIDEND:    return (viddma_addr_end & 0x00fffff8); //bits 31:24 undefined
624656      case IOMD_VIDSTART: return (viddma_addr_start & 0x1ffffff8); //bits 31, 30, 29 undefined
r8795r8796
666698         }
667699         break;
668700
701      case IOMD_T1LOW:    timer_in[1] = (timer_in[1] & 0xff00) | (data & 0xff); break;
702      case IOMD_T1HIGH:    timer_in[1] = (timer_in[1] & 0x00ff) | ((data & 0xff) << 8); break;
703      case IOMD_T1GO:
704         timer_counter[1] = timer_in[1];
705         fire_iomd_timer(1,timer_counter[1]);
706         break;
707      case IOMD_T1LATCH:
708         {
709            static UINT8 readinc;
710            readinc^=1;
711            timer_out[1] = timer_counter[1];
712            if(readinc)
713            {
714               timer_counter[1]--;
715               if(timer_counter[1] < 0)
716                  timer_counter[1]+= timer_in[1];
717            }
718         }
719         break;
720
669721      case IOMD_VIDEND:    viddma_addr_end = data & 0x00fffff8; //bits 31:24 unused
670722      case IOMD_VIDSTART: viddma_addr_start = data & 0x1ffffff8; //bits 31, 30, 29 unused
671723      case IOMD_VIDCR:
r8795r8796
701753
702754/* Input ports */
703755static INPUT_PORTS_START( a7000 )
704   PORT_START("VBLANK")
705   PORT_BIT( 0x80, IP_ACTIVE_HIGH, IPT_VBLANK )
706756INPUT_PORTS_END
707757
708758static MACHINE_START(a7000)
709759{
710760   IOMD_timer[0] = timer_alloc(machine, IOMD_timer0_callback, NULL);
711761   IOMD_timer[1] = timer_alloc(machine, IOMD_timer1_callback, NULL);
762   flyback_timer = timer_alloc(machine, flyback_timer_callback, NULL);
712763
713764   io_id = 0xd4e7;
714765}
r8795r8796
723774
724775   timer_adjust_oneshot( IOMD_timer[0], attotime_never, 0);
725776   timer_adjust_oneshot( IOMD_timer[1], attotime_never, 0);
777   timer_adjust_oneshot( flyback_timer, attotime_never, 0);
726778}
727779
728static INTERRUPT_GEN( flyback_irq )
729{
730   IRQ_status_A|=0x08;
731   if(IRQ_mask_A&0x08)
732   {
733      generic_pulse_irq_line(device, ARM7_IRQ_LINE);
734   }
735}
736
737
738780static MACHINE_DRIVER_START( a7000 )
739781
740782   /* Basic machine hardware */
741783   MDRV_CPU_ADD( "maincpu", ARM7, XTAL_32MHz )
742   MDRV_CPU_PROGRAM_MAP( a7000_mem)
743   MDRV_CPU_VBLANK_INT( "screen", flyback_irq )
784   MDRV_CPU_PROGRAM_MAP(a7000_mem)
744785
745786   MDRV_MACHINE_START( a7000 )
746787   MDRV_MACHINE_RESET( a7000 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team