trogdor: burninate the peasants

This commit is contained in:
Vince Weaver 2024-01-28 00:44:11 -05:00
parent a74e92e614
commit ab42f9623e
2 changed files with 159 additions and 25 deletions

View File

@ -1,17 +1,24 @@
;============================================================= ;=============================================================
; hgr copy from page in A to current DRAW_PAGE but magnify 2x ; hgr copy from page in A to current DRAW_PAGE but magnify 2x
;========================================================= ;=========================================================
; SPRITE_X, SPRITE_Y = offset to load from
hgr_copy_magnify: hgr_copy_magnify:
INPUT_OFFSET = 20 lda SPRITE_X
sta hcm_smc1+1
clc
adc #20
sta hcm_smc2+1
ldx #0 ; start at top
ldx #0
magnify_outer_loop: magnify_outer_loop:
txa txa
pha pha ; store X on stack
clc
adc #INPUT_OFFSET clc ; offset IN to our sprite
adc SPRITE_Y
tax tax
lda hposn_low,X lda hposn_low,X
@ -22,11 +29,10 @@ magnify_outer_loop:
adc #$40 ; hardcode at $60 adc #$40 ; hardcode at $60
sta INH sta INH
pla pla ; get X off stack again
pha pha
asl asl ; multiply by 2
tax tax
lda hposn_low,X lda hposn_low,X
@ -34,32 +40,31 @@ magnify_outer_loop:
lda hposn_high,X lda hposn_high,X
clc clc
adc DRAW_PAGE adc DRAW_PAGE ; adjust for draw page
sta OUTH sta OUTH
inx inx ; calculate (x*2)+1
lda hposn_low,X lda hposn_low,X
sta GBASL sta GBASL
lda hposn_high,X lda hposn_high,X
clc clc
adc DRAW_PAGE adc DRAW_PAGE
sta GBASH sta GBASH
hcm_smc1:
ldy #0 ; 2 ldy #0 ; 2
magnify_inner_loop: magnify_inner_loop:
lda (INL),Y ; 5 lda (INL),Y ; 5
and #$f ; 2 and #$f ; 2
tax ; 2 tax ; 2
lda magnify_table_low,X ; 4 lda magnify_table_low,X ; 4
sta (OUTL),Y ; 6 sta (OUTL),Y ; output at 2*X ; 6
sta (GBASL),Y ; 6 sta (GBASL),Y ; output at (2*X)+1 ; 6
inc OUTL ; 5 inc OUTL ; point to next xpos ; 5
inc GBASL ; 5 inc GBASL ; " ; 5
lda (INL),Y ; 5 lda (INL),Y ; 5
lsr ; 2 lsr ; 2
@ -71,13 +76,14 @@ magnify_inner_loop:
sta (GBASL),Y ; 6 sta (GBASL),Y ; 6
iny ; 2 iny ; 2
hcm_smc2:
cpy #20 ; 2 cpy #20 ; 2
bne magnify_inner_loop ; 2/3 bne magnify_inner_loop ; 2/3
pla pla ; get X off stack
tax tax
inx inx ; increment
cpx #96 cpx #96
bne magnify_outer_loop bne magnify_outer_loop

View File

