upgraded iris transition

This commit is contained in:
4am 2019-10-21 16:00:38 -04:00
parent 0db6b7007e
commit 51dfa78d70
5 changed files with 7001 additions and 1958 deletions

View File

@ -0,0 +1,37 @@
#!/usr/bin/env python3
from math import sqrt, sin, cos, pi
radius_x = 280/2
radius_y = 192/2
def f(t):
return (sqrt(t)*cos(2*pi*sqrt(t)), 0.82*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 y % 2 != 0:
continue
if x < 0 or x >= radius_x or y < 0 or y >= radius_y:
continue
coords.append((x,y))
d = {}
unique_coords = []
for c in coords:
if not d.get(c):
unique_coords.append(c)
d[c] = 1
if len(unique_coords) == 10000:
break
with open("../../../src/fx/fx.hgr.iris.data.a", "w") as f:
for x, y in unique_coords:
aval = "$" + hex(y)[2:].rjust(2, "0").upper()
bval = "%" + \
bin(x%7)[2:].rjust(3, "0") + \
bin(x//7)[2:].rjust(5, "0")
f.write(" !byte %s,%s\n" % (aval, bval))

View File

@ -12,11 +12,10 @@ counter = $ff
hgrlo = $8000
hgr1hi = $80C0
hgr2hi = $8180
!source "src/fx/macros.a"
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi, hgr2hi
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
+INIT_MASKS sourcemasks1, copymasks1
+INIT_MASKS sourcemasks4, copymasks4
@ -44,7 +43,7 @@ RowLoop
sta $3c
lda hgr1hi,x
sta $27
lda hgr2hi,x
eor #$60
sta $3d
; check if this column is visible
@ -104,7 +103,7 @@ BottomHalf
sta $3c
lda hgr1hi,x
sta $27
lda hgr2hi,x
eor #$60
sta $3d
ldy y

View File

@ -5,38 +5,247 @@
!to "build/FX/IRIS",plain
*=$6000
coord = $FE
src1 = $F0 ; word
dest1 = $F2 ; word
src2 = $F4 ; word
dest2 = $F6 ; word
input = $FE ; word
lda #<@coords
sta coord
lda #>@coords
sta coord+1
ldy #0
@loop
lda (coord),y
tax
copymasks = $0200 ; $100 bytes but sparse, index is 0..6 but in high 3 bits, so $00, $20, $40, $60, $80, $A0, $C0
sourcemasks = $0201 ; same as copymasks
mirror_copymasks = $0202
mirror_sourcemasks = $0203
hgrlo = $0300 ; $C0 bytes
mirror_cols = $BD58 ; $28 bytes
mirror_rows = $BD80 ; $C0 bytes
hgr1hi = $BE40 ; $C0 bytes
!source "src/fx/macros.a"
; build lookup tables for base address of HGR rows
+BUILD_HGR_LOOKUP_TABLES hgrlo, hgr1hi
; build lookup table to get $27-y for y in $00..$27
ldx #$27
ldy #$00
- tya
sta mirror_cols,x
iny
lda (coord),y
tay
txa
jsr HGRHalfBlockCopy
lda #$6
jsr WaitForKeyWithTimeout
bmi @exit
inc coord
bne +
inc coord+1
+ inc coord
bne +
inc coord+1
+ ldy #$00
lda ($FE),y
bpl @loop
@exit rts
dex
bpl -
@coords
; build lookup table to get $BF-x for x in $00..$BF
ldx #$BF
ldy #$00
- tya
sta mirror_rows,x
dex
iny
cpy #$C0
bne -
; build sparse lookup tables for bitmasks
lda #%10000001
sta copymasks
sta mirror_copymasks+$C0
eor #%11111111
sta sourcemasks
sta mirror_sourcemasks+$C0
lda #%10000010
sta copymasks+$20
sta mirror_copymasks+$A0
eor #%11111111
sta sourcemasks+$20
sta mirror_sourcemasks+$A0
lda #%10000100
sta copymasks+$40
sta mirror_copymasks+$80
eor #%11111111
sta sourcemasks+$40
sta mirror_sourcemasks+$80
lda #%10001000
sta copymasks+$60
sta mirror_copymasks+$60
eor #%11111111
sta sourcemasks+$60
sta mirror_sourcemasks+$60
lda #%10010000
sta copymasks+$80
sta mirror_copymasks+$40
eor #%11111111
sta sourcemasks+$80
sta mirror_sourcemasks+$40
lda #%10100000
sta copymasks+$A0
sta mirror_copymasks+$20
eor #%11111111
sta sourcemasks+$A0
sta mirror_sourcemasks+$20
lda #%11000000
sta copymasks+$C0
sta mirror_copymasks
eor #%11111111
sta sourcemasks+$C0
sta mirror_sourcemasks
; set up pointer to input data
lda #<Coords
sta input
lda #>Coords
sta input+1
jmp InputLoop
Exit1 rts
InputLoop
ldy #0
lda (input),y ; first value: HGR row (only 0..95 will be in coords array)
bmi Exit1 ; if > 127 then we're done
pha
tax
lda hgrlo,x
sta dest1
sta src1
lda hgr1hi,x
sta dest1+1
eor #$60
sta src1+1
inx
lda hgrlo,x
sta dest2
sta src2
lda hgr1hi,x
sta dest2+1
eor #$60
sta src2+1
iny
lda (input),y
pha
and #%00011111 ; second value: low 5 bits = byte offset within the row
tay
pla
and #%11100000 ; second value: high 3 bits = index into tables to find bitmasks
tax
; main 1x2 block in top-left quadrant
lda (dest1),y
and sourcemasks,x
sta $00
lda (src1),y
; lda #$FF
and copymasks,x
ora $00
sta (dest1),y
lda (dest2),y
and sourcemasks,x
sta $00
lda (src2),y
; lda #$FF
and copymasks,x
ora $00
sta (dest2),y
; corresponding 1x2 block in top-right quadrant (same row, opposite column)
lda mirror_cols,y
tay
lda (dest1),y
and mirror_sourcemasks,x
sta $00
lda (src1),y
; lda #$FF
and mirror_copymasks,x
ora $00
sta (dest1),y
lda (dest2),y
and mirror_sourcemasks,x
sta $00
lda (src2),y
; lda #$FF
and mirror_copymasks,x
ora $00
sta (dest2),y
; corresponding 1x2 block in bottom-right quadrant (opposite row, opposite column)
stx $00
pla
tax
lda mirror_rows,x
tax
lda hgrlo,x
sta dest1
sta src1
lda hgr1hi,x
sta dest1+1
eor #$60
sta src1+1
dex
lda hgrlo,x
sta dest2
sta src2
lda hgr1hi,x
sta dest2+1
eor #$60
sta src2+1
ldx $00
lda (dest1),y
and mirror_sourcemasks,x
sta $00
lda (src1),y
; lda #$FF
and mirror_copymasks,x
ora $00
sta (dest1),y
lda (dest2),y
and mirror_sourcemasks,x
sta $00
lda (src2),y
; lda #$FF
and mirror_copymasks,x
ora $00
sta (dest2),y
; corresponding 1x2 block in bottom-left quadrant (opposite row, original column)
lda mirror_cols,y
tay
lda (dest1),y
and sourcemasks,x
sta $00
lda (src1),y
; lda #$FF
and copymasks,x
ora $00
sta (dest1),y
lda (dest2),y
and sourcemasks,x
sta $00
lda (src2),y
; lda #$FF
and copymasks,x
ora $00
sta (dest2),y
bit $c000
bmi Exit2
inc input
bne +
inc input+1
+ inc input
+LBNE InputLoop
inc input+1
+LBNE InputLoop
Exit2 rts
Coords
!source "src/fx/fx.hgr.iris.data.a"
!byte $80
!source "src/wait.a"
!source "src/fx/fx.hgr.common.a"

File diff suppressed because it is too large Load Diff

View File

@ -1,11 +1,11 @@
!ifndef _HGRMACROS_ {
!source "src/macros.a"
; .lo, .page1hi, .page2hi will each be filled with $C0 bytes
; .hgrlo, .hgr1hi will each be filled with $C0 bytes
; based on routine by John Brooks
; 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, .hgr2hi {
!macro BUILD_HGR_LOOKUP_TABLES .hgrlo, .hgr1hi {
ldx #0
- txa
and #$F8
@ -25,8 +25,6 @@
clc
adc #$20
sta .hgr1hi,x
eor #$60
sta .hgr2hi,x
inx
cpx #$C0
bne -