dos33fsprogs/ootw/ootw_c2_elevator.s

195 lines
2.7 KiB
ArmAsm
Raw Normal View History

2019-07-09 15:23:48 +00:00
; Ootw Checkpoint2 -- Using the elevator
ootw_elevator:
;===========================
; Enable graphics
bit LORES
bit SET_GR
bit FULLGR
;===========================
; Setup pages (is this necessary?)
lda #0
sta DRAW_PAGE
lda #1
sta DISP_PAGE
;=============================
; load background image
jsr jail_load_background
;==============================
; setup per-room variables
lda WHICH_JAIL
bne elevator1
elevator0:
lda #(20+128)
sta LEFT_LIMIT
lda #(39+128)
sta RIGHT_LIMIT
; set right exit
lda #1
sta jer_smc+1
lda #<ootw_jail
sta jer_smc+5
lda #>ootw_jail
sta jer_smc+6
; set left exit
lda #0
sta jel_smc+1
lda #<ootw_jail
sta jel_smc+5
lda #>ootw_jail
sta jel_smc+6
jmp jail_setup_done
elevator1:
lda #(-4+128)
sta LEFT_LIMIT
lda #(39+128)
sta RIGHT_LIMIT
elevator_setup_done:
;=================================
; copy to screen
jsr gr_copy_to_current
jsr page_flip
;=================================
; setup vars
lda #0
sta GAIT
sta GAME_OVER
;============================
; Elevator Loop
;============================
elevator_loop:
;================================
; copy background to current page
jsr gr_copy_to_current
;===============================
; check keyboard
jsr handle_keypress
;===============================
; move physicist
jsr move_physicist
;===============
; check room limits
jsr check_screen_limit
;===============
; draw physicist
jsr draw_physicist
;================
; draw foreground
;===============
; page flip
jsr page_flip
;================
; inc frame count
inc FRAMEL
bne elevator_frame_no_oflo
inc FRAMEH
elevator_frame_no_oflo:
; check if done this level
lda GAME_OVER
beq still_in_elevator
cmp #$ff ; if $ff, we died
beq done_elevator
;===============================
; check if exited room to right
cmp #1
beq elevator_exit_left
; exit to right
elevator_exit_right:
lda #0
sta PHYSICIST_X
eer_smc:
lda #$0
sta WHICH_CAVE
jmp ootw_elevator
elevator_exit_left:
lda #37
sta PHYSICIST_X
eel_smc:
lda #0
sta WHICH_CAVE
jmp ootw_elevator
; loop forever
still_in_elevator:
jmp elevator_loop
done_elevator:
rts
;===============================
; load proper background to $c00
;===============================
elevator_load_background:
lda WHICH_JAIL
bne elevator_bg1
elevator_bg0:
; load background
lda #>(cage_fell_rle)
sta GBASH
lda #<(cage_fell_rle)
sta GBASL
jmp elevator_bg_done
elevator_bg1:
; load background
lda #>(jail2_rle)
sta GBASH
lda #<(jail2_rle)
sta GBASL
elevator_bg_done:
lda #$c ; load to page $c00
jmp load_rle_gr ; tail call