diff options
| author | Apexo | 2026-03-28 14:00:56 +0100 |
|---|---|---|
| committer | Apexo | 2026-03-28 14:00:56 +0100 |
| commit | 6336d478f7e046e45379c6996451b399e90b5bf1 (patch) | |
| tree | 04992f39d7e6c0fca1deb84c365d7e01666e2d69 /src/cpu/interrupt.ts | |
| parent | 0.21.0 (diff) | |
| download | avr8js-avr32dd20.tar.gz avr8js-avr32dd20.tar.bz2 avr8js-avr32dd20.zip | |
Diffstat (limited to '')
| -rw-r--r-- | src/cpu/interrupt.ts | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/cpu/interrupt.ts b/src/cpu/interrupt.ts index 73b56ee..df54ea3 100644 --- a/src/cpu/interrupt.ts +++ b/src/cpu/interrupt.ts @@ -13,10 +13,11 @@ import { CPU } from './cpu'; export function avrInterrupt(cpu: CPU, addr: number) { const sp = cpu.dataView.getUint16(93, true); - cpu.data[sp] = cpu.pc & 0xff; - cpu.data[sp - 1] = (cpu.pc >> 8) & 0xff; + const dmo = cpu.dataMemoryOffset; + cpu.data[sp + dmo] = cpu.pc & 0xff; + cpu.data[sp - 1 + dmo] = (cpu.pc >> 8) & 0xff; if (cpu.pc22Bits) { - cpu.data[sp - 2] = (cpu.pc >> 16) & 0xff; + cpu.data[sp - 2 + dmo] = (cpu.pc >> 16) & 0xff; } cpu.dataView.setUint16(93, sp - (cpu.pc22Bits ? 3 : 2), true); cpu.data[95] &= 0x7f; // clear global interrupt flag |
