diff --git a/demos/lovebyte2023/1k/Makefile b/demos/lovebyte2023/1k/Makefile index d647cef0..788e9886 100644 --- a/demos/lovebyte2023/1k/Makefile +++ b/demos/lovebyte2023/1k/Makefile @@ -48,7 +48,7 @@ blue_flame.o: blue_flame.s \ letters.s flame.s sier.s zp.inc \ ay3_write_regs.s interrupt_handler.s play_frame.s \ SmallLove2.s mockingboard_constants.s mockingboard_init.s \ - tracker_init.s + tracker_init.s static_column.s ca65 -o blue_flame.o blue_flame.s -l blue_flame.lst #### diff --git a/demos/lovebyte2023/1k/blue_flame.s b/demos/lovebyte2023/1k/blue_flame.s index 10e907d8..b2d3def3 100644 --- a/demos/lovebyte2023/1k/blue_flame.s +++ b/demos/lovebyte2023/1k/blue_flame.s @@ -8,17 +8,10 @@ ; 914 bytes -- fallthrough into the flames code ; 887 bytes -- BF using compact zx02 code, inlined ; 1007 bytes -- merge in sier_parallax +; 1006 bytes -- mildly optimzie hgr table gen +; 1046 bytes (+26) -- add static_column ; TODO: -; line border? -; DEMO OVER message, zooming from angle? - -; hgr/parallax/BOXES (68) ??? - -; COOL_PATTERN? (140) -; WEB? (140) - -; SIER/SIERFAST (140) ; MIRROR (140) ; THICK_LINES (88) ; RAINBOW SQUARES (106) @@ -31,6 +24,11 @@ .include "hardware.inc" +hgr_lookup_h = $1000 +hgr_lookup_l = $1100 +div4_lookup = $90 + + blue_flame: ; clear both pages of graphics @@ -42,6 +40,44 @@ blue_flame: sty FRAME ; init frame. Maybe only H important? sty FRAMEH + ;=================== + ; int tables + + ; Y must be 0? actually might not matter + + ;==================================== + ; Make HGR row address lookup table + + ldx #191 +hgr_table_loop: + txa + jsr HPOSN ; X= (y,x) Y=(a), saves incoming values + + ldx HGR_X ; restore X + + lda GBASL + sta hgr_lookup_l,X + lda GBASH + and #$1F ; 20 30 001X 40 50 010X + sta hgr_lookup_h,X + + + dex + cpx #$ff ; can't bpl/bmi as start > 128 + bne hgr_table_loop ; though if never use address 0 can we? + + ; lookup table of 0..40 but divided by 4 + ; in $90 to $C0 or so + + ldx #39 +div4_loop: + txa + asl + asl + sta div4_lookup,X + dex + bpl div4_loop + ;=================== ; music Player Setup @@ -50,6 +86,10 @@ blue_flame: ; inline mockingboard_init + ; Y must be 0 + + ldy #0 + .include "mockingboard_init.s" .include "tracker_init.s" @@ -58,6 +98,8 @@ blue_flame: .include "sier.s" + .include "static_column.s" + jsr do_letters ; fallthrough into flames @@ -72,6 +114,7 @@ blue_flame: .include "letters.s" + .include "interrupt_handler.s" .include "mockingboard_constants.s" diff --git a/demos/lovebyte2023/1k/sier.s b/demos/lovebyte2023/1k/sier.s index a08fe931..e1e38ac6 100644 --- a/demos/lovebyte2023/1k/sier.s +++ b/demos/lovebyte2023/1k/sier.s @@ -9,48 +9,20 @@ ; full 192 lines ; frame 0: 3bf5f = 245,599 cycles = roughly 4 fps - -.if 0 -; Zero Page -GBASL = $26 -GBASH = $27 - -HGR_X = $E0 -HGR_Y = $E2 -HGR_COLOR = $E4 -HGR_HORIZ = $E5 -HGR_PAGE = $E6 - -; Soft Switches - -PAGE1 = $C054 ; Page1 -PAGE2 = $C055 ; Page2 - - -; ROM routines - -HGR = $F3E2 -HGR2 = $F3D8 -HCLR = $F3F2 -HPLOT0 = $F457 ; plot at (Y,X), (A) -WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us -HPOSN = $F411 ; (Y,X),(A) (valued stores in HGRX,XH,Y) - -.endif - -hgr_lookup_h = $1000 -hgr_lookup_l = $1100 -div4_lookup = $90 - - +;hgr_lookup_h = $1000 +;hgr_lookup_l = $1100 +;div4_lookup = $90 sier_parallax: +.if 0 ;=================== ; init screen - jsr HGR ; clear PAGE1 - jsr HGR2 ; clear PAGE2 +; already done for us + +; jsr HGR ; clear PAGE1 +; jsr HGR2 ; clear PAGE2 ;=================== ; int tables @@ -82,6 +54,7 @@ div4_loop: dex bpl div4_loop +.endif parallax_forever: @@ -177,6 +150,9 @@ out_smc: cpy #32 ; 2 bne yloop ; 2/3 + ; stop after 512 frames + lda FRAMEH cmp #2 + bne parallax_forever ; bra ; 3 diff --git a/demos/lovebyte2023/1k/static_column.s b/demos/lovebyte2023/1k/static_column.s new file mode 100644 index 00000000..89ce78c4 --- /dev/null +++ b/demos/lovebyte2023/1k/static_column.s @@ -0,0 +1,61 @@ + ; shimmery blue pattern + +INDEXL = $F6 +INDEXH = $F7 + +;HGR2 = $F3D8 ; set hires page2 and clear $4000-$5fff +;WAIT = $FCA8 ; delay 1/2(26+27A+5A^2) us + + +even_lookup=$f000 +odd_lookup=$f100 + + +staggered: +; jsr HGR2 ; after, A=0, Y=0 + +; tax ; init X to 0 + + ldx #0 + stx INDEXL ; set INDEXL to 0 + + ; pulse loop horizontal +outer_loop: +; lda #$40 ; reset INDEXH to begin page2 + lda #$20 ; reset INDEXH to begin page2 + sta INDEXH + +inner_loop: + lda even_lookup,X ; get even color + sta (INDEXL),Y ; store it to memory + iny + + lda odd_lookup,X ; get odd color + sta (INDEXL),Y ; store it to memory + iny + + bne inner_loop ; repeat for 256 + + inc INDEXH ; point to next page + + inx ; point to next lookup + + txa ; wrap to 0..7 + and #$7 + tax + +; lda #$60 ; see if done + lda #$40 ; see if done + cmp INDEXH + bne inner_loop + +; lda #100 ; A is $60 here + jsr WAIT ; pause a bit + + ; A is 0 here + + inx ; offset next FRAME + + lda FRAMEH + cmp #4 + bne outer_loop diff --git a/graphics/hgr/parallax/sier.s b/graphics/hgr/parallax/sier.s index 3606086a..453f3cd9 100644 --- a/graphics/hgr/parallax/sier.s +++ b/graphics/hgr/parallax/sier.s @@ -52,12 +52,13 @@ parallax: ; int tables ldx #191 -init_loop: +hgr_table_loop: txa - pha - jsr HPOSN - pla - tax +; pha + jsr HPOSN ; X= (y,x) Y=(a), saves values + ; pla + ; tax + ldx HGR_X lda GBASL sta hgr_lookup_l,X lda GBASH @@ -67,7 +68,7 @@ init_loop: dex cpx #$ff - bne init_loop + bne hgr_table_loop ldx #39 div4_loop: