From ab42f9623e850676d209a6ce7eaac81744313436 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Sun, 28 Jan 2024 00:44:11 -0500 Subject: [PATCH] trogdor: burninate the peasants --- demos/trogdor/hgr_copy_magnify.s | 44 +++++----- demos/trogdor/trogdor.s | 140 +++++++++++++++++++++++++++++-- 2 files changed, 159 insertions(+), 25 deletions(-) diff --git a/demos/trogdor/hgr_copy_magnify.s b/demos/trogdor/hgr_copy_magnify.s index 85569a55..51f00bc1 100644 --- a/demos/trogdor/hgr_copy_magnify.s +++ b/demos/trogdor/hgr_copy_magnify.s @@ -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 diff --git a/demos/trogdor/trogdor.s b/demos/trogdor/trogdor.s index 176aa854..6ee0033e 100644 --- a/demos/trogdor/trogdor.s +++ b/demos/trogdor/trogdor.s @@ -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_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_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