@ -59,6 +59,11 @@ trog_no_music:
; copy+magnify to PAGE2 ; copy+magnify to PAGE2
lda #20
sta SPRITE_Y
lda #0
sta SPRITE_X
lda #$60 lda #$60
jsr hgr_copy_magnify jsr hgr_copy_magnify
@ -287,6 +292,11 @@ scroll_in_loop:
;========================== ;==========================
; dragon zoom ; dragon zoom
lda #0
sta SPRITE_X
lda #20
sta SPRITE_Y
lda #$60 lda #$60
jsr hgr_copy_magnify jsr hgr_copy_magnify
@ -340,7 +350,7 @@ scroll_down_in_loop:
lda #20 lda #20
jsr wait_ticks jsr wait_ticks
.endif
;====================================== ;======================================
; draw SCENE 7 ; draw SCENE 7
@ -527,8 +537,7 @@ country_flames:
dec ANIMATE_COUNT dec ANIMATE_COUNT
bne country_flames bne country_flames
.endif
;====================================== ;======================================
; draw SCENE 9 ; draw SCENE 9
@ -537,7 +546,46 @@ country_flames:
; big peasant head scrolling in right to left (also going down?) ; big peasant head scrolling in right to left (also going down?)
; roughly 60 frames ; roughly 60 frames
; TODO: big peasant head ; decompress trogdor+peasant to $6000
lda #<trog00_graphics
sta zx_src_l+1
lda #>trog00_graphics
sta zx_src_h+1
lda #$60
jsr zx02_full_decomp
; clear screen
ldy #$7f
jsr hgr_clear_screen
jsr hgr_page_flip
; URGH
ldy #$7f
jsr hgr_clear_screen
jsr hgr_page_flip
; copy+magnify to PAGE2
lda #20
sta SPRITE_X
lda #0
sta SPRITE_Y
lda #$60
jsr hgr_copy_magnify
jsr horiz_pan_skip
; clear to white
ldy #$7f
jsr hgr_clear_screen
jsr horiz_pan_skip
jsr hgr_page_flip
;====================================== ;======================================
; draw SCENE 10 ; draw SCENE 10
@ -554,16 +602,29 @@ country_flames:
lda #$60 lda #$60
jsr zx02_full_decomp jsr zx02_full_decomp
; TODO: fix copy
lda #00
sta SPRITE_X
lda #0
sta SPRITE_Y
lda #$60 lda #$60
jsr hgr_copy_magnify jsr hgr_copy_magnify
jsr hgr_page_flip jsr hgr_page_flip
lda #0
sta SPRITE_X
lda #96
sta SPRITE_Y
lda #$60 lda #$60
jsr hgr_copy_magnify jsr hgr_copy_magnify
lda #$60
jsr hgr_copy_magnify
;======================
; animate
lda #12 lda #12
sta ANIMATE_COUNT sta ANIMATE_COUNT
up_down_animate: up_down_animate:
@ -576,12 +637,66 @@ up_down_animate:
;====================================== ;======================================
; draw SCENE 11 ; draw SCENE 11
;====================================== ;======================================
; 1284
;
; Uncover peasants, 5 frames each ; Uncover peasants, 5 frames each
; R2 R4 L5 ; R2 R4 L5
; L3 L1 ; L3 L1
; then wait 25 frames ; then wait 25 frames
; TODO: peasant drawing lda #<trog00_graphics
sta zx_src_l+1
lda #>trog00_graphics
sta zx_src_h+1
lda #$60
jsr zx02_full_decomp
lda #1
sta COUNT
peasant_outer_loop:
ldy #$7f
jsr hgr_clear_screen
ldx #0
peasant_inner_loop:
stx ANIMATE_COUNT
lda peasant_data_x1,X
sta COPY_X1
lda peasant_data_width,X
sta COPY_WIDTH
lda peasant_data_y1,X
sta COPY_Y1
lda peasant_data_y2,X
sta COPY_Y2
lda peasant_data_sprite_x,X
sta SPRITE_X
lda peasant_data_sprite_y,X
sta SPRITE_Y
jsr hgr_copy_part
ldx ANIMATE_COUNT
inx
cpx COUNT
bne peasant_inner_loop
jsr hgr_page_flip
lda #20
jsr wait_ticks
inc COUNT
lda COUNT
cmp #6
bne peasant_outer_loop
lda #25
jsr wait_ticks
;====================================== ;======================================
; draw SCENE 12 ; draw SCENE 12
@ -689,6 +804,19 @@ trog04_graphics:
.include "irq_wait.s" .include "irq_wait.s"
peasant_data_x1:
.byte 20, 20, 20, 20, 20
peasant_data_width:
.byte 9, 8, 9, 8, 9
peasant_data_y1:
.byte 0, 98, 0, 98, 0
peasant_data_y2:
.byte 96,176, 96,176, 96
peasant_data_sprite_x:
.byte 22, 4, 12, 16, 28
peasant_data_sprite_y:
.byte 92, 30, 91, 2, 8
hposn_low = $1e00 hposn_low = $1e00
hposn_high = $1f00 hposn_high = $1f00