From e01ae3e0a046b60d1b1d89bd448ca930b9790d29 Mon Sep 17 00:00:00 2001 From: Uri Shaked Date: Tue, 19 Nov 2019 17:12:55 +0200 Subject: feat: implement STX --- src/instruction.ts | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/instruction.ts') diff --git a/src/instruction.ts b/src/instruction.ts index f7789d2..63c4caa 100644 --- a/src/instruction.ts +++ b/src/instruction.ts @@ -425,7 +425,7 @@ export function avrInstruction(cpu: ICPU) { /* STX */ if ((opcode & 0xfe0f) === 0x920c) { - /* not implemented */ + cpu.writeData(cpu.dataView.getUint16(26, true), cpu.data[(opcode & 0x1f0) >> 4]); } /* STX */ @@ -436,7 +436,10 @@ export function avrInstruction(cpu: ICPU) { /* STX */ if ((opcode & 0xfe0f) === 0x920e) { - /* not implemented */ + const i = cpu.data[(opcode & 0x1f0) >> 4]; + cpu.dataView.setUint16(26, cpu.dataView.getUint16(26, true) - 1, true); + cpu.writeData(cpu.dataView.getUint16(26, true), i); + cpu.cycles++; } /* STY */ -- cgit v1.2.3