dos33fsprogs/games/lemm/update_time.s

185 lines
2.2 KiB
ArmAsm
Raw Normal View History

2022-03-08 05:49:10 +00:00
; updates the time left
update_time:
2022-03-16 01:00:30 +00:00
; update explosion timer
; not ideal (first second might be short)
2022-03-23 01:48:02 +00:00
ldy #0
update_exploding_loop:
lda lemming_exploding,Y
2022-03-16 01:00:30 +00:00
beq not_done_exploding
2022-03-23 01:48:02 +00:00
tya
tax
inc lemming_exploding,X
lda lemming_exploding,Y
2022-03-16 01:00:30 +00:00
cmp #6
bne not_done_exploding
lda #LEMMING_EXPLODING
2022-03-23 01:48:02 +00:00
sta lemming_status,Y
2022-03-16 01:00:30 +00:00
lda #0
2022-03-23 01:48:02 +00:00
sta lemming_frame,Y
sta lemming_exploding,Y
2022-03-16 01:00:30 +00:00
not_done_exploding:
2022-03-23 01:48:02 +00:00
iny
cpy #MAX_LEMMINGS
bne update_exploding_loop
2022-03-16 01:00:30 +00:00
2022-03-08 05:49:10 +00:00
sed
sec
lda TIME_SECONDS
sbc #1
cmp #$99
bne no_time_uflo
lda #$59
dec TIME_MINUTES
no_time_uflo:
sta TIME_SECONDS
cld
2022-03-09 05:35:13 +00:00
lda TIME_MINUTES
bne not_over
lda TIME_SECONDS
bne not_over
2022-03-15 04:50:35 +00:00
; out of time
lda #LEVEL_FAIL
sta LEVEL_OVER
2022-03-09 05:35:13 +00:00
not_over:
2022-03-08 05:49:10 +00:00
draw_time:
; draw minute
ldy TIME_MINUTES
lda bignums_l,Y
sta INL
lda bignums_h,Y
sta INH
; 246, 152
ldx #35 ; 245
2022-03-09 20:15:38 +00:00
stx XPOS
2022-03-08 05:49:10 +00:00
lda #152
2022-03-09 20:15:38 +00:00
sta YPOS
2022-03-08 05:49:10 +00:00
2022-03-09 05:35:13 +00:00
jsr hgr_draw_sprite_autoshift
2022-03-08 05:49:10 +00:00
; draw seconds
lda TIME_SECONDS
lsr
lsr
lsr
lsr
tay
lda bignums_l,Y
sta INL
lda bignums_h,Y
sta INH
ldx #37
2022-03-09 20:15:38 +00:00
stx XPOS
2022-03-08 05:49:10 +00:00
lda #152
2022-03-09 20:15:38 +00:00
sta YPOS
2022-03-08 05:49:10 +00:00
2022-03-09 05:35:13 +00:00
jsr hgr_draw_sprite_autoshift
2022-03-08 05:49:10 +00:00
; draw seconds
lda TIME_SECONDS
and #$f
tay
lda bignums_l,Y
sta INL
lda bignums_h,Y
sta INH
ldx #38
2022-03-09 20:15:38 +00:00
stx XPOS
2022-03-08 05:49:10 +00:00
lda #152
2022-03-09 20:15:38 +00:00
sta YPOS
2022-03-08 05:49:10 +00:00
2022-03-09 05:35:13 +00:00
jsr hgr_draw_sprite_autoshift
2022-03-08 05:49:10 +00:00
rts
2022-03-22 03:00:30 +00:00
;===========================
;===========================
2022-03-11 04:43:10 +00:00
; update lemmings out number
2022-03-22 03:00:30 +00:00
;===========================
;===========================
; TODO: combine with time drawing code?
2022-03-11 04:43:10 +00:00
update_lemmings_out:
2022-03-22 03:00:30 +00:00
; draw tens
lda LEMMINGS_OUT
lsr
lsr
lsr
lsr
beq lemmings_out_ones
lemmings_out_tens:
2022-03-11 04:43:10 +00:00
2022-03-22 03:00:30 +00:00
tay
2022-03-11 04:43:10 +00:00
lda bignums_l,Y
sta INL
lda bignums_h,Y
sta INH
ldx #15 ; 105
stx XPOS
lda #152
sta YPOS
jsr hgr_draw_sprite_autoshift
2022-03-22 03:00:30 +00:00
lemmings_out_ones:
lda LEMMINGS_OUT
and #$f
tay
lda bignums_l,Y
sta INL
lda bignums_h,Y
sta INH
ldx #16 ; 112
stx XPOS
lda #152
sta YPOS
jsr hgr_draw_sprite_autoshift
2022-03-11 04:43:10 +00:00
rts
2022-03-08 05:49:10 +00:00
bignums_l:
.byte <big0_sprite,<big1_sprite,<big2_sprite,<big3_sprite,<big4_sprite
.byte <big5_sprite,<big6_sprite,<big7_sprite,<big8_sprite,<big9_sprite
bignums_h:
.byte >big0_sprite,>big1_sprite,>big2_sprite,>big3_sprite,>big4_sprite
.byte >big5_sprite,>big6_sprite,>big7_sprite,>big8_sprite,>big9_sprite