SHR iris and ripple effects

This commit is contained in:
4am 2021-12-15 21:59:32 -05:00
parent de1c57e427
commit 2193ea33c5
56 changed files with 8389 additions and 45 deletions

View File

@ -1 +1 @@
334.4422855629522
327.30579882322456

View File

@ -1 +1 @@
541.9530738584349
538.9938832685687

View File

@ -1 +1 @@
364.9317587447242
352.6997360423836

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -42,10 +42,12 @@
#
SHR.80BOXES
SHR.FIZZLE
SHR.RIPPLE
SHR.TWOPASS.LR
SHR.80.SNAKE
SHR.DIAGONAL
SHR.80.DOWN
SHR.IRIS
SHR.LR
SHR.80.SPIRAL
SHR.FADEIN

View File

@ -0,0 +1,32 @@
#!/usr/bin/env python3
from math import sqrt, sin, cos, pi
import util
radius_x = 160//2
radius_y = 100//2
def f(t):
return (sqrt(t)*cos(2*pi*sqrt(t)), 0.92*sqrt(t)*sin(2*pi*sqrt(t)))
coords = []
for i in range(1000000):
any = False
a, b = f(float(i)/10.0)
x = round(radius_x+a)
y = round(radius_y+b)
if x < 0 or x >= radius_x or y < 0 or y >= radius_y:
continue
coords.append((y*2,x))
unique_coords = util.unique(coords)
util.write("../../../src/fx/fx.shr.iris.data.a", unique_coords, header="""!cpu 6502
!to "build/FX/SHR.IRIS.DATA",plain
*=$9F00
""")
util.write("../../../src/fx/fx.shr.ripple.data.a", util.ripple(unique_coords), header="""!cpu 6502
!to "build/FX/SHR.RIPPLE.DATA",plain
*=$9F00
""")

View File

@ -103,7 +103,9 @@ def halfripple(unique_vals):
ripple_vals.append(unique_vals[j])
return ripple_vals
def write(filename, vals):
def write(filename, vals, header="", footer=""):
with open(filename, "w") as f:
f.write(header)
for aval, bval in vals:
f.write(" !byte %s,%s\n" % (aval, bval))
f.write(footer)

View File

@ -164,8 +164,8 @@ gVal = $1F81
gSearchIndex = $6000
gSearchCache = $A000
; LC RAM 1
iLoadFileDirect = $FFEF
; LC RAM 1 & 2
iLoadFileDirect = $FFEF ; note: you really want LC RAM 2 banked in before calling this
WaitForVBL = $FFF2
UnwaitForVBL = $FFF5

143
src/fx/fx.shr.iris.a Normal file
View File

