; ------------------------------------------------------------------------
; Actual code
- ldy #zpspace-1
-L1: lda sp,y
- sta zpsave,y ; Save the zero page locations we need
- dey
+ ldx #zpspace-1
+L1: lda sp,x
+ sta zpsave,x ; Save the zero page locations we need
+ dex
bpl L1
; Clear the BSS data
; fall thru to exit...
-_exit:
- lda #$ff
+_exit: lda #$ff
sta TEXTTYP
jsr doatexit ; call exit functions
; Copy back the zero page stuff
- ldy #zpspace-1
-L2: lda zpsave,y
- sta sp,y
- dey
+ ldx #zpspace-1
+L2: lda zpsave,x
+ sta sp,x
+ dex
bpl L2
; Reset changed vectors, back to basic
; Save the zero page locations we need
- ldy #zpspace-1
-L1: lda sp,y
- sta zpsave,y
- dey
+ ldx #zpspace-1
+L1: lda sp,x
+ sta zpsave,x
+ dex
bpl L1
; Clear the BSS data
; Copy back the zero page stuff
- ldy #zpspace-1
-L2: lda zpsave,y
- sta sp,y
- dey
+ ldx #zpspace-1
+L2: lda zpsave,x
+ sta sp,x
+ dex
bpl L2
; Back to DOS
; ------------------------------------------------------------------------
; Actual code
- ldy #zpspace-1
-L1: lda sp,y
- sta zpsave,y ; Save the zero page locations we need
- dey
+ ldx #zpspace-1
+L1: lda sp,x
+ sta zpsave,x ; Save the zero page locations we need
+ dex
bpl L1
; Close open files
; Copy back the zero page stuff
- ldy #zpspace-1
-L2: lda zpsave,y
- sta sp,y
- dey
+ ldx #zpspace-1
+L2: lda zpsave,x
+ sta sp,x
+ dex
bpl L2
; Back to basic