dos33fsprogs/mist/mist.s

219 lines
3.1 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"
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
;=================
; init vars
; FIXME: we could be re-called from other books
; so don't set location here
lda #0
sta LOCATION
lda #0
sta DIRECTION
2020-03-07 16:06:29 +00:00
lda LOCATION
bne not_first_time
; first time init
lda #0
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 GEAR_OPEN
; 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
;====================================
2020-03-07 23:24:46 +00:00
lda GEAR_OPEN
beq not_gear_related
jsr check_gear_delete
not_gear_related:
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
2020-03-07 18:07:42 +00:00
bne nothing_special
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
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
exit_level:
lda #2
sta WHICH_LOAD
lda #$ff
sta LEVEL_OVER
rts
2020-03-01 05:37:09 +00:00
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-04 21:14:41 +00:00
.include "graphics_island/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"
; linking books
.include "link_book_mist.s"
; 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-06 20:29:13 +00:00
.include "leveldata_island.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 21:50:00 +00:00
audio_link_noise:
.incbin "audio/link_noise.btc"
2020-03-02 16:49:55 +00:00
2020-03-07 23:24:46 +00:00