Previous 15994 Revisions Next

r6861 Saturday 2nd January, 2010 at 10:03:06 UTC by Wilbert Pol
Implemented uPD7801 timers.
[src/emu/cpu/upd7810]7810ops.c 7810tbl.c upd7810.c

src/emu/cpu/upd7810/7810ops.c
r6860r6861
94579457{
94589458   cpustate->ovc0 = ( ( TMM & 0x04 ) ? 16 * 8 : 8 ) * TM0;
94599459}
9460
9461static void STM_7801(upd7810_state *cpustate)
9462{
9463   /* Set the timer flip/fliop */
9464   TO = 1;
9465   if ( cpustate->config.io_callback)
9466      (*cpustate->config.io_callback)(cpustate->device,UPD7810_TO,TO);
9467
9468   /* Reload the timer */
9469   cpustate->ovc0 = 16 * ( TM0 + ( ( TM1 & 0x0f ) << 8 ) );
9470}
src/emu/cpu/upd7810/7810tbl.c
r6860r6861
10431043static void INR_B_7801(upd7810_state *cpustate);
10441044static void INR_C_7801(upd7810_state *cpustate);
10451045static void INRW_wa_7801(upd7810_state *cpustate);
1046static void STM_7801(upd7810_state *cpustate);
10461047
10471048
10481049static const struct opcode_s op48[256] =
r6860r6861
46454646   {INX_BC,      1, 7, 7,L0|L1},   {DCX_BC,      1, 7, 7,L0|L1},
46464647   {LXI_B_w,      3,10,10,L0|L1},   {ORIW_wa_xx,   3,16,16,L0|L1},
46474648   {XRI_A_xx,      2, 7, 7,L0|L1},   {ORI_A_xx,      2, 7, 7,L0|L1},
4648   {RETS,         1,11,11,L0|L1},   {STM,         1, 4, 4,L0|L1},
4649   {RETS,         1,11,11,L0|L1},   {STM_7801,      1, 4, 4,L0|L1},
46494650   {MOV_B_A,      1, 4, 4,L0|L1},   {MOV_C_A,      1, 4, 4,L0|L1},
46504651   {MOV_D_A,      1, 4, 4,L0|L1},   {MOV_E_A,      1, 4, 4,L0|L1},
46514652   {MOV_H_A,      1, 4, 4,L0|L1},   {MOV_L_A,      1, 4, 4,L0|L1},
src/emu/cpu/upd7810/upd7810.c
r6860r6861
16541654   }
16551655}
16561656
1657//static void upd7801_timers(upd7810_state *cpustate, int cycles)
1658//{
1659//}
1657static void upd7801_timers(upd7810_state *cpustate, int cycles)
1658{
1659   if ( cpustate->ovc0 )
1660   {
1661      cpustate->ovc0 -= cycles;
16601662
1663      /* Check if timer expired */
1664      if ( cpustate->ovc0 <= 0 )
1665      {
1666         IRR |= INTFT0;
1667
1668         /* Reset the timer flip/fliop */
1669         TO = 0;
1670         if ( cpustate->config.io_callback)
1671            (*cpustate->config.io_callback)(cpustate->device,UPD7810_TO,TO);
1672
1673         /* Reload the timer */
1674         cpustate->ovc0 = 16 * ( TM0 + ( ( TM1 & 0x0f ) << 8 ) );
1675      }
1676   }
1677}
1678
16611679static void upd78c05_timers(upd7810_state *cpustate, int cycles)
16621680{
16631681   if ( cpustate->ovc0 ) {
r6860r6861
18211839   cpustate->op70 = op70_7801;
18221840   cpustate->op74 = op74_7801;
18231841   cpustate->opXX = opXX_7801;
1842   cpustate->handle_timers = upd7801_timers;
1843   cpustate->ovc0 = 0;
18241844}
18251845
18261846static CPU_RESET( upd78c05 )

Previous 15994 Revisions Next


© 1998-2018 The MESS Team