dos33fsprogs/mist/mist.s

285 lines
3.8 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-07 16:06:29 +00:00
lda LOCATION
2020-03-19 18:17:12 +00:00
cmp #1 ; FIXME
2020-03-07 16:06:29 +00:00
bne not_first_time
; first time init
lda #0
2020-03-07 16:06:29 +00:00
sta CLOCK_MINUTE
sta CLOCK_HOUR
2020-03-07 20:21:16 +00:00
jsr clock_inside_reset
2020-03-07 16:06:29 +00:00
lda #0
sta DIRECTION
sta GEAR_OPEN
sta BREAKER_TRIPPED
sta GENERATOR_VOLTS
sta ROCKET_VOLTS
2020-03-11 18:17:58 +00:00
sta GENERATOR_VOLTS_DISP
sta ROCKET_VOLTS_DISP
sta SWITCH_TOP_ROW
sta SWITCH_BOTTOM_ROW
sta ROCKET_HANDLE_STEP
sta ROCKET_NOTE1
sta ROCKET_NOTE2
sta ROCKET_NOTE3
sta ROCKET_NOTE4
; debug
; lda #1
; sta GEAR_OPEN
; jsr open_the_gear
2020-03-07 23:24:46 +00:00
2020-03-07 16:06:29 +00:00
not_first_time:
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
2020-02-28 20:55:57 +00:00
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
2020-03-07 23:24:46 +00:00
cmp #25 ; clock puzzle
2020-03-07 20:21:16 +00:00
beq location_clock
cmp #27
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 #36
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
lda #$ff
sta LEVEL_OVER
rts
2020-03-01 05:37:09 +00:00
pad_special:
lda #40
sta LOCATION
jsr change_location
rts
leave_tower2:
lda #42
sta LOCATION
lda #DIRECTION_W
sta DIRECTION
jsr change_location
rts
leave_tower1:
lda #46
sta LOCATION
lda #DIRECTION_E
sta DIRECTION
jsr change_location
rts
green_house:
; FIXME: handle switch separately
lda #32
sta LOCATION
jsr change_location
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 "brother_books.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