mist_hgr: massive rework to make more room on QLOAD for VGI routines

This commit is contained in:
Vince Weaver 2021-07-13 13:09:44 -04:00
parent a048758229
commit 21372b764c
14 changed files with 130 additions and 69 deletions

View File

@ -9,7 +9,7 @@ B2D = ../../utils/bmp2dhr/b2d
EMPTY_DISK = ../../empty_disk/empty.dsk
TOKENIZE = ../../utils/asoft_basic-utils/tokenize_asoft
LINKER_SCRIPTS = ../../linker_scripts
all: mist_hgr.dsk
# mist_side2.dsk mist_side3.dsk
@ -18,22 +18,22 @@ all: mist_hgr.dsk
# zip mist.zip mist_hgr.dsk mist_side2.dsk mist_side3.dsk
mist_hgr.dsk: QBOOT TEXT_TITLE QLOAD \
MIST_TITLE
MIST_TITLE \
SAVE1 SAVE2 SAVE3 SAVE4 SAVE5
#MIST OCTAGON VIEWER \
# DENTIST D\'NI SHIP GENERATOR \
# SAVE1 SAVE2 SAVE3 SAVE4 SAVE5
cp $(EMPTY_DISK) mist_hgr.dsk
$(DOS33_RAW) mist_hgr.dsk 0 0 QBOOT 0 1
$(DOS33_RAW) mist_hgr.dsk 0 2 QBOOT 1 1
$(DOS33_RAW) mist_hgr.dsk 0 4 QBOOT 2 1
$(DOS33_RAW) mist_hgr.dsk 0 6 TEXT_TITLE 0 3
# $(DOS33_RAW) mist_hgr.dsk 0 11 SAVE1 0 1
# $(DOS33_RAW) mist_hgr.dsk 0 12 SAVE2 0 1
# $(DOS33_RAW) mist_hgr.dsk 0 13 SAVE3 0 1
# $(DOS33_RAW) mist_hgr.dsk 0 14 SAVE4 0 1
# $(DOS33_RAW) mist_hgr.dsk 0 15 SAVE5 0 1
$(DOS33_RAW) mist_hgr.dsk 1 0 QLOAD 0 14
$(DOS33_RAW) mist_hgr.dsk 2 0 MIST_TITLE 0 0
$(DOS33_RAW) mist_hgr.dsk 0 11 SAVE1 0 1
$(DOS33_RAW) mist_hgr.dsk 0 12 SAVE2 0 1
$(DOS33_RAW) mist_hgr.dsk 0 13 SAVE3 0 1
$(DOS33_RAW) mist_hgr.dsk 0 14 SAVE4 0 1
$(DOS33_RAW) mist_hgr.dsk 0 15 SAVE5 0 1
$(DOS33_RAW) mist_hgr.dsk 1 0 QLOAD 0 0
$(DOS33_RAW) mist_hgr.dsk 3 0 MIST_TITLE 0 0
# 84
# $(DOS33_RAW) mist_hgr.dsk 8 0 MIST 0 159
# $(DOS33_RAW) mist_hgr.dsk 18 0 OCTAGON 0 128
@ -63,7 +63,7 @@ mist_hgr.dsk: QBOOT TEXT_TITLE QLOAD \
###
#WBOOT2: wrong_boot2.o
# ld65 -o WBOOT2 wrong_boot2.o -C ../../linker_scripts/apple2_800.inc
# ld65 -o WBOOT2 wrong_boot2.o -C $(LINKER_SCRIPTS)/apple2_800.inc
#wrong_boot2.o: wrong_boot2.s
# ca65 -o wrong_boot2.o wrong_boot2.s -l wrong_boot2.lst
@ -71,7 +71,7 @@ mist_hgr.dsk: QBOOT TEXT_TITLE QLOAD \
###
#WBOOT3: wrong_boot3.o
# ld65 -o WBOOT3 wrong_boot3.o -C ../../linker_scripts/apple2_800.inc
# ld65 -o WBOOT3 wrong_boot3.o -C $(LINKER_SCRIPTS)/apple2_800.inc
#wrong_boot3.o: wrong_boot3.s
# ca65 -o wrong_boot3.o wrong_boot3.s -l wrong_boot3.lst
@ -80,7 +80,7 @@ mist_hgr.dsk: QBOOT TEXT_TITLE QLOAD \
###
QBOOT: qboot_sector.o
ld65 -o QBOOT qboot_sector.o -C ../../linker_scripts/apple2_800.inc
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
@ -88,7 +88,7 @@ qboot_sector.o: qboot_sector.s qboot_stage2.s
###
TEXT_TITLE: text_title.o
ld65 -o TEXT_TITLE text_title.o -C ../../linker_scripts/apple2_800.inc
ld65 -o TEXT_TITLE text_title.o -C $(LINKER_SCRIPTS)/apple2_800.inc
text_title.o: text_title.s text_print.s wait_a_bit.s
ca65 -o text_title.o text_title.s -l text_title.lst
@ -97,7 +97,7 @@ text_title.o: text_title.s text_print.s wait_a_bit.s
###
QLOAD: qload.o
ld65 -o QLOAD qload.o -C ../../linker_scripts/apple2_1200.inc
ld65 -o QLOAD qload.o -C $(LINKER_SCRIPTS)/apple2_e00.inc
qload.o: qload.s qboot.inc \
gr_offsets.s hgr_14x14_sprite.s common_sprites.inc \
@ -110,7 +110,7 @@ qload.o: qload.s qboot.inc \
###
LOADER: loader.o
ld65 -o LOADER loader.o -C ../../linker_scripts/apple2_1000.inc
ld65 -o LOADER loader.o -C $(LINKER_SCRIPTS)/apple2_c00.inc
loader.o: loader.s \
gr_offsets.s \
@ -122,7 +122,7 @@ loader.o: loader.s \
###
SAVE1: save1.o
ld65 -o SAVE1 save1.o -C ../../linker_scripts/apple2_e00.inc
ld65 -o SAVE1 save1.o -C $(LINKER_SCRIPTS)/apple2_a00.inc
save1.o: save1.s
ca65 -o save1.o save1.s -l save1.lst
@ -130,7 +130,7 @@ save1.o: save1.s
###
SAVE2: save2.o
ld65 -o SAVE2 save2.o -C ../../linker_scripts/apple2_e00.inc
ld65 -o SAVE2 save2.o -C $(LINKER_SCRIPTS)/apple2_a00.inc
save2.o: save2.s
ca65 -o save2.o save2.s -l save2.lst
@ -138,7 +138,7 @@ save2.o: save2.s
###
SAVE3: save3.o
ld65 -o SAVE3 save3.o -C ../../linker_scripts/apple2_e00.inc
ld65 -o SAVE3 save3.o -C $(LINKER_SCRIPTS)/apple2_a00.inc
save3.o: save3.s
ca65 -o save3.o save3.s -l save3.lst
@ -146,7 +146,7 @@ save3.o: save3.s
###
SAVE4: save4.o
ld65 -o SAVE4 save4.o -C ../../linker_scripts/apple2_e00.inc
ld65 -o SAVE4 save4.o -C $(LINKER_SCRIPTS)/apple2_a00.inc
save4.o: save4.s
ca65 -o save4.o save4.s -l save4.lst
@ -154,7 +154,7 @@ save4.o: save4.s
###
SAVE5: save5.o
ld65 -o SAVE5 save5.o -C ../../linker_scripts/apple2_e00.inc
ld65 -o SAVE5 save5.o -C $(LINKER_SCRIPTS)/apple2_a00.inc
save5.o: save5.s
ca65 -o save5.o save5.s -l save5.lst
@ -175,7 +175,7 @@ common_routines.inc: qload.lst generate_common
####
MIST_TITLE: mist_title.o
ld65 -o MIST_TITLE mist_title.o -C ../../linker_scripts/apple2_4000.inc
ld65 -o MIST_TITLE mist_title.o -C $(LINKER_SCRIPTS)/apple2_4000.inc
mist_title.o: mist_title.s zp.inc hardware.inc common_defines.inc \
common_routines.inc \

