From 4452156d1af88fab1bce2ac4a2cbea8800baccd6 Mon Sep 17 00:00:00 2001
From: Oliver Schmidt
Date: Sun, 26 Jan 2014 18:10:01 +0100
Subject: [PATCH] Avoid indirect jmp with unknown vector address.
---
libsrc/apple2/crt0.s | 10 +++++-----
libsrc/apple2/exec.s | 4 ++--
libsrc/apple2/reboot.s | 4 ++--
3 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/libsrc/apple2/crt0.s b/libsrc/apple2/crt0.s
index 27c44f016..a140a7249 100644
--- a/libsrc/apple2/crt0.s
+++ b/libsrc/apple2/crt0.s
@@ -107,7 +107,7 @@ exit: ldx #$02
txs ; Re-init stack pointer
; We're done
- jmp (done)
+ jmp done
.segment "INIT"
@@ -148,8 +148,8 @@ init: ldx #zpspace-1
; No BASIC.SYSTEM so quit to ProDOS dispatcher instead
lda #quit
- sta done
- stx done+1
+ sta done+1
+ stx done+2
; No BASIC.SYSTEM so use addr of ProDOS system global page
lda #<$BF00
@@ -202,8 +202,8 @@ q_param:.byte $04 ; param_count
.data
- ; Location to jump to when we're done
-done: .addr DOSWARM
+ ; Final jump when we're done
+done: jmp DOSWARM ; Potentially patched at runtime
.segment "ZPSAVE"
diff --git a/libsrc/apple2/exec.s b/libsrc/apple2/exec.s
index 914e10c50..c486306bb 100644
--- a/libsrc/apple2/exec.s
+++ b/libsrc/apple2/exec.s
@@ -161,8 +161,8 @@ setbuf: lda #$00 ; Low byte
; Call loader stub after C libary shutdown
lda #target
- sta done
- stx done+1
+ sta done+1
+ stx done+2
; Initiate C libary shutdown
jmp _exit
diff --git a/libsrc/apple2/reboot.s b/libsrc/apple2/reboot.s
index 89c34bdf0..8ee1ba067 100644
--- a/libsrc/apple2/reboot.s
+++ b/libsrc/apple2/reboot.s
@@ -16,6 +16,6 @@ initreboot:
; Quit to PWRUP
lda #<$FAA6
ldx #>$FAA6
- sta done
- stx done+1
+ sta done+1
+ stx done+2
rts
--
2.39.5