From ad16db1e84ee22ce794e9dd4ee60dfaabca248e2 Mon Sep 17 00:00:00 2001 From: Uri Shaked Date: Wed, 29 Apr 2020 23:07:27 +0300 Subject: fix(timer): Reading TCNT in 2-cycle instructions close #40 --- src/peripherals/timer.ts | 1 + 1 file changed, 1 insertion(+) (limited to 'src/peripherals/timer.ts') diff --git a/src/peripherals/timer.ts b/src/peripherals/timer.ts index 04c09aa..7cae2ac 100644 --- a/src/peripherals/timer.ts +++ b/src/peripherals/timer.ts @@ -197,6 +197,7 @@ export class AVRTimer { constructor(private cpu: CPU, private config: AVRTimerConfig) { this.updateWGMConfig(); this.cpu.readHooks[config.TCNT] = (addr: u8) => { + this.tick(); if (this.config.bits === 16) { this.cpu.data[addr + 1] = this.tcnt >> 8; } -- cgit v1.2.3