summary refs log tree commit diff
path: root/65c02.ts
diff options
context:
space:
mode:
authorWlodekM <[email protected]>2025-04-05 15:51:22 +0300
committerWlodekM <[email protected]>2025-04-05 15:51:22 +0300
commitfd53ef569512f657fef6ae6bdca51bfea777478d (patch)
tree87a490a2093579b58f419992411fe9fc7d4be8fd /65c02.ts
parenta3dc6ddf93f0789636ea7064844ab696e819955d (diff)
uuh i forgor HEAD master
Diffstat (limited to '65c02.ts')
-rw-r--r--65c02.ts10
1 files changed, 5 insertions, 5 deletions
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 {