lemm: animate the flames

This commit is contained in:
Vince Weaver 2022-03-09 00:35:13 -05:00
parent f5c9513998
commit 5f73aaa421
8 changed files with 212 additions and 33 deletions

View File

@ -39,7 +39,7 @@ LEMM: lemm.o
lemm.o: lemm.s zp.inc hardware.inc \
graphics/graphics_test.inc \
intro_level1.s update_time.s hgr_sprite.s \
intro_level1.s update_time.s hgr_sprite.s draw_flames.s \
interrupt_handler.s
ca65 -o lemm.o lemm.s -l lemm.lst

53
games/lemm/draw_flames.s Normal file
View File

@ -0,0 +1,53 @@
; updates the time left
draw_flames:
; draw left_flame
lda FRAMEL
and #$3
tay
lda lflame_l,Y
sta INL
lda lflame_h,Y
sta INH
ldx #31 ; 217
stx CURSOR_X
lda #108
sta CURSOR_Y
jsr hgr_draw_sprite
; draw right_flame
lda FRAMEL
and #$3
tay
lda rflame_l,Y
sta INL
lda rflame_h,Y
sta INH
ldx #35 ; 245
stx CURSOR_X
lda #108
sta CURSOR_Y
jmp hgr_draw_sprite
; rts
lflame_l:
.byte <lflame1_sprite,<lflame2_sprite,<lflame3_sprite,<lflame4_sprite
lflame_h:
.byte >lflame1_sprite,>lflame2_sprite,>lflame3_sprite,>lflame4_sprite
rflame_l:
.byte <rflame1_sprite,<rflame2_sprite,<rflame3_sprite,<rflame4_sprite
rflame_h:
.byte >rflame1_sprite,>rflame2_sprite,>rflame3_sprite,>rflame4_sprite

View File

@ -37,6 +37,16 @@ sprites.inc: sprites.png
$(HGR_SPRITE) -s -l big7_sprite sprites.png 112 1 118 16 >> sprites.inc
$(HGR_SPRITE) -s -l big8_sprite sprites.png 126 1 132 16 >> sprites.inc
$(HGR_SPRITE) -s -l big9_sprite sprites.png 140 1 146 16 >> sprites.inc
$(HGR_SPRITE) -s -l lflame1_sprite sprites.png 7 29 13 35 >> sprites.inc
$(HGR_SPRITE) -s -l lflame2_sprite sprites.png 7 36 13 41 >> sprites.inc
$(HGR_SPRITE) -s -l lflame3_sprite sprites.png 7 43 13 48 >> sprites.inc
$(HGR_SPRITE) -s -l lflame4_sprite sprites.png 7 50 13 55 >> sprites.inc
$(HGR_SPRITE) -s -l rflame1_sprite sprites.png 21 29 27 35 >> sprites.inc
$(HGR_SPRITE) -s -l rflame2_sprite sprites.png 21 36 27 41 >> sprites.inc
$(HGR_SPRITE) -s -l rflame3_sprite sprites.png 21 43 27 48 >> sprites.inc
$(HGR_SPRITE) -s -l rflame4_sprite sprites.png 21 50 27 55 >> sprites.inc

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.5 KiB

After

Width:  |  Height:  |  Size: 9.8 KiB

View File

