add SHR radial effect

This commit is contained in:
4am 2021-12-16 22:07:35 -05:00
parent 81bfbed130
commit 737e143c79
47 changed files with 4257 additions and 46 deletions

View File

@ -1 +1 @@
366.6186156999756
360.76131384665905

View File

@ -1 +1 @@
428.2243931616122
414.42902539011936

Binary file not shown.

Binary file not shown.

View File

@ -46,6 +46,7 @@ SHR.80BOXES
SHR.FIZZLE
SHR.RIPPLE
SHR.TWOPASS.LR
SHR.RADIAL
SHR.80.SNAKE
SHR.DIAGONAL
SHR.80.DOWN

View File

@ -0,0 +1,32 @@
#!/usr/bin/env python3
import math
import util
radius_x = 160//2
radius_y = 100//2
def f(x,r=36.3):
try:
return math.sqrt(r*r*(1.0-(x*x/(r*r*0.6))))
except:
return -1
coords = []
for i in range(30000, 0, -1):
a = float(i)/1000.0
b = f(a)
for x in range(80, 0, -1):
y = round(float(x)*b/a)
if x < 1 or x > radius_x or y < 1 or y > radius_y:
continue
for m in range(1, y+1):
coords.append((2*(radius_y - m), radius_x - x))
unique_coords = util.unique(coords)
util.write("../../../src/fx/fx.shr.radial.data.a", unique_coords, header="""!cpu 6502
!to "build/FX/SHR.RADIAL.DATA",plain
*=$9F00
""", footer=""" !byte 128
""")

View File

@ -66,15 +66,14 @@ stage2
inx
bne -
+READ_RAM1_WRITE_RAM1
rts
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)
input ldx coords ; first value: SHR row (only 0..99 will be in input array)
bmi exit ; if > 127 then we're done
inc <input+1
ldy #1
lda (<input+1), y
tay
@ -96,12 +95,13 @@ input ldx coords, y ; first value: SHR row (only 0..99 will be
tay
jsr copy_block
inc <input+1
inc <input+1
bne InputLoop
bit $C000
bmi exit
inc <input+2
bne InputLoop ; always branches
bit $C000
bpl InputLoop
exit rts
copy_block_from_x
lda shrlo, x

174
src/fx/fx.shr.radial.a Normal file
View File

@ -0,0 +1,174 @@
;license:MIT
;(c) 2021 by 4am
;
!cpu 6502
!to "build/FX.INDEXED/SHR.RADIAL",plain
*=$A000
shrlo = $201 ; $C8 bytes
CoordinatesFileCopy = $2C8; $11 bytes
shrhi = $301 ; $C8 bytes
mirror_cols = $1E29 ; $A0 bytes but clobbers $28 bytes before
mirror_rows = $1F01 ; $C7 bytes
coords = $9F00 ; $1F41 bytes
last_coords = coords+$1F3E
!source "src/constants.a"
!source "src/macros.a"
!source "src/fx/fx.shr.common.a"
start
ldx #$C6
ldy #$00
- tya
sta mirror_cols-$27, 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 {
stage2
ldx 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
lda #$80
sta coords-2
ldx #(endzp-startzp) ; copy loop code to zero page
- lda startzp-1, x
sta $FF, x
dex
bne -
+WRITE_AUX
jsr LoopBL
+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
rts
startzp
!pseudopc 0 {
; bottom-left quadrant (opposite row, original column, reverse input order)
LoopBL ldx last_coords ; SMC
bmi LoopTL
lda mirror_rows, x
tax
ldy #1
lda (LoopBL+1), y
tay
jsr copy
lda <LoopBL+1
php
dec <LoopBL+1
dec <LoopBL+1
plp
bne LoopBL
dec <LoopBL+2
bit $C000
bpl LoopBL
rts
; top-left quadrant (original row, original column, original input order)
LoopTL ldx coords ; SMC
bmi LoopTR
ldy #1
lda (LoopTL+1), y
tay
jsr copy
inc <LoopTL+1
inc <LoopTL+1
bne LoopTL
inc <LoopTL+2
bit $C000
bpl LoopTL
rts
; top-right quadrant (original row, opposite column, reverse input order)
LoopTR ldx last_coords ; SMC
bmi LoopBR
ldy #1
lda (LoopTR+1), y
tay
lda mirror_cols, y
tay
jsr copy
lda <LoopTR+1
php
dec <LoopTR+1
dec <LoopTR+1
plp
bne LoopTR
dec <LoopTR+2
bit $C000
bpl LoopTR
rts
; bottom-right quadrant (opposite row, opposite column, original input order)
LoopBR ldx coords ; SMC
bmi exit
lda mirror_rows, x
tax
ldy #1
lda (LoopBR+1), y
tay
lda mirror_cols, y
tay
jsr copy
inc <LoopBR+1
inc <LoopBR+1
bne LoopBR
inc <LoopBR+2
bit $C000
bpl LoopBR
exit rts
copy
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
src1 lda $FD00, y ; SMC high byte
sta (src1+1), y
src2 lda $FD00, y ; SMC high byte
sta (src2+1), y
rts
}
endzp
}
CoordinatesFile
!byte 18
!text "FX/SHR.RADIAL.DATA"

4004
src/fx/fx.shr.radial.data.a Normal file

File diff suppressed because it is too large Load Diff

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -4,5 +4,5 @@
; This file is automatically generated
;
!byte 0
!be24 10924235
!le16 281
!be24 10925596
!le16 298

View File

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

View File

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