Skip to content

Commit

Permalink
add timer code
Browse files Browse the repository at this point in the history
  • Loading branch information
noahw2021 committed Dec 26, 2023
1 parent 8ec910d commit ce887d0
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 3 deletions.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -333,8 +333,8 @@
filePath = "plasm2_emu/cpu/cpu_clock.c"
startingColumnNumber = "9223372036854775807"
endingColumnNumber = "9223372036854775807"
startingLineNumber = "64"
endingLineNumber = "64"
startingLineNumber = "66"
endingLineNumber = "66"
landmarkName = "CpuClock()"
landmarkType = "9">
</BreakpointContent>
Expand Down
4 changes: 3 additions & 1 deletion plasm2_emu/cpu/cpu_clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,10 @@ void CpuClock(void) {
}
#endif

if (CpuCtx->NextInterruptNS <= CpuCtx->LastTrackedNanoSecond)
if (CpuCtx->NextInterruptNS <= CpuCtx->LastTrackedNanoSecond) {
CpuCtx->NeedsFireThisTick = 1;
CpuCtx->NextInterruptNS += 10000;
}

CpuCtx->SystemTicks++;

Expand Down
1 change: 1 addition & 0 deletions plasm2_emu/cpu/cpu_init.c
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ void CpuInit(void) {
CpuCtx->SystemTicks = 0;
CpuCtx->ClocksPerSecond = BASE_CLOCK;
CpuCtx->NextTickNanoSecond = 4096;
CpuCtx->NextTickNanoSecond = 10000;

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

0 comments on commit ce887d0

Please sign in to comment.