@ -0,0 +1,143 @@
;license:MIT
;(c) 2021 by 4am
;
!cpu 6502
!to "build/FX.INDEXED/SHR.IRIS",plain
*=$A000
mirror_cols = $126 ; $A0 bytes but clobbers $20 bytes before
shrlo = $201 ; $C8 bytes
CoordinatesFileCopy = $2C8; $11 bytes
shrhi = $301 ; $C8 bytes
coords = $9F00 ; $1F40 bytes
mirror_rows = $BE40 ; $C0 bytes
!macro BUILD_MIRROR_COLS .mirror_cols {
; build lookup table to get $9F-y for y in $00..$9F
; X=0
}
!source "src/constants.a"
!source "src/macros.a"
!source "src/fx/fx.shr.common.a"
start
ldx #$C0
ldy #$00
- tya
sta mirror_cols-$21, x
sta mirror_rows-1, x
iny
dex
bne -
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
;X=0
+COPY_SCB_AND_PALETTES
;WRITEAUXMEM active
+WRITE_MAIN
;X=0
- lda start, x
sta $9D00, x
lda start+$100, x
sta $9E00, x
inx
bne -
jmp stage2
!pseudopc *-$300 {
CoordinatesFile
!byte 16
!text "FX/SHR.IRIS.DATA"
stage2
ldx #(stage2-CoordinatesFile) ; LOAD_FILE_AT macro destroys pathname
- lda CoordinatesFile, x ; so we need to make a copy
sta CoordinatesFileCopy, x
dex
bpl -
+READ_RAM2_WRITE_RAM2
+LOAD_FILE_AT CoordinatesFileCopy, coords
;WRITEMAINMEM active after LOAD_FILE_AT macro
ldx #(endzp-startzp) ; copy loop code to zero page
- lda startzp-1, x
sta $FF, x
dex
bne -
+WRITE_AUX
jsr InputLoop
+WRITE_MAIN
ldx #$00
- lda $9D00, x ; copy main code back to $A000
sta start, x ; so it can be called again if necessary
lda $9E00, x
sta start+$100, x
inx
bne -
+READ_RAM1_WRITE_RAM1
startzp
!pseudopc 0 {
exit rts ; also terminates stage2 code
InputLoop
ldy #0
input ldx coords, y ; first value: SHR row (only 0..99 will be in input array)
bmi exit ; if > 127 then we're done
inc <input+1 ; (technically the first byte of mirror_rows serves as this EOF delimiter)
lda (<input+1), y
tay
; main 2x2 block in top-left quadrant
jsr copy_block_from_x
; corresponding 2x2 block in top-right quadrant
lda mirror_cols, y
tay
jsr copy_block
dey
; corresponding 2x2 block in bottom-right quadrant
lda mirror_rows, x
tax
jsr copy_block_from_x
; corresponding 2x2 block in bottom-left quadrant
lda mirror_cols, y
tay
jsr copy_block
inc <input+1
bne InputLoop
bit $C000
bmi exit
inc <input+2
bne InputLoop ; always branches
copy_block_from_x
lda shrlo, x
sta <src1+1
lda shrhi, x
sta <src1+2
lda shrlo+1, x
sta <src2+1
lda shrhi+1, x
sta <src2+2
copy_block
src1 lda $FD00, y ; SMC high byte
sta (src1+1), y
src2 lda $FD00, y ; SMC high byte
sta (src2+1), y
iny
lda (src1+1), y
sta (src1+1), y
lda (src2+1), y
sta (src2+1), y
rts
}
endzp
}
end

4003
src/fx/fx.shr.iris.data.a Normal file

File diff suppressed because it is too large Load Diff

143
src/fx/fx.shr.ripple.a Normal file
View File

@ -0,0 +1,143 @@
;license:MIT
;(c) 2021 by 4am
;
!cpu 6502
!to "build/FX.INDEXED/SHR.RIPPLE",plain
*=$A000
mirror_cols = $126 ; $A0 bytes but clobbers $20 bytes before
shrlo = $201 ; $C8 bytes
CoordinatesFileCopy = $2C8; $11 bytes
shrhi = $301 ; $C8 bytes
coords = $9F00 ; $1F40 bytes
mirror_rows = $BE40 ; $C0 bytes
!macro BUILD_MIRROR_COLS .mirror_cols {
; build lookup table to get $9F-y for y in $00..$9F
; X=0
}
!source "src/constants.a"
!source "src/macros.a"
!source "src/fx/fx.shr.common.a"
start
ldx #$C0
ldy #$00
- tya
sta mirror_cols-$21, x
sta mirror_rows-1, x
iny
dex
bne -
+BUILD_SHR_LOOKUP_TABLES shrlo, shrhi
;X=0
+COPY_SCB_AND_PALETTES
;WRITEAUXMEM active
+WRITE_MAIN
;X=0
- lda start, x
sta $9D00, x
lda start+$100, x
sta $9E00, x
inx
bne -
jmp stage2
!pseudopc *-$300 {
CoordinatesFile
!byte 18
!text "FX/SHR.RIPPLE.DATA"
stage2
ldx #(stage2-CoordinatesFile) ; LOAD_FILE_AT macro destroys pathname
- lda CoordinatesFile, x ; so we need to make a copy
sta CoordinatesFileCopy, x
dex
bpl -
+READ_RAM2_WRITE_RAM2
+LOAD_FILE_AT CoordinatesFileCopy, coords
;WRITEMAINMEM active after LOAD_FILE_AT macro
ldx #(endzp-startzp) ; copy loop code to zero page
- lda startzp-1, x
sta $FF, x
dex
bne -
+WRITE_AUX
jsr InputLoop
+WRITE_MAIN
ldx #$00
- lda $9D00, x ; copy main code back to $A000
sta start, x ; so it can be called again if necessary
lda $9E00, x
sta start+$100, x
inx
bne -
+READ_RAM1_WRITE_RAM1
startzp
!pseudopc 0 {
exit rts ; also terminates stage2 code
InputLoop
ldy #0
input ldx coords, y ; first value: SHR row (only 0..99 will be in input array)
bmi exit ; if > 127 then we're done
inc <input+1 ; (technically the first byte of mirror_rows serves as this EOF delimiter)
lda (<input+1), y
tay
; main 2x2 block in top-left quadrant
jsr copy_block_from_x
; corresponding 2x2 block in top-right quadrant
lda mirror_cols, y
tay
jsr copy_block
dey
; corresponding 2x2 block in bottom-right quadrant
lda mirror_rows, x
tax
jsr copy_block_from_x
; corresponding 2x2 block in bottom-left quadrant
lda mirror_cols, y
tay
jsr copy_block
inc <input+1
bne InputLoop
bit $C000
bmi exit
inc <input+2
bne InputLoop ; always branches
copy_block_from_x
lda shrlo, x
sta <src1+1
lda shrhi, x
sta <src1+2
lda shrlo+1, x
sta <src2+1
lda shrhi+1, x
sta <src2+2
copy_block
src1 lda $FD00, y ; SMC high byte
sta (src1+1), y
src2 lda $FD00, y ; SMC high byte
sta (src2+1), y
iny
lda (src1+1), y
sta (src1+1), y
lda (src2+1), y
sta (src2+1), y
rts
}
endzp
}
end

