2020-02-28 20:55:57 +00:00
|
|
|
; Mist
|
|
|
|
|
|
|
|
; a version of Myst?
|
|
|
|
; (yes there's a subtle German joke here)
|
|
|
|
|
|
|
|
; by deater (Vince Weaver) <vince@deater.net>
|
|
|
|
|
|
|
|
; Zero Page
|
|
|
|
.include "zp.inc"
|
|
|
|
.include "hardware.inc"
|
2020-03-19 17:55:29 +00:00
|
|
|
.include "common_defines.inc"
|
2020-02-28 20:55:57 +00:00
|
|
|
|
|
|
|
mist_start:
|
|
|
|
;===================
|
|
|
|
; init screen
|
|
|
|
jsr TEXT
|
|
|
|
jsr HOME
|
|
|
|
bit KEYRESET
|
|
|
|
|
|
|
|
bit SET_GR
|
|
|
|
bit PAGE0
|
2020-03-02 21:50:00 +00:00
|
|
|
bit LORES
|
2020-02-28 20:55:57 +00:00
|
|
|
bit FULLGR
|
|
|
|
|
2020-03-01 05:37:09 +00:00
|
|
|
lda #0
|
|
|
|
sta DRAW_PAGE
|
2020-03-08 18:11:11 +00:00
|
|
|
sta LEVEL_OVER
|
2020-02-28 20:55:57 +00:00
|
|
|
|
2020-03-01 17:45:24 +00:00
|
|
|
; init cursor
|
|
|
|
|
2020-03-01 05:37:09 +00:00
|
|
|
lda #20
|
|
|
|
sta CURSOR_X
|
|
|
|
sta CURSOR_Y
|
2020-02-28 20:55:57 +00:00
|
|
|
|
2020-03-01 18:14:49 +00:00
|
|
|
; set up initial location
|
2020-03-01 17:45:24 +00:00
|
|
|
|
2020-03-01 18:14:49 +00:00
|
|
|
jsr change_location
|
2020-02-28 20:55:57 +00:00
|
|
|
|
2020-03-01 18:28:04 +00:00
|
|
|
lda #1
|
|
|
|
sta CURSOR_VISIBLE ; visible at first
|
|
|
|
|
2020-03-24 04:36:53 +00:00
|
|
|
; init the clock bridge
|
|
|
|
jsr raise_bridge
|
2020-02-28 20:55:57 +00:00
|
|
|
|
2020-03-24 04:50:05 +00:00
|
|
|
; init the gear
|
|
|
|
jsr open_the_gear
|
|
|
|
|
|
|
|
|
2020-03-01 05:37:09 +00:00
|
|
|
game_loop:
|
2020-03-01 18:14:49 +00:00
|
|
|
;=================
|
|
|
|
; reset things
|
|
|
|
;=================
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
sta IN_SPECIAL
|
2020-03-01 20:18:10 +00:00
|
|
|
sta IN_RIGHT
|
|
|
|
sta IN_LEFT
|
2020-03-01 05:37:09 +00:00
|
|
|
|
|
|
|
;====================================
|
|
|
|
; copy background to current page
|
|
|
|
;====================================
|
|
|
|
|
|
|
|
jsr gr_copy_to_current
|
2020-02-28 20:55:57 +00:00
|
|
|
|
2020-03-07 18:07:42 +00:00
|
|
|
;====================================
|
|
|
|
; handle special-case forground logic
|
|
|
|
;====================================
|
|
|
|
|
2020-03-11 13:47:25 +00:00
|
|
|
; handle gear opening
|
|
|
|
|
2020-03-07 23:24:46 +00:00
|
|
|
lda GEAR_OPEN
|
|
|
|
beq not_gear_related
|
|
|
|
|
|
|
|
jsr check_gear_delete
|
|
|
|
not_gear_related:
|
|
|
|
|
2020-03-11 13:47:25 +00:00
|
|
|
; handle clock puzzles
|
|
|
|
|
2020-03-07 18:07:42 +00:00
|
|
|
lda LOCATION
|
2020-03-19 21:25:20 +00:00
|
|
|
cmp #MIST_CLOCK_PUZZLE ; clock puzzle
|
2020-03-07 20:21:16 +00:00
|
|
|
beq location_clock
|
2020-03-19 21:25:20 +00:00
|
|
|
cmp #MIST_CLOCK_INSIDE
|
2020-03-07 20:21:16 +00:00
|
|
|
beq location_inside_clock
|
2020-03-11 13:47:25 +00:00
|
|
|
bne location_generator
|
2020-03-07 18:07:42 +00:00
|
|
|
|
2020-03-07 20:21:16 +00:00
|
|
|
location_clock:
|
2020-03-07 18:07:42 +00:00
|
|
|
jsr draw_clock_face
|
2020-03-07 20:21:16 +00:00
|
|
|
jmp nothing_special
|
|
|
|
location_inside_clock:
|
|
|
|
jsr draw_clock_inside
|
2020-03-07 23:24:46 +00:00
|
|
|
jmp nothing_special
|
2020-03-07 18:07:42 +00:00
|
|
|
|
2020-03-11 13:47:25 +00:00
|
|
|
; handle generator puzzle
|
|
|
|
location_generator:
|
2020-03-19 21:25:20 +00:00
|
|
|
cmp #MIST_GENERATOR_ROOM
|
2020-03-11 13:47:25 +00:00
|
|
|
bne nothing_special
|
|
|
|
lda DIRECTION
|
|
|
|
and #$f
|
|
|
|
cmp #DIRECTION_N
|
|
|
|
bne nothing_special
|
|
|
|
|
|
|
|
jsr generator_update_volts
|
|
|
|
jsr generator_draw_buttons
|
|
|
|
jmp nothing_special
|
2020-03-07 18:07:42 +00:00
|
|
|
|
|
|
|
nothing_special:
|
2020-03-08 04:11:08 +00:00
|
|
|
|
2020-03-01 05:37:09 +00:00
|
|
|
;====================================
|
|
|
|
; draw pointer
|
|
|
|
;====================================
|
2020-03-01 18:28:04 +00:00
|
|
|
|
2020-03-08 04:11:08 +00:00
|
|
|
jsr draw_pointer
|
2020-03-01 18:28:04 +00:00
|
|
|
|
2020-03-01 05:37:09 +00:00
|
|
|
;====================================
|
|
|
|
; page flip
|
|
|
|
;====================================
|
2020-02-28 20:55:57 +00:00
|
|
|
|
2020-03-01 05:37:09 +00:00
|
|
|
jsr page_flip
|
2020-02-28 20:55:57 +00:00
|
|
|
|
2020-03-01 05:37:09 +00:00
|
|
|
;====================================
|
|
|
|
; handle keypress/joystick
|
|
|
|
;====================================
|
2020-02-28 20:55:57 +00:00
|
|
|
|
2020-03-01 05:37:09 +00:00
|
|
|
jsr handle_keypress
|
2020-02-28 20:55:57 +00:00
|
|
|
|
|
|
|
|
2020-03-01 05:37:09 +00:00
|
|
|
;====================================
|
|
|
|
; inc frame count
|
|
|
|
;====================================
|
|
|
|
|
|
|
|
inc FRAMEL
|
|
|
|
bne room_frame_no_oflo
|
|
|
|
inc FRAMEH
|
|
|
|
room_frame_no_oflo:
|
|
|
|
|
2020-03-08 18:11:11 +00:00
|
|
|
;====================================
|
|
|
|
; check level over
|
|
|
|
;====================================
|
|
|
|
|
|
|
|
lda LEVEL_OVER
|
|
|
|
bne really_exit
|
2020-03-01 05:37:09 +00:00
|
|
|
jmp game_loop
|
|
|
|
|
2020-03-08 18:11:11 +00:00
|
|
|
really_exit:
|
|
|
|
jmp end_level
|
|
|
|
|
2020-03-19 05:59:09 +00:00
|
|
|
;=================
|
|
|
|
; special exits
|
2020-03-08 18:11:11 +00:00
|
|
|
|
2020-03-15 18:25:51 +00:00
|
|
|
go_to_meche:
|
2020-03-17 05:42:26 +00:00
|
|
|
lda #LOAD_MECHE
|
2020-03-08 18:11:11 +00:00
|
|
|
sta WHICH_LOAD
|
|
|
|
|
2020-03-23 23:16:38 +00:00
|
|
|
lda #MECHE_INSIDE_GEAR
|
|
|
|
sta LOCATION
|
|
|
|
|
|
|
|
lda #DIRECTION_E
|
|
|
|
sta DIRECTION
|
|
|
|
|
2020-03-26 18:17:10 +00:00
|
|
|
jmp set_level_over
|
2020-03-01 05:37:09 +00:00
|
|
|
|
2020-03-19 05:59:09 +00:00
|
|
|
pad_special:
|
2020-03-19 21:25:20 +00:00
|
|
|
lda #MIST_TOWER2_PATH
|
2020-03-19 05:59:09 +00:00
|
|
|
sta LOCATION
|
|
|
|
jsr change_location
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
leave_tower2:
|
2020-03-19 21:25:20 +00:00
|
|
|
lda #MIST_TOWER2_TOP
|
2020-03-19 05:59:09 +00:00
|
|
|
sta LOCATION
|
2020-03-19 15:43:59 +00:00
|
|
|
|
|
|
|
lda #DIRECTION_W
|
|
|
|
sta DIRECTION
|
|
|
|
|
|
|
|
jsr change_location
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
leave_tower1:
|
2020-03-19 21:25:20 +00:00
|
|
|
lda #MIST_TOWER1_TOP
|
2020-03-19 15:43:59 +00:00
|
|
|
sta LOCATION
|
|
|
|
|
|
|
|
lda #DIRECTION_E
|
|
|
|
sta DIRECTION
|
|
|
|
|
2020-03-19 05:59:09 +00:00
|
|
|
jsr change_location
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2020-03-19 15:43:59 +00:00
|
|
|
green_house:
|
|
|
|
|
|
|
|
; FIXME: handle switch separately
|
|
|
|
|
2020-03-19 21:25:20 +00:00
|
|
|
lda #MIST_GREEN_SHACK
|
2020-03-19 15:43:59 +00:00
|
|
|
sta LOCATION
|
|
|
|
|
|
|
|
jsr change_location
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2020-03-20 01:07:21 +00:00
|
|
|
enter_octagon:
|
|
|
|
|
|
|
|
lda #OCTAGON_TEMPLE_DOORWAY
|
|
|
|
sta LOCATION
|
|
|
|
|
|
|
|
lda #LOAD_OCTAGON
|
|
|
|
sta WHICH_LOAD
|
|
|
|
|
2020-03-26 18:17:10 +00:00
|
|
|
jmp set_level_over
|
2020-03-20 01:07:21 +00:00
|
|
|
|
2020-03-25 05:17:59 +00:00
|
|
|
enter_viewer:
|
|
|
|
|
|
|
|
lda #VIEWER_STEPS
|
|
|
|
sta LOCATION
|
|
|
|
|
|
|
|
lda #LOAD_VIEWER
|
|
|
|
sta WHICH_LOAD
|
|
|
|
|
2020-03-26 18:17:10 +00:00
|
|
|
jmp set_level_over
|
|
|
|
|
2020-04-15 17:30:23 +00:00
|
|
|
enter_channel_main:
|
|
|
|
|
|
|
|
lda #CHANNEL_OUTSIDE_CABIN
|
|
|
|
sta LOCATION
|
|
|
|
|
|
|
|
lda #LOAD_CHANNEL
|
|
|
|
sta WHICH_LOAD
|
|
|
|
|
|
|
|
lda #DIRECTION_E
|
|
|
|
sta DIRECTION
|
|
|
|
|
|
|
|
jmp set_level_over
|
|
|
|
|
|
|
|
enter_channel_clock:
|
|
|
|
|
|
|
|
lda #CHANNEL_CLOCK_PATH
|
|
|
|
sta LOCATION
|
|
|
|
|
|
|
|
lda #LOAD_CHANNEL
|
|
|
|
sta WHICH_LOAD
|
|
|
|
|
|
|
|
lda #DIRECTION_N
|
|
|
|
sta DIRECTION
|
|
|
|
|
|
|
|
jmp set_level_over
|
|
|
|
|
2020-03-26 18:17:10 +00:00
|
|
|
enter_stoneyship:
|
|
|
|
lda #STONEY_SHIP_STERN
|
|
|
|
sta LOCATION
|
|
|
|
|
|
|
|
lda #DIRECTION_N
|
|
|
|
sta DIRECTION
|
|
|
|
|
|
|
|
lda #LOAD_STONEY
|
|
|
|
sta WHICH_LOAD
|
|
|
|
|
|
|
|
set_level_over:
|
2020-03-25 05:17:59 +00:00
|
|
|
lda #$ff
|
|
|
|
sta LEVEL_OVER
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
2020-03-01 18:14:49 +00:00
|
|
|
;==========================
|
|
|
|
; includes
|
|
|
|
;==========================
|
2020-03-01 05:37:09 +00:00
|
|
|
|
|
|
|
.include "gr_copy.s"
|
|
|
|
.include "gr_offsets.s"
|
|
|
|
.include "gr_pageflip.s"
|
|
|
|
.include "gr_putsprite_crop.s"
|
2020-03-02 20:46:04 +00:00
|
|
|
.include "text_print.s"
|
|
|
|
.include "gr_fast_clear.s"
|
2020-03-05 05:25:59 +00:00
|
|
|
.include "decompress_fast_v2.s"
|
2020-03-08 04:11:08 +00:00
|
|
|
.include "keyboard.s"
|
|
|
|
.include "draw_pointer.s"
|
2020-03-01 05:37:09 +00:00
|
|
|
|
2020-03-02 20:46:04 +00:00
|
|
|
.include "audio.s"
|
2020-03-02 16:49:55 +00:00
|
|
|
|
2020-03-18 05:48:15 +00:00
|
|
|
.include "graphics_mist/mist_graphics.inc"
|
2020-02-28 20:55:57 +00:00
|
|
|
|
2020-03-08 18:11:11 +00:00
|
|
|
.include "end_level.s"
|
2020-02-28 20:55:57 +00:00
|
|
|
|
2020-03-07 16:06:29 +00:00
|
|
|
; puzzles
|
|
|
|
|
|
|
|
.include "clock_bridge_puzzle.s"
|
2020-03-07 16:16:44 +00:00
|
|
|
.include "marker_switch.s"
|
2020-03-10 20:12:56 +00:00
|
|
|
.include "generator_puzzle.s"
|
2020-03-07 16:16:44 +00:00
|
|
|
|
|
|
|
; linking books
|
|
|
|
|
|
|
|
; letters
|
|
|
|
|
|
|
|
.include "letter_cat.s"
|
|
|
|
|
2020-03-07 16:06:29 +00:00
|
|
|
|
2020-03-06 20:19:35 +00:00
|
|
|
.include "common_sprites.inc"
|
2020-02-28 20:55:57 +00:00
|
|
|
|
2020-03-15 18:25:51 +00:00
|
|
|
.include "leveldata_mist.inc"
|
2020-03-02 16:49:55 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2020-03-07 16:16:44 +00:00
|
|
|
|
|
|
|
|
2020-03-02 16:49:55 +00:00
|
|
|
;.align $100
|
2020-03-08 18:11:11 +00:00
|
|
|
;audio_red_page:
|
|
|
|
;.incbin "audio/red_page.btc"
|
2020-03-19 18:04:41 +00:00
|
|
|
|
2020-03-02 16:49:55 +00:00
|
|
|
|
2020-03-07 23:24:46 +00:00
|
|
|
|