add wavy corner effect, and macros for fullscreen patterns

This commit is contained in:
4am 2019-11-05 14:46:45 -05:00
parent 102a9b2ace
commit a8b8e0b653
6 changed files with 10499 additions and 3 deletions

View File

@ -1 +1 @@
RIPPLE STAR.IN SOFT.DIAGONAL STAGGERWHITE.UD RADIAL STAGGER.LR SOFT.UD HEART.IN CRYSTAL STAR.RIPPLE BIT.FIZZLE MEETINTHEMIDDLE SOFT.IRIS W.RIPPLE.BLOOM DIAGONAL STAR R.BY.PIXEL WAVY.IRIS SUNRISE SOFT.L HEART.RIPPLE SUNSET SLOW.STAR.IN IRIS.IN BUTTERFLYRIPPLE W.IRIS.BLOOM.IN CORNER.CIRCLE CENTER.BY.PIXEL DIAGONAL2 RIPPLE2 STAR.BLOOM PALETTE.FIZZLE RADIAL2 BUTTERFLY SPLIT.UD.INTRO WAVY.IRIS.IN R.BY.2 HALF.FIZZLE RADIAL3 HEART DIAGONAL3 WAVY.RIPPLE CORNER4.OUT LATTICE BAR.DISSOLVE R.BY.PALETTE FOURSPIRAL SOFT.R IRIS CASCADE AND BUTTERFLY.IN CHECKERBOARD LR.BY.PIXEL RADIAL4 CHECKER.FIZZLE STAGGERWHITE.LR SOFT.UD.OUT ONESQUARE W.IRIS.BLOOM FIZZLE SLOW.STAR ARROW.WHITE TRI.FIZZLE SOFT.IRIS.IN DIAMOND TWOPASS.LR HALF.MOSAIC RADIAL5 ARROW FOURSQUARE BLOCK.FIZZLE DIAGONAL4 STAGGER.UD INTERLOCK.LR SOFT.UD.IN BLOCK.MOSAIC CORNER4.IN INTERLOCK.UD LITTLE.BOXES SPIRAL [eof] # # transition effects for HGR slideshows # # Each Mega-Attract Module that is an HGR slideshow (see attract.conf) # will use a single transition effect for the length of the module. # Transition effects are loaded in the order listed in this file. Each line # of this file is a filename (not including comments, like this one). The # name of the next transition effect is stored in the global prefs, so this # file should not contain duplicates. # # Transition effects are binary files loaded at $6000 and called with # hi-res page 1 showing and the next HGR graphic already loaded at $4000. # A transition effect can use $6000-$BFFF in main memory, zero page, and # text page if needed (but preserve the screen holes). $800-$1FFF is reserved # for the slideshow data. LC RAM banks 1 and 2 are reserved for the launcher. # # Important: LC RAM bank 1 will be read/write on entry and must be read/write # on exit. If you need ROM routines, you are responsible for switching to ROM # then switching back to RAM bank 1 (read/write) before returning. #
RIPPLE STAR.IN SOFT.DIAGONAL STAGGERWHITE.UD RADIAL STAGGER.LR SOFT.UD HEART.IN CRYSTAL STAR.RIPPLE BIT.FIZZLE MEETINTHEMIDDLE SOFT.IRIS W.RIPPLE.BLOOM DIAGONAL STAR R.BY.PIXEL WAVY.IRIS SUNRISE SOFT.L HEART.RIPPLE SUNSET SLOW.STAR.IN IRIS.IN BUTTERFLYRIPPLE W.IRIS.BLOOM.IN CORNER.CIRCLE CENTER.BY.PIXEL DIAGONAL2 RIPPLE2 STAR.BLOOM PALETTE.FIZZLE RADIAL2 BUTTERFLY SPLIT.UD.INTRO WAVY.IRIS.IN R.BY.2 HALF.FIZZLE RADIAL3 HEART DIAGONAL3 WAVY.RIPPLE CORNER4.OUT LATTICE BAR.DISSOLVE R.BY.PALETTE FOURSPIRAL SOFT.R IRIS CASCADE AND BUTTERFLY.IN CHECKERBOARD LR.BY.PIXEL RADIAL4 CHECKER.FIZZLE STAGGERWHITE.LR SOFT.UD.OUT ONESQUARE W.IRIS.BLOOM FIZZLE SLOW.STAR ARROW.WHITE TRI.FIZZLE SOFT.IRIS.IN DIAMOND TWOPASS.LR HALF.MOSAIC RADIAL5 ARROW FOURSQUARE BLOCK.FIZZLE DIAGONAL4 STAGGER.UD INTERLOCK.LR SOFT.UD.IN BLOCK.MOSAIC CORNER4.IN INTERLOCK.UD LITTLE.BOXES SPIRAL WAVY.CORNER [eof] # # transition effects for HGR slideshows # # Each Mega-Attract Module that is an HGR slideshow (see attract.conf) # will use a single transition effect for the length of the module. # Transition effects are loaded in the order listed in this file. Each line # of this file is a filename (not including comments, like this one). The # name of the next transition effect is stored in the global prefs, so this # file should not contain duplicates. # # Transition effects are binary files loaded at $6000 and called with # hi-res page 1 showing and the next HGR graphic already loaded at $4000. # A transition effect can use $6000-$BFFF in main memory, zero page, and # text page if needed (but preserve the screen holes). $800-$1FFF is reserved # for the slideshow data. LC RAM banks 1 and 2 are reserved for the launcher. # # Important: LC RAM bank 1 will be read/write on entry and must be read/write # on exit. If you need ROM routines, you are responsible for switching to ROM # then switching back to RAM bank 1 (read/write) before returning. #

