load precomputed.3bit data from external files and transform it at runtime

This commit is contained in:
4am 2020-11-12 17:07:04 -05:00
parent 4354aa3148
commit 31c4f73ae6
34 changed files with 261 additions and 102480 deletions

View File

@ -23,6 +23,8 @@
; DC00..DFFF - HGR font data
;------------------------------------------------------------------------------
!ifndef _CONSTANTS_ {
; soft switches
KBD = $C000 ; last key pressed (if any)
CLEARKBD = $C010 ; clear last key pressed
@ -153,3 +155,6 @@ itraverse = $D8E0
ldrhi = $56
namlo = $57
namhi = $58
_CONSTANTS_=*
}

View File

@ -1,5 +1,5 @@
;license:MIT
;(c) 2019 by 4am
;(c) 2019-2020 by 4am/qkumba
;
!cpu 6502
!to "build/FX/APPLE",plain
@ -7,8 +7,10 @@
!source "src/fx/fx.hgr.precomputed.3bit.a"
+FX_PRECOMPUTED_3BIT Coordinates
+FX_INITONCE_3BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_3BIT Coordinates3Bit
Coordinates
!source "src/fx/fx.hgr.apple.data.a"
!byte $80
CoordinatesFile
!byte 13
!text "FX/APPLE.DATA"

View File

@ -1,3 +1,6 @@
!cpu 6502
!to "build/FX/APPLE.DATA",plain
*=$6B00
!byte $1F,%00010100
!byte $1F,%11110011
!byte $20,%11110011

View File

@ -1,5 +1,5 @@
;license:MIT
;(c) 2019 by 4am
;(c) 2019-2020 by 4am/qkumba
;
!cpu 6502
!to "build/FX/APPLE.IN",plain
@ -7,8 +7,11 @@
!source "src/fx/fx.hgr.precomputed.3bit.a"
+FX_PRECOMPUTED_3BIT Coordinates
+FX_INITONCE_3BIT CoordinatesFile, Start
+FX_REVERSE_3BIT
Start
+FX_PRECOMPUTED_3BIT Coordinates3Bit
Coordinates
!source "src/fx/fx.hgr.apple.in.data.a"
!byte $80
CoordinatesFile
!byte 13
!text "FX/APPLE.DATA"

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
;license:MIT
;(c) 2019 by 4am
;(c) 2019-2020 by 4am/qkumba
;
!cpu 6502
!to "build/FX/APPLE.RIPPLE",plain
@ -7,8 +7,11 @@
!source "src/fx/fx.hgr.precomputed.3bit.a"
+FX_PRECOMPUTED_3BIT Coordinates
+FX_INITONCE_3BIT CoordinatesFile, Start
+FX_RIPPLE_3BIT
Start
+FX_PRECOMPUTED_3BIT Coordinates3Bit
Coordinates
!source "src/fx/fx.hgr.apple.ripple.data.a"
!byte $80
CoordinatesFile
!byte 13
!text "FX/APPLE.DATA"

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
;license:MIT
;(c) 2019 by 4am
;(c) 2019-2020 by 4am/qkumba
;
; https://thenounproject.com/ArtZ91/collection/pure-lines/?i=550425
; Lightning Bolt by Arthur Shlain from the Noun Project
@ -10,8 +10,10 @@
!source "src/fx/fx.hgr.precomputed.3bit.a"
+FX_PRECOMPUTED_3BIT Coordinates
+FX_INITONCE_3BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_3BIT Coordinates3Bit
Coordinates
!source "src/fx/fx.hgr.bolt.data.a"
!byte $00
CoordinatesFile
!byte 12
!text "FX/BOLT.DATA"

View File

@ -1,3 +1,6 @@
!cpu 6502
!to "build/FX/BOLT.DATA",plain
*=$6B00
!byte $1F,%11110011
!byte $1F,%00010100
!byte $1F,%00110100

View File