View File

@ -4,10 +4,10 @@ $01 - stack
$02 - disk lookup table
$03 - disk lookup ($300-$369)
$04-$07 - text page1
$08-$0B - (danger, text page2)
$0C-$0F - current background data, temp savegame workplace ($E)
$10-$11 - QBOOT stage2
$12-$1F - QLOAD, common routines
$08-$0B - (danger, text page2) initial boot sector $8
- current background data, temp savegame workplace ($E)
$0C-$0D - QBOOT stage2
$0E-$1F - QLOAD, common routines
$20-$3f - HIRES page1
$40-$?? - gameplay/data/code all loaded here
$BE - hires lookup

View File

@ -7,8 +7,10 @@
static int routine_offset=0x1000;
#else
/* new, qload */
// static char filename[]="qload.lst";
// static int routine_offset=0x1200;
static char filename[]="qload.lst";
static int routine_offset=0x1200;
static int routine_offset=0xe00;
#endif
@ -117,6 +119,11 @@ int main(int argc, char **argv) {
find_address("change_location");
printf("\n");
printf("; vgi_*.s\n");
find_address("vgi_init");
find_address("play_vgi");
printf("\n");
printf("; text_print.s\n");
find_address("move_and_print");
find_address("ps_smc1");

View File

@ -13,10 +13,11 @@ title_graphics.inc: \
cyan1.lzsa cyan2.lzsa \
m_title_m.lzsa m_title_y.lzsa m_title_s.lzsa m_title_t.lzsa \
fissure_stars.lzsa fissure_crescent.lzsa fissure.lzsa fissure2.lzsa \
fissure_book_small.lzsa fissure_book_big.lzsa
fissure_book_small.lzsa fissure_book_big.lzsa \
m_link_book.lzsa
echo "cyan1_lzsa: .incbin \"cyan1.lzsa\"" > title_graphics.inc
echo "cyan2_lzsa: .incbin \"cyan2.lzsa\"" >> title_graphics.inc
echo "m_link_book_lzsa: .incbin \"fissure_stars.lzsa\"" >> title_graphics.inc
echo "m_link_book_lzsa: .incbin \"m_link_book.lzsa\"" >> title_graphics.inc
echo "m_title_m_lzsa: .incbin \"m_title_m.lzsa\"" >> title_graphics.inc
echo "m_title_y_lzsa: .incbin \"m_title_y.lzsa\"" >> title_graphics.inc
echo "m_title_s_lzsa: .incbin \"m_title_s.lzsa\"" >> title_graphics.inc
@ -34,7 +35,7 @@ title_graphics.inc: \
echo "book_glow_lzsa: .incbin \"fissure_stars.lzsa\"" >> title_graphics.inc
echo "book_ground_lzsa: .incbin \"fissure_stars.lzsa\"" >> title_graphics.inc
echo "book_ground_n_lzsa: .incbin \"fissure_stars.lzsa\"" >> title_graphics.inc
echo "book_closed_n_lzsa: .incbin \"fissure_stars.lzsa\"" >> title_graphics.inc
echo "book_closed_n_lzsa: .incbin \"m_link_book.lzsa\"" >> title_graphics.inc
####

View File

@ -189,6 +189,14 @@ do_inc_cursor_y:
done_down_pressed:
jmp done_keypress
;check_escape:
; cmp #27
; bne check_return
;escape_pressed:
; inc ESCAPE_PRESSED
; jmp done_keypress
check_return:
cmp #' '
beq return_pressed
@ -278,7 +286,9 @@ change_direction:
bit TEXTGR
; also change sprite cutoff
ldx #40
; not needed for HGR
; ldx #40
; stx psc_smc1+1
;; stx psc_smc2+1
@ -287,7 +297,7 @@ no_split:
bit FULLGR
; also change sprite cutoff
ldx #48
; ldx #48
; stx psc_smc1+1
;; stx psc_smc2+1
@ -308,6 +318,10 @@ done_split:
lda #$c ; load to page $c00
jsr decompress_lzsa2_fast
; draw background
jsr play_vgi
rts
@ -324,6 +338,7 @@ change_location:
sta CURSOR_VISIBLE
lda #20
sta CURSOR_X
lda #89
sta CURSOR_Y
lda LOCATION

View File

@ -1,3 +1,5 @@
loadsave_addr_load = $a00 ; was $e00
loadsave_addr_save = $900 ; was $d00
;===================================
;===================================
@ -26,7 +28,7 @@ load_game:
ldx #0
load_loop:
lda $e00,X
lda loadsave_addr_load,X
sta WHICH_LOAD,X
inx
cpx #(END_OF_SAVE-WHICH_LOAD+1)
@ -79,12 +81,12 @@ actually_save:
pla
sta WHICH_LOAD
; copy save data to $d00
; copy save data to $900
ldx #0
copy_loop:
lda WHICH_LOAD,X
sta $d00,X
sta loadsave_addr_save,X
inx
cpx #(END_OF_SAVE-WHICH_LOAD+1)
bne copy_loop

View File

@ -672,6 +672,19 @@ draw_and_wait:
pla
jsr wait_a_bit
; check if escape was pressed, skip into in that case
lda LAST_KEY
cmp #27|$80 ; check for ESCAPE
bne no_escape
pla
pla ; get return value off stack
jmp done_intro
no_escape:
rts
@ -764,4 +777,4 @@ config_string:
; MOCKINGBOARD: NONE
.include "vgi_common.s"
;.include "vgi_common.s"

View File

@ -1,8 +1,9 @@
seek = $1126
driveon = $119D
driveoff = $1122
load_new = $11AB
load_address=$11C4
; made by hand?
seek = $d26
driveon = $d9D
driveoff = $d22
load_new = $dAB
load_address=$dC4
load_track=load_address+1
load_sector=load_address+2
load_length=load_address+3

View File

@ -3,11 +3,11 @@
; Paramaters for loading QLOAD
sectors = 14 ; user-defined
sectors = 18 ; 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
address = $0E ; user-defined
entry = $E00 ; user-defined
version = 1
;memory usage:
@ -40,20 +40,18 @@
.byte 1 ; number of sectors for ROM to load
boot_entry:
; this code loads two sectors up to $10/$11
; this code loads two sectors up to $C0/$D0
; assume A=1 coming in here
lsr ; check sector number
; A=0, carry=1
tay ; Y=0
adc #$0f ; A=$10 (destintation)
adc #$0B ; A=$C (destintation)
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
cmp #$0E
; so if hit $0e00 we are done
beq done_load_2 ; branch if loaded 2
@ -236,9 +234,11 @@ end_code:
.res $8fe-*
; traditionally, entry point to jump to at end of loading
; $1000 in this case
; $c00 in this case
;*=$8fe
.byte $10, $00
.byte $C, $00
.include "qboot_stage2.s"

View File

@ -13,7 +13,7 @@
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
.org $1000
.org $c00
code_begin:

View File

@ -31,16 +31,18 @@ qload_start:
main_game_loop:
jsr load_file
lda WHICH_LOAD
bne not_title
; lda WHICH_LOAD
; bne not_title
; on hgr, we all start at $4000
start_title:
jsr $4000
jmp main_game_loop
not_title:
jsr $2000
jmp main_game_loop
;not_title:
; jsr $2000
; jmp main_game_loop
;====================================
; loads file specified by WHICH_LOAD
@ -129,13 +131,13 @@ fnf_keypress:
sta WHICH_LOAD
tax
; first sector now in $c00
; first sector now in $800
; offset 59
; disk1 = $0a
; disk2 = $32 ('2')
; disk3 = $33 ('3')
lda $c59
lda $859
cmp #$0a
beq is_disk1
cmp #$32
@ -185,17 +187,17 @@ which_disk_array:
.byte $f ; FIRST_SECTOR
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
.byte $40,$40,$40,$40 ; MIST_TITLE,MIST,MECHE,SELENA
.byte $40,$40,$40,$40 ; OCTAGON,VIEWER,STONEY,CHANNEL
.byte $40,$40,$40,$40 ; CABIN,DENTIST,ARBOR,NIBEL
.byte $40,$40,$40,$40 ; SHIP,GENERATOR,D'NI,SUB
.byte $08 ; TEXT_TITLE
.byte $0E,$0E,$0E,$0E
.byte $0E ; SAVE1,SAVE2,SAVE3,SAVE4,SAVE5
.byte $0C ; FIRST_SECTOR
.byte $0A,$0A,$0A,$0A
.byte $0A ; SAVE1,SAVE2,SAVE3,SAVE4,SAVE5
.byte $08 ; FIRST_SECTOR
track_array:
.byte 2, 8, 1,21 ; MIST_TITLE,MIST,MECHE,SELENA
.byte 3, 8, 1,21 ; MIST_TITLE,MIST,MECHE,SELENA
.byte 18,31,11, 1 ; OCTAGON,VIEWER,STONEY,CHANNEL
.byte 27,26,10,20 ; CABIN,DENTIST,ARBOR,NIBEL
.byte 30,32,28,30 ; SHIP,GENERATOR,D'NI,SUB
@ -242,6 +244,9 @@ length_array:
.include "qkumba_popwr.s"
.include "vgi_common.s"
qload_end:
.assert (>qload_end - >qload_start) < $e , error, "loader too big"
;.assert (>qload_end - >qload_start) < $e , error, "loader too big"
.assert (>qload_end - >qload_start) < $12 , error, "loader too big"

View File

@ -21,6 +21,8 @@ keyloop:
done_keyloop:
sta LAST_KEY
bit KEYRESET
rts

View File

@ -24,6 +24,9 @@ TEMP3 = $13
TEMP4 = $14
TEMP5 = $15
LAST_KEY = $16
HGR_SHAPE = $1A ; also used in BKGND0
HGR_SHAPE2 = $1B
HGR_BITS = $1C

View File

@ -0,0 +1,12 @@
MEMORY {
ZP: start = $00, size = $1A, type = rw;
RAM: start = $A00, size = $8E00, 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;
}