View File

@ -16,7 +16,7 @@ def vals_2bit(unique_coords):
aval = "$" + hex(y)[2:].rjust(2, "0").upper()
byte = x//7
if byte % 2 == 0:
# high 3 bits are 0-3, low 5 bits are 0-39
# high 3 bits are 0-3, low 5 bits are 0-19
bval = "%" + bin(even_byte_bitmask[x % 7])[2:].rjust(3, "0") + bin(byte)[2:].rjust(5, "0")
unique_vals.append((aval, bval))
if x % 7 == 6:
@ -24,7 +24,34 @@ def vals_2bit(unique_coords):
bval = "%100" + bin(byte+1)[2:].rjust(5, "0") + ";"
unique_vals.append((aval, bval))
else:
# high 3 bits are 5-7 or 4, low 5 bits are 0-39
# high 3 bits are 5-7 or 4, low 5 bits are 0-19
bval = "%" + bin(odd_byte_bitmask[x % 7])[2:].rjust(3, "0") + bin(byte)[2:].rjust(5, "0")
unique_vals.append((aval, bval))
if x % 7 == 6:
# this 2x2 block will be split across bytes, so add an extra coordinate pair with the adjacent byte and high 3 bits = 3
bval = "%011" + bin(byte+1)[2:].rjust(5, "0") + ";"
unique_vals.append((aval, bval))
return unique_vals
def vals_3bit(unique_coords):
unique_vals = []
for x, y in unique_coords:
y = 63 - y//3
byte = x//7
if byte >= 32:
byte -= 32
y += 64
aval = "$" + hex(y)[2:].rjust(2, "0").upper()
if byte % 2 == 0:
# high 3 bits are 0-3, low 5 bits are 0-19
bval = "%" + bin(even_byte_bitmask[x % 7])[2:].rjust(3, "0") + bin(byte)[2:].rjust(5, "0")
unique_vals.append((aval, bval))
if x % 7 == 6:
# this 2x2 block will be split across bytes, so add an extra coordinate pair with the adjacent byte and high 3 bits = 4
bval = "%100" + bin(byte+1)[2:].rjust(5, "0") + ";"
unique_vals.append((aval, bval))
else:
# high 3 bits are 5-7 or 4, low 5 bits are 0-19
bval = "%" + bin(odd_byte_bitmask[x % 7])[2:].rjust(3, "0") + bin(byte)[2:].rjust(5, "0")
unique_vals.append((aval, bval))
if x % 7 == 6:

View File

@ -0,0 +1,49 @@
#!/usr/bin/env python3
from math import sqrt, sin, cos, acos, pi
import util
# Graph is plotted across the entire HGR screen, but only coordinates
# - on every 3rd row
# - on even columns
# are included.
#
# X coordinates are converted to byte+bitmask (but see notes below).
# Y coordinates are flipped (so 0,0 ends up on the bottom left) then
# divided by 3.
#
# 6502 code will be responsible for plotting each of these coordinates
# in a 2x3 block. The bitmask usually includes 2 adjacent pixels;
# the code will also plot the same 2 adjacent pixels in the adjacent row,
# AND mirror both of those plots in the right half of the screen.
#
# Unfortunately, since bytes are 7 bits across, some blocks will cross a
# byte boundary. To simplify the 6502 code, those are simply listed as
# separate coordinate pairs, each with a bitmask that includes 1 pixel
# instead of 2.
max_x = 280
max_y = 192
def f(theta, k):
r = k*(10.8+sin(16*theta))
return r*cos(theta),r*sin(theta)
coords = []
for k_mul in range(3000):
for t_mul in range(int(pi*1000+1)):
a, b = f(float(t_mul/100), float(k_mul)/100.0)
x = round(max_x+a*1.2)
y = round(b)
if (x % 2 != 0) or (y % 3 != 0):
continue
if x < 0 or x >= max_x or y < 0 or y >= max_y:
continue
coords.append((x,y))
unique_coords = util.unique(coords)
unique_vals = util.vals_3bit(unique_coords)
ripple_vals = util.ripple(unique_vals)
with open("../../../src/fx/fx.hgr.wavy.corner.data.a", "w") as f:
for aval, bval in ripple_vals:
f.write(" !byte %s,%s\n" % (aval, bval))