@ -1,5 +1,5 @@
;license:MIT
;(c) 2019 by 4am
;(c) 2019-2020 by 4am/qkumba
;
; https://thenounproject.com/ArtZ91/collection/pure-lines/?i=550425
; Lightning Bolt by Arthur Shlain from the Noun Project
@ -10,8 +10,11 @@
!source "src/fx/fx.hgr.precomputed.3bit.a"
+FX_PRECOMPUTED_3BIT Coordinates
+FX_INITONCE_3BIT CoordinatesFile, Start
+FX_REVERSE_3BIT
Start
+FX_PRECOMPUTED_3BIT Coordinates3Bit
Coordinates
!source "src/fx/fx.hgr.bolt.in.data.a"
!byte $00
CoordinatesFile
!byte 12
!text "FX/BOLT.DATA"

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
;license:MIT
;(c) 2019 by 4am
;(c) 2019-2020 by 4am/qkumba
;
; https://thenounproject.com/ArtZ91/collection/pure-lines/?i=550425
; Lightning Bolt by Arthur Shlain from the Noun Project
@ -10,8 +10,11 @@
!source "src/fx/fx.hgr.precomputed.3bit.a"
+FX_PRECOMPUTED_3BIT Coordinates
+FX_INITONCE_3BIT CoordinatesFile, Start
+FX_RIPPLE_3BIT
Start
+FX_PRECOMPUTED_3BIT Coordinates3Bit
Coordinates
!source "src/fx/fx.hgr.bolt.ripple.data.a"
!byte $00
CoordinatesFile
!byte 12
!text "FX/BOLT.DATA"

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
;license:MIT
;(c) 2019 by 4am
;(c) 2019-2020 by 4am/qkumba
;
!cpu 6502
!to "build/FX/FLOWER",plain
@ -7,8 +7,10 @@
!source "src/fx/fx.hgr.precomputed.3bit.a"
+FX_PRECOMPUTED_3BIT Coordinates
+FX_INITONCE_3BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_3BIT Coordinates3Bit
Coordinates
!source "src/fx/fx.hgr.flower.data.a"
!byte $80
CoordinatesFile
!byte 14
!text "FX/FLOWER.DATA"

View File

@ -1,3 +1,6 @@
!cpu 6502
!to "build/FX/FLOWER.DATA",plain
*=$6B00
!byte $1F,%00010100
!byte $1F,%00110100
!byte $1F,%11110011

View File

@ -1,5 +1,5 @@
;license:MIT
;(c) 2019 by 4am
;(c) 2019-2020 by 4am/qkumba
;
!cpu 6502
!to "build/FX/FLOWER.IN",plain
@ -7,8 +7,11 @@
!source "src/fx/fx.hgr.precomputed.3bit.a"
+FX_PRECOMPUTED_3BIT Coordinates
+FX_INITONCE_3BIT CoordinatesFile, Start
+FX_REVERSE_3BIT
Start
+FX_PRECOMPUTED_3BIT Coordinates3Bit
Coordinates
!source "src/fx/fx.hgr.flower.in.data.a"
!byte $80
CoordinatesFile
!byte 14
!text "FX/FLOWER.DATA"

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
;license:MIT
;(c) 2019 by 4am
;(c) 2019-2020 by 4am/qkumba
;
!cpu 6502
!to "build/FX/FLOWER.RAD",plain
@ -7,8 +7,10 @@
!source "src/fx/fx.hgr.precomputed.3bit.a"
+FX_PRECOMPUTED_3BIT Coordinates
+FX_INITONCE_3BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_3BIT Coordinates3Bit
Coordinates
!source "src/fx/fx.hgr.flower.radial.data.a"
!byte $80
CoordinatesFile
!byte 18
!text "FX/FLOWER.RAD.DATA"

View File

@ -1,3 +1,6 @@
!cpu 6502
!to "build/FX/FLOWER.RAD.DATA",plain
*=$6B00
!byte $1F,%00010100
!byte $1F,%00110100
!byte $1F,%11110011

View File

