From 29536bd90140ee396a2d53eb67d7a5476674b90f Mon Sep 17 00:00:00 2001 From: 4am Date: Mon, 13 Dec 2021 21:15:26 -0500 Subject: [PATCH] shave some bytes --- src/fx/fx.dhgr.2bit.fizzle.a | 8 +++++--- src/fx/fx.dhgr.2pass.lr.a | 1 + src/fx/fx.dhgr.bar.dissolve.a | 1 + src/fx/fx.dhgr.diagonal.a | 2 +- src/fx/fx.dhgr.fizzle.a | 19 ++++++++++--------- src/fx/fx.dhgr.flick.a | 8 ++++---- src/fx/fx.hgr.1bit.fizzle.a | 6 ++++-- src/fx/fx.hgr.2bit.fizzle.a | 4 ++-- src/fx/fx.shr.fizzle.a | 28 ++++++++++++++-------------- src/fx/fx.shr.lr.a | 20 +++++++++++--------- src/fx/macros.a | 2 ++ src/index/artwork.idx.a | 2 +- src/index/attract.idx.a | 2 +- src/index/cache00.idx.a | 2 +- src/index/cache01.idx.a | 2 +- src/index/cache10.idx.a | 2 +- src/index/cache11.idx.a | 2 +- src/index/coverfade.idx.a | 2 +- src/index/credits.idx.a | 2 +- src/index/decrunch.idx.a | 2 +- src/index/dfx.idx.a | 2 +- src/index/dgr.fizzle.idx.a | 2 +- src/index/dgr.idx.a | 2 +- src/index/dhgr.idx.a | 2 +- src/index/dtitle.idx.a | 2 +- src/index/fx.idx.a | 2 +- src/index/gamehelp.idx.a | 2 +- src/index/gr.fizzle.idx.a | 2 +- src/index/gr.idx.a | 2 +- src/index/helptext.idx.a | 2 +- src/index/hgr0.idx.a | 2 +- src/index/hgr1.idx.a | 2 +- src/index/hgr2.idx.a | 2 +- src/index/hgr3.idx.a | 2 +- src/index/hgr4.idx.a | 2 +- src/index/hgr5.idx.a | 2 +- src/index/hgr6.idx.a | 2 +- src/index/joystick.idx.a | 2 +- src/index/miniattract.idx.a | 2 +- src/index/prelaunch.idx.a | 2 +- src/index/search00.idx.a | 2 +- src/index/search01.idx.a | 2 +- src/index/search10.idx.a | 2 +- src/index/search11.idx.a | 2 +- src/index/sfx.idx.a | 2 +- src/index/slideshow.idx.a | 2 +- src/index/title.idx.a | 2 +- 47 files changed, 91 insertions(+), 80 deletions(-) diff --git a/src/fx/fx.dhgr.2bit.fizzle.a b/src/fx/fx.dhgr.2bit.fizzle.a index 3cf3ad1ab..aec88a694 100644 --- a/src/fx/fx.dhgr.2bit.fizzle.a +++ b/src/fx/fx.dhgr.2bit.fizzle.a @@ -13,6 +13,8 @@ copymasks = $6200 ; [256 bytes, page-aligned, duplicated in a sta $FF, x dex bne - + ;X=0 + ;A=3 -- ldy #$40 ; create identical copymask tables in main and aux memory ora #%10000000 - sta copymasks, x @@ -50,9 +52,9 @@ copymasks = $6200 ; [256 bytes, page-aligned, duplicated in a start !pseudopc 0 { !byte %00000011 +;Y=0 on entry to copyaux copyaux sta $C003 ; copy $4000/aux to $8000/main ldx #$20 - ldy #$00 a lda $4000, y b sta $8000, y iny @@ -90,9 +92,9 @@ dst sta $FD00, y ; write the result bmi exit txa bne loop1 -exit lda (src+1), y ; last lousy byte (because LFSR never hits 0) + lda (src+1), y ; last lousy byte (because LFSR never hits 0) sta (dst+1), y - sta $C000 ; 80STORE mode off +exit sta $C000 ; 80STORE mode off rts aux sta $C055 ; switch $2000 access to aux memory (read/write!) diff --git a/src/fx/fx.dhgr.2pass.lr.a b/src/fx/fx.dhgr.2pass.lr.a index fc30099b1..9a32d7f3e 100644 --- a/src/fx/fx.dhgr.2pass.lr.a +++ b/src/fx/fx.dhgr.2pass.lr.a @@ -15,6 +15,7 @@ hgr1hi = $0300 ; [$C0 bytes, main memory only] sta $FF, x dex bne - + ;X=0 +BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi jmp loop diff --git a/src/fx/fx.dhgr.bar.dissolve.a b/src/fx/fx.dhgr.bar.dissolve.a index 354376b79..e1d43d503 100644 --- a/src/fx/fx.dhgr.bar.dissolve.a +++ b/src/fx/fx.dhgr.bar.dissolve.a @@ -15,6 +15,7 @@ hgr1hi = $0300 ; [$C0 bytes, main memory only] sta $FF, x dex bne - + ;X=0 +BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi jmp loop diff --git a/src/fx/fx.dhgr.diagonal.a b/src/fx/fx.dhgr.diagonal.a index f690a6ea0..1a763b05b 100644 --- a/src/fx/fx.dhgr.diagonal.a +++ b/src/fx/fx.dhgr.diagonal.a @@ -16,7 +16,7 @@ copymasks= $02C0 ; [$08 bytes, different values in main and sta $FF, x dex bne - - + ;X=0 +BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 hgrlo, hgr1hi ldy #8 ; copy copymask arrays into place in main and auxmem diff --git a/src/fx/fx.dhgr.fizzle.a b/src/fx/fx.dhgr.fizzle.a index 5f79cfb5a..f4f0887b0 100644 --- a/src/fx/fx.dhgr.fizzle.a +++ b/src/fx/fx.dhgr.fizzle.a @@ -5,7 +5,7 @@ !to "build/FX.INDEXED/DHGR.FIZZLE",plain *=$6000 -addrs=$C0 ; [$40 bytes] +addrs=$BF ; [$40 bytes] ldx #$1F ; build address lookup table - txa @@ -15,18 +15,20 @@ addrs=$C0 ; [$40 bytes] sta addrs+$20, x dex bpl - - ldx #(end-start) ; copy LFSR code to zero page -- lda start-1, x - sta $FF, x + ldx #(end-start+1) ; copy LFSR code to zero page +- ldy start-2, x + sty $FE, x dex bne - + ;X=0 + ;Y=0 jmp copyaux start !pseudopc 0 { +;Y=0 on entry to copyaux copyaux sta $C003 ; copy $4000/aux to $8000/main ldx #$20 - ldy #$00 a lda $4000, y b sta $8000, y iny @@ -37,8 +39,7 @@ b sta $8000, y bne a sta $C002 sta $C001 ; 80STORE mode -; X,Y=0 on entry to LFSR -; in: X,Y=0 +;X,Y=0 on entry to LFSR loop txa loop1 eor #$35 ; LFSR form 0x3500 with period 16383 tax @@ -62,9 +63,9 @@ dst sta $FD00, y bmi exit txa bne loop1 -exit lda (src+1), y ; last lousy byte (because LFSR never hits 0) + lda (src+1), y ; last lousy byte (because LFSR never hits 0) sta (dst+1), y - sta $C000 ; 80STORE mode off +exit sta $C000 ; 80STORE mode off rts aux sta $C055 ; switch $2000 access to aux memory (read/write!) sta $38 { +!if end-start > shrhi { !error "code is too large: ends at ", end-start } diff --git a/src/fx/macros.a b/src/fx/macros.a index ee2561854..b3a76d63e 100644 --- a/src/fx/macros.a +++ b/src/fx/macros.a @@ -6,12 +6,14 @@ ; posted on comp.sys.apple2 on 2018-07-11 ; https://groups.google.com/d/msg/comp.sys.apple2/v2HOfHOmeNQ/zD76fJg_BAAJ !macro BUILD_HGR_LOOKUP_TABLES .hgrlo, .hgr1hi { +; preserves Y ldx #0 +BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 .hgrlo, .hgr1hi } ; use this macro instead if you know X is already 0 on entry, to save 2 bytes !macro BUILD_HGR_LOOKUP_TABLES_X_IS_ALREADY_0 .hgrlo, .hgr1hi { +; preserves Y - txa and #$F8 bpl + diff --git a/src/index/artwork.idx.a b/src/index/artwork.idx.a index e0a59f70b..3ea1d5ce1 100644 --- a/src/index/artwork.idx.a +++ b/src/index/artwork.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10947866 + !be24 10947858 !le16 4281 diff --git a/src/index/attract.idx.a b/src/index/attract.idx.a index e6e3e2215..a1f782353 100644 --- a/src/index/attract.idx.a +++ b/src/index/attract.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10900652 + !be24 10900644 !le16 5239 diff --git a/src/index/cache00.idx.a b/src/index/cache00.idx.a index eb5742ceb..61741377e 100644 --- a/src/index/cache00.idx.a +++ b/src/index/cache00.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10843511 + !be24 10843503 !le16 3586 diff --git a/src/index/cache01.idx.a b/src/index/cache01.idx.a index 1bac51deb..0941a5528 100644 --- a/src/index/cache01.idx.a +++ b/src/index/cache01.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10855881 + !be24 10855873 !le16 3946 diff --git a/src/index/cache10.idx.a b/src/index/cache10.idx.a index 61aa67154..0ac16b1f6 100644 --- a/src/index/cache10.idx.a +++ b/src/index/cache10.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10871280 + !be24 10871272 !le16 4998 diff --git a/src/index/cache11.idx.a b/src/index/cache11.idx.a index 538adf769..48133c6f2 100644 --- a/src/index/cache11.idx.a +++ b/src/index/cache11.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10888932 + !be24 10888924 !le16 5571 diff --git a/src/index/coverfade.idx.a b/src/index/coverfade.idx.a index 9f8fc8cbd..70ced0eb4 100644 --- a/src/index/coverfade.idx.a +++ b/src/index/coverfade.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10952147 + !be24 10952139 !le16 410 diff --git a/src/index/credits.idx.a b/src/index/credits.idx.a index b91de20a0..a930baf42 100644 --- a/src/index/credits.idx.a +++ b/src/index/credits.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10952932 + !be24 10952924 !le16 448 diff --git a/src/index/decrunch.idx.a b/src/index/decrunch.idx.a index 8b726e1e9..f489ec1d3 100644 --- a/src/index/decrunch.idx.a +++ b/src/index/decrunch.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10953380 + !be24 10953372 !le16 303 diff --git a/src/index/dfx.idx.a b/src/index/dfx.idx.a index 72c53cd95..529e69c25 100644 --- a/src/index/dfx.idx.a +++ b/src/index/dfx.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10908037 + !be24 10908029 !le16 1242 diff --git a/src/index/dgr.fizzle.idx.a b/src/index/dgr.fizzle.idx.a index 1431d79ea..dd25083a0 100644 --- a/src/index/dgr.fizzle.idx.a +++ b/src/index/dgr.fizzle.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10952664 + !be24 10952656 !le16 67 diff --git a/src/index/dgr.idx.a b/src/index/dgr.idx.a index 7f500efb8..2b4080797 100644 --- a/src/index/dgr.idx.a +++ b/src/index/dgr.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10947807 + !be24 10947799 !le16 59 diff --git a/src/index/dhgr.idx.a b/src/index/dhgr.idx.a index 6b03f4fb8..973c14143 100644 --- a/src/index/dhgr.idx.a +++ b/src/index/dhgr.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10946477 + !be24 10946469 !le16 1249 diff --git a/src/index/dtitle.idx.a b/src/index/dtitle.idx.a index 8b6f64782..868d0988c 100644 --- a/src/index/dtitle.idx.a +++ b/src/index/dtitle.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10932467 + !be24 10932459 !le16 464 diff --git a/src/index/fx.idx.a b/src/index/fx.idx.a index 21555a3b2..59b037877 100644 --- a/src/index/fx.idx.a +++ b/src/index/fx.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10905891 + !be24 10905883 !le16 2146 diff --git a/src/index/gamehelp.idx.a b/src/index/gamehelp.idx.a index 589256d6e..4dccf7e16 100644 --- a/src/index/gamehelp.idx.a +++ b/src/index/gamehelp.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10909510 + !be24 10909502 !le16 6149 diff --git a/src/index/gr.fizzle.idx.a b/src/index/gr.fizzle.idx.a index 917605b4f..5b95f18e6 100644 --- a/src/index/gr.fizzle.idx.a +++ b/src/index/gr.fizzle.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10952557 + !be24 10952549 !le16 107 diff --git a/src/index/gr.idx.a b/src/index/gr.idx.a index 3699c87e6..92dfaa083 100644 --- a/src/index/gr.idx.a +++ b/src/index/gr.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10947726 + !be24 10947718 !le16 81 diff --git a/src/index/helptext.idx.a b/src/index/helptext.idx.a index b8876e7cb..1ef5e752b 100644 --- a/src/index/helptext.idx.a +++ b/src/index/helptext.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10952731 + !be24 10952723 !le16 201 diff --git a/src/index/hgr0.idx.a b/src/index/hgr0.idx.a index 8c93d3cb9..dfc980c3c 100644 --- a/src/index/hgr0.idx.a +++ b/src/index/hgr0.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10932931 + !be24 10932923 !le16 4407 diff --git a/src/index/hgr1.idx.a b/src/index/hgr1.idx.a index 2066ef53d..df46c2943 100644 --- a/src/index/hgr1.idx.a +++ b/src/index/hgr1.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10937338 + !be24 10937330 !le16 1533 diff --git a/src/index/hgr2.idx.a b/src/index/hgr2.idx.a index e1eac9af0..135e69fb3 100644 --- a/src/index/hgr2.idx.a +++ b/src/index/hgr2.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10938871 + !be24 10938863 !le16 1040 diff --git a/src/index/hgr3.idx.a b/src/index/hgr3.idx.a index e3fdfd88e..46519a401 100644 --- a/src/index/hgr3.idx.a +++ b/src/index/hgr3.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10939911 + !be24 10939903 !le16 3237 diff --git a/src/index/hgr4.idx.a b/src/index/hgr4.idx.a index ccbdce2e8..e8d459fb1 100644 --- a/src/index/hgr4.idx.a +++ b/src/index/hgr4.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10943148 + !be24 10943140 !le16 2764 diff --git a/src/index/hgr5.idx.a b/src/index/hgr5.idx.a index 65fed1788..c9c01e8cc 100644 --- a/src/index/hgr5.idx.a +++ b/src/index/hgr5.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10945912 + !be24 10945904 !le16 460 diff --git a/src/index/hgr6.idx.a b/src/index/hgr6.idx.a index 71fe8a3bf..15afc0f60 100644 --- a/src/index/hgr6.idx.a +++ b/src/index/hgr6.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10946372 + !be24 10946364 !le16 105 diff --git a/src/index/joystick.idx.a b/src/index/joystick.idx.a index ece965306..d4c311c44 100644 --- a/src/index/joystick.idx.a +++ b/src/index/joystick.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10953683 + !be24 10953675 !le16 2370 diff --git a/src/index/miniattract.idx.a b/src/index/miniattract.idx.a index 565a18e4e..e89fbaff7 100644 --- a/src/index/miniattract.idx.a +++ b/src/index/miniattract.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10920572 + !be24 10920564 !le16 6149 diff --git a/src/index/prelaunch.idx.a b/src/index/prelaunch.idx.a index bf850d4da..6766932e9 100644 --- a/src/index/prelaunch.idx.a +++ b/src/index/prelaunch.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10894503 + !be24 10894495 !le16 6149 diff --git a/src/index/search00.idx.a b/src/index/search00.idx.a index 0ca75b81c..796a6f72d 100644 --- a/src/index/search00.idx.a +++ b/src/index/search00.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10835479 + !be24 10835471 !le16 8032 diff --git a/src/index/search01.idx.a b/src/index/search01.idx.a index 97b4da0fb..c45c1ce1d 100644 --- a/src/index/search01.idx.a +++ b/src/index/search01.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10847097 + !be24 10847089 !le16 8784 diff --git a/src/index/search10.idx.a b/src/index/search10.idx.a index 998b8af71..04cf709b5 100644 --- a/src/index/search10.idx.a +++ b/src/index/search10.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10859827 + !be24 10859819 !le16 11453 diff --git a/src/index/search11.idx.a b/src/index/search11.idx.a index a88ec68d8..0e3b5153d 100644 --- a/src/index/search11.idx.a +++ b/src/index/search11.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10876278 + !be24 10876270 !le16 12654 diff --git a/src/index/sfx.idx.a b/src/index/sfx.idx.a index bbaac5da5..e19ce401e 100644 --- a/src/index/sfx.idx.a +++ b/src/index/sfx.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10909279 + !be24 10909271 !le16 231 diff --git a/src/index/slideshow.idx.a b/src/index/slideshow.idx.a index 7f856a652..4238efa47 100644 --- a/src/index/slideshow.idx.a +++ b/src/index/slideshow.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10915659 + !be24 10915651 !le16 4913 diff --git a/src/index/title.idx.a b/src/index/title.idx.a index 760a0be1b..2d66f1570 100644 --- a/src/index/title.idx.a +++ b/src/index/title.idx.a @@ -4,5 +4,5 @@ ; This file is automatically generated ; !byte 0 - !be24 10926721 + !be24 10926713 !le16 5746