sys.exit(), exit2(), exit3() now romable

This commit is contained in:
Irmen de Jong
2025-04-09 22:13:52 +02:00
parent 9c7ebc883c
commit 0916b943da
11 changed files with 289 additions and 118 deletions

View File

@@ -360,7 +360,6 @@ _no_msb_size
}
asmsub save_prog8_internals() {
; TODO: Romable
%asm {{
lda P8ZP_SCRATCH_B1
sta save_SCRATCH_ZPB1
@@ -431,7 +430,7 @@ save_SCRATCH_ZPWORD2 .word ?
sta p8_sys_startup.cleanup_at_exit._exitcode
lda #0
rol a
sta p8_sys_startup.cleanup_at_exit._exitcodeCarry
sta p8_sys_startup.cleanup_at_exit._exitcarry
stx p8_sys_startup.cleanup_at_exit._exitcodeX
sty p8_sys_startup.cleanup_at_exit._exitcodeY
ldx prog8_lib.orig_stackpointer
@@ -606,7 +605,6 @@ cx16 {
&byte r15sH = $7fff
asmsub save_virtual_registers() clobbers(A,Y) {
; TODO: Romable
%asm {{
ldy #31
- lda cx16.r0,y
@@ -671,18 +669,22 @@ asmsub init_system_phase2() {
asmsub cleanup_at_exit() {
; executed when the main subroutine does rts
; TODO: Romable
%asm {{
_exitcodeCarry = *+1
lda #0
lda _exitcarry
lsr a
_exitcode = *+1
lda #0 ; exit code possibly modified in exit()
_exitcodeX = *+1
ldx #0
_exitcodeY = *+1
ldy #0
lda _exitcode
ldx _exitcodeX
ldy _exitcodeY
rts
.section BSS
_exitcarry .byte ?
_exitcode .byte ?
_exitcodeX .byte ?
_exitcodeY .byte ?
.send BSS
; !notreached!
}}
}