mist: move common routines into loader

big change, only saves 2k per level?  maybe worth it?
This commit is contained in:
Vince Weaver 2020-06-16 13:30:45 -04:00
parent b712a98eba
commit ff77c52c62
17 changed files with 281 additions and 120 deletions

View File

@ -17,21 +17,21 @@ mist.dsk: HELLO LOADER MIST_TITLE MIST OCTAGON VIEWER \
$(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 0x1400 MIST
$(DOS33) -y mist.dsk BSAVE -a 0x1400 OCTAGON
# $(DOS33) -y mist.dsk BSAVE -a 0x1400 MECHE
# $(DOS33) -y mist.dsk BSAVE -a 0x1400 SELENA
# $(DOS33) -y mist.dsk BSAVE -a 0x1400 CHANNEL
# $(DOS33) -y mist.dsk BSAVE -a 0x1400 VIEWER
$(DOS33) -y mist.dsk BSAVE -a 0x1400 STONEY
$(DOS33) -y mist.dsk BSAVE -a 0x2000 MIST
$(DOS33) -y mist.dsk BSAVE -a 0x2000 OCTAGON
# $(DOS33) -y mist.dsk BSAVE -a 0x2000 MECHE
# $(DOS33) -y mist.dsk BSAVE -a 0x2000 SELENA
# $(DOS33) -y mist.dsk BSAVE -a 0x2000 CHANNEL
# $(DOS33) -y mist.dsk BSAVE -a 0x2000 VIEWER
$(DOS33) -y mist.dsk BSAVE -a 0x2000 STONEY
$(DOS33) -y mist.dsk BSAVE -a 0x9000 ./audio/link_noise.btc LINK_NOISE.BTC
mist_side2.dsk: MECHE SELENA CHANNEL VIEWER
cp empty.dsk mist_side2.dsk
$(DOS33) -y mist_side2.dsk BSAVE -a 0x1400 MECHE
$(DOS33) -y mist_side2.dsk BSAVE -a 0x1400 SELENA
$(DOS33) -y mist_side2.dsk BSAVE -a 0x1400 CHANNEL
$(DOS33) -y mist_side2.dsk BSAVE -a 0x1400 VIEWER
$(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 MECHE
$(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 SELENA
$(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 CHANNEL
$(DOS33) -y mist_side2.dsk BSAVE -a 0x2000 VIEWER
$(DOS33) -y mist_side2.dsk BSAVE -a 0x9000 ./audio/link_noise.btc LINK_NOISE.BTC
###
@ -54,6 +54,7 @@ MIST_TITLE: mist_title.o
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 \
graphics_title/mist_title.lzsa graphics_title/title_graphics.inc \
gr_copy.s gr_offsets.s gr_pageflip.s gr_putsprite_crop.s \
text_print.s gr_fast_clear.s decompress_fast_v2.s \
@ -65,9 +66,9 @@ mist_title.o: mist_title.s zp.inc hardware.inc common_defines.inc \
####
MIST: mist.o
ld65 -o MIST mist.o -C ../linker_scripts/apple2_1400.inc
ld65 -o MIST mist.o -C ../linker_scripts/apple2_2000.inc
mist.o: mist.s zp.inc hardware.inc common_defines.inc \
mist.o: mist.s zp.inc hardware.inc common_defines.inc common_routines.inc \
graphics_mist/mist_graphics.inc \
common_sprites.inc \
leveldata_mist.inc \
@ -84,9 +85,10 @@ mist.o: mist.s zp.inc hardware.inc common_defines.inc \
####
OCTAGON: octagon.o
ld65 -o OCTAGON octagon.o -C ../linker_scripts/apple2_1400.inc
ld65 -o OCTAGON octagon.o -C ../linker_scripts/apple2_2000.inc
octagon.o: octagon.s zp.inc hardware.inc common_defines.inc \
common_routines.inc \
graphics_octagon/octagon_graphics.inc \
books/octagon_books.inc \
common_sprites.inc page_sprites.inc \
@ -107,9 +109,10 @@ octagon.o: octagon.s zp.inc hardware.inc common_defines.inc \
####
MECHE: meche.o
ld65 -o MECHE meche.o -C ../linker_scripts/apple2_1400.inc
ld65 -o MECHE meche.o -C ../linker_scripts/apple2_2000.inc
meche.o: meche.s zp.inc hardware.inc common_defines.inc \
common_routines.inc \
graphics_meche/meche_graphics.inc \
common_sprites.inc \
page_sprites.inc \
@ -126,9 +129,10 @@ meche.o: meche.s zp.inc hardware.inc common_defines.inc \
####
SELENA: selena.o
ld65 -o SELENA selena.o -C ../linker_scripts/apple2_1400.inc
ld65 -o SELENA selena.o -C ../linker_scripts/apple2_2000.inc
selena.o: selena.s zp.inc hardware.inc common_defines.inc \
common_routines.inc \
graphics_selena/selena_graphics.inc \
common_sprites.inc \
leveldata_selena.inc \
@ -145,10 +149,11 @@ selena.o: selena.s zp.inc hardware.inc common_defines.inc \
####
VIEWER: viewer.o
ld65 -o VIEWER viewer.o -C ../linker_scripts/apple2_1400.inc
ld65 -o VIEWER viewer.o -C ../linker_scripts/apple2_2000.inc
viewer.o: viewer.s zp.inc hardware.inc common_defines.inc \
graphics_viewer/viewer_graphics.inc \
common_routines.inc \
common_sprites.inc \
page_sprites.inc \
leveldata_viewer.inc \
@ -161,10 +166,11 @@ viewer.o: viewer.s zp.inc hardware.inc common_defines.inc \
####
STONEY: stoney.o
ld65 -o STONEY stoney.o -C ../linker_scripts/apple2_1400.inc
ld65 -o STONEY stoney.o -C ../linker_scripts/apple2_2000.inc
stoney.o: stoney.s zp.inc hardware.inc common_defines.inc \
graphics_stoney/stoney_graphics.inc \
common_routines.inc \
common_sprites.inc \
page_sprites.inc \
leveldata_stoney.inc \
@ -179,9 +185,10 @@ stoney.o: stoney.s zp.inc hardware.inc common_defines.inc \
####
CHANNEL: channel.o
ld65 -o CHANNEL channel.o -C ../linker_scripts/apple2_1400.inc
ld65 -o CHANNEL channel.o -C ../linker_scripts/apple2_2000.inc
channel.o: channel.s zp.inc hardware.inc common_defines.inc \
common_routines.inc \
graphics_channel/channel_graphics.inc \
common_sprites.inc \
page_sprites.inc \

View File

@ -6,7 +6,7 @@ For release 1.0
+ MIST (split off ship-up/ship-down?)
-- constellation puzzle/ship raising
-- marker switches
+ OBSERVATORY
+ DENTIST
-- all of it
+ CABIN (split off?)
-- safe puzzle
@ -17,14 +17,20 @@ For release 1.0
-- ending
+ SELENA
-- sounds/door puzzle
-- have sub background change
+ STONEY
-- hook up compass rose
-- hook up pump
-- hook up telescope
-- hook up key/trunk puzzle
+ CHANNEL
-- 2nd floor
-- 3rd floor
-- hook up water valves at least
-- hook up stairway and elevator1
+ ARBOR
-- all of it
Done:
+ MECHE

View File

@ -6,6 +6,7 @@
.include "zp.inc"
.include "hardware.inc"
.include "common_defines.inc"
.include "common_routines.inc"
channel_start:
;===================
@ -19,6 +20,16 @@ channel_start:
bit LORES
bit FULLGR
;=================
; set up location
;=================
lda #<locations
sta LOCATIONS_L
lda #>locations
sta LOCATIONS_H
lda #0
sta DRAW_PAGE
sta LEVEL_OVER
@ -277,7 +288,7 @@ exit_to_mist:
;==========================
; includes
;==========================
.if 0
.include "gr_copy.s"
.include "gr_offsets.s"
.include "gr_pageflip.s"
@ -288,25 +299,24 @@ exit_to_mist:
.include "keyboard.s"
.include "draw_pointer.s"
.include "end_level.s"
.include "audio.s"
.include "graphics_channel/channel_graphics.inc"
; sprites
.include "common_sprites.inc"
.include "page_sprites.inc"
; puzzles
.endif
; level graphics
.include "graphics_channel/channel_graphics.inc"
; puzzles
.include "channel_switches.s"
; level data
.include "leveldata_channel.inc"
; linking books
.include "link_book_mist.s"
.include "link_book_channel.s"

View File

@ -1,15 +1,5 @@
;=============================
; other common stuff
; external routines
opendir_filename = $1039
; audio files
linking_noise = $9000
LINKING_NOISE_LENGTH = 43
; common stuff
;===============================================
; level data structure definitions

55
mist/common_routines.inc Normal file
View File

@ -0,0 +1,55 @@
;=============================
; external routines
; loader.s
opendir_filename = $1039
; audio.c
play_audio = $131b
; decompress_fast_v2.s
decompress_lzsa2_fast = $142c
getsrc_smc = $1522
; draw_pointer.s
draw_pointer = $152f
; end_level.s
end_level = $1672
; gr_copy.s
gr_copy_to_current = $1694
; gr_fast_clear.s
clear_all = $17f8
clear_all_color = $181d
; gr_offsets.s
gr_offsets = $183b
; gr_page_flip.s
page_flip = $186b
; gr_putsprite_crop.s
put_sprite_crop = $1885
; keyboard.s
handle_keypress = $19c1
change_location = $1a8e
; text_print.s
move_and_print = $1b26
; common_sprites.inc
; page_sprites.inc
blue_page_sprite = $1c57
red_page_sprite = $1c6d
white_page_sprite = $1c83
blue_page_small_sprite = $1c99
red_page_small_sprite = $1ca1
; audio files
linking_noise = $9000
LINKING_NOISE_LENGTH = 43

View File

@ -313,6 +313,7 @@ getlargesrc:
; fall through grab high 8 bits
getsrc:
getsrc_smc:
LZSA_SRC_LO = *+1
LZSA_SRC_HI = *+2
lda $AAAA
@ -353,6 +354,7 @@ getlargesrc:
; fall through grab high 8 bits
getsrc:
getsrc_smc:
LZSA_SRC_LO = *+1
LZSA_SRC_HI = *+2
lda $AAAA

View File

@ -191,9 +191,10 @@ change_location:
asl
tay
lda locations,Y
lda (LOCATIONS_L),Y
sta LOCATION_STRUCT_L
lda locations+1,Y
iny
lda (LOCATIONS_H),Y
sta LOCATION_STRUCT_H
jsr change_direction

View File

@ -4,6 +4,8 @@
.include "zp.inc"
.include "hardware.inc"
.include "common_defines.inc"
; the TITLE program sets $05 with which thing to load
; this part of the program stays resident, so when a level ends
; it changes $05 (WHICH_LOAD) and this code loads the proper executable
@ -51,6 +53,7 @@ filbuf = $3D6 ; filbuf: .res 4 ; = bit2tbl+86
;===================================================
;===================================================
.if 0
LOAD_TITLE = $0
LOAD_MIST = $1
LOAD_MECHE = $2
@ -60,7 +63,7 @@ LOAD_VIEWER = $5
LOAD_STONEDSHIP = $6
LOAD_CHANNEL = $7
LOAD_ENDING = $8
.endif
loader_start:
lda #LOAD_TITLE
@ -96,9 +99,9 @@ load_intro:
jmp actual_load
load_other:
lda #<$1400
lda #<$2000
sta entry_smc+1
lda #>$1400
lda #>$2000
sta entry_smc+2
actual_load:
@ -717,6 +720,24 @@ sectbl: .byte $00,$0d,$0b,$09,$07,$05,$03,$01,$0e,$0c,$0a,$08,$06,$04,$02,$0f
;filbuf: .res 4 ; = bit2tbl+86
;dataend = filbuf+4
.include "audio.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 "common_sprites.inc"
.include "page_sprites.inc"
loader_end:
.assert (<loader_end - <loader_start)>3, error, "loader too big"
.assert (<loader_end - <loader_start)>16, error, "loader too big"

View File

@ -6,6 +6,7 @@
.include "zp.inc"
.include "hardware.inc"
.include "common_defines.inc"
.include "common_routines.inc"
meche_start:
;===================
@ -19,6 +20,15 @@ meche_start:
bit LORES
bit FULLGR
;=================
; set up location
;=================
lda #<locations
sta LOCATIONS_L
lda #>locations
sta LOCATIONS_H
lda #0
sta DRAW_PAGE
sta LEVEL_OVER
@ -256,6 +266,7 @@ no_draw_page:
; includes
;==========================
.if 0
.include "gr_copy.s"
.include "gr_offsets.s"
.include "gr_pageflip.s"
@ -266,27 +277,26 @@ no_draw_page:
.include "keyboard.s"
.include "draw_pointer.s"
.include "end_level.s"
.include "audio.s"
.include "common_sprites.inc"
.include "page_sprites.inc"
.endif
; puzzles
.include "meche_rotation.s"
.include "audio.s"
; graphics
.include "graphics_meche/meche_graphics.inc"
; puzzles
; linking books
.include "link_book_meche.s"
.include "link_book_mist.s"
.include "common_sprites.inc"
.include "page_sprites.inc"
; level data
.include "leveldata_meche.inc"

View File

@ -9,10 +9,13 @@
.include "zp.inc"
.include "hardware.inc"
.include "common_defines.inc"
.include "common_routines.inc"
mist_start:
;===================
; init screen
;===================
jsr TEXT
jsr HOME
bit KEYRESET
@ -22,6 +25,15 @@ mist_start:
bit LORES
bit FULLGR
;=================
; set up location
;=================
lda #<locations
sta LOCATIONS_L
lda #>locations
sta LOCATIONS_H
lda #0
sta DRAW_PAGE
sta LEVEL_OVER
@ -268,6 +280,7 @@ set_level_over:
; includes
;==========================
.if 0
.include "gr_copy.s"
.include "gr_offsets.s"
.include "gr_pageflip.s"
@ -277,15 +290,17 @@ set_level_over:
.include "decompress_fast_v2.s"
.include "keyboard.s"
.include "draw_pointer.s"
.include "audio.s"
.include "graphics_mist/mist_graphics.inc"
.include "end_level.s"
; puzzles
.include "common_sprites.inc"
.endif
; graphics data
.include "graphics_mist/mist_graphics.inc"
; puzzles
.include "clock_bridge_puzzle.s"
.include "marker_switch.s"
.include "generator_puzzle.s"
@ -293,18 +308,11 @@ set_level_over:
; linking books
; letters
.include "letter_cat.s"
.include "common_sprites.inc"
; level data
.include "leveldata_mist.inc"
;.align $100
;audio_red_page:
;.incbin "audio/red_page.btc"

View File

@ -9,10 +9,13 @@
.include "zp.inc"
.include "hardware.inc"
.include "common_defines.inc"
.include "common_routines.inc"
mist_start:
;===================
; init screen
;===================
jsr TEXT
jsr HOME
bit KEYRESET
@ -22,15 +25,24 @@ mist_start:
bit HIRES
bit FULLGR
;===================
; setup location
;===================
lda #<locations
sta LOCATIONS_L
lda #>locations
sta LOCATIONS_H
;===================
; Load graphics
;===================
reload_everything:
lda #<file
sta LZSA_SRC_LO
sta getsrc_smc+1 ; LZSA_SRC_LO
lda #>file
sta LZSA_SRC_HI
sta getsrc_smc+2 ; LZSA_SRC_HI
lda #$20
@ -190,7 +202,7 @@ really_exit:
;==========================
; includes
;==========================
.if 0
.include "gr_copy.s"
.include "gr_offsets.s"
.include "gr_pageflip.s"
@ -200,10 +212,9 @@ really_exit:
.include "decompress_fast_v2.s"
.include "keyboard.s"
.include "draw_pointer.s"
.include "end_level.s"
.include "audio.s"
.endif
.include "init_state.s"

View File

@ -6,6 +6,7 @@
.include "zp.inc"
.include "hardware.inc"
.include "common_defines.inc"
.include "common_routines.inc"
octagon_start:
;===================
@ -19,6 +20,15 @@ octagon_start:
bit LORES
bit FULLGR
;=================
; set up location
;=================
lda #<locations
sta LOCATIONS_L
lda #>locations
sta LOCATIONS_H
lda #0
sta DRAW_PAGE
sta LEVEL_OVER
@ -389,6 +399,7 @@ draw_page_close:
; includes
;==========================
.if 0
.include "gr_copy.s"
.include "gr_offsets.s"
.include "gr_pageflip.s"
@ -398,37 +409,30 @@ draw_page_close:
.include "decompress_fast_v2.s"
.include "keyboard.s"
.include "draw_pointer.s"
.include "audio.s"
.include "end_level.s"
.include "common_sprites.inc"
.include "page_sprites.inc"
.endif
; level graphics
.include "graphics_octagon/octagon_graphics.inc"
.include "end_level.s"
; puzzles
.include "brother_books.s"
.include "octagon_bookshelf.s"
.include "octagon_rotation.s"
; linking books
.include "handle_pages.s"
; books
.include "books/octagon_books.inc"
.include "common_sprites.inc"
.include "page_sprites.inc"
; level data
.include "leveldata_octagon.inc"
;.align $100
;audio_red_page:
;.incbin "audio/red_page.btc"

View File

@ -50,34 +50,34 @@ read_fireplace:
read_selenitic:
lda #<selenitic_book_lzsa
sta LZSA_SRC_LO
sta getsrc_smc+1 ; LZSA_SRC_LO
iny
lda #>selenitic_book_lzsa
jmp load_the_book
read_stoneship:
lda #<stoneship_book_lzsa
sta LZSA_SRC_LO
sta getsrc_smc+1 ; LZSA_SRC_LO
iny
lda #>stoneship_book_lzsa
jmp load_the_book
read_mechanical:
lda #<mechanical_book_lzsa
sta LZSA_SRC_LO
sta getsrc_smc+1 ; LZSA_SRC_LO
iny
lda #>mechanical_book_lzsa
jmp load_the_book
read_channelwood:
lda #<channelwood_book_lzsa
sta LZSA_SRC_LO
sta getsrc_smc+1 ; LZSA_SRC_LO
iny
lda #>channelwood_book_lzsa
load_the_book:
sta LZSA_SRC_HI
sta getsrc_smc+2 ; LZSA_SRC_HI
lda #$c ; load to page $c00
jsr decompress_lzsa2_fast

View File

@ -6,7 +6,7 @@
.include "zp.inc"
.include "hardware.inc"
.include "common_defines.inc"
.include "common_routines.inc"
selena_start:
;===================
@ -20,6 +20,16 @@ selena_start:
bit LORES
bit FULLGR
;=================
; set up location
;=================
lda #<locations
sta LOCATIONS_L
lda #>locations
sta LOCATIONS_H
lda #0
sta DRAW_PAGE
@ -380,6 +390,7 @@ keypad_press:
; includes
;==========================
.if 0
.include "gr_copy.s"
.include "gr_offsets.s"
.include "gr_pageflip.s"
@ -390,27 +401,27 @@ keypad_press:
.include "keyboard.s"
.include "draw_pointer.s"
.include "end_level.s"
.include "audio.s"
.include "common_sprites.inc"
.include "page_sprites.inc"
.endif
; level graphics
.include "graphics_selena/selena_graphics.inc"
; puzzles
.include "organ_puzzle.s"
; linking books
.include "link_book_mist.s"
.include "handle_pages.s"
.include "common_sprites.inc"
.include "page_sprites.inc"
; level data
.include "leveldata_selena.inc"
; sound
.include "speaker_beeps.s"

View File

@ -6,6 +6,7 @@
.include "zp.inc"
.include "hardware.inc"
.include "common_defines.inc"
.include "common_routines.inc"
stoney_start:
;===================
@ -19,6 +20,16 @@ stoney_start:
bit LORES
bit FULLGR
;=================
; set up location
;=================
lda #<locations
sta LOCATIONS_L
lda #>locations
sta LOCATIONS_H
lda #0
sta DRAW_PAGE
sta LEVEL_OVER
@ -576,7 +587,7 @@ battery_sprite7:
;==========================
; includes
;==========================
.if 0
.include "gr_copy.s"
.include "gr_offsets.s"
.include "gr_pageflip.s"
@ -587,23 +598,21 @@ battery_sprite7:
.include "keyboard.s"
.include "draw_pointer.s"
.include "end_level.s"
.include "audio.s"
.include "common_sprites.inc"
.include "page_sprites.inc"
.endif
; level graphics
.include "graphics_stoney/stoney_graphics.inc"
; linking books
.include "link_book_stoney.s"
.include "link_book_mist.s"
; puzzles
.include "handle_pages.s"
.include "common_sprites.inc"
.include "page_sprites.inc"
; level data
.include "leveldata_stoney.inc"

View File

@ -6,6 +6,7 @@
.include "zp.inc"
.include "hardware.inc"
.include "common_defines.inc"
.include "common_routines.inc"
viewer_start:
;===================
@ -19,6 +20,16 @@ viewer_start:
bit LORES
bit FULLGR
;=================
; set up location
;=================
lda #<locations
sta LOCATIONS_L
lda #>locations
sta LOCATIONS_H
lda #0
sta DRAW_PAGE
sta LEVEL_OVER
@ -145,6 +156,7 @@ back_to_mist:
; includes
;==========================
.if 0
.include "gr_copy.s"
.include "gr_offsets.s"
.include "gr_pageflip.s"
@ -155,16 +167,18 @@ back_to_mist:
.include "keyboard.s"
.include "draw_pointer.s"
.include "end_level.s"
.include "graphics_viewer/viewer_graphics.inc"
; puzzles
.include "common_sprites.inc"
.include "page_sprites.inc"
.endif
; graphics
.include "graphics_viewer/viewer_graphics.inc"
; puzzles
.include "viewer_controls.s"
; leveldata
.include "leveldata_viewer.inc"
.include "viewer_controls.s"

View File

@ -154,6 +154,8 @@ CHANNEL_VALVES = $B3
ANIMATE_FRAME = $E0
LEVEL_OVER = $E1
LOCATIONS_L = $E2
LOCATIONS_H = $E3
DISP_PAGE = $ED ; ALL
DRAW_PAGE = $EE ; ALL