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
;=========================================================
; SPRITE_X, SPRITE_Y = offset to load from
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:
txa
pha
clc
adc #INPUT_OFFSET
pha ; store X on stack
clc ; offset IN to our sprite
adc SPRITE_Y
tax
lda hposn_low,X
@ -19,14 +26,13 @@ magnify_outer_loop:
lda hposn_high,X
clc
adc #$40 ; hardcode at $60
adc #$40 ; hardcode at $60
sta INH
pla
pla ; get X off stack again
pha
asl
asl ; multiply by 2
tax
lda hposn_low,X
@ -34,32 +40,31 @@ magnify_outer_loop:
lda hposn_high,X
clc
adc DRAW_PAGE
adc DRAW_PAGE ; adjust for draw page
sta OUTH
inx
inx ; calculate (x*2)+1
lda hposn_low,X
sta GBASL
lda hposn_high,X
clc
adc DRAW_PAGE
sta GBASH
hcm_smc1:
ldy #0 ; 2
magnify_inner_loop:
lda (INL),Y ; 5
and #$f ; 2
tax ; 2
lda magnify_table_low,X ; 4
sta (OUTL),Y ; 6
sta (GBASL),Y ; 6
sta (OUTL),Y ; output at 2*X ; 6
sta (GBASL),Y ; output at (2*X)+1 ; 6
inc OUTL ; 5
inc GBASL ; 5
inc OUTL ; point to next xpos ; 5
inc GBASL ; " ; 5
lda (INL),Y ; 5
lsr ; 2
@ -71,13 +76,14 @@ magnify_inner_loop:
sta (GBASL),Y ; 6
iny ; 2
hcm_smc2:
cpy #20 ; 2
bne magnify_inner_loop ; 2/3
pla
pla ; get X off stack
tax
inx
inx ; increment
cpx #96
bne magnify_outer_loop

View File

@ -59,6 +59,11 @@ trog_no_music:
; copy+magnify to PAGE2
lda #20
sta SPRITE_Y
lda #0
sta SPRITE_X
lda #$60
jsr hgr_copy_magnify
@ -287,6 +292,11 @@ scroll_in_loop:
;==========================
; dragon zoom
lda #0
sta SPRITE_X
lda #20
sta SPRITE_Y
lda #$60
jsr hgr_copy_magnify
@ -340,7 +350,7 @@ scroll_down_in_loop:
lda #20
jsr wait_ticks
.endif
;======================================
; draw SCENE 7
@ -527,8 +537,7 @@ country_flames:
dec ANIMATE_COUNT
bne country_flames
.endif
;======================================
; draw SCENE 9
@ -537,7 +546,46 @@ country_flames:
; big peasant head scrolling in right to left (also going down?)
; 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
@ -554,16 +602,29 @@ country_flames:
lda #$60
jsr zx02_full_decomp
; TODO: fix copy
lda #00
sta SPRITE_X
lda #0
sta SPRITE_Y
lda #$60
jsr hgr_copy_magnify
jsr hgr_page_flip
lda #0
sta SPRITE_X
lda #96
sta SPRITE_Y
lda #$60
jsr hgr_copy_magnify
lda #$60
jsr hgr_copy_magnify
;======================
; animate
lda #12
sta ANIMATE_COUNT
up_down_animate:
@ -576,12 +637,66 @@ up_down_animate:
;======================================
; draw SCENE 11
;======================================
; 1284
;
; Uncover peasants, 5 frames each
; R2 R4 L5
; L3 L1
; 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
@ -689,6 +804,19 @@ trog04_graphics:
.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_high = $1f00