4003
src/fx/fx.shr.ripple.data.a Normal file

File diff suppressed because it is too large Load Diff

View File

@ -44,7 +44,7 @@ SaveSmallFileInternal
lda #0 ; 0 = read into main memory
sta sizelo
;sta sizehi ; 0 = query load address
;jsr hddopendir ; call ProRWTS2
;jsr hddopendir ; call ProRWTS2
;lda ldrlo2
sta ldrlo
lda #>kGlobalPrefsBuffer ;lda ldrhi2

View File

@ -4,7 +4,7 @@
; Functions to enable and disable VBL polling on various
; Apple II models
iWaitForVBL
iWaitForVBL
sei ; IIc is special
sta $C07F ; enable access to VBL register
sta $C05B ; enable VBL polling

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10947147
!be24 10948420
!le16 4281

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10899933
!be24 10901174
!le16 5239

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10842792
!be24 10844033
!le16 3586

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10855162
!be24 10856403
!le16 3946

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10870561
!be24 10871802
!le16 4998

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10888213
!be24 10889454
!le16 5571

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10951428
!be24 10952701
!le16 410

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10952182
!be24 10953455
!le16 448

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10952630
!be24 10953903
!le16 303

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10907318
!be24 10908559
!le16 1242

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10951914
!be24 10953187
!le16 67

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10947088
!be24 10948361
!le16 59

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10945758
!be24 10947031
!le16 1249

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10931748
!be24 10933021
!le16 464

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10905172
!be24 10906413
!le16 2146

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10908791
!be24 10910064
!le16 6149

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10951838
!be24 10953111
!le16 76

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10947007
!be24 10948280
!le16 81

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10951981
!be24 10953254
!le16 201

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10932212
!be24 10933485
!le16 4407

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10936619
!be24 10937892
!le16 1533

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10938152
!be24 10939425
!le16 1040

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10939192
!be24 10940465
!le16 3237

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10942429
!be24 10943702
!le16 2764

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10945193
!be24 10946466
!le16 460

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10945653
!be24 10946926
!le16 105

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10952933
!be24 10954206
!le16 2370

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10919853
!be24 10921126
!le16 6149

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10893784
!be24 10895025
!le16 6149

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10834760
!be24 10836001
!le16 8032

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10846378
!be24 10847619
!le16 8784

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10859108
!be24 10860349
!le16 11453

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10875559
!be24 10876800
!le16 12654

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10908560
!le16 231
!be24 10909801
!le16 263

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10914940
!be24 10916213
!le16 4913

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10926002
!be24 10927275
!le16 5746

View File

@ -240,6 +240,22 @@
bit $C082
}
!macro READ_AUX {
sta READMAINMEM
}
!macro READ_MAIN {
sta READAUXMEM
}
!macro WRITE_AUX {
sta WRITEAUXMEM
}
!macro WRITE_MAIN {
sta WRITEMAINMEM
}
; requires setting zpCharMask in zero page to #$FF or #$DF before use
!macro FORCE_UPPERCASE_IF_REQUIRED {
cmp #$E1