apu sortof working.

This commit is contained in:
2025-02-03 16:25:18 -07:00
parent d4c6f05fb8
commit e00b81304a
4 changed files with 396 additions and 230 deletions

View File

@ -13,18 +13,15 @@ long long now;
void timer_init() {
ctx.div = 0XAC00;
LARGE_INTEGER freq;
QueryPerformanceFrequency(&freq);
counts_per_cycle = freq.QuadPart / (1 << 22);
}
void timer_tick() {
while(now - last < counts_per_cycle){
LARGE_INTEGER current;
QueryPerformanceCounter(&current);
now = current.QuadPart;
//while(now - last < counts_per_cycle){
// LARGE_INTEGER current;
// QueryPerformanceCounter(&current);
// now = current.QuadPart;
//printf("Last-now: %lld, counts: %lld\n", now - last, counts_per_cycle);
}
//}
last = now;
u16 prev_div = ctx.div;
ctx.div++;
@ -60,7 +57,7 @@ void timer_tick() {
}
if((prev_div & (1 << 1)) && (!(ctx.div & (1 << 1)))){
audio_period_tick();
//audio_period_tick();
}
}