diff --git a/demos/trogdor/Makefile b/demos/trogdor/Makefile index 67379bac..138a4a27 100644 --- a/demos/trogdor/Makefile +++ b/demos/trogdor/Makefile @@ -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 diff --git a/demos/trogdor/graphics/Makefile b/demos/trogdor/graphics/Makefile index dd4e6116..6c597010 100644 --- a/demos/trogdor/graphics/Makefile +++ b/demos/trogdor/graphics/Makefile @@ -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 diff --git a/demos/trogdor/graphics/actual00_trog_cottage.png b/demos/trogdor/graphics/actual00_trog_cottage.png new file mode 100644 index 00000000..43473a11 Binary files /dev/null and b/demos/trogdor/graphics/actual00_trog_cottage.png differ diff --git a/demos/trogdor/hgr_copy_fast.s b/demos/trogdor/hgr_copy_fast.s new file mode 100644 index 00000000..718b521b --- /dev/null +++ b/demos/trogdor/hgr_copy_fast.s @@ -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 + diff --git a/demos/trogdor/hgr_copy_magnify.s b/demos/trogdor/hgr_copy_magnify.s new file mode 100644 index 00000000..4d22e873 --- /dev/null +++ b/demos/trogdor/hgr_copy_magnify.s @@ -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 diff --git a/demos/trogdor/horiz_scroll_simple.s b/demos/trogdor/horiz_scroll_simple.s new file mode 100644 index 00000000..b0060458 --- /dev/null +++ b/demos/trogdor/horiz_scroll_simple.s @@ -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 diff --git a/demos/trogdor/trogdor.s b/demos/trogdor/trogdor.s index 6ff065ae..8c44e99e 100644 --- a/demos/trogdor/trogdor.s +++ b/demos/trogdor/trogdor.s @@ -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 #