@ -10,23 +10,6 @@
hgr_draw_sprite:
; self modify to shift for odd start location
; SEC=$38 0b0011 1000 CLC=$18 0b0001 10000
lda CURSOR_X
lsr
bcc make_it_even
make_it_odd:
lda #$18
bne make_it_so
make_it_even:
lda #$38
make_it_so:
sta odd_even_smc
ldy #0
lda (INL),Y ; load xsize
clc
@ -76,6 +59,116 @@ sprite_inner_loop:
sprite_smc1:
lda $d000 ; get sprite pattern
sta (GBASL),Y ; store out
inx
iny
inc sprite_smc1+1
bne sprite_noflo
inc sprite_smc1+2
sprite_noflo:
sprite_width_end_smc:
cpy #6
bne sprite_inner_loop
inc MASK ; row
lda MASK ; row
sprite_ysize_smc:
cmp #31
bne hgr_sprite_yloop
rts
;===========================================
; hgr draw sprite (only at 7-bit boundaries)
;===========================================
; autoshift version
; assumes sprite is drawn for even column
; and shifts it if in odd column
; SPRITE in INL/INH
; Location at CURSOR_X CURSOR_Y
; xsize, ysize in first two bytes
; sprite AT INL/INH
hgr_draw_sprite_autoshift:
; self modify to shift for odd start location
; SEC=$38 0b0011 1000 CLC=$18 0b0001 10000
lda CURSOR_X
lsr
bcc make_it_even
make_it_odd:
lda #$18
bne make_it_so
make_it_even:
lda #$38
make_it_so:
sta odd_even_smc
ldy #0
lda (INL),Y ; load xsize
clc
adc CURSOR_X
sta sprite_width_end_smc_as+1 ; self modify for end of line
iny ; load ysize
lda (INL),Y
sta sprite_ysize_smc_as+1 ; self modify
; skip the xsize/ysize and point to sprite
clc
lda INL ; 16-bit add
adc #2
sta sprite_smc1_as+1
lda INH
adc #0
sta sprite_smc1_as+2
ldx #0 ; X is pointer offset
stx MASK ; actual row
hgr_sprite_yloop_as:
lda MASK ; row
clc
adc CURSOR_Y ; add in cursor_y
; calc GBASL/GBASH
tay ; get output ROW into GBASL/H
lda hposn_low,Y
sta GBASL
lda hposn_high,Y
; eor #$00 draws on page2
; eor #$60 draws on page1
hgr_sprite_page_smc_as:
eor #$00
sta GBASH
ldy CURSOR_X
sprite_inner_loop_as:
sprite_smc1_as:
lda $d000 ; get sprite pattern
; lsr
@ -105,22 +198,23 @@ no_adjust:
iny
inc sprite_smc1+1
bne sprite_noflo
inc sprite_smc1+2
sprite_noflo:
inc sprite_smc1_as+1
bne sprite_noflo_as
inc sprite_smc1_as+2
sprite_noflo_as:
sprite_width_end_smc:
sprite_width_end_smc_as:
cpy #6
bne sprite_inner_loop
bne sprite_inner_loop_as
inc MASK ; row
lda MASK ; row
sprite_ysize_smc:
sprite_ysize_smc_as:
cmp #31
bne hgr_sprite_yloop
bne hgr_sprite_yloop_as
rts

View File

@ -238,7 +238,12 @@ zurg:
jsr decompress_lzsa2_fast
;=======================
; init vars
;=======================
lda #0
sta LEVEL_OVER
;=======================
; Play "Let's Go"
@ -266,16 +271,24 @@ zurg:
;===================
main_loop:
jsr draw_flames
jsr update_time
lda #$ff
jsr wait
inc FRAMEL
lda LEVEL_OVER
bne level_over
jmp main_loop
level_over:
jmp level_over
;========================
@ -330,6 +343,7 @@ load_song_chunk_good:
.include "hgr_sprite.s"
.include "update_time.s"
.include "intro_level1.s"
.include "draw_flames.s"
; pt3 player

View File

@ -16,6 +16,16 @@ no_time_uflo:
cld
lda TIME_MINUTES
bne not_over
lda TIME_SECONDS
bne not_over
inc LEVEL_OVER
not_over:
draw_time:
@ -34,7 +44,7 @@ draw_time:
lda #152
sta CURSOR_Y
jsr hgr_draw_sprite
jsr hgr_draw_sprite_autoshift
; draw seconds
lda TIME_SECONDS
@ -54,7 +64,7 @@ draw_time:
lda #152
sta CURSOR_Y
jsr hgr_draw_sprite
jsr hgr_draw_sprite_autoshift
; draw seconds
@ -72,7 +82,7 @@ draw_time:
lda #152
sta CURSOR_Y
jsr hgr_draw_sprite
jsr hgr_draw_sprite_autoshift
rts

View File

@ -27,9 +27,6 @@ SEEDH = $4f
XMAX = $50
; MIST zero page addresses
FRAMEL = $60
FRAMEH = $61
;CURSOR_X = $62
@ -45,7 +42,7 @@ IN_RIGHT = $6B
BTC_L = $6C
BTC_H = $6D
; ym player
CURRENT_FRAME_L = $70
CURRENT_FRAME_H = $71
BASE_FRAME_L = $72
@ -57,6 +54,7 @@ CURSOR_X = $77
CURSOR_Y = $78
DISP_PAGE = $79
DRAW_PAGE = $7A
LEVEL_OVER = $7B
APPLEII_MODEL = $8B