@ -1,5 +1,5 @@
;license:MIT
;(c) 2019 by 4am
;(c) 2019-2020 by 4am/qkumba
;
!cpu 6502
!to "build/FX/FLOWER.RAD.IN",plain
@ -7,8 +7,11 @@
!source "src/fx/fx.hgr.precomputed.3bit.a"
+FX_PRECOMPUTED_3BIT Coordinates
+FX_INITONCE_3BIT CoordinatesFile, Start
+FX_REVERSE_3BIT
Start
+FX_PRECOMPUTED_3BIT Coordinates3Bit
Coordinates
!source "src/fx/fx.hgr.flower.radial.in.data.a"
!byte $80
CoordinatesFile
!byte 18
!text "FX/FLOWER.RAD.DATA"

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
;license:MIT
;(c) 2019 by 4am
;(c) 2019-2020 by 4am/qkumba
;
!cpu 6502
!to "build/FX/FLOWER.RAD.RIP",plain
@ -7,8 +7,11 @@
!source "src/fx/fx.hgr.precomputed.3bit.a"
+FX_PRECOMPUTED_3BIT Coordinates
+FX_INITONCE_3BIT CoordinatesFile, Start
+FX_RIPPLE_3BIT
Start
+FX_PRECOMPUTED_3BIT Coordinates3Bit
Coordinates
!source "src/fx/fx.hgr.flower.radial.ripple.data.a"
!byte $80
CoordinatesFile
!byte 18
!text "FX/FLOWER.RAD.DATA"

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
;license:MIT
;(c) 2019 by 4am
;(c) 2019-2020 by 4am/qkumba
;
!cpu 6502
!to "build/FX/FLOWER.RIPPLE",plain
@ -7,8 +7,11 @@
!source "src/fx/fx.hgr.precomputed.3bit.a"
+FX_PRECOMPUTED_3BIT Coordinates
+FX_INITONCE_3BIT CoordinatesFile, Start
+FX_RIPPLE_3BIT
Start
+FX_PRECOMPUTED_3BIT Coordinates3Bit
Coordinates
!source "src/fx/fx.hgr.flower.ripple.data.a"
!byte $80
CoordinatesFile
!byte 14
!text "FX/FLOWER.DATA"

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
;license:MIT
;(c) 2019 by 4am
;(c) 2019-2020 by 4am/qkumba
;
!cpu 6502
!to "build/FX/MANDELBROT",plain
@ -7,8 +7,10 @@
!source "src/fx/fx.hgr.precomputed.3bit.a"
+FX_PRECOMPUTED_3BIT Coordinates
+FX_INITONCE_3BIT CoordinatesFile, Start
Start
+FX_PRECOMPUTED_3BIT Coordinates3Bit
Coordinates
!source "src/fx/fx.hgr.mandelbrot.data.a"
!byte $80
CoordinatesFile
!byte 18
!text "FX/MANDELBROT.DATA"

View File

@ -1,3 +1,6 @@
!cpu 6502
!to "build/FX/MANDELBROT.DATA",plain
*=$6B00
!byte $1F,%00010100
!byte $20,%00010100
!byte $20,%00110100

View File

@ -1,5 +1,5 @@
;license:MIT
;(c) 2019 by 4am
;(c) 2019-2020 by 4am/qkumba
;
!cpu 6502
!to "build/FX/MANDELBROT.IN",plain
@ -7,8 +7,11 @@
!source "src/fx/fx.hgr.precomputed.3bit.a"
+FX_PRECOMPUTED_3BIT Coordinates
+FX_INITONCE_3BIT CoordinatesFile, Start
+FX_REVERSE_3BIT
Start
+FX_PRECOMPUTED_3BIT Coordinates3Bit
Coordinates
!source "src/fx/fx.hgr.mandelbrot.in.data.a"
!byte $80
CoordinatesFile
!byte 18
!text "FX/MANDELBROT.DATA"

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
;license:MIT
;(c) 2019 by 4am
;(c) 2019-2020 by 4am/qkumba
;
!cpu 6502
!to "build/FX/MANDELBROT.RIP",plain
@ -7,8 +7,11 @@
!source "src/fx/fx.hgr.precomputed.3bit.a"
+FX_PRECOMPUTED_3BIT Coordinates
+FX_INITONCE_3BIT CoordinatesFile, Start
+FX_RIPPLE_3BIT
Start
+FX_PRECOMPUTED_3BIT Coordinates3Bit
Coordinates
!source "src/fx/fx.hgr.mandelbrot.ripple.data.a"
!byte $80
CoordinatesFile
!byte 18
!text "FX/MANDELBROT.DATA"

