aboutsummaryrefslogtreecommitdiff
path: root/src/interrupt.spec.ts
diff options
context:
space:
mode:
authorUri Shaked2020-03-22 21:12:03 +0200
committerGitHub2020-03-22 21:12:03 +0200
commitb3dc0329a8a7bfb8350ddc71719d4348dd4ed66c (patch)
treee85d52944ce76ac604e276f25859a26d38a0afd0 /src/interrupt.spec.ts
parentMerge pull request #25 from LironHazan/AVR8JS-24-editor-user-history (diff)
parentrefactor: added peripherals and cpu feature folders (diff)
downloadavr8js-b3dc0329a8a7bfb8350ddc71719d4348dd4ed66c.tar.gz
avr8js-b3dc0329a8a7bfb8350ddc71719d4348dd4ed66c.tar.bz2
avr8js-b3dc0329a8a7bfb8350ddc71719d4348dd4ed66c.zip
Merge pull request #22 from LironHazan/AVR8JS-21-restructure-project
refactor: add peripherals and cpu feature folders
Diffstat (limited to 'src/interrupt.spec.ts')
-rw-r--r--src/interrupt.spec.ts19
1 files changed, 0 insertions, 19 deletions
diff --git a/src/interrupt.spec.ts b/src/interrupt.spec.ts
deleted file mode 100644
index cc54e3c..0000000
--- a/src/interrupt.spec.ts
+++ /dev/null
@@ -1,19 +0,0 @@
-import { CPU } from './cpu';
-import { avrInterrupt } from './interrupt';
-
-describe('avrInterrupt', () => {
- it('should execute interrupt handler', () => {
- const cpu = new CPU(new Uint16Array(0x8000));
- cpu.pc = 0x520;
- cpu.data[94] = 0;
- cpu.data[93] = 0x80; // SP <- 0x80
- cpu.data[95] = 0b10000001; // SREG <- I------C
- avrInterrupt(cpu, 5);
- expect(cpu.cycles).toEqual(2);
- expect(cpu.pc).toEqual(5);
- expect(cpu.data[93]).toEqual(0x7e); // SP
- expect(cpu.data[0x80]).toEqual(0x20); // Return addr low
- expect(cpu.data[0x7f]).toEqual(0x5); // Return addr high
- expect(cpu.data[95]).toEqual(0b00000001); // SREG: -------C
- });
-});