Rewrote timer code.
The new code is based on timestamps, rather than delays. This eliminates the need to update every timer in timer_process(), which cost a non-trivial amount of CPU time on low-end machines. This involved changes to every user of the timer code, so this change almost certainly introduces bugs.
This commit is contained in:
parent
ab359ca9c5
commit
a7d006b637
79 changed files with 1050 additions and 1033 deletions
|
|
@ -190,8 +190,8 @@ typedef struct wy700_t
|
|||
int enabled; /* Display enabled, 0 or 1 */
|
||||
int detach; /* Detach cursor, 0 or 1 */
|
||||
|
||||
int dispontime, dispofftime;
|
||||
int vidtime;
|
||||
uint64_t dispontime, dispofftime;
|
||||
pc_timer_t timer;
|
||||
|
||||
int linepos, displine;
|
||||
int vc;
|
||||
|
|
@ -490,8 +490,8 @@ void wy700_recalctimings(wy700_t *wy700)
|
|||
_dispofftime = disptime - _dispontime;
|
||||
_dispontime *= MDACONST;
|
||||
_dispofftime *= MDACONST;
|
||||
wy700->dispontime = (int)(_dispontime * (1 << TIMER_SHIFT));
|
||||
wy700->dispofftime = (int)(_dispofftime * (1 << TIMER_SHIFT));
|
||||
wy700->dispontime = (uint64_t)_dispontime;
|
||||
wy700->dispofftime = (uint64_t)_dispofftime;
|
||||
}
|
||||
|
||||
|
||||
|
|
@ -759,7 +759,7 @@ void wy700_poll(void *p)
|
|||
|
||||
if (!wy700->linepos)
|
||||
{
|
||||
wy700->vidtime += wy700->dispofftime;
|
||||
timer_advance_u64(&wy700->timer, wy700->dispofftime);
|
||||
wy700->cga_stat |= 1;
|
||||
wy700->mda_stat |= 1;
|
||||
wy700->linepos = 1;
|
||||
|
|
@ -820,7 +820,7 @@ void wy700_poll(void *p)
|
|||
wy700->cga_stat &= ~1;
|
||||
wy700->mda_stat &= ~1;
|
||||
}
|
||||
wy700->vidtime += wy700->dispontime;
|
||||
timer_advance_u64(&wy700->timer, wy700->dispontime);
|
||||
wy700->linepos = 0;
|
||||
|
||||
if (wy700->displine == 800)
|
||||
|
|
@ -868,7 +868,7 @@ void *wy700_init()
|
|||
/* 128k video RAM */
|
||||
wy700->vram = malloc(0x20000);
|
||||
|
||||
timer_add(wy700_poll, &wy700->vidtime, TIMER_ALWAYS_ENABLED, wy700);
|
||||
timer_add(&wy700->timer, wy700_poll, wy700, 1);
|
||||
|
||||
/* Occupy memory between 0xB0000 and 0xBFFFF (moves to 0xA0000 in
|
||||
* high-resolution modes) */
|
||||
|
|
|
|||
Loading…
Reference in a new issue