Implemented uPD7801 timers.

This commit is contained in:
Wilbert Pol 2010-01-02 10:02:47 +00:00
parent e66fe1dad7
commit 22c5856130
3 changed files with 36 additions and 4 deletions

View File

@ -9457,3 +9457,14 @@ static void STM(upd7810_state *cpustate)
{
cpustate->ovc0 = ( ( TMM & 0x04 ) ? 16 * 8 : 8 ) * TM0;
}
static void STM_7801(upd7810_state *cpustate)
{
/* Set the timer flip/fliop */
TO = 1;
if ( cpustate->config.io_callback)
(*cpustate->config.io_callback)(cpustate->device,UPD7810_TO,TO);
/* Reload the timer */
cpustate->ovc0 = 16 * ( TM0 + ( ( TM1 & 0x0f ) << 8 ) );
}

View File

@ -1043,6 +1043,7 @@ static void INR_A_7801(upd7810_state *cpustate);
static void INR_B_7801(upd7810_state *cpustate);
static void INR_C_7801(upd7810_state *cpustate);
static void INRW_wa_7801(upd7810_state *cpustate);
static void STM_7801(upd7810_state *cpustate);
static const struct opcode_s op48[256] =
@ -4645,7 +4646,7 @@ static const struct opcode_s opXX_7801[256] =
{INX_BC, 1, 7, 7,L0|L1}, {DCX_BC, 1, 7, 7,L0|L1},
{LXI_B_w, 3,10,10,L0|L1}, {ORIW_wa_xx, 3,16,16,L0|L1},
{XRI_A_xx, 2, 7, 7,L0|L1}, {ORI_A_xx, 2, 7, 7,L0|L1},
{RETS, 1,11,11,L0|L1}, {STM, 1, 4, 4,L0|L1},
{RETS, 1,11,11,L0|L1}, {STM_7801, 1, 4, 4,L0|L1},
{MOV_B_A, 1, 4, 4,L0|L1}, {MOV_C_A, 1, 4, 4,L0|L1},
{MOV_D_A, 1, 4, 4,L0|L1}, {MOV_E_A, 1, 4, 4,L0|L1},
{MOV_H_A, 1, 4, 4,L0|L1}, {MOV_L_A, 1, 4, 4,L0|L1},

View File

@ -1654,9 +1654,27 @@ static void upd7810_timers(upd7810_state *cpustate, int cycles)
}
}
//static void upd7801_timers(upd7810_state *cpustate, int cycles)
//{
//}
static void upd7801_timers(upd7810_state *cpustate, int cycles)
{
if ( cpustate->ovc0 )
{
cpustate->ovc0 -= cycles;
/* Check if timer expired */
if ( cpustate->ovc0 <= 0 )
{
IRR |= INTFT0;
/* Reset the timer flip/fliop */
TO = 0;
if ( cpustate->config.io_callback)
(*cpustate->config.io_callback)(cpustate->device,UPD7810_TO,TO);
/* Reload the timer */
cpustate->ovc0 = 16 * ( TM0 + ( ( TM1 & 0x0f ) << 8 ) );
}
}
}
static void upd78c05_timers(upd7810_state *cpustate, int cycles)
{
@ -1821,6 +1839,8 @@ static CPU_RESET( upd7801 )
cpustate->op70 = op70_7801;
cpustate->op74 = op74_7801;
cpustate->opXX = opXX_7801;
cpustate->handle_timers = upd7801_timers;
cpustate->ovc0 = 0;
}
static CPU_RESET( upd78c05 )