2022-03-20 15:32:08 +00:00
|
|
|
|
|
|
|
;=======================
|
|
|
|
; Clear Lemmings Out
|
|
|
|
;=======================
|
|
|
|
clear_lemmings_out:
|
|
|
|
|
|
|
|
lda #0
|
|
|
|
ldy #0
|
|
|
|
clear_lemmings_loop:
|
|
|
|
sta lemming_out,Y
|
|
|
|
iny
|
2022-03-22 03:00:30 +00:00
|
|
|
cpy #MAX_LEMMINGS
|
2022-03-20 15:32:08 +00:00
|
|
|
bne clear_lemmings_loop
|
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
;=======================
|
2022-03-22 03:00:30 +00:00
|
|
|
; Release Lemmings
|
2022-03-20 15:32:08 +00:00
|
|
|
;=======================
|
2022-03-22 03:00:30 +00:00
|
|
|
; TODO: adjust speed based on release speed
|
2022-03-20 15:32:08 +00:00
|
|
|
release_lemming:
|
2022-03-22 03:00:30 +00:00
|
|
|
|
|
|
|
; don't release if we've released them all
|
|
|
|
lda LEMMINGS_TO_RELEASE
|
|
|
|
beq done_release_lemmings
|
|
|
|
|
|
|
|
; don't release if door is still opening
|
|
|
|
lda DOOR_OPEN
|
|
|
|
beq done_release_lemmings
|
|
|
|
|
|
|
|
; only release every X frames
|
|
|
|
lda FRAMEL
|
|
|
|
and #$f
|
|
|
|
bne done_release_lemmings
|
|
|
|
|
|
|
|
ldy NEXT_LEMMING_TO_RELEASE
|
2022-03-20 15:32:08 +00:00
|
|
|
|
|
|
|
lda #1
|
|
|
|
sta lemming_out,Y
|
|
|
|
lda #0
|
|
|
|
sta lemming_exploding,Y
|
2022-03-23 01:10:57 +00:00
|
|
|
sta lemming_fall_distance,Y
|
2022-03-20 15:32:08 +00:00
|
|
|
lda INIT_X
|
|
|
|
sta lemming_x,Y
|
|
|
|
lda INIT_Y
|
|
|
|
sta lemming_y,Y
|
|
|
|
lda #LEMMING_RIGHT
|
|
|
|
sta lemming_direction,Y
|
|
|
|
lda #LEMMING_FALLING
|
|
|
|
sta lemming_status,Y
|
|
|
|
|
2022-03-22 03:00:30 +00:00
|
|
|
sed
|
|
|
|
lda LEMMINGS_OUT ; BCD
|
|
|
|
clc
|
|
|
|
adc #1
|
|
|
|
sta LEMMINGS_OUT
|
|
|
|
cld
|
|
|
|
|
2022-03-20 15:32:08 +00:00
|
|
|
jsr update_lemmings_out
|
|
|
|
|
2022-03-22 03:00:30 +00:00
|
|
|
inc NEXT_LEMMING_TO_RELEASE
|
|
|
|
|
2022-03-20 15:32:08 +00:00
|
|
|
dec LEMMINGS_TO_RELEASE
|
|
|
|
|
2022-03-22 03:00:30 +00:00
|
|
|
done_release_lemmings:
|
2022-03-20 15:32:08 +00:00
|
|
|
|
|
|
|
rts
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|