trogdor: work on horiz scroll

This commit is contained in:
Vince Weaver 2024-01-20 15:41:58 -05:00
parent 81828eae07
commit fcf5e39281
7 changed files with 194 additions and 16 deletions

View File

@ -165,7 +165,7 @@ trogdor.o: trogdor.s \
flames.inc \
zp.inc hardware.inc qload.inc \
graphics/trog00_trogdor.hgr.zx02 \
hgr_sprite_big_mask.s
hgr_sprite_big_mask.s horiz_scroll_simple.s hgr_copy_magnify.s
ca65 -o trogdor.o trogdor.s -l trogdor.lst

View File

@ -6,6 +6,7 @@ PNG2GR = ../../../utils/gr-utils/png2gr
HGR_SPRITE = ../../../utils/hgr-utils/hgr_make_sprite
all: \
actual00_trog_cottage.hgr.zx02 \
trog00_trogdor.hgr.zx02 \
trog01_countryside.hgr.zx02 \
trog02_countryside.hgr.zx02 \
@ -50,6 +51,14 @@ a2_strongbad.hgr.zx02: a2_strongbad.hgr
a2_strongbad.hgr: a2_strongbad.png
$(PNG_TO_HGR) a2_strongbad.png > a2_strongbad.hgr
####
actual00_trog_cottage.hgr.zx02: actual00_trog_cottage.hgr
$(ZX02) actual00_trog_cottage.hgr actual00_trog_cottage.hgr.zx02
actual00_trog_cottage.hgr: actual00_trog_cottage.png
$(PNG_TO_HGR) actual00_trog_cottage.png > actual00_trog_cottage.hgr
####
trog00_trogdor.hgr.zx02: trog00_trogdor.hgr

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

View File

@ -0,0 +1,49 @@
;=========================================================
; hgr copy from page in A to current DRAW_PAGE
;=========================================================
; would be faster if we unroll it, but much bigger
; old numbers
; 14+ ((14*256)+20)*32 + 5 = 115347 = 8.6fps
; theoretical unrolled, 30*6 bytes bigger (180 bytes?)
; 2 + ((9*32)+5)*256 + 5 = 75015 = 13.3 fps
hgr_copy_fast:
; copy from in A
sta hgr_copy_smc+2 ; 4
clc
adc #$20
sta hgr_copy_end_smc+1
ldx #0 ; 2
lda DRAW_PAGE
clc
adc #$20
sta hgr_copy_smc+5 ; 4
hgr_copy_column:
hgr_copy_smc:
lda $8000,X ; 4
sta $2000,X ; 5
dex ; 2
bne hgr_copy_column ; 2nt/3t
inc hgr_copy_smc+2 ; 6
inc hgr_copy_smc+5 ; 6
lda hgr_copy_smc+2 ; 4
hgr_copy_end_smc:
cmp #$C0 ; 2
bne hgr_copy_column ; 2/3
rts ; 6

View File

@ -0,0 +1,56 @@
;=============================================================
; hgr copy from page in A to current DRAW_PAGE but magnify 2x
;=========================================================
; would be faster if we unroll it, but much bigger
; At first from left side of image, eventually arbitrary?
; destination in A?
hgr_copy_magnify:
; for (y=0;y<192;y++) {
; for(x=0;x<40;x+=2) {
; A=src[x];
; dest[x]=lookup1[A];
; dest[x+1]=lookup2[A];
; y++;
; dest[x]=lookup1[A];
; dest[x+1]=lookup2[A];
; }
; }
ldx #0
magnify_outer_loop:
lda hposn_low,X
sta OUTL
lda hposn_high,X
clc
adc DRAW_PAGE
sta OUTH
lda hposn_low,X
sta INL
lda hposn_high,X
clc
adc #$40
sta INH
ldy #0
magnify_inner_loop:
lda (INL),Y
sta (OUTL),Y
iny
cpy #40
bne magnify_inner_loop
inx
cpx #192
bne magnify_outer_loop
rts

View File

@ -0,0 +1,66 @@
;==================================
; do very simple horizontal scroll
;==================================
; screens to pan in $2000/$4000 to left
horiz_pan:
pan_loop:
lda #0
sta COUNT
pan_outer_outer_loop:
ldx #191
pan_outer_loop:
lda hposn_high,X
sta pil_smc1+2
sta pil_smc2+2
sta pil_smc4+2
eor #$60
sta pil_smc3+2
lda hposn_low,X
sta pil_smc2+1
sta pil_smc4+1
sta pil_smc1+1
inc pil_smc1+1
clc
adc COUNT
sta pil_smc3+1
ldy #0
pan_inner_loop:
pil_smc1:
lda $2000+1,Y
pil_smc2:
sta $2000,Y
iny
cpy #39
bne pan_inner_loop
pil_smc3:
lda $4000
pil_smc4:
sta $2000,Y
dex
cpx #$ff
bne pan_outer_loop
; jsr wait_until_keypress
inc COUNT
lda COUNT
cmp #39
bne pan_outer_outer_loop
rts

View File

@ -16,8 +16,8 @@ trogdor_main:
lda #$0
sta DRAW_PAGE
; sta FRAME
; sta SECONDS
; clear PAGE1 to white
ldy #$7f
jsr hgr_clear_screen
@ -29,6 +29,9 @@ trogdor_main:
bit FULLGR
bit PAGE1
lda #$20
sta DRAW_PAGE
;======================================
; draw SCENE 1
;======================================
@ -36,7 +39,7 @@ trogdor_main:
; scroll in zoomed in trogdor from right to left
; for 60 frames (roughly 2s)
; decompress trogdor screen to offscreen $6000
; decompress trogdor to $6000
lda #<trog00_graphics
sta zx_src_l+1
@ -45,16 +48,12 @@ trogdor_main:
lda #$60
jsr zx02_full_decomp
; copy+magnify to PAGE2
lda #$60
jsr hgr_copy_fast
jsr hgr_copy_magnify
jsr wait_until_keypress
; TODO: can remove these?
; current, DRAW_PAGE=0, active page=1
lda #$20
sta DRAW_PAGE
jsr horiz_pan
; clear to white
ldy #$7f
@ -281,7 +280,7 @@ finished:
trog00_graphics:
.incbin "graphics/trog00_trogdor.hgr.zx02"
.incbin "graphics/actual00_trog_cottage.hgr.zx02"
trog03_graphics:
.incbin "graphics/trog03_man.hgr.zx02"
@ -294,9 +293,8 @@ hposn_low = $1e00
hposn_high = $1f00
.include "hgr_sprite_big_mask.s"
;.include "graphics/flame_sprites.inc"
.include "horiz_scroll_simple.s"
.include "hgr_copy_magnify.s"
;===============================
; draw_flame_small