mirror of
https://github.com/deater/dos33fsprogs.git
synced 2024-12-25 20:30:31 +00:00
mist: move to fast qboot disk loader by qkumba
much faster! have to fix lots of things that broke
This commit is contained in:
parent
29513f6aca
commit
287d1cbb43
12
linker_scripts/apple2_1200.inc
Normal file
12
linker_scripts/apple2_1200.inc
Normal file
@ -0,0 +1,12 @@
|
||||
MEMORY {
|
||||
ZP: start = $00, size = $1A, type = rw;
|
||||
RAM: start = $1200, size = $AE00, file = %O;
|
||||
}
|
||||
|
||||
SEGMENTS {
|
||||
CODE: load = RAM, type = ro, align=$100;
|
||||
RODATA: load = RAM, type = ro;
|
||||
DATA: load = RAM, type = rw;
|
||||
BSS: load = RAM, type = bss, define = yes;
|
||||
ZEROPAGE: load = ZP, type = zp;
|
||||
}
|
110
mist/Makefile
110
mist/Makefile
@ -1,6 +1,7 @@
|
||||
include ../Makefile.inc
|
||||
|
||||
DOS33 = ../dos33fs-utils/dos33
|
||||
DOS33_RAW = ../dos33fs-utils/dos33_raw
|
||||
PNG_TO_40x96 = ../gr-utils/png_to_40x96
|
||||
PNG_TO_40x48D = ../gr-utils/png_to_40x48d
|
||||
PNG2RLE = ../gr-utils/png2rle
|
||||
@ -11,38 +12,91 @@ all: mist.dsk mist_side2.dsk mist_side3.dsk
|
||||
zip: mist.dsk mist_side2.dsk mist_side3.dsk
|
||||
zip mist.zip mist.dsk mist_side2.dsk mist_side3.dsk
|
||||
|
||||
mist.dsk: HELLO LOADER MIST_TITLE MIST OCTAGON VIEWER \
|
||||
DENTIST D\'NI SAVE0 SHIP
|
||||
cp empty.dsk mist.dsk
|
||||
$(DOS33) -y mist.dsk SAVE A HELLO
|
||||
$(DOS33) -y mist.dsk BSAVE -a 0x1000 LOADER
|
||||
$(DOS33) -y mist.dsk BSAVE -a 0x4000 MIST_TITLE
|
||||
$(DOS33) -y mist.dsk BSAVE -a 0x2000 MIST
|
||||
$(DOS33) -y mist.dsk BSAVE -a 0x2000 OCTAGON
|
||||
$(DOS33) -y mist.dsk BSAVE -a 0x2000 VIEWER
|
||||
$(DOS33) -y mist.dsk BSAVE -a 0x2000 DENTIST
|
||||
$(DOS33) -y mist.dsk BSAVE -a 0x2000 D\'NI
|
||||
$(DOS33) -y mist.dsk BSAVE -a 0xe00 SAVE0
|
||||
$(DOS33) -y mist.dsk BSAVE -a 0x2000 SHIP
|
||||
#mist_old.dsk: HELLO LOADER MIST_TITLE MIST OCTAGON VIEWER \
|
||||
# DENTIST D\'NI SAVE0 SHIP
|
||||
# cp empty.dsk mist_old.dsk
|
||||
# $(DOS33) -y mist_old.dsk SAVE A HELLO
|
||||
# $(DOS33) -y mist_old.dsk BSAVE -a 0x1000 LOADER
|
||||
# $(DOS33) -y mist_old.dsk BSAVE -a 0x4000 MIST_TITLE
|
||||
# $(DOS33) -y mist_old.dsk BSAVE -a 0x2000 MIST
|
||||
# $(DOS33) -y mist_old.dsk BSAVE -a 0x2000 OCTAGON
|
||||
# $(DOS33) -y mist_old.dsk BSAVE -a 0x2000 VIEWER
|
||||
# $(DOS33) -y mist_old.dsk BSAVE -a 0x2000 DENTIST
|
||||
# $(DOS33) -y mist_old.dsk BSAVE -a 0x2000 D\'NI
|
||||
# $(DOS33) -y mist_old.dsk BSAVE -a 0xe00 SAVE0
|
||||
# $(DOS33) -y mist_old.dsk BSAVE -a 0x2000 SHIP
|
||||
|
||||
mist_side2.dsk: HELLO_DISK2 CHANNEL ARBOR NIBEL CABIN GENERATOR
|
||||
cp extra_empty.dsk mist_side2.dsk
|
||||
$(DOS33) -y mist_side2.dsk SAVE A HELLO_DISK2 HELLO
|
||||
$(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 CHANNEL
|
||||
$(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 ARBOR
|
||||
$(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 NIBEL
|
||||
$(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 CABIN
|
||||
$(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 GENERATOR
|
||||
#mist_side2.dsk: HELLO_DISK2 CHANNEL ARBOR NIBEL CABIN GENERATOR
|
||||
# cp extra_empty.dsk mist_side2.dsk
|
||||
# $(DOS33) -y mist_side2.dsk SAVE A HELLO_DISK2 HELLO
|
||||
# $(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 CHANNEL
|
||||
# $(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 ARBOR
|
||||
# $(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 NIBEL
|
||||
# $(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 CABIN
|
||||
# $(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 GENERATOR
|
||||
|
||||
mist_side3.dsk: HELLO_DISK2 MECHE SELENA STONEY SUB
|
||||
cp extra_empty.dsk mist_side3.dsk
|
||||
#mist_side3.dsk: HELLO_DISK2 MECHE SELENA STONEY SUB
|
||||
# cp extra_empty.dsk mist_side3.dsk
|
||||
# $(DOS33) -y mist_side3.dsk SAVE A HELLO_DISK2 HELLO
|
||||
$(DOS33) -y mist_side3.dsk BSAVE -a 0x2000 MECHE
|
||||
$(DOS33) -y mist_side3.dsk BSAVE -a 0x2000 SELENA
|
||||
$(DOS33) -y mist_side3.dsk BSAVE -a 0x2000 STONEY
|
||||
$(DOS33) -y mist_side3.dsk BSAVE -a 0x2000 SUB
|
||||
# $(DOS33) -y mist_side3.dsk BSAVE -a 0x2000 MECHE
|
||||
# $(DOS33) -y mist_side3.dsk BSAVE -a 0x2000 SELENA
|
||||
# $(DOS33) -y mist_side3.dsk BSAVE -a 0x2000 STONEY
|
||||
# $(DOS33) -y mist_side3.dsk BSAVE -a 0x2000 SUB
|
||||
|
||||
|
||||
mist.dsk: QBOOT QLOAD MIST_TITLE MIST OCTAGON VIEWER \
|
||||
DENTIST D\'NI SAVE0 SHIP GENERATOR
|
||||
cp extra_empty.dsk mist.dsk
|
||||
$(DOS33_RAW) mist.dsk 0 0 QBOOT 0 1
|
||||
$(DOS33_RAW) mist.dsk 0 2 QBOOT 1 1
|
||||
$(DOS33_RAW) mist.dsk 0 4 QBOOT 2 1
|
||||
$(DOS33_RAW) mist.dsk 0 6 SAVE0 0 1
|
||||
$(DOS33_RAW) mist.dsk 1 0 QLOAD 0 12
|
||||
$(DOS33_RAW) mist.dsk 2 0 MIST_TITLE 0 83
|
||||
$(DOS33_RAW) mist.dsk 8 0 MIST 0 159
|
||||
$(DOS33_RAW) mist.dsk 18 0 OCTAGON 0 128
|
||||
$(DOS33_RAW) mist.dsk 26 0 DENTIST 0 31
|
||||
$(DOS33_RAW) mist.dsk 28 0 D\'NI 0 27
|
||||
$(DOS33_RAW) mist.dsk 30 0 SHIP 0 20
|
||||
$(DOS33_RAW) mist.dsk 31 8 VIEWER 0 19
|
||||
$(DOS33_RAW) mist.dsk 32 12 GENERATOR 0 33
|
||||
|
||||
|
||||
mist_side2.dsk: CHANNEL ARBOR NIBEL CABIN
|
||||
cp extra_empty.dsk mist_side2.dsk
|
||||
$(DOS33_RAW) mist_side2.dsk 1 0 CHANNEL 0 135
|
||||
$(DOS33_RAW) mist_side2.dsk 10 0 ARBOR 0 159
|
||||
$(DOS33_RAW) mist_side2.dsk 20 0 NIBEL 0 109
|
||||
$(DOS33_RAW) mist_side2.dsk 27 0 CABIN 0 61
|
||||
|
||||
mist_side3.dsk: MECHE SELENA STONEY SUB
|
||||
cp extra_empty.dsk mist_side3.dsk
|
||||
$(DOS33_RAW) mist_side3.dsk 1 0 MECHE 0 157
|
||||
$(DOS33_RAW) mist_side3.dsk 11 0 SELENA 0 145
|
||||
$(DOS33_RAW) mist_side3.dsk 21 0 STONEY 0 158
|
||||
$(DOS33_RAW) mist_side3.dsk 31 0 SUB 0 54
|
||||
|
||||
|
||||
###
|
||||
|
||||
QBOOT: qboot_sector.o
|
||||
ld65 -o QBOOT qboot_sector.o -C ../linker_scripts/apple2_800.inc
|
||||
|
||||
qboot_sector.o: qboot_sector.s qboot_stage2.s
|
||||
ca65 -o qboot_sector.o qboot_sector.s -l qboot_sector.lst
|
||||
|
||||
###
|
||||
|
||||
QLOAD: qload.o
|
||||
ld65 -o QLOAD qload.o -C ../linker_scripts/apple2_1200.inc
|
||||
|
||||
qload.o: qload.s \
|
||||
gr_copy.s gr_offsets.s gr_pageflip.s gr_putsprite_crop.s \
|
||||
text_print.s gr_fast_clear.s decompress_fast_v2.s \
|
||||
keyboard.s draw_pointer.s end_level.s audio.s loadstore.s \
|
||||
qkumba_popwr.s
|
||||
ca65 -o qload.o qload.s -l qload.lst
|
||||
|
||||
|
||||
###
|
||||
|
||||
@ -83,7 +137,7 @@ generate_common.o: generate_common.c
|
||||
|
||||
####
|
||||
|
||||
common_routines.inc: loader.lst generate_common
|
||||
common_routines.inc: qload.lst loader.lst generate_common
|
||||
./generate_common > common_routines.inc
|
||||
|
||||
####
|
||||
|
40
mist/README
40
mist/README
@ -60,16 +60,52 @@ New disk1:
|
||||
|
||||
disk2:
|
||||
CHANNEL 34418 -> 34560 -> 135 9
|
||||
ARBOR 31591 -> 31744 -> 124 8
|
||||
ARBOR 40702 -> 40704 -> 159 ?
|
||||
NIBEL 27688 -> 28904 -> 109 6
|
||||
CABIN 15398 -> 15616 -> 61 4
|
||||
GENERATOR 8434 -> 8448 -> 33 3 2T1S
|
||||
======== ===
|
||||
414+5= 419 = 104k 30
|
||||
disk3:
|
||||
MECHE 39629 -> 39629 -> 155 10
|
||||
MECHE 40064 -> 40192 -> 157 10
|
||||
SELENA 36912 -> 37120 -> 145 10
|
||||
STONEY 40195 -> 40448 -> 158 10
|
||||
SUB 13786 -> 13824 -> 54 4
|
||||
======== ====
|
||||
503+5=508 = 127k 34
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
NEW:
|
||||
disk1: sectors T/S start end length
|
||||
|
||||
QBOOT 716 3 0_0,0_d,0_e 3
|
||||
SAVE0..4 256 5 0_1..0_5 5
|
||||
QLOAD 3060 12 1_0 1_11 12
|
||||
MIST_TITLE 21008 83 2_0 7_2 83
|
||||
MIST 40653 159 8_0 17_14 159
|
||||
OCTAGON 32610 128 18_0 25_15 128
|
||||
DENTIST 7879 31 26_0 27_15 31
|
||||
D'NI 6863 27 28_0 29_10 27
|
||||
SHIP 5047 20 30_0 31_4 20
|
||||
VIEWER 4834 19 31_8 32_11 19
|
||||
GENERATOR 8434 33 32_12 34_13 33
|
||||
|
||||
disk2:
|
||||
|
||||
CHANNEL 34418 135 (8T7S) 1_0 9_6 135
|
||||
ARBOR 40702 159 (9T15S) 10_0 19_14 159
|
||||
NIBEL 27688 109 (6T13S) 20_0 26_12 109
|
||||
CABIN 15398 61 (3T13S) 27_0 30_2 61
|
||||
|
||||
disk3:
|
||||
|
||||
MECHE 40064 157 (9T13S) 1_0 10_12 157
|
||||
SELENA 36912 145 (9T1S) 11_0 20_0 145
|
||||
STONEY 40195 158 (9T14S) 21_0 30_13 158
|
||||
SUB 13786 54 (3T6S) 31_0 34_5 54
|
||||
|
||||
|
||||
|
||||
|
@ -1,5 +1,12 @@
|
||||
For release 1.0
|
||||
|
||||
+ QLOAD
|
||||
-- add back in intro text (load to gr page2, switch to, then load?)
|
||||
-- add in 5 load games
|
||||
-- make it which-disk-is-in aware
|
||||
-- code to sanity check right disk is put in?
|
||||
read t0/s0 check fingerprint?
|
||||
|
||||
+ LOADER
|
||||
-- save game
|
||||
-- joystick support
|
||||
@ -38,7 +45,7 @@ For release 1.0
|
||||
+ MECHE
|
||||
-- animations for elevator
|
||||
-- way to turn around in basement
|
||||
-- more of paths to hints
|
||||
-- make rotation more similar to actual game?
|
||||
|
||||
+ SUB
|
||||
-- can walk around outside of sub
|
||||
|
@ -2,53 +2,53 @@
|
||||
; external routines
|
||||
|
||||
; loader.s
|
||||
opendir_filename =$1042
|
||||
opendir_filename =$1263
|
||||
|
||||
; linking_noise.s
|
||||
play_link_noise =$1598
|
||||
play_link_noise =$13e2
|
||||
|
||||
; decompress_fast_v2.s
|
||||
decompress_lzsa2_fast =$15b4
|
||||
getsrc_smc =$16aa
|
||||
decompress_lzsa2_fast =$13fe
|
||||
getsrc_smc =$14f4
|
||||
|
||||
; draw_pointer.s
|
||||
draw_pointer =$16b7
|
||||
draw_pointer =$1501
|
||||
|
||||
; end_level.s
|
||||
end_level =$1825
|
||||
end_level =$166f
|
||||
|
||||
; gr_copy.s
|
||||
gr_copy_to_current =$1847
|
||||
gr_copy_to_current =$1691
|
||||
|
||||
; gr_fast_clear.s
|
||||
clear_bottom =$196d
|
||||
clear_all =$19ab
|
||||
clear_all_color =$19d0
|
||||
clear_bottom =$17b7
|
||||
clear_all =$17f5
|
||||
clear_all_color =$181a
|
||||
|
||||
; gr_offsets.s
|
||||
gr_offsets =$19ee
|
||||
gr_offsets =$1838
|
||||
|
||||
; gr_page_flip.s
|
||||
page_flip =$1a1e
|
||||
page_flip =$1868
|
||||
|
||||
; gr_putsprite_crop.s
|
||||
put_sprite_crop =$1a38
|
||||
psc_smc1 =$1a5b
|
||||
psc_smc2 =$1af3
|
||||
put_sprite_crop =$1882
|
||||
psc_smc1 =$18a5
|
||||
psc_smc2 =$193d
|
||||
|
||||
; keyboard.s
|
||||
handle_keypress =$1b74
|
||||
change_direction =$1c38
|
||||
change_location =$1c71
|
||||
handle_keypress =$19be
|
||||
change_direction =$1a82
|
||||
change_location =$1abb
|
||||
|
||||
; text_print.s
|
||||
move_and_print =$1d09
|
||||
ps_smc1 =$1d36
|
||||
move_and_print =$1b53
|
||||
ps_smc1 =$1b80
|
||||
|
||||
; page_sprites.inc
|
||||
blue_page_sprite =$1e1e
|
||||
red_page_sprite =$1e34
|
||||
white_page_sprite =$1e4a
|
||||
blue_page_small_sprite =$1e60
|
||||
red_page_small_sprite =$1e68
|
||||
blue_page_sprite =$1c68
|
||||
red_page_sprite =$1c7e
|
||||
white_page_sprite =$1c94
|
||||
blue_page_small_sprite =$1caa
|
||||
red_page_small_sprite =$1cb2
|
||||
|
||||
|
@ -1,6 +1,16 @@
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
|
||||
#if 0
|
||||
/* old, loader.s */
|
||||
static char filename[]="loader.lst";
|
||||
static int routine_offset=0x1000;
|
||||
#else
|
||||
/* new, qload */
|
||||
static char filename[]="qload.lst";
|
||||
static int routine_offset=0x1200;
|
||||
#endif
|
||||
|
||||
|
||||
static FILE *fff;
|
||||
|
||||
@ -27,14 +37,14 @@ static void find_address(char *symbol_name) {
|
||||
}
|
||||
|
||||
|
||||
printf("%s\t=$%04x\n",symbol_name,addr+0x1000);
|
||||
printf("%s\t=$%04x\n",symbol_name,addr+routine_offset);
|
||||
}
|
||||
|
||||
int main(int argc, char **argv) {
|
||||
|
||||
fff=fopen("loader.lst","r");
|
||||
fff=fopen(filename,"r");
|
||||
if (fff==NULL) {
|
||||
fprintf(stderr,"ERROR! could not open loader.lst\n");
|
||||
fprintf(stderr,"ERROR! could not open %s\n",filename);
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
235
mist/qboot_sector.s
Normal file
235
mist/qboot_sector.s
Normal file
@ -0,0 +1,235 @@
|
||||
; fast seek/multi-read
|
||||
; copyright (c) Peter Ferrie 2015-16
|
||||
|
||||
sectors = 12 ; user-defined
|
||||
firsttrk = 1 ; user-defined, first track to read
|
||||
firstsec = 0 ; user-defined, first sector to read
|
||||
address = $12 ; user-defined
|
||||
entry = $1200 ; user-defined
|
||||
version = 1
|
||||
|
||||
;memory usage:
|
||||
;256 bytes ($200-2ff) static table
|
||||
grouped = $200
|
||||
|
||||
; stay aware from interrupt vectors at $3fe !!!
|
||||
|
||||
;106 bytes ($300-369) static table
|
||||
preshift = $300
|
||||
zvalue = $fd ; only during init
|
||||
znibble = $fe ; only during init
|
||||
zmask = $ff ; only during init
|
||||
|
||||
|
||||
; $26/$27 sector read location (ROM)
|
||||
; $3D sector number (ROM)
|
||||
|
||||
|
||||
; at entry (at least on AppleWin) A=1, X=60 (slot<<4), Y=0
|
||||
; qkumba says cffa cards leave Y at $10
|
||||
; 26/27 = 00/09
|
||||
; 3D = 1
|
||||
|
||||
; For Disk II booting, the firmware loads track0/sector0
|
||||
; to $800 and then jumps to $801
|
||||
|
||||
.org $800
|
||||
.byte 1 ; number of sectors for ROM to load
|
||||
|
||||
boot_entry:
|
||||
; this code loads two sectors up to $10/$11
|
||||
|
||||
lsr ; check sector number
|
||||
tay
|
||||
adc #$0f
|
||||
sta $27 ; set or update address as needed
|
||||
cmp #$12
|
||||
; 10 11 12 (1 1 1)
|
||||
; be, bf, c0 (1011 1011 1100)
|
||||
; so if hit $c000 we are done
|
||||
|
||||
beq done_load_2 ; branch if loaded 2
|
||||
|
||||
inc $3d ; increment sector (faster to find)
|
||||
|
||||
; call to the read routine in proper slot
|
||||
; using rts to jump indirect to
|
||||
; $CX5C
|
||||
|
||||
; this routine reads sector in $3D on track in $41
|
||||
; to address in $26/$27
|
||||
; when it's done it jumps back to $801
|
||||
|
||||
txa ; x is slot# << 4
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
lsr
|
||||
ora #$c0 ; slot to PROM base
|
||||
pha
|
||||
lda #$5b ;read-1
|
||||
pha
|
||||
rts
|
||||
|
||||
done_load_2:
|
||||
|
||||
; patch self modifying code for Q6L read
|
||||
|
||||
txa
|
||||
ora #$8c ; slot to Q6L
|
||||
; Q6L?
|
||||
; if slot 6, after this A is $EC
|
||||
patch_loop:
|
||||
iny
|
||||
ldx patchtbl-3, Y
|
||||
sta code_begin, X ; replace placeholders with Q6L
|
||||
; BE02 = EC? lda c0ec
|
||||
; so sets to c08c (Q6L)
|
||||
|
||||
bne patch_loop
|
||||
|
||||
; patch self-modifying code for turning motor off
|
||||
|
||||
and #$f8 ; MOTOROFF (c088) -> c0e8
|
||||
sta slotpatch7+1
|
||||
|
||||
; patch self-modifying code for turning motor on
|
||||
clc
|
||||
adc #1 ; MOTOROFF (c088) -> c0e9
|
||||
sta slotpatch9+1
|
||||
|
||||
; patch self-modifying code for phase off
|
||||
|
||||
eor #9 ; PHASEOFF (c080)
|
||||
sta slotpatch8+1
|
||||
|
||||
ldx #$3f
|
||||
stx zmask
|
||||
inx
|
||||
ldy #$7f
|
||||
|
||||
bne skip_ahead ; branch always
|
||||
|
||||
; pad with zeros until $839
|
||||
; $839 is the entry point
|
||||
; adjusts address at $8FE to be entry point
|
||||
; jumps to boot 2
|
||||
;.res $839-*
|
||||
|
||||
; lda #>(entry-1)
|
||||
; pha
|
||||
; lda #<(entry-1)
|
||||
; pha
|
||||
; jsr preread
|
||||
; jmp $1000 ; stage2 entry point
|
||||
|
||||
patchtbl:
|
||||
.byte <(slotpatch1+1), <(slotpatch2+1), <(slotpatch3+1)
|
||||
.byte <(slotpatch4+1), <(slotpatch5+1), <(slotpatch6+1)
|
||||
indextbl: ;the 0 also terminates the patchtbl list!
|
||||
.byte 0, 2, 1, 3
|
||||
|
||||
|
||||
;construct denibbilisation table
|
||||
;pre-shifted for interleave read
|
||||
|
||||
skip_ahead:
|
||||
loopaa:
|
||||
sty znibble
|
||||
tya
|
||||
asl
|
||||
bit znibble
|
||||
beq loopz
|
||||
ora znibble
|
||||
eor #$ff
|
||||
and #$7e
|
||||
loopa:
|
||||
bcs loopz
|
||||
lsr
|
||||
bne loopa
|
||||
dex
|
||||
txa
|
||||
asl
|
||||
asl
|
||||
sta preshift-$16, Y
|
||||
loopz:
|
||||
dey
|
||||
bne loopaa
|
||||
|
||||
;construct 2-bit group table
|
||||
|
||||
sty zvalue
|
||||
loopbb:
|
||||
lsr zmask
|
||||
lsr zmask
|
||||
loopb:
|
||||
lda indextbl, X
|
||||
sta grouped, Y
|
||||
inc zvalue
|
||||
lda zvalue
|
||||
and zmask
|
||||
bne loopy
|
||||
inx
|
||||
txa
|
||||
and #3
|
||||
tax
|
||||
loopy:
|
||||
iny
|
||||
iny
|
||||
iny
|
||||
iny
|
||||
cpy #3
|
||||
bcs loopb
|
||||
iny
|
||||
cpy #3
|
||||
bcc loopbb
|
||||
lda #>(entry-1)
|
||||
pha
|
||||
lda #<(entry-1)
|
||||
pha
|
||||
jsr preread
|
||||
|
||||
; seek backward support
|
||||
; sty startsec+1
|
||||
; sta tmpadr+1
|
||||
; stx total+1
|
||||
|
||||
jmp seekread
|
||||
|
||||
preread:
|
||||
|
||||
;copy post-read if necessary
|
||||
;push post-read address here
|
||||
; pla
|
||||
; tax
|
||||
; pla
|
||||
; tay
|
||||
; lda #>(postread-1)
|
||||
; pha
|
||||
; lda #<(postread-1)
|
||||
; pha
|
||||
; tya
|
||||
; pha
|
||||
; txa
|
||||
; pha
|
||||
|
||||
lda #<(firsttrk*2)
|
||||
sta phase+1
|
||||
ldx #sectors
|
||||
lda #address
|
||||
ldy #firstsec
|
||||
rts
|
||||
|
||||
|
||||
|
||||
end_code:
|
||||
|
||||
.res $8fe-*
|
||||
|
||||
; traditionally, entry point to jump to at end of loading
|
||||
; $1000 in this case
|
||||
;*=$8fe
|
||||
.byte $10, $00
|
||||
|
||||
|
||||
.include "qboot_stage2.s"
|
334
mist/qboot_stage2.s
Normal file
334
mist/qboot_stage2.s
Normal file
@ -0,0 +1,334 @@
|
||||
; the following lives on sectors $0E and $0D
|
||||
; why?
|
||||
; request sector 2 and 4, and the interleave is
|
||||
|
||||
; beneath apple dos (3-23)
|
||||
; Physical (firmware) : 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
|
||||
; DOS33 mapping : 0, 7, 14, 6, 13, 5, 12, 4, 11, 3, 10, 2, 9, 1, 8, 15
|
||||
|
||||
|
||||
; Beneath Apple DOS
|
||||
; p86 (dos reference)
|
||||
;
|
||||
|
||||
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
|
||||
|
||||
.org $1000
|
||||
|
||||
code_begin:
|
||||
|
||||
.byte version
|
||||
|
||||
readnib:
|
||||
slotpatch1: ; smc
|
||||
lda $c0d1 ; gets set to C08C (Q6L) read
|
||||
bpl readnib
|
||||
rts
|
||||
|
||||
;fill address array for one track
|
||||
seekread:
|
||||
sty startsec+1
|
||||
sta tmpadr+1
|
||||
stx total+1
|
||||
|
||||
inittrk:
|
||||
sec
|
||||
lda #$10
|
||||
sbc startsec+1
|
||||
cmp total+1
|
||||
bcs it_skip
|
||||
|
||||
tax
|
||||
|
||||
it_skip:
|
||||
stx partial1
|
||||
stx partial2
|
||||
jsr seek
|
||||
|
||||
startsec:
|
||||
ldy #$d1
|
||||
|
||||
tmpadr:
|
||||
tmpadr_loop:
|
||||
lda #$d1
|
||||
sta addrtbl, y
|
||||
inc tmpadr+1
|
||||
iny
|
||||
dec partial1
|
||||
bne tmpadr_loop
|
||||
|
||||
read:
|
||||
|
||||
outer_read:
|
||||
jsr readnib
|
||||
inner_read:
|
||||
cmp #$d5
|
||||
bne outer_read
|
||||
jsr readnib
|
||||
cmp #$aa
|
||||
bne inner_read
|
||||
tay ; we need Y=#$AA later
|
||||
jsr readnib
|
||||
eor #$ad ; zero A if match
|
||||
beq check_mode
|
||||
|
||||
;if not #$AD, then #$96 is assumed
|
||||
|
||||
ldy #2 ; volume, track, sector
|
||||
another:
|
||||
jsr readnib
|
||||
rol ; set carry
|
||||
sta sector+1
|
||||
jsr readnib
|
||||
and sector+1
|
||||
dey
|
||||
bpl another
|
||||
tay
|
||||
ldx addrtbl, Y ; fetch corresponding address
|
||||
beq read
|
||||
sta sector+1 ; store index for later
|
||||
|
||||
stx adrpatch1+2
|
||||
stx adrpatch8+2
|
||||
stx adrpatch2+2
|
||||
stx adrpatch3+2
|
||||
stx adrpatch5+2
|
||||
stx adrpatch7+2
|
||||
|
||||
inx
|
||||
stx adrpatch9+2
|
||||
dex
|
||||
|
||||
dex
|
||||
stx adrpatch4+2
|
||||
stx adrpatch6+2
|
||||
|
||||
ldy #$fe
|
||||
adrpatch1:
|
||||
loop2:
|
||||
lda $d102, Y
|
||||
pha
|
||||
iny
|
||||
bne loop2
|
||||
|
||||
branch_read:
|
||||
bcs read ; branch always
|
||||
check_mode:
|
||||
cpx #0
|
||||
beq read ; loop if not expecting #$AD
|
||||
|
||||
loop33:
|
||||
sta tmpval+1 ; zero rolling checksum
|
||||
slotpatch2:
|
||||
loop4:
|
||||
ldx $c0d1
|
||||
bpl loop4
|
||||
lda preshift-$96, X
|
||||
adrpatch2:
|
||||
sta $d102, Y ; store 2-bit array
|
||||
|
||||
tmpval:
|
||||
eor #$d1
|
||||
iny
|
||||
bne loop33
|
||||
ldy #$aa
|
||||
slotpatch3:
|
||||
loop5:
|
||||
ldx $c0d1
|
||||
bpl loop5
|
||||
eor preshift-$96, X
|
||||
adrpatch3:
|
||||
ldx $d102, Y ; bit2tbl
|
||||
eor grouped+2, X ; first 86 nibbles use group bits 0-1
|
||||
adrpatch4:
|
||||
sta $d156, y
|
||||
iny
|
||||
bne loop5
|
||||
and #$fc
|
||||
ldy #$aa
|
||||
slotpatch4:
|
||||
loop6:
|
||||
ldx $c0d1
|
||||
bpl loop6
|
||||
eor preshift-$96, X
|
||||
adrpatch5:
|
||||
ldx $d102, Y ; bit2tbl
|
||||
eor grouped+1, X ; second 86 nibbles use group bits 2-3
|
||||
adrpatch6:
|
||||
sta $d1ac, Y
|
||||
iny
|
||||
bne loop6
|
||||
and #$fc
|
||||
ldx #$ac
|
||||
slotpatch5:
|
||||
loop7:
|
||||
ldy $c0d1
|
||||
bpl loop7
|
||||
eor preshift-$96, Y
|
||||
adrpatch7:
|
||||
ldy $d100, X ; bit2tbl
|
||||
eor grouped, Y ; last 84 nibbles use group bits 4-5
|
||||
adrpatch8:
|
||||
sta $d100, x
|
||||
inx
|
||||
bne loop7
|
||||
and #$fc
|
||||
slotpatch6:
|
||||
loop8:
|
||||
ldy $c0d1
|
||||
bpl loop8
|
||||
eor preshift-$96, Y
|
||||
cmp #1 ; carry = !zero
|
||||
ldy #1
|
||||
loop9:
|
||||
pla
|
||||
adrpatch9:
|
||||
sta $d100, Y
|
||||
dey
|
||||
bpl loop9
|
||||
branch_read2:
|
||||
bcs branch_read ; branch if checksum failure
|
||||
sector:
|
||||
ldy #$d1
|
||||
txa
|
||||
sta addrtbl, Y ; zero corresponding address
|
||||
dec total+1
|
||||
dec partial2 ; adjust remaining count (faster than looping over array)
|
||||
sec
|
||||
bne branch_read2 ; read all requested sectors in one track
|
||||
total:
|
||||
ldx #$d1
|
||||
beq driveoff
|
||||
inc phase+1
|
||||
inc phase+1 ; update current track
|
||||
jmp inittrk
|
||||
|
||||
driveoff:
|
||||
slotpatch7:
|
||||
lda $c0d1
|
||||
|
||||
seekret:
|
||||
rts
|
||||
|
||||
seek:
|
||||
lda #0
|
||||
sta step+1
|
||||
copy_cur:
|
||||
curtrk:
|
||||
lda #0
|
||||
sta tmpval+1
|
||||
sec
|
||||
phase:
|
||||
sbc #$d1
|
||||
beq seekret
|
||||
|
||||
; if seek backwards
|
||||
bcs sback
|
||||
|
||||
eor #$ff
|
||||
inc curtrk+1
|
||||
|
||||
bcc ssback
|
||||
sback:
|
||||
adc #$fe
|
||||
dec curtrk+1
|
||||
ssback:
|
||||
cmp step+1
|
||||
bcc loop10
|
||||
step:
|
||||
lda #$d1
|
||||
loop10:
|
||||
cmp #8
|
||||
bcs loop11
|
||||
tay
|
||||
sec
|
||||
loop11:
|
||||
lda curtrk+1
|
||||
ldx step1, Y
|
||||
bne loop12
|
||||
loopmmm:
|
||||
clc
|
||||
lda tmpval+1
|
||||
ldx step2, Y
|
||||
loop12:
|
||||
stx sector+1
|
||||
and #3
|
||||
rol
|
||||
tax
|
||||
slotpatch8:
|
||||
sta $c0d1, X
|
||||
loopmm:
|
||||
ldx #$13
|
||||
loopm:
|
||||
dex
|
||||
bne loopm
|
||||
dec sector+1
|
||||
bne loopmm
|
||||
lsr
|
||||
bcs loopmmm
|
||||
inc step+1
|
||||
bne copy_cur
|
||||
|
||||
step1: .byte 1, $30, $28, $24, $20, $1e, $1d, $1c
|
||||
step2: .byte $70, $2c, $26, $22, $1f, $1e, $1d, $1c
|
||||
addrtbl: .res 16
|
||||
|
||||
partial1: .byte $00
|
||||
partial2: .byte $00
|
||||
code_end:
|
||||
|
||||
|
||||
load_new:
|
||||
|
||||
; enable drive motor
|
||||
|
||||
slotpatch9:
|
||||
lda $c0e9 ; fixme, patch
|
||||
|
||||
; wait 1s
|
||||
|
||||
ldx #6
|
||||
wait_1s:
|
||||
lda #255
|
||||
jsr WAIT
|
||||
dex
|
||||
bne wait_1s
|
||||
|
||||
; setup return on stack
|
||||
; is value - 1
|
||||
|
||||
lda load_address
|
||||
sec
|
||||
sbc #1
|
||||
pha
|
||||
lda #$ff
|
||||
pha
|
||||
|
||||
lda load_track
|
||||
asl ; track to start*2
|
||||
sta phase+1
|
||||
|
||||
lda load_address ; address to load
|
||||
pha
|
||||
|
||||
lda load_sector
|
||||
tay ; sector to start
|
||||
|
||||
lda load_length ; length
|
||||
tax
|
||||
|
||||
pla
|
||||
|
||||
jmp seekread
|
||||
|
||||
|
||||
load_address:
|
||||
.byte $00
|
||||
load_track:
|
||||
.byte $00
|
||||
load_sector:
|
||||
.byte $00
|
||||
load_length:
|
||||
.byte $00
|
||||
|
||||
|
170
mist/qload.s
Normal file
170
mist/qload.s
Normal file
@ -0,0 +1,170 @@
|
||||
; Loader for MIST
|
||||
|
||||
.include "zp.inc"
|
||||
.include "hardware.inc"
|
||||
|
||||
.include "common_defines.inc"
|
||||
|
||||
qload_start:
|
||||
|
||||
; first time entry
|
||||
; start by loading title
|
||||
|
||||
lda #LOAD_TITLE ; load title
|
||||
sta WHICH_LOAD
|
||||
|
||||
main_game_loop:
|
||||
jsr load_file
|
||||
jmp main_game_loop
|
||||
|
||||
|
||||
which_disk:
|
||||
.byte '1' ; MIST_TITLE
|
||||
.byte '1' ; MIST
|
||||
.byte '3' ; MECHE
|
||||
.byte '3' ; SELENA
|
||||
.byte '1' ; OCTAGON
|
||||
.byte '1' ; VIEWER
|
||||
.byte '3' ; STONEY
|
||||
.byte '2' ; CHANNEL
|
||||
.byte '2' ; CABIN
|
||||
.byte '1' ; DENTIST
|
||||
.byte '2' ; ARBOR
|
||||
.byte '2' ; NIBEL
|
||||
.byte '1' ; SHIP
|
||||
.byte '2' ; GENERATOR
|
||||
.byte '1' ; D'NI
|
||||
.byte '3' ; SUB
|
||||
|
||||
|
||||
|
||||
;===================================================
|
||||
;===================================================
|
||||
; file not found
|
||||
;===================================================
|
||||
;===================================================
|
||||
|
||||
file_not_found:
|
||||
|
||||
mlsmc07:lda $c0e8 ; turn off drive motor?
|
||||
|
||||
jsr TEXT
|
||||
jsr HOME
|
||||
|
||||
ldy #0
|
||||
|
||||
lda #<error_string
|
||||
sta OUTL
|
||||
lda #>error_string
|
||||
sta OUTH
|
||||
|
||||
quick_print:
|
||||
lda (OUTL),Y
|
||||
beq quick_print_done
|
||||
jsr COUT1
|
||||
iny
|
||||
jmp quick_print
|
||||
|
||||
quick_print_done:
|
||||
; rts
|
||||
|
||||
; jsr quick_print
|
||||
|
||||
fnf_keypress:
|
||||
lda KEYPRESS
|
||||
bpl fnf_keypress
|
||||
bit KEYRESET
|
||||
|
||||
; jmp which_load_loop
|
||||
|
||||
; offset for disk number is 19
|
||||
error_string:
|
||||
.byte "PLEASE INSERT DISK 1, PRESS RETURN",0
|
||||
|
||||
|
||||
opendir_filename:
|
||||
rts
|
||||
|
||||
|
||||
load_new = $119A
|
||||
load_address=$11C8
|
||||
load_track=load_address+1
|
||||
load_sector=load_address+2
|
||||
load_length=load_address+3
|
||||
|
||||
|
||||
;====================================
|
||||
; loads file specified by WHICH_LOAD
|
||||
;====================================
|
||||
load_file:
|
||||
ldx WHICH_LOAD
|
||||
|
||||
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
|
||||
|
||||
jmp load_new
|
||||
|
||||
|
||||
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
|
||||
|
||||
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
|
||||
|
||||
track_array:
|
||||
.byte 2, 8, 1,11 ; MIST_TITLE,MIST,MECHE,SELENA
|
||||
.byte 18,31,21, 1 ; OCTAGON,VIEWER,STONEY,CHANNEL
|
||||
.byte 27,26,10,20 ; CABIN,DENTIST,ARBOR,NIBEL
|
||||
.byte 30,32,28,31 ; SHIP,GENERATOR,D'NI,SUB
|
||||
|
||||
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
|
||||
.byte 0,12, 0, 0 ; SHIP,GENERATOR,D'NI,SUB
|
||||
|
||||
length_array:
|
||||
.byte 83,159,157,145 ; MIST_TITLE,MIST,MECHE,SELENA
|
||||
.byte 128, 19,158,135 ; OCTAGON,VIEWER,STONEY,CHANNEL
|
||||
.byte 61, 31,159,109 ; CABIN,DENTIST,ARBOR,NIBEL
|
||||
.byte 20, 33, 27, 54 ; SHIP,GENERATOR,D'NI,SUB
|
||||
|
||||
; .include "qkumba_popwr.s"
|
||||
|
||||
|
||||
|
||||
.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"
|
||||
|
||||
.include "page_sprites.inc"
|
||||
.include "common_sprites.inc"
|
||||
|
||||
qload_end:
|
||||
|
||||
.assert (<qload_end - <qload_start)>14, error, "loader too big"
|
Loading…
Reference in New Issue
Block a user