From fd53ef569512f657fef6ae6bdca51bfea777478d Mon Sep 17 00:00:00 2001 From: WlodekM Date: Sat, 5 Apr 2025 15:51:22 +0300 Subject: uuh i forgor --- 65c02.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to '65c02.ts') diff --git a/65c02.ts b/65c02.ts index 7fa0516..4d4cc83 100644 --- a/65c02.ts +++ b/65c02.ts @@ -191,18 +191,18 @@ export default class The65c02 { /** push stuff onto stack */ push(val: number) { if (this.stackPointer.num() == 0) - console.error('stack overflow (no, not like the website)'); - this.stackPointer.increment(); - this.io.address.set(0x01FF - this.stackPointer.num()); + console.error(`stack overflow (no, not like the website)`); + this.stackPointer.decrement(); + this.io.address.set(0x0100 | this.stackPointer.num()); this.io.data.set(val); this.write(); } pop(): number { if (this.stackPointer.num() == 0xFF) console.error('stack underflow'); - this.io.address.set(0x01FF - this.stackPointer.num()); + this.io.address.set(0x0100 | this.stackPointer.num()); this.read() - this.stackPointer.decrement(); + this.stackPointer.increment(); return this.io.data.num() } getZPAddr(): number { -- cgit 1.4.1-2-gfad0