2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
;=======================
|
|
|
|
;=======================
|
|
|
|
; starbase_init
|
|
|
|
;=======================
|
|
|
|
;=======================
|
2019-11-04 02:58:21 +00:00
|
|
|
; call once before entering starbase for first time
|
|
|
|
|
2019-10-02 04:03:00 +00:00
|
|
|
starbase_init:
|
|
|
|
lda #0
|
|
|
|
sta WHICH_ROOM
|
2019-11-05 21:48:44 +00:00
|
|
|
sta CART_OUT
|
2019-10-02 04:03:00 +00:00
|
|
|
sta LASER_OUT
|
|
|
|
sta BLAST_OUT
|
|
|
|
sta GUN_FIRE
|
|
|
|
sta NUM_DOORS
|
2019-11-15 03:23:26 +00:00
|
|
|
sta ON_ELEVATOR
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-04 05:47:34 +00:00
|
|
|
lda #1
|
|
|
|
sta DIRECTION ; right
|
|
|
|
|
2019-11-15 21:15:50 +00:00
|
|
|
lda #20 ; start already charging
|
|
|
|
sta GUN_STATE
|
|
|
|
|
2019-10-02 04:03:00 +00:00
|
|
|
lda #100
|
|
|
|
sta GUN_CHARGE
|
|
|
|
|
2019-11-05 21:48:44 +00:00
|
|
|
lda #$40
|
|
|
|
sta CART_X
|
|
|
|
|
2019-10-02 04:03:00 +00:00
|
|
|
;====================
|
|
|
|
; reset doors
|
|
|
|
lda #DOOR_STATUS_LOCKED
|
2019-11-04 05:47:34 +00:00
|
|
|
sta c4_r0_door0_status
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
;===============
|
|
|
|
; set up aliens
|
|
|
|
|
|
|
|
jsr clear_aliens
|
|
|
|
|
|
|
|
lda #1
|
|
|
|
sta ALIEN_OUT
|
|
|
|
|
2019-11-05 15:17:37 +00:00
|
|
|
lda #1
|
2019-10-02 04:03:00 +00:00
|
|
|
sta alien0_room
|
2019-11-05 15:17:37 +00:00
|
|
|
lda #20
|
2019-10-02 04:03:00 +00:00
|
|
|
sta alien0_x
|
2019-11-05 15:17:37 +00:00
|
|
|
lda #30
|
2019-10-02 04:03:00 +00:00
|
|
|
sta alien0_y
|
|
|
|
lda #A_STANDING
|
|
|
|
sta alien0_state
|
|
|
|
lda #0
|
|
|
|
sta alien0_direction
|
|
|
|
|
|
|
|
|
|
|
|
; set up physicist
|
|
|
|
|
|
|
|
lda #1
|
|
|
|
sta HAVE_GUN
|
|
|
|
|
2019-11-04 02:58:21 +00:00
|
|
|
lda #0
|
2019-10-02 04:38:01 +00:00
|
|
|
sta ASTRONAUT_X
|
2019-11-04 05:47:34 +00:00
|
|
|
lda #10
|
2019-10-02 04:38:01 +00:00
|
|
|
sta ASTRONAUT_Y
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-04 05:47:34 +00:00
|
|
|
lda #P_STANDING
|
2019-10-02 04:38:01 +00:00
|
|
|
sta ASTRONAUT_STATE
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
;===========================
|
|
|
|
;===========================
|
|
|
|
; enter new room in jail
|
|
|
|
;===========================
|
|
|
|
;===========================
|
2019-11-04 02:58:21 +00:00
|
|
|
starbase_setup_room:
|
2019-10-02 04:03:00 +00:00
|
|
|
;=================================
|
|
|
|
; setup vars
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
sta GAIT
|
|
|
|
sta GAME_OVER
|
|
|
|
sta NUM_DOORS
|
|
|
|
|
|
|
|
;============================
|
|
|
|
; init shields
|
|
|
|
|
|
|
|
jsr init_shields
|
|
|
|
|
|
|
|
|
|
|
|
; jsr alien_room_init
|
|
|
|
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
sta FRAMEL ; reset frame count for action timer
|
|
|
|
sta FRAMEH
|
|
|
|
|
|
|
|
;==============================
|
|
|
|
; setup per-room variables
|
|
|
|
;==============================
|
|
|
|
|
|
|
|
lda WHICH_ROOM
|
|
|
|
bne room1
|
|
|
|
|
|
|
|
;======================
|
2019-11-04 05:47:34 +00:00
|
|
|
; Room0 with ramp
|
2019-10-02 04:03:00 +00:00
|
|
|
room0:
|
|
|
|
|
|
|
|
; set up doors
|
|
|
|
|
2019-11-04 05:47:34 +00:00
|
|
|
lda #2
|
2019-10-02 04:03:00 +00:00
|
|
|
sta NUM_DOORS
|
|
|
|
|
|
|
|
lda #<door_c4_r0
|
|
|
|
sta setup_door_table_loop_smc+1
|
|
|
|
lda #>door_c4_r0
|
|
|
|
sta setup_door_table_loop_smc+2
|
|
|
|
jsr setup_door_table
|
|
|
|
|
|
|
|
; set up room limits
|
|
|
|
|
2019-11-04 05:47:34 +00:00
|
|
|
lda #(-3+128) ; stop at wall
|
2019-10-02 04:03:00 +00:00
|
|
|
sta LEFT_LIMIT
|
|
|
|
lda #(39+128)
|
|
|
|
sta RIGHT_LIMIT
|
|
|
|
|
|
|
|
; set left exit
|
|
|
|
lda #0
|
|
|
|
sta cel_smc+1
|
|
|
|
|
2019-11-04 05:47:34 +00:00
|
|
|
; set right exit
|
|
|
|
lda #1
|
|
|
|
sta cer_smc+1
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-04 05:47:34 +00:00
|
|
|
lda #10
|
2019-10-02 04:38:01 +00:00
|
|
|
sta ASTRONAUT_Y
|
2019-11-04 05:47:34 +00:00
|
|
|
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
; load background
|
2019-10-03 04:49:35 +00:00
|
|
|
lda #>(jail_rle)
|
2019-10-02 04:03:00 +00:00
|
|
|
sta GBASH
|
2019-10-03 04:49:35 +00:00
|
|
|
lda #<(jail_rle)
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
jmp room_setup_done
|
|
|
|
|
|
|
|
;===========================
|
|
|
|
; hallway with weird ceiling
|
|
|
|
room1:
|
|
|
|
cmp #1
|
|
|
|
bne room2
|
|
|
|
|
2019-11-04 22:00:16 +00:00
|
|
|
; set up doors
|
|
|
|
|
|
|
|
lda #3
|
|
|
|
sta NUM_DOORS
|
|
|
|
|
|
|
|
lda #<door_c4_r1
|
|
|
|
sta setup_door_table_loop_smc+1
|
|
|
|
lda #>door_c4_r1
|
|
|
|
sta setup_door_table_loop_smc+2
|
|
|
|
jsr setup_door_table
|
|
|
|
|
2019-10-02 04:03:00 +00:00
|
|
|
lda #(-4+128)
|
|
|
|
sta LEFT_LIMIT
|
|
|
|
lda #(39+128)
|
|
|
|
sta RIGHT_LIMIT
|
|
|
|
|
2019-11-05 16:52:43 +00:00
|
|
|
; pretend a battle was underway
|
|
|
|
first_shield:
|
|
|
|
lda #0
|
|
|
|
; sta FIRST_SHIELD
|
|
|
|
sta shield_count
|
|
|
|
|
|
|
|
lda #1
|
|
|
|
sta shield_out
|
|
|
|
lda #16
|
|
|
|
sta shield_x
|
|
|
|
|
|
|
|
lda #30
|
|
|
|
sta shield_y
|
|
|
|
|
|
|
|
inc SHIELD_OUT
|
|
|
|
|
2019-10-02 04:03:00 +00:00
|
|
|
; set right exit
|
|
|
|
lda #2
|
|
|
|
sta cer_smc+1
|
|
|
|
|
|
|
|
; set left exit
|
|
|
|
lda #0
|
|
|
|
sta cel_smc+1
|
|
|
|
|
2019-11-04 22:00:16 +00:00
|
|
|
lda #30
|
2019-10-02 04:38:01 +00:00
|
|
|
sta ASTRONAUT_Y
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
; load background
|
|
|
|
lda #>(hallway_rle)
|
|
|
|
sta GBASH
|
|
|
|
lda #<(hallway_rle)
|
|
|
|
|
|
|
|
jmp room_setup_done
|
|
|
|
|
2019-11-04 22:00:16 +00:00
|
|
|
;=====================
|
|
|
|
; room with big window
|
2019-10-02 04:03:00 +00:00
|
|
|
room2:
|
|
|
|
cmp #2
|
|
|
|
bne room3
|
|
|
|
|
|
|
|
lda #(-4+128)
|
|
|
|
sta LEFT_LIMIT
|
|
|
|
lda #(39+128)
|
|
|
|
sta RIGHT_LIMIT
|
|
|
|
|
|
|
|
; set right exit
|
|
|
|
lda #3
|
|
|
|
sta cer_smc+1
|
|
|
|
|
|
|
|
; set left exit
|
|
|
|
lda #1
|
|
|
|
sta cel_smc+1
|
|
|
|
|
2019-11-04 22:00:16 +00:00
|
|
|
lda #30
|
2019-10-02 04:38:01 +00:00
|
|
|
sta ASTRONAUT_Y
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
; load background
|
2019-10-03 04:49:35 +00:00
|
|
|
lda #>(window_rle)
|
2019-10-02 04:03:00 +00:00
|
|
|
sta GBASH
|
2019-10-03 04:49:35 +00:00
|
|
|
lda #<(window_rle)
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
jmp room_setup_done
|
|
|
|
|
|
|
|
;=======================
|
2019-11-04 22:00:16 +00:00
|
|
|
;room with ship
|
2019-11-05 03:47:52 +00:00
|
|
|
|
2019-10-02 04:03:00 +00:00
|
|
|
room3:
|
|
|
|
cmp #3
|
2019-11-05 03:47:52 +00:00
|
|
|
beq do_room3
|
|
|
|
|
|
|
|
jmp end_sequence
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-05 03:47:52 +00:00
|
|
|
do_room3:
|
2019-10-02 04:03:00 +00:00
|
|
|
lda #1
|
|
|
|
sta NUM_DOORS
|
|
|
|
|
2019-11-04 22:00:16 +00:00
|
|
|
lda #<door_c4_r3
|
2019-10-02 04:03:00 +00:00
|
|
|
sta setup_door_table_loop_smc+1
|
2019-11-04 22:00:16 +00:00
|
|
|
lda #>door_c4_r3
|
2019-10-02 04:03:00 +00:00
|
|
|
sta setup_door_table_loop_smc+2
|
|
|
|
jsr setup_door_table
|
|
|
|
|
2019-11-04 22:00:16 +00:00
|
|
|
lda #(-4+128)
|
2019-10-02 04:03:00 +00:00
|
|
|
sta LEFT_LIMIT
|
|
|
|
lda #(39+128)
|
|
|
|
sta RIGHT_LIMIT
|
|
|
|
|
|
|
|
; set right exit
|
2019-11-04 22:00:16 +00:00
|
|
|
lda #4
|
2019-10-02 04:03:00 +00:00
|
|
|
sta cer_smc+1
|
|
|
|
|
2019-11-04 22:00:16 +00:00
|
|
|
; set left exit
|
|
|
|
lda #2
|
|
|
|
sta cel_smc+1
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-04 22:00:16 +00:00
|
|
|
lda #30
|
2019-10-02 04:38:01 +00:00
|
|
|
sta ASTRONAUT_Y
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
; load background
|
2019-10-03 04:49:35 +00:00
|
|
|
lda #>(ship_rle)
|
2019-10-02 04:03:00 +00:00
|
|
|
sta GBASH
|
2019-10-03 04:49:35 +00:00
|
|
|
lda #<(ship_rle)
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-04 22:00:16 +00:00
|
|
|
; fall through
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
room_setup_done:
|
|
|
|
|
|
|
|
; load bg image
|
|
|
|
sta GBASL
|
|
|
|
lda #$c ; load to page $c00
|
|
|
|
jsr load_rle_gr
|
|
|
|
|
|
|
|
; setup walk collision
|
|
|
|
jsr recalc_walk_collision
|
|
|
|
|
|
|
|
ootw_room_already_set:
|
|
|
|
;===========================
|
|
|
|
; Enable graphics
|
|
|
|
|
|
|
|
bit LORES
|
|
|
|
bit SET_GR
|
|
|
|
bit FULLGR
|
|
|
|
|
|
|
|
;============================================
|
|
|
|
; Setup pages (is this necessary?)
|
|
|
|
; FIXME: use code from c3 which clears better
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
sta DRAW_PAGE
|
|
|
|
lda #1
|
|
|
|
sta DISP_PAGE
|
|
|
|
|
|
|
|
|
|
|
|
;============================
|
|
|
|
;============================
|
2019-11-04 05:47:34 +00:00
|
|
|
; starbase Loop
|
2019-10-02 04:03:00 +00:00
|
|
|
;============================
|
|
|
|
;============================
|
2019-11-04 05:47:34 +00:00
|
|
|
starbase_loop:
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
;================================
|
|
|
|
;================================
|
|
|
|
; copy background to current page
|
|
|
|
;================================
|
|
|
|
;================================
|
|
|
|
|
|
|
|
jsr gr_copy_to_current
|
|
|
|
|
|
|
|
;==================================
|
|
|
|
; draw background action
|
|
|
|
;==================================
|
|
|
|
|
2019-11-15 03:23:26 +00:00
|
|
|
lda WHICH_ROOM
|
2019-11-04 22:00:16 +00:00
|
|
|
beq bg_room0
|
|
|
|
cmp #3
|
|
|
|
beq bg_room3
|
|
|
|
|
|
|
|
bne c4_no_bg_action
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
bg_room0:
|
|
|
|
; Room #0, draw pulsing recharger
|
|
|
|
|
|
|
|
lda FRAMEL
|
|
|
|
and #$c
|
|
|
|
lsr
|
|
|
|
tay
|
|
|
|
|
|
|
|
|
2019-11-04 05:47:34 +00:00
|
|
|
lda #0
|
2019-10-02 04:03:00 +00:00
|
|
|
sta XPOS
|
2019-11-04 05:47:34 +00:00
|
|
|
lda #26
|
2019-10-02 04:03:00 +00:00
|
|
|
sta YPOS
|
|
|
|
|
|
|
|
lda recharge_bg_progression,Y
|
|
|
|
sta INL
|
|
|
|
lda recharge_bg_progression+1,Y
|
|
|
|
sta INH
|
|
|
|
|
|
|
|
jsr put_sprite
|
|
|
|
|
|
|
|
lda FRAMEL
|
|
|
|
and #$18
|
|
|
|
lsr
|
|
|
|
lsr
|
|
|
|
tay
|
|
|
|
|
2019-11-04 22:00:16 +00:00
|
|
|
jmp c4_no_bg_action
|
|
|
|
|
|
|
|
bg_room3:
|
|
|
|
; Room #3, draw clamp if applicable
|
|
|
|
|
|
|
|
lda c4_r3_door0_status ; door status
|
|
|
|
cmp #DOOR_STATUS_EXPLODED
|
|
|
|
beq bg3_blink
|
|
|
|
|
|
|
|
; draw clamp at 22,5
|
|
|
|
|
|
|
|
lda #22
|
|
|
|
sta XPOS
|
|
|
|
lda #4
|
|
|
|
sta YPOS
|
|
|
|
lda #<clamp_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>clamp_sprite
|
|
|
|
sta INH
|
|
|
|
jsr put_sprite
|
|
|
|
|
|
|
|
jmp c4_no_bg_action
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-04 22:00:16 +00:00
|
|
|
bg3_blink:
|
|
|
|
|
|
|
|
lda FRAMEL
|
2019-11-04 22:01:49 +00:00
|
|
|
and #$20
|
2019-11-04 22:00:16 +00:00
|
|
|
beq bg3_blink_off
|
|
|
|
|
|
|
|
|
|
|
|
; 9x16
|
|
|
|
bg3_blink_on:
|
|
|
|
lda #$56
|
|
|
|
bne bg3_blink_done
|
|
|
|
bg3_blink_off:
|
|
|
|
lda #$52
|
|
|
|
bg3_blink_done:
|
|
|
|
|
|
|
|
sta $c28+9
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
c4_no_bg_action:
|
|
|
|
|
|
|
|
;===============================
|
|
|
|
; check keyboard
|
|
|
|
;===============================
|
|
|
|
|
|
|
|
jsr handle_keypress
|
|
|
|
|
|
|
|
;===============================
|
2019-11-04 05:47:34 +00:00
|
|
|
; move astronaut
|
2019-10-02 04:03:00 +00:00
|
|
|
;===============================
|
|
|
|
|
2019-10-02 04:38:01 +00:00
|
|
|
jsr move_astronaut
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
;===================
|
|
|
|
; check room limits
|
|
|
|
;===================
|
2019-10-02 04:38:01 +00:00
|
|
|
lda ASTRONAUT_STATE
|
2019-10-02 04:03:00 +00:00
|
|
|
cmp #P_FALLING_DOWN
|
|
|
|
beq done_room_limits
|
|
|
|
cmp #P_IMPALED
|
|
|
|
beq done_room_limits
|
|
|
|
|
|
|
|
jsr check_screen_limit
|
|
|
|
|
|
|
|
done_room_limits:
|
|
|
|
|
2019-11-04 05:47:34 +00:00
|
|
|
;===============
|
|
|
|
; draw astronaut
|
|
|
|
;===============
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-04 05:47:34 +00:00
|
|
|
; only have slope in room0
|
2019-10-02 04:03:00 +00:00
|
|
|
lda WHICH_ROOM
|
2019-11-04 05:47:34 +00:00
|
|
|
bne just_draw_astronaut
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-04 05:47:34 +00:00
|
|
|
; adjust y for slope
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-10-02 04:38:01 +00:00
|
|
|
lda ASTRONAUT_X
|
2019-11-04 05:47:34 +00:00
|
|
|
cmp #11
|
|
|
|
bcc asstr_above ; blt
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-04 05:47:34 +00:00
|
|
|
cmp #22
|
|
|
|
bcs asstr_below ; bge
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-04 05:47:34 +00:00
|
|
|
sec
|
|
|
|
sbc #11
|
|
|
|
and #$fe ; our sprite code only draws even y
|
|
|
|
adc #11
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-04 05:47:34 +00:00
|
|
|
jmp asstr_adjust_y
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-04 05:47:34 +00:00
|
|
|
asstr_below:
|
|
|
|
lda #22
|
|
|
|
jmp asstr_adjust_y
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-04 05:47:34 +00:00
|
|
|
asstr_above:
|
|
|
|
lda #10
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-04 05:47:34 +00:00
|
|
|
asstr_adjust_y:
|
2019-11-10 01:17:07 +00:00
|
|
|
and #$fe
|
2019-11-04 05:47:34 +00:00
|
|
|
sta ASTRONAUT_Y
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-04 05:47:34 +00:00
|
|
|
jsr recalc_walk_collision
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-10-02 04:38:01 +00:00
|
|
|
just_draw_astronaut:
|
|
|
|
jsr draw_astronaut
|
|
|
|
after_draw_astronaut:
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
;===============
|
|
|
|
; draw alien
|
|
|
|
;===============
|
|
|
|
|
|
|
|
lda ALIEN_OUT
|
|
|
|
beq no_draw_alien
|
|
|
|
|
|
|
|
jsr move_alien
|
|
|
|
jsr draw_alien
|
|
|
|
no_draw_alien:
|
|
|
|
|
|
|
|
;================
|
|
|
|
; handle gun
|
|
|
|
;================
|
|
|
|
|
|
|
|
jsr handle_gun
|
|
|
|
|
|
|
|
;================
|
|
|
|
; handle doors
|
|
|
|
;================
|
|
|
|
|
|
|
|
jsr handle_doors
|
|
|
|
|
|
|
|
;================
|
|
|
|
; draw doors
|
|
|
|
;================
|
|
|
|
|
|
|
|
jsr draw_doors
|
|
|
|
|
|
|
|
|
|
|
|
;========================
|
|
|
|
; draw foreground cover
|
|
|
|
;========================
|
|
|
|
|
|
|
|
lda WHICH_ROOM
|
2019-11-04 05:47:34 +00:00
|
|
|
beq c4_room0_cover
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-05 21:48:44 +00:00
|
|
|
cmp #2
|
|
|
|
beq room2_robot
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
jmp c4_no_fg_cover
|
2019-11-04 05:47:34 +00:00
|
|
|
|
|
|
|
c4_room0_cover:
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
lda #0
|
|
|
|
sta XPOS
|
2019-11-04 05:47:34 +00:00
|
|
|
lda #6
|
2019-10-02 04:03:00 +00:00
|
|
|
sta YPOS
|
|
|
|
|
|
|
|
lda #<causeway_door_cover
|
|
|
|
sta INL
|
|
|
|
lda #>causeway_door_cover
|
|
|
|
sta INH
|
|
|
|
|
2019-11-05 21:48:44 +00:00
|
|
|
jsr put_sprite
|
|
|
|
|
|
|
|
jmp c4_no_fg_cover
|
|
|
|
|
|
|
|
room2_robot:
|
|
|
|
|
|
|
|
; 0 is never seen, 2 is all done
|
|
|
|
lda CART_OUT
|
|
|
|
cmp #1
|
|
|
|
bne c4_no_fg_cover
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-05 21:48:44 +00:00
|
|
|
c2_draw_cart:
|
|
|
|
|
|
|
|
lda CART_X
|
|
|
|
sta XPOS
|
|
|
|
lda #42
|
|
|
|
sta YPOS
|
|
|
|
lda #<robot_sprite
|
|
|
|
sta INL
|
|
|
|
lda #>robot_sprite
|
|
|
|
sta INH
|
|
|
|
jsr put_sprite_crop
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
c4_no_fg_cover:
|
|
|
|
|
|
|
|
|
|
|
|
;========================
|
2019-11-05 21:48:44 +00:00
|
|
|
; activate fg actions
|
2019-10-02 04:03:00 +00:00
|
|
|
;========================
|
|
|
|
|
2019-11-05 21:48:44 +00:00
|
|
|
lda WHICH_ROOM
|
|
|
|
cmp #2
|
|
|
|
bne no_fg_action
|
|
|
|
|
|
|
|
lda CART_OUT
|
|
|
|
bne no_fg_action ; if 0 activate
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-05 21:48:44 +00:00
|
|
|
inc CART_OUT
|
|
|
|
|
|
|
|
no_fg_action:
|
|
|
|
|
|
|
|
;================
|
|
|
|
; move fg objects
|
|
|
|
;================
|
|
|
|
move_fg_objects:
|
|
|
|
|
|
|
|
lda CART_OUT
|
2019-10-02 04:03:00 +00:00
|
|
|
cmp #1
|
2019-11-05 21:48:44 +00:00
|
|
|
bne cart_not_out
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-05 21:48:44 +00:00
|
|
|
; move cart
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-05 21:48:44 +00:00
|
|
|
lda FRAMEL
|
|
|
|
and #$3
|
|
|
|
bne cart_not_out
|
|
|
|
|
|
|
|
dec CART_X
|
|
|
|
dec CART_X
|
|
|
|
lda CART_X
|
|
|
|
cmp #$fc
|
|
|
|
bne cart_not_out
|
|
|
|
inc CART_OUT
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
|
2019-11-05 21:48:44 +00:00
|
|
|
cart_not_out:
|
|
|
|
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
;===============
|
|
|
|
; page flip
|
|
|
|
;===============
|
|
|
|
|
|
|
|
jsr page_flip
|
|
|
|
|
|
|
|
;================
|
|
|
|
; inc frame count
|
|
|
|
|
|
|
|
inc FRAMEL
|
|
|
|
bne city_frame_no_oflo
|
|
|
|
inc FRAMEH
|
|
|
|
city_frame_no_oflo:
|
|
|
|
|
|
|
|
;=========================
|
|
|
|
; exit hack
|
|
|
|
;=========================
|
|
|
|
|
|
|
|
lda WHICH_ROOM
|
|
|
|
cmp #4
|
|
|
|
bne regular_exit_check
|
|
|
|
|
2019-10-02 04:38:01 +00:00
|
|
|
lda ASTRONAUT_X
|
2019-10-02 04:03:00 +00:00
|
|
|
cmp #32
|
|
|
|
bcc regular_exit_check ; blt
|
|
|
|
|
|
|
|
lda #5
|
|
|
|
sta WHICH_ROOM
|
|
|
|
rts
|
|
|
|
|
|
|
|
regular_exit_check:
|
|
|
|
|
|
|
|
|
|
|
|
;==========================
|
|
|
|
; check if done this level
|
|
|
|
;==========================
|
|
|
|
|
|
|
|
lda GAME_OVER
|
|
|
|
beq still_in_city
|
|
|
|
|
|
|
|
cmp #$ff ; if $ff, we died
|
|
|
|
beq done_city
|
|
|
|
|
|
|
|
;===============================
|
|
|
|
; check if exited room to right
|
|
|
|
cmp #1
|
|
|
|
beq city_exit_left
|
|
|
|
|
|
|
|
;=================
|
|
|
|
; exit to right
|
|
|
|
|
|
|
|
city_right_yes_exit:
|
|
|
|
|
|
|
|
lda #0
|
2019-10-02 04:38:01 +00:00
|
|
|
sta ASTRONAUT_X
|
2019-10-02 04:03:00 +00:00
|
|
|
cer_smc:
|
|
|
|
lda #$0 ; smc+1 = exit location
|
2019-11-15 03:23:26 +00:00
|
|
|
sta WHICH_ROOM
|
2019-10-02 04:03:00 +00:00
|
|
|
jmp done_city
|
|
|
|
|
|
|
|
;=====================
|
|
|
|
; exit to left
|
|
|
|
|
|
|
|
city_exit_left:
|
|
|
|
|
|
|
|
lda #37
|
2019-10-02 04:38:01 +00:00
|
|
|
sta ASTRONAUT_X
|
2019-10-02 04:03:00 +00:00
|
|
|
cel_smc:
|
|
|
|
lda #0 ; smc+1
|
2019-11-15 03:23:26 +00:00
|
|
|
sta WHICH_ROOM
|
2019-10-02 04:03:00 +00:00
|
|
|
jmp done_city
|
|
|
|
|
|
|
|
; loop forever
|
|
|
|
still_in_city:
|
|
|
|
lda #0
|
|
|
|
sta GAME_OVER
|
|
|
|
|
2019-11-04 05:47:34 +00:00
|
|
|
jmp starbase_loop
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
done_city:
|
|
|
|
rts
|
|
|
|
|
|
|
|
recharge_bg_progression:
|
|
|
|
.word recharge_bg1
|
|
|
|
.word recharge_bg2
|
|
|
|
.word recharge_bg3
|
|
|
|
.word recharge_bg4
|
|
|
|
|
|
|
|
recharge_bg1:
|
|
|
|
.byte 2,10
|
|
|
|
.byte $6A,$FA
|
|
|
|
.byte $27,$f6
|
|
|
|
.byte $ff,$7f
|
|
|
|
.byte $6f,$7f
|
|
|
|
.byte $ff,$5f
|
|
|
|
.byte $f5,$5f
|
|
|
|
.byte $62,$f2
|
|
|
|
.byte $72,$65
|
|
|
|
.byte $5f,$7f
|
|
|
|
.byte $A2,$a5
|
|
|
|
|
|
|
|
recharge_bg2:
|
|
|
|
.byte 2,10
|
|
|
|
.byte $2A,$6A
|
|
|
|
.byte $76,$65
|
|
|
|
.byte $5f,$f5
|
|
|
|
.byte $ff,$77
|
|
|
|
.byte $22,$f2
|
|
|
|
.byte $5f,$f6
|
|
|
|
.byte $2f,$75
|
|
|
|
.byte $52,$f5
|
|
|
|
.byte $f2,$52
|
|
|
|
.byte $A6,$a2
|
|
|
|
|
|
|
|
recharge_bg3:
|
|
|
|
.byte 2,10
|
|
|
|
.byte $fA,$7A
|
|
|
|
.byte $f5,$27
|
|
|
|
.byte $5f,$ff
|
|
|
|
.byte $2f,$5f
|
|
|
|
.byte $77,$ff
|
|
|
|
.byte $f5,$f6
|
|
|
|
.byte $25,$52
|
|
|
|
.byte $5f,$52
|
|
|
|
.byte $5f,$2f
|
|
|
|
.byte $A7,$a2
|
|
|
|
|
|
|
|
recharge_bg4:
|
|
|
|
.byte 2,10
|
|
|
|
.byte $5A,$2A
|
|
|
|
.byte $55,$76
|
|
|
|
.byte $f5,$5f
|
|
|
|
.byte $77,$ff
|
|
|
|
.byte $75,$22
|
|
|
|
.byte $f2,$5f
|
|
|
|
.byte $27,$22
|
|
|
|
.byte $7f,$5f
|
|
|
|
.byte $6f,$f5
|
|
|
|
.byte $A7,$a2
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
; 0x18
|
|
|
|
causeway_door_cover:
|
2019-11-04 05:47:34 +00:00
|
|
|
.byte 6,10
|
|
|
|
.byte $00,$00,$00,$00,$00,$00
|
|
|
|
.byte $00,$00,$11,$00,$00,$00
|
|
|
|
.byte $00,$00,$11,$11,$00,$00
|
|
|
|
.byte $00,$00,$00,$11,$00,$00
|
|
|
|
.byte $00,$00,$00,$00,$00,$00
|
|
|
|
.byte $00,$00,$00,$00,$00,$00
|
|
|
|
.byte $00,$00,$00,$00,$00,$00
|
|
|
|
.byte $00,$00,$00,$00,$00,$00
|
|
|
|
.byte $00,$00,$00,$00,$00,$00
|
|
|
|
.byte $00,$00,$00,$00,$00,$00
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-04 22:00:16 +00:00
|
|
|
; 3x3
|
|
|
|
|
|
|
|
clamp_sprite:
|
|
|
|
.byte 3,3
|
|
|
|
.byte $AA,$1A,$9A
|
|
|
|
.byte $00,$00,$00
|
|
|
|
.byte $AA,$A9,$A1
|
|
|
|
|
|
|
|
|
|
|
|
; Room 0 doors
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
door_c4_r0:
|
|
|
|
.word door_c4_r0_status
|
|
|
|
.word door_c4_r0_x
|
|
|
|
.word door_c4_r0_y
|
|
|
|
.word door_c4_r0_xmin
|
|
|
|
.word door_c4_r0_xmax
|
|
|
|
|
|
|
|
door_c4_r0_status:
|
2019-11-04 05:47:34 +00:00
|
|
|
c4_r0_door0_status: .byte DOOR_STATUS_LOCKED
|
|
|
|
c4_r0_door1_status: .byte DOOR_STATUS_LOCKED
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
door_c4_r0_x:
|
2019-11-04 05:47:34 +00:00
|
|
|
c4_r0_door0_x: .byte 6
|
|
|
|
c4_r0_door1_x: .byte 37
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
door_c4_r0_y:
|
2019-11-04 05:47:34 +00:00
|
|
|
c4_r0_door0_y: .byte 6
|
|
|
|
c4_r0_door1_y: .byte 18
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
door_c4_r0_xmin:
|
2019-11-04 05:47:34 +00:00
|
|
|
c4_r0_door0_xmin: .byte 0 ; 37-4-5
|
|
|
|
c4_r0_door1_xmin: .byte 28 ; 37-4-5
|
|
|
|
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
door_c4_r0_xmax:
|
2019-11-04 05:47:34 +00:00
|
|
|
c4_r0_door0_xmax: .byte 4 ; ??
|
|
|
|
c4_r0_door1_xmax: .byte 39 ; ??
|
|
|
|
|
2019-11-04 22:00:16 +00:00
|
|
|
; Room 1 doors
|
|
|
|
|
|
|
|
door_c4_r1:
|
|
|
|
.word door_c4_r1_status
|
|
|
|
.word door_c4_r1_x
|
|
|
|
.word door_c4_r1_y
|
|
|
|
.word door_c4_r1_xmin
|
|
|
|
.word door_c4_r1_xmax
|
|
|
|
|
|
|
|
door_c4_r1_status:
|
|
|
|
c4_r1_door0_status: .byte DOOR_STATUS_CLOSED
|
|
|
|
c4_r1_door1_status: .byte DOOR_STATUS_CLOSED
|
|
|
|
c4_r1_door2_status: .byte DOOR_STATUS_CLOSED
|
|
|
|
|
|
|
|
door_c4_r1_x:
|
|
|
|
c4_r1_door0_x: .byte 31
|
|
|
|
c4_r1_door1_x: .byte 34
|
|
|
|
c4_r1_door2_x: .byte 37
|
|
|
|
|
|
|
|
door_c4_r1_y:
|
|
|
|
c4_r1_door0_y: .byte 26
|
|
|
|
c4_r1_door1_y: .byte 26
|
|
|
|
c4_r1_door2_y: .byte 26
|
|
|
|
|
|
|
|
door_c4_r1_xmin:
|
|
|
|
c4_r1_door0_xmin: .byte 22 ; 31-4-5
|
|
|
|
c4_r1_door1_xmin: .byte 25 ; 34-4-5
|
|
|
|
c4_r1_door2_xmin: .byte 28 ; 37-4-5
|
|
|
|
|
|
|
|
door_c4_r1_xmax:
|
|
|
|
c4_r1_door0_xmax: .byte 39 ; ??
|
|
|
|
c4_r1_door1_xmax: .byte 39 ; ??
|
|
|
|
c4_r1_door2_xmax: .byte 39 ; ??
|
|
|
|
|
|
|
|
|
2019-10-02 04:03:00 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
2019-11-04 22:00:16 +00:00
|
|
|
door_c4_r3:
|
|
|
|
.word door_c4_r3_status
|
|
|
|
.word door_c4_r3_x
|
|
|
|
.word door_c4_r3_y
|
|
|
|
.word door_c4_r3_xmin
|
|
|
|
.word door_c4_r3_xmax
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-04 22:00:16 +00:00
|
|
|
door_c4_r3_status:
|
|
|
|
c4_r3_door0_status: .byte DOOR_STATUS_CLOSED
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-04 22:00:16 +00:00
|
|
|
door_c4_r3_x:
|
|
|
|
c4_r3_door0_x: .byte 12
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-04 22:00:16 +00:00
|
|
|
door_c4_r3_xmin: .byte 39
|
|
|
|
door_c4_r3_xmax: .byte 39
|
|
|
|
door_c4_r3_y:
|
|
|
|
c4_r3_door0_y: .byte 26
|
2019-10-02 04:03:00 +00:00
|
|
|
|
2019-11-05 03:47:52 +00:00
|
|
|
|
|
|
|
;============================
|
|
|
|
; end_sequence
|
|
|
|
;============================
|
|
|
|
;
|
|
|
|
; fire engines, star-wipe
|
|
|
|
end_sequence:
|
|
|
|
|
|
|
|
;=========================
|
|
|
|
; set up bg
|
|
|
|
|
|
|
|
; lda #>(ship_rle)
|
|
|
|
; sta GBASH
|
|
|
|
; lda #<(ship_rle)
|
|
|
|
; sta GBASL
|
|
|
|
; lda #$0c ; load image off-screen $c00
|
|
|
|
; jsr load_rle_gr
|
|
|
|
|
|
|
|
|
|
|
|
lda #<flame_sequence
|
|
|
|
sta INTRO_LOOPL
|
|
|
|
lda #>flame_sequence
|
|
|
|
sta INTRO_LOOPH
|
|
|
|
|
|
|
|
jsr run_sequence
|
|
|
|
|
|
|
|
lda #<star_sequence
|
|
|
|
sta INTRO_LOOPL
|
|
|
|
lda #>star_sequence
|
|
|
|
sta INTRO_LOOPH
|
|
|
|
|
|
|
|
jsr run_sequence
|
|
|
|
|
|
|
|
|
|
|
|
; bit KEYRESET
|
|
|
|
|
|
|
|
; jsr wait_until_keypressed
|
|
|
|
|
|
|
|
; trigger end
|
|
|
|
lda #5
|
|
|
|
sta WHICH_ROOM
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
FLAME_FRAMERATE = 10
|
|
|
|
|
|
|
|
flame_sequence:
|
|
|
|
.byte 255
|
|
|
|
.word ship_rle
|
|
|
|
.byte 1
|
|
|
|
.word ship_rle
|
|
|
|
.byte 50
|
|
|
|
.word ship_flame0_rle
|
|
|
|
.byte 40
|
|
|
|
.word ship_flame1_rle
|
|
|
|
.byte 40
|
|
|
|
.word ship_flame2_rle
|
|
|
|
|
|
|
|
.byte FLAME_FRAMERATE
|
|
|
|
.word ship_flame3_rle
|
|
|
|
.byte FLAME_FRAMERATE
|
|
|
|
.word ship_flame4_rle
|
|
|
|
.byte FLAME_FRAMERATE
|
|
|
|
.word ship_flame5_rle
|
|
|
|
|
|
|
|
.byte FLAME_FRAMERATE
|
|
|
|
.word ship_flame3_rle
|
|
|
|
.byte FLAME_FRAMERATE
|
|
|
|
.word ship_flame4_rle
|
|
|
|
.byte FLAME_FRAMERATE
|
|
|
|
.word ship_flame5_rle
|
|
|
|
|
|
|
|
.byte FLAME_FRAMERATE
|
|
|
|
.word ship_flame3_rle
|
|
|
|
.byte FLAME_FRAMERATE
|
|
|
|
.word ship_flame4_rle
|
|
|
|
.byte FLAME_FRAMERATE
|
|
|
|
.word ship_flame5_rle
|
|
|
|
|
|
|
|
.byte FLAME_FRAMERATE
|
|
|
|
.word ship_flame3_rle
|
|
|
|
.byte FLAME_FRAMERATE
|
|
|
|
.word ship_flame4_rle
|
|
|
|
.byte FLAME_FRAMERATE
|
|
|
|
.word ship_flame5_rle
|
|
|
|
|
|
|
|
.byte FLAME_FRAMERATE
|
|
|
|
.word ship_flame3_rle
|
|
|
|
.byte FLAME_FRAMERATE
|
|
|
|
.word ship_flame4_rle
|
|
|
|
.byte 255
|
|
|
|
.word ship_flame5_rle
|
|
|
|
|
|
|
|
.byte 0
|
|
|
|
|
2019-11-05 21:48:44 +00:00
|
|
|
STAR_SPEED = 16
|
|
|
|
|
2019-11-05 03:47:52 +00:00
|
|
|
star_sequence:
|
2019-11-05 21:48:44 +00:00
|
|
|
.byte STAR_SPEED
|
2019-11-05 03:47:52 +00:00
|
|
|
.word star_wipe1_rle
|
2019-11-05 21:48:44 +00:00
|
|
|
.byte STAR_SPEED
|
2019-11-05 03:47:52 +00:00
|
|
|
.word star_wipe2_rle
|
2019-11-05 21:48:44 +00:00
|
|
|
.byte STAR_SPEED
|
2019-11-05 03:47:52 +00:00
|
|
|
.word star_wipe3_rle
|
2019-11-05 21:48:44 +00:00
|
|
|
.byte STAR_SPEED
|
2019-11-05 03:47:52 +00:00
|
|
|
.word star_wipe4_rle
|
2019-11-05 21:48:44 +00:00
|
|
|
.byte STAR_SPEED
|
2019-11-05 03:47:52 +00:00
|
|
|
.word star_wipe5_rle
|
2019-11-05 21:48:44 +00:00
|
|
|
.byte STAR_SPEED
|
2019-11-05 03:47:52 +00:00
|
|
|
.word empty_rle
|
2019-11-05 21:48:44 +00:00
|
|
|
.byte STAR_SPEED
|
2019-11-05 17:35:47 +00:00
|
|
|
.word empty_rle
|
2019-11-05 03:47:52 +00:00
|
|
|
.byte 0
|
2019-11-05 17:35:47 +00:00
|
|
|
|
2019-11-05 21:48:44 +00:00
|
|
|
robot_sprite:
|
|
|
|
.byte 5,3
|
|
|
|
.byte $aa,$0a,$00,$0a,$aa
|
|
|
|
.byte $0a,$90,$00,$00,$aa
|
|
|
|
.byte $00,$00,$00,$00,$00
|