Skip to content

Commit ce887d0

Browse files
committed
add timer code
1 parent 8ec910d commit ce887d0

File tree

4 files changed

+6
-3
lines changed

4 files changed

+6
-3
lines changed

plasm2.xcodeproj/xcuserdata/noahwooten.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -333,8 +333,8 @@
333333
filePath = "plasm2_emu/cpu/cpu_clock.c"
334334
startingColumnNumber = "9223372036854775807"
335335
endingColumnNumber = "9223372036854775807"
336-
startingLineNumber = "64"
337-
endingLineNumber = "64"
336+
startingLineNumber = "66"
337+
endingLineNumber = "66"
338338
landmarkName = "CpuClock()"
339339
landmarkType = "9">
340340
</BreakpointContent>

plasm2_emu/cpu/cpu_clock.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,10 @@ void CpuClock(void) {
4141
}
4242
#endif
4343

44-
if (CpuCtx->NextInterruptNS <= CpuCtx->LastTrackedNanoSecond)
44+
if (CpuCtx->NextInterruptNS <= CpuCtx->LastTrackedNanoSecond) {
4545
CpuCtx->NeedsFireThisTick = 1;
46+
CpuCtx->NextInterruptNS += 10000;
47+
}
4648

4749
CpuCtx->SystemTicks++;
4850

plasm2_emu/cpu/cpu_init.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ void CpuInit(void) {
2828
CpuCtx->SystemTicks = 0;
2929
CpuCtx->ClocksPerSecond = BASE_CLOCK;
3030
CpuCtx->NextTickNanoSecond = 4096;
31+
CpuCtx->NextTickNanoSecond = 10000;
3132

3233
for (int i = 0; i < 256; i++) {
3334
if (Instructions[i] == NULL)

0 commit comments

Comments
 (0)