64 lines
1.9 KiB
ArmAsm
64 lines
1.9 KiB
ArmAsm
; Part of JoeyLib, Copyright (c) 2026 Scott Duensing, under the MIT License.
|
|
; See LICENSE.md for license information.
|
|
; SPDX-License-Identifier: MIT
|
|
;
|
|
; GS/OS inline-call stubs for iigsStart.
|
|
;
|
|
; The same inline form and the same self-patch as the llvm816 runtime's
|
|
; gsosDispatch (runtime/src/iigsGsos.s): the caller passes the parameter
|
|
; block's address in A:X (A = offset, X = bank), and the stub writes it
|
|
; into its own inline pBlock operand before the call. The stores target
|
|
; the stub's own bank (phk/plb), not the caller's DBR. The blocks used to
|
|
; sit at fixed addresses in the $E1:9DC8-$9DFD scratch window, which is 54
|
|
; bytes: a program name of 8 characters or more ran the QuitGS pathname
|
|
; over the SetPrefix string, prefix 0 was never set, and the program could
|
|
; not open "ntpplayer" or its DATA folder.
|
|
|
|
; iigsStartSetPrefix(parm) -- SetPrefixGS ($2009).
|
|
;
|
|
; GS/OS does NOT point prefix 0 at the program named in a QuitGS launch: it
|
|
; was measured still pointing at the BOOT volume, so the launched example's
|
|
; own relative fopen()s missed. That is not cosmetic -- JoeyLib loads the
|
|
; NTP replayer as bare "ntpplayer", and when that read fails jlpAudioInit
|
|
; bails before ntpArm(), leaving the sound vector at its ROM default and
|
|
; the application completely silent.
|
|
.section .text.iigsStartSetPrefix,"ax"
|
|
.globl iigsStartSetPrefix
|
|
iigsStartSetPrefix:
|
|
phb
|
|
phk
|
|
plb
|
|
sta spPblock
|
|
sep #0x20
|
|
txa
|
|
sta spPblock+2
|
|
rep #0x20
|
|
plb
|
|
jsl 0xE100A8
|
|
.word 0x2009
|
|
spPblock:
|
|
.long 0
|
|
rtl
|
|
|
|
; iigsStartQuit(parm) -- QuitGS ($2029).
|
|
;
|
|
; Unlike jlpShutdown's pCount=0 "quit to my parent", this is called with
|
|
; pCount=2 and a pathname, which tells GS/OS to LAUNCH that program in our
|
|
; place. On success it never returns.
|
|
.section .text.iigsStartQuit,"ax"
|
|
.globl iigsStartQuit
|
|
iigsStartQuit:
|
|
phb
|
|
phk
|
|
plb
|
|
sta qtPblock
|
|
sep #0x20
|
|
txa
|
|
sta qtPblock+2
|
|
rep #0x20
|
|
plb
|
|
jsl 0xE100A8
|
|
.word 0x2029
|
|
qtPblock:
|
|
.long 0
|
|
rtl
|