File diff suppressed because it is too large Load Diff

View File

@ -12,6 +12,10 @@ hgrlo3c = $BD00 ; $80 bytes
hgrhi3a = $BD80 ; $80 bytes
hgrhi3b = $BE00 ; $80 bytes
hgrhi3c = $BE80 ; $80 bytes
Coordinates3Bit= $6B00 ; pixel data is $5001 bytes ($5000 on disk + 1 byte as EOF marker)
; and for optimization we only support loading external files page-aligned
; and $BC00+ is used by the 3bit macros for data tables
; so we load at $6B00 and waste $FF bytes at $BB01+ but it's okay
!source "src/fx/macros.a"
@ -107,6 +111,119 @@ hgrhi3c = $BE80 ; $80 bytes
sta <src3+1
}
!macro FX_INITONCE_3BIT .CoordinatesFile, .Start {
InitOnce
bit .Start
lda #$4C
sta InitOnce
+READ_RAM2_WRITE_RAM2
+LOAD_FILE_AT .CoordinatesFile, Coordinates3Bit
+READ_RAM1_WRITE_RAM1
lda #$80
sta Coordinates3Bit + $5000
}
!macro FX_REVERSE_3BIT {
ldy #0 ; <Coordinates3Bit
sty $f0
lda #>Coordinates3Bit
sta $f1
lda #<(Coordinates3Bit + $5000 - 2)
sta $f2
lda #>(Coordinates3Bit + $5000 - 2)
sta $f3
ldx #$28
clc
!byte $24
- sec
-- lda ($f0), y
pha
lda ($f2), y
sta ($f0), y
pla
sta ($f2), y
iny
bcc -
ldy #0
!byte $24
- clc
inc $f0
bne +
inc $f1
dex
beq ++
+ lda $f2
bne +
dec $f3
+ dec $f2
bcs -
bcc -- ; always branches
++
}
!macro FX_RIPPLE_3BIT {
ldx #$1B
- lda ripplezp, x
sta $e0, x
dex
bpl -
--- ldx #$0c
-- ldy $ee, x
lda $ef, x
jsr aslmod
sty $ee, x
sta $ef, x
sty $ec
clc
adc #>Coordinates3Bit
sta $ed
ldy #0
!byte $24
- sec
lda ($ec), y
pha
lda $de, x
sta ($ec), y
pla
sta $de, x
inx
iny
bcc -
dex
dex
dex
dex
bne --
dec $ee
bne ---
dec $ef
bpl ---
bmi ++ ; always branches
aslmod
jsr +
+ cmp #$28
bcc +
iny
+ pha
tya
asl
tay
pla
rol
cmp #$50
bcc +
sbc #$50
+ rts
ripplezp
!byte $1F,$F3,$20,$F3,$20,$14,$20,$D3
!byte $1E,$F3,$1F,$54,$00,$00,$AA,$06
!byte $02,$00,$04,$00,$06,$00,$0C,$00
!byte $16,$00,$1A,$00
++
}
!macro FX_PRECOMPUTED_3BIT .coords {
+BUILD_3BIT_HGR_LOOKUP_TABLES
+BUILD_EXTRA_COLS
@ -116,9 +233,7 @@ hgrhi3c = $BE80 ; $80 bytes
sta $0, x
dex
bpl -
lda #0
pha
pha
jmp $1
start
!pseudopc 0 {
Exit3Bit rts

View File

@ -1,4 +1,4 @@
!ifndef _HGRMACROS_ {
!ifndef _FX_MACROS_ {
!source "src/macros.a"
; .hgrlo, .hgr1hi will each be filled with $C0 bytes
@ -132,5 +132,5 @@
++
}
_HGRMACROS_=*
_FX_MACROS_=*
}

View File

@ -4,6 +4,9 @@
; common assembler macros (6502 compatible)
;
!ifndef _MACROS_ {
!source "src/constants.a"
; for functions that take parameters on the stack
; set (PARAM) to point to the parameters and
; move the stack pointer to the first byte after the parameters
@ -382,3 +385,6 @@
pla
sta iCurBlockLo
}
_MACROS_=*
}