From 2d44b76a59c450fb743772a59f9c4fb403a070a0 Mon Sep 17 00:00:00 2001 From: Vince Weaver Date: Thu, 11 Nov 2021 20:55:03 -0500 Subject: [PATCH] d2_hgr: inline to save bytes --- demos/d2/d2.s | 39 +++++++++++++++++++++++++++++++++------ demos/d2/moving.s | 25 +++++++++++++------------ demos/d2/oval.s | 14 +++++++------- demos/d2/wires.s | 14 +++++--------- 4 files changed, 58 insertions(+), 34 deletions(-) diff --git a/demos/d2/d2.s b/demos/d2/d2.s index bf79afc2..3ea2ebc0 100644 --- a/demos/d2/d2.s +++ b/demos/d2/d2.s @@ -101,7 +101,7 @@ forever: ;===================== ; orange/green effect - jsr moving +.include "moving.s" ;===================== ; clear screen @@ -113,16 +113,26 @@ forever: ;===================== ; wires effect - jsr wires +.include "wires.s" + +; jsr wires ;===================== ; oval effect - jsr oval +; jsr oval + +.include "oval.s" ;===================== ; repeat + lda #$7f + sta color_smc+1 + lda #159 + sta moving_size_smc+1 + sta oval_size_smc+1 + bit TEXTGR jmp forever @@ -187,11 +197,28 @@ message2: hiasc "MUSIC: MA2E " .include "dsr_shape.s" -.include "moving.s" -.include "wires.s" -.include "oval.s" +;.include "oval.s" .include "clear_bottom.s" +colorlookup2: +.byte $11,$55,$5d,$7f,$5d,$55,$11,$00 + +even_lookup: +.byte $D7,$DD,$F5, $D5,$D5,$D5,$D5 +odd_lookup: +.byte $AA,$AA,$AA, $AB,$AE,$BA,$EA + +colorlookup: +.byte $22,$aa,$ba,$ff,$ba,$aa,$22 ; use 00 from sinetable + +sinetable_base: +; this is actually (32*sin(x)) +.byte $00,$03,$06,$09,$0C,$0F,$11,$14 +.byte $16,$18,$1A,$1C,$1D,$1E,$1F,$1F +.byte $20 + +sinetable=$8000 + ; music .include "mA2E_2.s" .include "interrupt_handler.s" diff --git a/demos/d2/moving.s b/demos/d2/moving.s index f5d4806d..3c707d9d 100644 --- a/demos/d2/moving.s +++ b/demos/d2/moving.s @@ -15,6 +15,7 @@ moving: draw_moving: inc FRAME +moving_size_smc: lda #191 ; YY create_yloop: @@ -102,21 +103,21 @@ ror_nop_smc: cmp #$1b ; NOTE: NEEDS TO BE ODD bne draw_moving ; bra - rts +; rts -colorlookup: -.byte $22,$aa,$ba,$ff,$ba,$aa,$22 ; use 00 from sinetable -;.byte $00 +;colorlookup: +;.byte $22,$aa,$ba,$ff,$ba,$aa,$22 ; use 00 from sinetable +;;.byte $00 -;.byte $11,$55,$5d,$7f,$5d,$55,$11 ; use 00 from sinetable -;.byte $00 +;;.byte $11,$55,$5d,$7f,$5d,$55,$11 ; use 00 from sinetable +;;.byte $00 -sinetable_base: -; this is actually (32*sin(x)) -.byte $00,$03,$06,$09,$0C,$0F,$11,$14 -.byte $16,$18,$1A,$1C,$1D,$1E,$1F,$1F -.byte $20 +;sinetable_base: +;; this is actually (32*sin(x)) +;.byte $00,$03,$06,$09,$0C,$0F,$11,$14 +;.byte $16,$18,$1A,$1C,$1D,$1E,$1F,$1F +;.byte $20 -sinetable=$8000 +;sinetable=$8000 diff --git a/demos/d2/oval.s b/demos/d2/oval.s index 4d3657be..ccb244c4 100644 --- a/demos/d2/oval.s +++ b/demos/d2/oval.s @@ -43,6 +43,7 @@ oval: draw_oval: inc FRAME +oval_size_smc: lda #191 ; YY oval_yloop: @@ -89,7 +90,9 @@ oval_row_sum_smc: oval_ror_nop_smc: ror ; $6A/$EA ; 2 -; and #$7f ; make all purple + +color_smc: + and #$ff ; make all purple sta (GBASL),Y ; 6 lda oval_ror_nop_smc ; toggle ror/nop ; 4 @@ -113,10 +116,7 @@ oval_ror_nop_smc: bne draw_oval ; bra - rts - -colorlookup2: -.byte $11,$55,$5d,$7f,$5d,$55,$11,$00 - - +; rts +;colorlookup2: +;.byte $11,$55,$5d,$7f,$5d,$55,$11,$00 diff --git a/demos/d2/wires.s b/demos/d2/wires.s index dd206ae6..80798494 100644 --- a/demos/d2/wires.s +++ b/demos/d2/wires.s @@ -82,13 +82,9 @@ noflo: bne outer_loop - rts - -even_lookup: -.byte $D7,$DD,$F5, $D5,$D5,$D5,$D5 -odd_lookup: -.byte $AA,$AA,$AA, $AB,$AE,$BA,$EA - - - +; rts +;even_lookup: +;.byte $D7,$DD,$F5, $D5,$D5,$D5,$D5 +;odd_lookup: +;.byte $AA,$AA,$AA, $AB,$AE,$BA,$EA