View File

@ -0,0 +1,166 @@
;license:MIT
;(c) 2019 by 4am
;
src1 = $F0 ; word
dest1 = $F2 ; word
src2 = $F4 ; word
dest2 = $F6 ; word
src3 = $F8 ; word
dest3 = $FA ; word
input = $FE ; word
copymasks = $0200 ; $100 bytes but sparse, index is 0..7 but in high 3 bits, so $00, $20, $40...
tmplo = $0300 ; $C0 bytes
extra_cols = $02F8 ; $08 bytes
tmphi = $BF40 ; $C0 bytes
hgrlo3a = $BC00 ; $80 bytes
hgrlo3b = $BC80 ; $80 bytes
hgrlo3c = $BD00 ; $80 bytes
hgrhi3a = $BD80 ; $80 bytes
hgrhi3b = $BE00 ; $80 bytes
hgrhi3c = $BE80 ; $80 bytes
!source "src/fx/macros.a"
!macro BUILD_EXTRA_COLS {
; build lookup table to get $20+y for y in $00..$07
ldx #$07
ldy #$27
- tya
sta extra_cols-$20, y
dey
dex
bpl -
}
!macro BUILD_SPARSE_BITMASKS_3BIT {
; build sparse lookup tables for bitmasks
lda #%10000011
sta copymasks
lda #%10001100
sta copymasks+$20
lda #%10110000
sta copymasks+$40
lda #%11000000
sta copymasks+$60
lda #%10000001
sta copymasks+$80
lda #%10000110
sta copymasks+$A0
lda #%10011000
sta copymasks+$C0
lda #%11100000
sta copymasks+$E0
}
!macro BUILD_3BIT_HGR_LOOKUP_TABLES {
+BUILD_HGR_LOOKUP_TABLES tmplo, tmphi
ldx #$BF
ldy #$3F
- lda tmplo, x
sta hgrlo3c, y
sta hgrlo3c+$40, y
lda tmphi, x
sta hgrhi3c, y
sta hgrhi3c+$40, y
dex
lda tmplo, x
sta hgrlo3b, y
sta hgrlo3b+$40, y
lda tmphi, x
sta hgrhi3b, y
sta hgrhi3b+$40, y
dex
lda tmplo, x
sta hgrlo3a, y
sta hgrlo3a+$40, y
lda tmphi, x
sta hgrhi3a, y
sta hgrhi3a+$40, y
dex
dey
bpl -
}
!macro ROW_X_TO_3BIT_BASE_ADDRESSES {
; X = $00..$3F, mapping to row 0, 3, 6, 9, 12, ... 189
lda hgrlo3a,x
sta dest1
sta src1
lda hgrhi3a,x
sta dest1+1
eor #$60
sta src1+1
lda hgrlo3b,x
sta dest2
sta src2
lda hgrhi3b,x
sta dest2+1
eor #$60
sta src2+1
lda hgrlo3c,x
sta dest3
sta src3
lda hgrhi3c,x
sta dest3+1
eor #$60
sta src3+1
}
!macro INC_INPUT_AND_LOOP .loop {
inc input
beq +
jmp .loop
+ bit $c000
bmi +
inc input+1
jmp .loop
+ rts
}
!macro FX_PRECOMPUTED_3BIT .coords {
+BUILD_3BIT_HGR_LOOKUP_TABLES
+BUILD_EXTRA_COLS
+BUILD_SPARSE_BITMASKS_3BIT
+LDADDR .coords
+STAY input
jmp InputLoop
Exit3Bit rts
InputLoop
ldy #0
lda (input),y
bmi Exit3Bit ; if high bit is 1 then we're done
cmp #$40
php
tax
+ROW_X_TO_3BIT_BASE_ADDRESSES
inc input
lda (input),y
and #%11100000
tax
eor (input),y
plp
bcc +
tay
lda extra_cols,y
+ tay
; 2x3 block
+COPY_BIT src1, dest1, copymasks
+COPY_BIT src2, dest2, copymasks
+COPY_BIT src3, dest3, copymasks
+INC_INPUT_AND_LOOP InputLoop
rts
!if * and 1 {
!byte 0 ;align 2 but avoids the fake allocation bug if it was aligned already
}
}

View File

@ -0,0 +1,14 @@
;license:MIT
;(c) 2019 by 4am
;
!cpu 6502
!to "build/FX/WAVY.CORNER",plain
*=$6000
!source "src/fx/fx.hgr.precomputed.3bit.a"
+FX_PRECOMPUTED_3BIT Coordinates
Coordinates
!source "src/fx/fx.hgr.wavy.corner.data.a"
!byte $80

File diff suppressed because it is too large Load Diff