65816-llvm-mos/runtime/src/iigsGsosStub.s
Scott Duensing c4da4b77b3 Checkpoint
2026-05-02 20:41:19 -05:00

18 lines
701 B
ArmAsm

; Minimal GS/OS dispatcher stub at $E100A8. Native, M=0, X=0.
; Stack at entry: S+1=PCL, S+2=PCH, S+3=PBR, S+4..5=bank (=0),
; S+9=parm ptr low 16, S+10=high. We only use the low 16 (bank-0
; parm blocks). Writes $42 to *parm and returns A=0.
.text
php ; save P
pha ; save A (16-bit)
lda 9, s ; A = parm ptr 16
sta 0xe4 ; DP $E4..$E5
ldy #0 ; X=0 here, so 3-byte encoding
sep #0x20 ; M=8 for the 1-byte store
.byte 0xa9, 0x42 ; lda #$42 (8-bit imm under M=8)
sta (0xe4), y ; *parm = $42
rep #0x20 ; M=16
pla ; restore A
plp
lda #0 ; status = 0
rtl