2020-09-01 20:27:34 +00:00
|
|
|
; Loader for MIST
|
|
|
|
|
|
|
|
.include "zp.inc"
|
|
|
|
.include "hardware.inc"
|
|
|
|
|
|
|
|
.include "common_defines.inc"
|
2020-09-05 04:34:14 +00:00
|
|
|
.include "qboot.inc"
|
2020-09-01 20:27:34 +00:00
|
|
|
|
|
|
|
qload_start:
|
|
|
|
|
2020-09-05 04:34:14 +00:00
|
|
|
; init the write code
|
2020-09-06 21:17:12 +00:00
|
|
|
lda WHICH_SLOT
|
2020-09-05 04:34:14 +00:00
|
|
|
jsr popwr_init
|
|
|
|
|
2020-09-01 20:27:34 +00:00
|
|
|
; first time entry
|
2020-09-02 04:49:51 +00:00
|
|
|
; start by loading text title
|
2020-09-01 20:27:34 +00:00
|
|
|
|
2020-09-02 04:49:51 +00:00
|
|
|
lda #LOAD_TEXT_TITLE ; load title
|
2020-09-01 20:27:34 +00:00
|
|
|
sta WHICH_LOAD
|
|
|
|
|
2020-09-02 00:01:05 +00:00
|
|
|
lda #1
|
|
|
|
sta CURRENT_DISK ; current disk number
|
|
|
|
|
2020-09-02 04:49:51 +00:00
|
|
|
jsr load_file
|
|
|
|
|
|
|
|
jsr $800
|
|
|
|
|
|
|
|
lda #LOAD_TITLE ; load title
|
|
|
|
sta WHICH_LOAD
|
|
|
|
|
2020-09-01 20:27:34 +00:00
|
|
|
main_game_loop:
|
|
|
|
jsr load_file
|
|
|
|
|
2020-09-02 01:31:15 +00:00
|
|
|
lda WHICH_LOAD
|
|
|
|
bne not_title
|
2020-09-01 20:27:34 +00:00
|
|
|
|
2020-09-02 01:31:15 +00:00
|
|
|
start_title:
|
|
|
|
jsr $4000
|
|
|
|
jmp main_game_loop
|
|
|
|
|
|
|
|
not_title:
|
|
|
|
jsr $2000
|
|
|
|
jmp main_game_loop
|
2020-09-02 00:01:05 +00:00
|
|
|
|
|
|
|
;====================================
|
|
|
|
; loads file specified by WHICH_LOAD
|
|
|
|
;====================================
|
|
|
|
load_file:
|
|
|
|
ldx WHICH_LOAD
|
|
|
|
|
|
|
|
lda which_disk_array,X
|
|
|
|
cmp CURRENT_DISK
|
|
|
|
bne change_disk
|
|
|
|
|
2020-09-03 18:27:03 +00:00
|
|
|
load_file_no_diskcheck:
|
2020-09-02 00:01:05 +00:00
|
|
|
lda load_address_array,X
|
|
|
|
sta load_address
|
|
|
|
|
|
|
|
lda track_array,X
|
|
|
|
sta load_track
|
|
|
|
|
|
|
|
lda sector_array,X
|
|
|
|
sta load_sector
|
|
|
|
|
|
|
|
lda length_array,X
|
|
|
|
sta load_length
|
|
|
|
|
2020-09-02 01:31:15 +00:00
|
|
|
jsr load_new
|
2020-09-02 00:01:05 +00:00
|
|
|
|
2020-09-02 01:31:15 +00:00
|
|
|
rts
|
2020-09-02 00:01:05 +00:00
|
|
|
|
2020-09-01 20:27:34 +00:00
|
|
|
;===================================================
|
|
|
|
;===================================================
|
2020-09-02 00:01:05 +00:00
|
|
|
; change disk
|
2020-09-01 20:27:34 +00:00
|
|
|
;===================================================
|
|
|
|
;===================================================
|
|
|
|
|
2020-09-02 00:01:05 +00:00
|
|
|
change_disk:
|
2020-09-01 20:27:34 +00:00
|
|
|
|
2020-09-02 00:01:05 +00:00
|
|
|
; turn off disk drive light
|
|
|
|
|
|
|
|
jsr driveoff
|
2020-09-01 20:27:34 +00:00
|
|
|
|
|
|
|
jsr TEXT
|
|
|
|
jsr HOME
|
|
|
|
|
|
|
|
lda #<error_string
|
|
|
|
sta OUTL
|
|
|
|
lda #>error_string
|
|
|
|
sta OUTH
|
|
|
|
|
2020-09-02 00:47:16 +00:00
|
|
|
ldx WHICH_LOAD
|
|
|
|
lda which_disk_array,X
|
2020-09-02 02:06:12 +00:00
|
|
|
clc
|
|
|
|
adc #48
|
|
|
|
|
2020-09-02 00:47:16 +00:00
|
|
|
ldy #19
|
|
|
|
sta (OUTL),Y
|
|
|
|
|
|
|
|
ldy #0
|
|
|
|
|
2020-09-01 20:27:34 +00:00
|
|
|
quick_print:
|
|
|
|
lda (OUTL),Y
|
|
|
|
beq quick_print_done
|
|
|
|
jsr COUT1
|
|
|
|
iny
|
|
|
|
jmp quick_print
|
|
|
|
|
|
|
|
quick_print_done:
|
|
|
|
|
|
|
|
fnf_keypress:
|
|
|
|
lda KEYPRESS
|
|
|
|
bpl fnf_keypress
|
|
|
|
bit KEYRESET
|
|
|
|
|
2020-09-03 18:27:03 +00:00
|
|
|
;==============================================
|
|
|
|
; actually verify proper disk is there
|
|
|
|
; read T0:S0 and verify proper disk
|
|
|
|
|
|
|
|
lda WHICH_LOAD
|
|
|
|
pha
|
|
|
|
|
|
|
|
ldx #LOAD_FIRST_SECTOR ; load track 0 sector 0
|
|
|
|
stx WHICH_LOAD
|
|
|
|
|
|
|
|
jsr load_file_no_diskcheck
|
|
|
|
|
|
|
|
pla
|
|
|
|
sta WHICH_LOAD
|
|
|
|
tax
|
|
|
|
|
|
|
|
; first sector now in $c00
|
|
|
|
; offset 59
|
2020-09-06 21:17:12 +00:00
|
|
|
; disk1 = $0a
|
2020-09-03 18:27:03 +00:00
|
|
|
; disk2 = $32 ('2')
|
|
|
|
; disk3 = $33 ('3')
|
|
|
|
|
|
|
|
lda $c59
|
2020-09-06 21:17:12 +00:00
|
|
|
cmp #$0a
|
2020-09-03 18:27:03 +00:00
|
|
|
beq is_disk1
|
|
|
|
cmp #$32
|
|
|
|
beq is_disk2
|
|
|
|
cmp #$33
|
|
|
|
beq is_disk3
|
|
|
|
bne change_disk ; unknown disk
|
|
|
|
|
|
|
|
is_disk1:
|
|
|
|
lda #1
|
|
|
|
bne disk_compare
|
|
|
|
|
|
|
|
is_disk2:
|
|
|
|
lda #2
|
|
|
|
bne disk_compare
|
|
|
|
|
|
|
|
is_disk3:
|
|
|
|
lda #3
|
|
|
|
|
|
|
|
disk_compare:
|
|
|
|
cmp which_disk_array,X
|
|
|
|
bne change_disk ; disk mismatch
|
|
|
|
|
|
|
|
;==============================================
|
|
|
|
; all good, retry original load
|
|
|
|
|
|
|
|
jsr HOME
|
2020-09-01 20:27:34 +00:00
|
|
|
|
|
|
|
ldx WHICH_LOAD
|
2020-09-02 00:01:05 +00:00
|
|
|
lda which_disk_array,X
|
|
|
|
sta CURRENT_DISK
|
2020-09-01 20:27:34 +00:00
|
|
|
|
2020-09-02 00:01:05 +00:00
|
|
|
jmp load_file
|
2020-09-01 20:27:34 +00:00
|
|
|
|
2020-09-02 00:01:05 +00:00
|
|
|
; offset for disk number is 19
|
|
|
|
error_string:
|
|
|
|
.byte "PLEASE INSERT DISK 1, PRESS RETURN",0
|
2020-09-01 20:27:34 +00:00
|
|
|
|
|
|
|
|
|
|
|
which_disk_array:
|
|
|
|
.byte 1,1,3,3 ; MIST_TITLE,MIST,MECHE,SELENA
|
|
|
|
.byte 1,1,3,2 ; OCTAGON,VIEWER,STONEY,CHANNEL
|
|
|
|
.byte 2,1,2,2 ; CABIN,DENTIST,ARBOR,NIBEL
|
|
|
|
.byte 1,1,1,3 ; SHIP,GENERATOR,D'NI,SUB
|
2020-09-02 00:47:16 +00:00
|
|
|
.byte 1 ; TEXT_TITLE
|
|
|
|
.byte 1,1,1,1,1 ; SAVE1,SAVE2,SAVE3,SAVE4,SAVE5
|
2020-09-03 18:27:03 +00:00
|
|
|
.byte $f ; FIRST_SECTOR
|
2020-09-01 20:27:34 +00:00
|
|
|
|
|
|
|
load_address_array:
|
|
|
|
.byte $40,$20,$20,$20 ; MIST_TITLE,MIST,MECHE,SELENA
|
|
|
|
.byte $20,$20,$20,$20 ; OCTAGON,VIEWER,STONEY,CHANNEL
|
|
|
|
.byte $20,$20,$20,$20 ; CABIN,DENTIST,ARBOR,NIBEL
|
|
|
|
.byte $20,$20,$20,$20 ; SHIP,GENERATOR,D'NI,SUB
|
2020-09-02 00:47:16 +00:00
|
|
|
.byte $08 ; TEXT_TITLE
|
|
|
|
.byte $0E,$0E,$0E,$0E
|
|
|
|
.byte $0E ; SAVE1,SAVE2,SAVE3,SAVE4,SAVE5
|
2020-09-03 18:27:03 +00:00
|
|
|
.byte $0C ; FIRST_SECTOR
|
2020-09-01 20:27:34 +00:00
|
|
|
|
|
|
|
track_array:
|
2020-09-06 16:45:41 +00:00
|
|
|
.byte 2, 8, 1,21 ; MIST_TITLE,MIST,MECHE,SELENA
|
|
|
|
.byte 18,31,11, 1 ; OCTAGON,VIEWER,STONEY,CHANNEL
|
2020-09-01 20:27:34 +00:00
|
|
|
.byte 27,26,10,20 ; CABIN,DENTIST,ARBOR,NIBEL
|
2020-09-06 16:45:41 +00:00
|
|
|
.byte 30,32,28,30 ; SHIP,GENERATOR,D'NI,SUB
|
2020-09-02 00:47:16 +00:00
|
|
|
.byte 0 ; TEXT_TITLE
|
|
|
|
.byte 0, 0, 0, 0, 0 ; SAVE1,SAVE2,SAVE3,SAVE4,SAVE5
|
2020-09-03 18:27:03 +00:00
|
|
|
.byte 0 ; FIRST_SECTOR
|
2020-09-01 20:27:34 +00:00
|
|
|
|
|
|
|
sector_array:
|
|
|
|
.byte 0, 0, 0, 0 ; MIST_TITLE,MIST,MECHE,SELENA
|
|
|
|
.byte 0, 8, 0, 0 ; OCTAGON,VIEWER,STONEY,CHANNEL
|
|
|
|
.byte 0, 0, 0, 0 ; CABIN,DENTIST,ARBOR,NIBEL
|
2020-09-13 16:42:07 +00:00
|
|
|
.byte 0,13, 0, 1 ; SHIP,GENERATOR,D'NI,SUB
|
2020-09-02 04:49:51 +00:00
|
|
|
.byte 6 ; TEXT_TITLE
|
2020-09-02 01:31:15 +00:00
|
|
|
.byte 11,12,13,14,15 ; SAVE1,SAVE2,SAVE3,SAVE4,SAVE5
|
2020-09-03 18:27:03 +00:00
|
|
|
.byte 0 ; FIRST_SECTOR
|
2020-09-01 20:27:34 +00:00
|
|
|
|
|
|
|
length_array:
|
|
|
|
.byte 83,159,157,145 ; MIST_TITLE,MIST,MECHE,SELENA
|
2020-09-13 16:42:07 +00:00
|
|
|
.byte 128, 20,158,135 ; OCTAGON,VIEWER,STONEY,CHANNEL
|
2020-09-01 20:27:34 +00:00
|
|
|
.byte 61, 31,159,109 ; CABIN,DENTIST,ARBOR,NIBEL
|
2020-09-06 16:45:41 +00:00
|
|
|
.byte 20, 33, 27, 78 ; SHIP,GENERATOR,D'NI,SUB
|
2020-09-02 04:49:51 +00:00
|
|
|
.byte 3 ; TEXT_TITLE
|
2020-09-02 00:47:16 +00:00
|
|
|
.byte 1,1,1,1,1 ; SAVE1,SAVE2,SAVE3,SAVE4,SAVE5
|
2020-09-03 18:27:03 +00:00
|
|
|
.byte 1 ; FIRST_SECTOR
|
2020-09-01 20:27:34 +00:00
|
|
|
|
|
|
|
.include "audio.s"
|
|
|
|
.include "linking_noise.s"
|
|
|
|
.include "decompress_fast_v2.s"
|
|
|
|
.include "draw_pointer.s"
|
|
|
|
.include "end_level.s"
|
|
|
|
.include "gr_copy.s"
|
|
|
|
.include "gr_fast_clear.s"
|
|
|
|
.include "gr_offsets.s"
|
|
|
|
.include "gr_pageflip.s"
|
|
|
|
.include "gr_putsprite_crop.s"
|
|
|
|
.include "keyboard.s"
|
|
|
|
.include "text_print.s"
|
|
|
|
.include "loadstore.s"
|
2020-09-06 04:28:26 +00:00
|
|
|
.include "joystick.s"
|
2020-09-01 20:27:34 +00:00
|
|
|
|
|
|
|
.include "page_sprites.inc"
|
|
|
|
.include "common_sprites.inc"
|
|
|
|
|
2020-09-06 21:17:12 +00:00
|
|
|
.include "qkumba_popwr.s"
|
|
|
|
|
2020-09-01 20:27:34 +00:00
|
|
|
qload_end:
|
|
|
|
|
2020-09-02 00:47:16 +00:00
|
|
|
.assert (>qload_end - >qload_start) < $e , error, "loader too big"
|