mist: make loader handle multiple levels

This commit is contained in:
Vince Weaver 2020-03-08 13:53:24 -04:00
parent a0d37340be
commit 0bbdd0d80d
2 changed files with 21 additions and 56 deletions

View File

@ -65,66 +65,32 @@ loader_start:
;=================================================== ;===================================================
which_load_loop: which_load_loop:
ldx WHICH_LOAD lda WHICH_LOAD
beq load_intro asl
cpx #16
beq load_ending
lda #<ootw_filename tay
lda filenames,Y
sta OUTL sta OUTL
lda #>ootw_filename lda filenames+1,Y
sta OUTH sta OUTH
ldy #6 lda WHICH_LOAD
cpx #10 bne load_other
bcc load_less_than_10 ; blt
txa
sec
sbc #10
tax
lda #'1' ; assume it's 10-15
sta (OUTL),Y
iny
load_less_than_10:
txa
clc
adc #48
sta (OUTL),Y
iny
lda #0
sta (OUTL),Y ; be sure NUL terminated
; might be issue if load >10 level
; then back to lower? that possible?
jmp opendir_filename
load_intro: load_intro:
lda #<$4000 lda #<$4000
sta entry_smc+1 sta entry_smc+1
lda #>$4000 lda #>$4000
sta entry_smc+2 sta entry_smc+2
jmp actual_load
lda #<intro_filename load_other:
sta OUTL
lda #>intro_filename
sta OUTH
bne opendir_filename ; branch always
load_ending:
lda #<$1000 lda #<$1000
sta entry_smc+1 sta entry_smc+1
lda #>$1000 lda #>$1000
sta entry_smc+2 sta entry_smc+2
lda #<ending_filename actual_load:
sta OUTL
lda #>ending_filename
sta OUTH
; fallthrough
;=================================================== ;===================================================
;=================================================== ;===================================================
@ -167,21 +133,20 @@ entry_smc:
jmp which_load_loop jmp which_load_loop
; filename to open is 30-character Apple text, must be padded with space ($A0)
;filename: filenames:
; .byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0 .word intro_filename
; .byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0 .word mist_filename,meche_filename
; .byte $A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0,$A0 .word ending_filename
intro_filename: intro_filename:
.byte "MIST_TITLE",0 .byte "MIST_TITLE",0
mist_filename:
ending_filename:
.byte "MIST",0 .byte "MIST",0
meche_filename:
ootw_filename: .byte "MECHE",0
.byte "OOTW_C",0,0,0 ending_filename:
.byte "ENDING",0
;=================================================== ;===================================================

View File

@ -44,7 +44,7 @@ keyloop:
bit KEYRESET bit KEYRESET
lda #16 lda #1 ; load mist
sta 5 sta 5
rts rts