dos33fsprogs/mist/mist.s

314 lines
4.3 KiB
ArmAsm
Raw Normal View History

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"
.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
sta LEVEL_OVER
2020-02-28 20:55:57 +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 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
; init the clock bridge
jsr raise_bridge
2020-02-28 20:55:57 +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
;====================================
; 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:
; handle clock puzzles
2020-03-07 18:07:42 +00:00
lda LOCATION
cmp #MIST_CLOCK_PUZZLE ; clock puzzle
2020-03-07 20:21:16 +00:00
beq location_clock
cmp #MIST_CLOCK_INSIDE
2020-03-07 20:21:16 +00:00
beq location_inside_clock
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
; handle generator puzzle
location_generator:
cmp #MIST_GENERATOR_ROOM
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:
;====================================
; check level over
;====================================
lda LEVEL_OVER
bne really_exit
2020-03-01 05:37:09 +00:00
jmp game_loop
really_exit:
jmp end_level
;=================
; special exits
2020-03-15 18:25:51 +00:00
go_to_meche:
lda #LOAD_MECHE
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
pad_special:
lda #MIST_TOWER2_PATH
sta LOCATION
jsr change_location
rts
leave_tower2:
lda #MIST_TOWER2_TOP
sta LOCATION
lda #DIRECTION_W
sta DIRECTION
jsr change_location
rts
leave_tower1:
lda #MIST_TOWER1_TOP
sta LOCATION
lda #DIRECTION_E
sta DIRECTION
jsr change_location
rts
green_house:
; FIXME: handle switch separately
lda #MIST_GREEN_SHACK
sta LOCATION
jsr change_location
rts
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-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
.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"
.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
;audio_red_page:
;.incbin "audio/red_page.btc"
2020-03-02 16:49:55 +00:00
2020-03-07 23:24:46 +00:00