plasmag: add more files

This commit is contained in:
Vince Weaver 2024-02-05 01:44:58 -05:00
parent dc781aa714
commit fd9932206e
9 changed files with 4882 additions and 0 deletions

View File

@ -0,0 +1,80 @@
; 11+48 = 59 bytes
gr_setup_line:
lda gr_lookup_low,X ; 4
sta GBASL ; 3
lda gr_lookup_high,X ; 4
sta GBASH ; 3
rts
gr_lookup_low:
.byte $00,$80,$00,$80,$00,$80,$00,$80
.byte $28,$A8,$28,$A8,$28,$A8,$28,$A8
.byte $50,$D0,$50,$D0,$50,$D0,$50,$D0
gr_lookup_high:
.byte $08,$08,$09,$09,$0A,$0A,$0B,$0B
.byte $08,$08,$09,$09,$0A,$0A,$0B,$0B
.byte $08,$08,$09,$09,$0A,$0A,$0B,$0B
; 28+10 = 38
gr_setup_line2:
txa
pha
and #7
lsr
tax
lda gr_lookup_high2,X
sta GBASH
pla
pha
lsr
php
lsr
lsr
plp
rol
tax
lda gr_lookup_low2,X
sta GBASL
pla
tax
rts
; high= gr_lookup_high[(line&3)>>1]
; low = gr_lookup_low[abc defgh -> 0 1 0 1 0 1 2 3 2 3 2 3 2 3 4 5 4 5 4 5 4 5
; deh
gr_lookup_low2:
.byte $00,$80,$28,$A8,$50,$D0
gr_lookup_high2:
.byte $08,$09,$0A,$0B
; 24 bytes
; based on GBASCALC from monitor firmware
gr_setup_line3:
txa ; 2
lsr ; 2
and #$03 ; 2
ora #$08 ; 2
sta GBASH ; 3
txa
and #$18
bcc gbcalc
adc #$7f
gbcalc:
sta GBASL
asl
asl
ora GBASL
sta GBASL
rts
gr_setup_line4:
txa
jmp GBASCALC

View File

@ -0,0 +1,103 @@
;; HARDWARE LOCATIONS
KEYPRESS = $C000
KEYRESET = $C010
;; SOFT SWITCHES
CLR80COL = $C000 ; PAGE0/PAGE1 normal
SET80COL = $C001 ; PAGE0/PAGE1 switches PAGE0 in Aux instead
EIGHTYCOLOFF = $C00C
EIGHTYCOLON = $C00D
TBCOLOR = $C022 ; IIgs text foreground / background colors
NEWVIDEO = $C029 ; IIgs graphics modes
SPEAKER = $C030
CLOCKCTL = $C034 ; bits 0-3 are IIgs border color
SET_GR = $C050
SET_TEXT = $C051
FULLGR = $C052
TEXTGR = $C053
PAGE1 = $C054
PAGE2 = $C055
LORES = $C056 ; Enable LORES graphics
HIRES = $C057 ; Enable HIRES graphics
AN3 = $C05E ; Annunciator 3
PADDLE_BUTTON0 = $C061
PADDLE_BUTTON1 = $C062
PADDL0 = $C064
PTRIG = $C070
;; BASIC ROUTINES
NORMAL = $F273
;; MONITOR ROUTINES
PLOT = $F800 ;; PLOT AT Y,A
PLOT1 = $F80E ;; PLOT at (GBASL),Y (need MASK to be $0f or $f0)
HLINE = $F819 ;; HLINE Y,$2C at A
VLINE = $F828 ;; VLINE A,$2D at Y
CLRSCR = $F832 ;; Clear low-res screen
CLRTOP = $F836 ;; clear only top of low-res screen
GBASCALC= $F847 ;; take Y-coord/2 in A, put address in GBASL/H ( a trashed, C clear)
SETCOL = $F864 ;; COLOR=A
ROM_TEXT2COPY = $F962 ;; iigs
SETTXT = $FB36
SETGR = $FB40
TABV = $FB5B ;; VTAB to A
ROM_MACHINEID = $FBB3 ;; iigs
BELL = $FBDD ;; ring the bell
BASCALC = $FBC1 ;;
VTAB = $FC22 ;; VTAB to CV
HOME = $FC58 ;; Clear the text screen
WAIT = $FCA8 ;; delay 1/2(26+27A+5A^2) us
CROUT1 = $FD8B
SETINV = $FE80 ;; INVERSE
SETNORM = $FE84 ;; NORMAL
COUT = $FDED ;; output A to screen
COUT1 = $FDF0 ;; output A to screen
COLOR_BLACK = 0
COLOR_RED = 1
COLOR_DARKBLUE = 2
COLOR_PURPLE = 3
COLOR_DARKGREEN = 4
COLOR_GREY = 5
COLOR_MEDIUMBLUE = 6
COLOR_LIGHTBLUE = 7
COLOR_BROWN = 8
COLOR_ORANGE = 9
COLOR_GREY2 = 10
COLOR_PINK = 11
COLOR_LIGHTGREEN = 12
COLOR_YELLOW = 13
COLOR_AQUA = 14
COLOR_WHITE = 15
COLOR_BOTH_BLACK = $00
COLOR_BOTH_RED = $11
COLOR_BOTH_DARKBLUE = $22
COLOR_BOTH_DARKGREEN = $44
COLOR_BOTH_GREY = $55
COLOR_BOTH_MEDIUMBLUE = $66
COLOR_BOTH_LIGHTBLUE = $77
COLOR_BOTH_BROWN = $88
COLOR_BOTH_ORANGE = $99
COLOR_BOTH_PINK = $BB
COLOR_BOTH_LIGHTGREEN = $CC
COLOR_BOTH_YELLOW = $DD
COLOR_BOTH_AQUA = $EE
COLOR_BOTH_WHITE = $FF

View File

@ -0,0 +1,37 @@
; hposn_low, hposn_high 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
; clobbers A,X
; preserves Y
; vmw note: version I was using based on applesoft HPOSN was ~64 bytes
; this one is 37 bytes
build_tables:
ldx #0
btmi:
txa
and #$F8
bpl btpl1
ora #5
btpl1:
asl
bpl btpl2
ora #5
btpl2:
asl
asl
sta hposn_low, X
txa
and #7
rol
asl hposn_low, X
rol
ora #$20
sta hposn_high, X
inx
cpx #$C0
bne btmi
rts

View File

@ -0,0 +1,224 @@
; code to use the FAC (floating point accumulator)
; to generate plasmagoria sine tables
; 232 bytes = initial implementation
; 218 bytes = increment high byte of destination instead of loading
; 208 bytes = modify 1->4 on the fly
; 205 bytes = make page increment common code
; 198 bytes = convert thirty-two to twenty-four on fly
; 188 bytes = convert forty-seven to thirty-eight with one byte
; 173 bytes = assume constants on same page
; 171 bytes = optimize save/load of loop index
; 169 bytes = optimize multiply by 8
; 166 bytes = separate common sin code
; 164 bytes = move more to common sin code
; 162 bytes = move more to common sin code
; 159 bytes = fallthrough at end
qint = $EBF2 ; convert FAC to 32-bit int?
fadd = $E7BE ; FAC = (Y:A)+FAC
movmf = $EB2B ; move fac to mem: round FAC and store at Y:X
fmult = $E97F ; FAC = (Y:A) * FAC
float = $EB93 ; signed value in A to FAC
sin = $EFF1
ARG = $A5 ; A5-AA
FAC = $9D ; 9D-A2
; code uses: 5E/5F "index" in load arg from Y:A
; uses ARG (A5-AA) for argument
; uses FAC (9D-A2)
TEMP1 = $FE
OURX = $FF
sin1 = $2000
sin2 = $2100
sin3 = $2200
save = $2300
HGR = $F3E2
make_tables:
;====================================================
; sin1[i]=round(47.0+
; 32.0*sin(i*(PI*2.0/256.0))+
; 16.0*sin(2.0*i*(PI*2.0/256.0)));
; sin1[i]=round(47.0+
; 16*(2.0*sin(i*(PI*2.0/256.0))+
; sin(2.0*i*(PI*2.0/256.0)));
; already set up for this one
jsr make_sin_table
;===================================================
; sin2[i]=round(47.0+
; 32.0*sin(4.0*i*(PI*2.0/256.0))+
; 16.0*sin(3.0*i*(PI*2.0/256.0)));
; 47 is same, 32 is same, 16 is same
; convert one to four
lda #$7d ; only one byte different
sta one_input
; load 3 instead of 2 (assume on same page)
lda #<three_input
sta sin_table_input3_smc+1
jsr make_sin_table
;======================================================
; sin3[i]=round(38.0+
; 24.0*sin(3.0*i*(PI*2.0/256.0))+
; 16.0*sin(8.0*i*(PI*2.0/256.0)));
; convert 47 to 38
lda #$18
sta forty_seven+1
; convert 32 to 24
dec thirty_two
lda #$40
sta thirty_two+1
; ideally, convert input4->input3
; load 3 input (assume on same page)
lda #<three_input
sta sin_table_input1_smc+1
; convert four to eight
inc one_input ; increment power of two
; load 8 input (assume on same page)
lda #<one_input
sta sin_table_input3_smc+1
; jsr make_sin_table
; fallthrough
;===============================
;===============================
;===============================
;===============================
;===============================
make_sin_table:
ldx #0
sin_loop:
stx OURX
sin_table_input1_smc:
lda #<one_input
; thirtytwo or twentyfour
ldx #<thirty_two
jsr sin_common
jsr movmf ; save FAC to mem
sin_table_input3_smc:
lda #<two_input
; always 16
ldx #<sixteen
jsr sin_common
; add first sine
txa
jsr fadd ; FAC=FAC+(previous result)
; add constant 47 or 38
lda #<forty_seven
ldy #>forty_seven
jsr fadd ; FAC=FAC+constant
jsr qint ; convert to integer
lda FAC+4 ; get bottom byte
ldx OURX
sin_table_dest_smc:
sta sin1,X ; save to memory
inx ; move to next
bne sin_loop ; loop until done
inc sin_table_dest_smc+2 ; point to next location
rts
;==============================
; sin_common
;==============================
; A = low byte for input multiplier
; X = low byte for result multiplier
sin_common:
stx TEMP1
pha
lda OURX
jsr float ; FAC = float(OURX) (again)
pla
ldy #>one_input ; high byte, assume always same
jsr fmult ; FAC=FAC*(constant from RAM)
jsr sin ; FAC=sin(FAC)
ldy #>thirty_two ; high byte, assume always same
lda TEMP1
jsr fmult ; FAC=constant*FAC
ldy #>save
ldx #<save
rts
sixteen:
.byte $85,$00,$00,$00,$00
;twenty_four:
; .byte $85,$40,$00,$00,$00
thirty_two:
.byte $86,$00,$00,$00,$00
;thirty_eight:
; .byte $86,$18,$00,$00,$00
; 2^5 = 32, 1.0011 0000 = 1/8+1/16
forty_seven:
.byte $86,$3C,$00,$00,$00
; 32 * 1.0111 10000 = 1/4+1/8+1/16+1/32
one_input:
; 1*2*pi/256 = .0736310778
.byte $7b,$49,$0F,$da,$a2
two_input:
; 2*2*pi/256 = .0736310778
.byte $7c,$49,$0F,$da,$a2
three_input:
; 3*2*pi/256 = .0736310778
.byte $7d,$16,$cb,$e3,$f9
;four_input:
; ; 4*2*pi/256 = .0736310778
; .byte $7d,$49,$0F,$da,$a2
;eight_input:
; ; 8*2*pi/256 = .196349541
; .byte $7E,$49,$0F,$da,$a2

View File

@ -0,0 +1,339 @@
; PLASMAGORIA
; original code by French Touch
; this is just part3 and size optimized
; just the graphics, no music
; Note: look into modifying color lookup table
; there's a wide setting that gives a slightly different effect
.include "hardware.inc"
; Page Zero
OUT1 = $20 ; +$21
OUT2 = $22 ; +$23
; counter if not MOCKING
COMPT1 = $30
COMPT2 = $31
;
PARAM1 = $60
PARAM2 = $61
PARAM3 = $62
PARAM4 = $63
count = $64
count2 = $65
;
GRLINE = $F0 ; +$F1
IndexMask = $F2
Mask = $F3
Beat = $FA
Mark = $FB
; =============================================================================
; ROUTINE MAIN
; =============================================================================
PLASMA_DEBUT:
bit PAGE2 ; set page 2
bit SET_TEXT ; set text
bit LORES ; set lo-res
; jsr setup_dump
; ============================================================================
; -------------------------------------
STEP3:
; init
; lda #00
; sta Beat
lda #02
sta COMPT2
sta PARAM1
sta PARAM2
sta PARAM3
sta PARAM4
BP3:
jsr precalc ; pre-calc
jsr display_normal ; display normal
jsr VBLANK
; jsr DUMP
inc COMPT1
bne BP3
dec COMPT2
bne BP3
jmp STEP3
; ============================================================================
; Precalculate some values
; ROUTINES PRE CALCUL
; ============================================================================
precalc:
lda PARAM1 ; self modify various parts
sta pc_off1+1
lda PARAM2
sta pc_off2+1
lda PARAM3
sta pc_off3+1
lda PARAM4
sta pc_off4+1
; Table1(X) = sin1(PARAM1+X)+sin2(PARAM1+X)
; Table2(X) = sin3(PARAM3+X)+sin1(PARAM4+X)
ldx #$28 ; 40
pc_b1:
pc_off1:
lda sin1
pc_off2:
adc sin2
sta Table1,X
pc_off3:
lda sin3
pc_off4:
adc sin1
sta Table2,X
inc pc_off1+1
inc pc_off2+1
inc pc_off3+1
inc pc_off4+1
dex
bpl pc_b1
inc PARAM1
inc PARAM1
dec PARAM2
inc PARAM3
dec PARAM4
rts
; ============================================================================
; Display Routines
; ROUTINES AFFICHAGES
; ============================================================================
; Display "Normal"
; AFFICHAGE "NORMAL"
display_normal:
bit SET_GR ; gfx (lores) why needed?
ldx #23 ; lines 0-23 lignes 0-23
display_line_loop:
lda gr_lookup_low,X ; setup pointers for line
sta GRLINE
lda gr_lookup_high,X
sta GRLINE+1
ldy #39 ; col 0-39
lda Table2,X ; setup base sine value for row
sta display_row_sin_smc+1
display_col_loop:
lda Table1,Y ; load in column sine value
display_row_sin_smc:
adc #00 ; add in row value
sta display_lookup_smc+1 ; patch in low byte of lookup
display_lookup_smc:
lda lores_colors_fine ; attention: must be aligned
sta (GRLINE),Y
dey
bpl display_col_loop
dex
bpl display_line_loop
rts
VBLANK:
inc Mark
rts
;.align 256
gr_lookup_low:
.byte $00,$80,$00,$80,$00,$80,$00,$80
.byte $28,$A8,$28,$A8,$28,$A8,$28,$A8
.byte $50,$D0,$50,$D0,$50,$D0,$50,$D0
gr_lookup_high:
.byte $08,$08,$09,$09,$0A,$0A,$0B,$0B
.byte $08,$08,$09,$09,$0A,$0A,$0B,$0B
.byte $08,$08,$09,$09,$0A,$0A,$0B,$0B
.align 256
; This appears to be roughly 47+32*sin(x)+16*sin(2x)
sin1: ; 256
.byte $2E,$30,$32,$34,$35,$36,$38,$3A,$3C,$3C,$3E,$40,$41,$42,$44,$45,$47,$47,$49,$4A,$4B,$4C,$4D,$4E,$4F,$50,$51,$52,$53,$53,$54,$54
.byte $55,$55,$56,$57,$57,$58,$58,$57,$58,$58,$58,$58,$58,$58,$58,$58,$58,$57,$57,$57,$56,$56,$55,$54,$55,$54,$53,$52,$52,$51,$50,$4F
.byte $4E,$4E,$4D,$4C,$4B,$4B,$4A,$49,$48,$47,$46,$45,$45,$44,$42,$42,$41,$41,$3F,$3F,$3D,$3D,$3C,$3B,$3B,$39,$39,$39,$38,$38,$37,$36
.byte $36,$35,$35,$34,$34,$33,$32,$32,$32,$31,$31,$31,$30,$31,$30,$30,$30,$30,$2F,$2F,$30,$2F,$2F,$2F,$2F,$2F,$2F,$2F,$2E,$2F,$2F,$2F
.byte $2E,$2F,$2F,$2F,$2F,$2E,$2F,$2F,$2F,$2E,$2F,$2F,$2E,$2E,$2F,$2E,$2E,$2D,$2E,$2D,$2D,$2D,$2C,$2C,$2C,$2B,$2B,$2B,$2A,$2A,$29,$28
.byte $28,$27,$27,$26,$26,$25,$25,$23,$23,$22,$21,$21,$20,$1F,$1F,$1D,$1D,$1C,$1B,$1A,$19,$19,$17,$16,$16,$15,$14,$13,$13,$12,$11,$10
.byte $0F,$0F,$0E,$0D,$0C,$0C,$0B,$0A,$09,$09,$08,$08,$08,$07,$06,$07,$06,$06,$06,$06,$05,$06,$05,$05,$06,$05,$06,$06,$07,$07,$08,$08
.byte $09,$09,$0A,$0B,$0B,$0C,$0C,$0D,$0F,$0F,$10,$12,$12,$14,$15,$16,$17,$19,$1A,$1B,$1D,$1E,$20,$21,$22,$24,$26,$27,$28,$2A,$2C,$2E
; This appears to be roughly 47+32*sin(4x)+16*sin(3x)
sin2: ; 256
.byte $2E,$33,$38,$3C,$40,$43,$47,$4B,$4E,$51,$54,$56,$59,$5A,$5C,$5D,$5D,$5E,$5E,$5D,$5C,$5A,$59,$57,$55,$53,$4F,$4C,$49,$46,$42,$3E
.byte $3A,$36,$32,$2E,$2A,$26,$23,$1F,$1C,$18,$15,$12,$10,$0E,$0C,$0A,$09,$08,$07,$07,$07,$07,$09,$0A,$0B,$0D,$0F,$11,$13,$16,$19,$1C
.byte $1F,$22,$26,$29,$2C,$2F,$32,$36,$38,$3B,$3E,$3F,$42,$44,$46,$47,$48,$49,$4B,$4B,$4B,$4A,$4A,$49,$49,$48,$46,$44,$43,$41,$3F,$3C
.byte $3A,$38,$35,$33,$30,$2E,$2C,$2A,$28,$26,$24,$22,$21,$20,$1F,$1F,$1E,$1E,$1D,$1D,$1E,$1E,$1F,$20,$21,$22,$24,$25,$27,$29,$2B,$2D
.byte $2E,$30,$33,$35,$37,$38,$3A,$3C,$3D,$3E,$3F,$3F,$40,$40,$41,$40,$40,$3F,$3F,$3E,$3D,$3B,$3A,$38,$36,$34,$31,$2F,$2D,$2B,$29,$25
.byte $23,$21,$1F,$1D,$1B,$19,$18,$16,$15,$14,$14,$13,$13,$13,$13,$14,$16,$17,$18,$1A,$1C,$1D,$20,$23,$26,$28,$2C,$2E,$32,$35,$38,$3B
.byte $3E,$41,$45,$48,$4B,$4C,$4F,$51,$53,$54,$55,$55,$57,$57,$57,$56,$55,$53,$52,$50,$4E,$4B,$49,$45,$42,$3F,$3B,$37,$34,$30,$2C,$27
.byte $23,$1F,$1C,$18,$14,$11,$0E,$0B,$09,$07,$05,$03,$02,$01,$00,$00,$01,$01,$02,$03,$05,$07,$0A,$0D,$10,$13,$17,$1A,$1E,$22,$26,$2A
; This appears to be roughly 38+24*sin(3x)+16*sin(8x)
sin3: ; 256
.byte $26,$2C,$31,$35,$39,$3D,$40,$42,$44,$45,$45,$46,$45,$43,$42,$40,$3C,$3A,$38,$36,$33,$31,$30,$2F,$2F,$2E,$2F,$2F,$30,$33,$33,$36
.byte $37,$3A,$3C,$3C,$3E,$3E,$3D,$3D,$3B,$39,$36,$34,$30,$2B,$28,$23,$1D,$19,$14,$11,$0C,$09,$07,$04,$03,$03,$03,$03,$04,$07,$09,$0C
.byte $0F,$13,$16,$18,$1B,$1E,$20,$22,$22,$23,$24,$24,$23,$22,$21,$20,$1D,$1C,$1B,$1A,$19,$19,$19,$1A,$1C,$1E,$20,$23,$27,$2B,$2F,$33
.byte $37,$3D,$40,$44,$47,$4A,$4C,$4D,$4E,$4E,$4D,$4C,$4A,$47,$45,$41,$3C,$39,$35,$32,$2E,$2B,$28,$26,$25,$23,$23,$22,$22,$24,$24,$25
.byte $26,$29,$2A,$2A,$2B,$2C,$2B,$2B,$29,$28,$25,$23,$20,$1C,$19,$15,$10,$0D,$09,$07,$04,$02,$01,$00,$00,$00,$02,$03,$06,$0A,$0D,$11
.byte $15,$1B,$1F,$23,$27,$2B,$2D,$30,$32,$33,$34,$35,$35,$33,$33,$32,$30,$2E,$2D,$2C,$2B,$2A,$2A,$2A,$2B,$2C,$2E,$30,$32,$36,$38,$3B
.byte $3E,$42,$45,$47,$49,$4B,$4B,$4B,$4A,$49,$47,$45,$42,$3D,$3A,$35,$30,$2B,$26,$22,$1E,$1A,$17,$14,$13,$11,$10,$10,$10,$12,$12,$14
.byte $15,$18,$1A,$1B,$1D,$1E,$1F,$1F,$1F,$1F,$1E,$1D,$1B,$18,$16,$14,$10,$0E,$0C,$0B,$09,$08,$08,$09,$0A,$0C,$0E,$11,$14,$19,$1D,$22
.if 0
; This appears to be roughly 64+64*sin(x)
sin4: ; 256
.byte $40,$41,$43,$44,$46,$47,$49,$4A,$4C,$4D,$4F,$50,$52,$53,$55,$56,$58,$59,$5B,$5C,$5D,$5F,$60,$61,$63,$64,$65,$67,$68,$69,$6A,$6B
.byte $6C,$6D,$6F,$70,$71,$72,$73,$73,$74,$75,$76,$77,$78,$78,$79,$7A,$7A,$7B,$7B,$7C,$7C,$7D,$7D,$7D,$7E,$7E,$7E,$7F,$7F,$7F,$7F,$7F
.byte $7F,$7F,$7F,$7F,$7F,$7F,$7E,$7E,$7E,$7D,$7D,$7D,$7C,$7C,$7B,$7B,$7A,$7A,$79,$78,$78,$77,$76,$75,$74,$73,$73,$72,$71,$70,$6F,$6D
.byte $6C,$6B,$6A,$69,$68,$67,$65,$64,$63,$61,$60,$5F,$5D,$5C,$5B,$59,$58,$56,$55,$53,$52,$50,$4F,$4D,$4C,$4A,$49,$47,$46,$44,$43,$41
.byte $3F,$3E,$3C,$3B,$39,$38,$36,$35,$33,$32,$30,$2F,$2D,$2C,$2A,$29,$27,$26,$24,$23,$22,$20,$1F,$1E,$1C,$1B,$1A,$18,$17,$16,$15,$14
.byte $13,$12,$10,$0F,$0E,$0D,$0C,$0C,$0B,$0A,$09,$08,$07,$07,$06,$05,$05,$04,$04,$03,$03,$02,$02,$02,$01,$01,$01,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$01,$01,$01,$02,$02,$02,$03,$03,$04,$04,$05,$05,$06,$07,$07,$08,$09,$0A,$0B,$0C,$0C,$0D,$0E,$0F,$10,$12
.byte $13,$14,$15,$16,$17,$18,$1A,$1B,$1C,$1E,$1F,$20,$22,$23,$24,$26,$27,$29,$2A,$2C,$2D,$2F,$30,$32,$33,$35,$36,$38,$39,$3B,$3C,$3E
.endif
; Lookup table for colors
; Note the sine tables point roughly to the middle and go to the edges
; This table has relatively fine color bands
lores_colors_fine: ; 256
.if 1
.byte $00,$00,$00,$00,$88,$88,$88,$88
.byte $55,$55,$55,$55,$99,$99,$99,$99
.byte $ff,$ff,$ff,$ff,$bb,$bb,$bb,$bb
.byte $33,$33,$33,$33,$22,$22,$22,$22
.byte $66,$66,$66,$66,$77,$77,$77,$77
.byte $44,$44,$44,$44,$cc,$cc,$cc,$cc
.byte $ee,$ee,$ee,$ee,$dd,$dd,$dd,$dd
.byte $99,$99,$99,$99,$11,$11,$11,$11
.byte $00,$00,$00,$00,$88,$88,$88,$88
.byte $55,$55,$55,$55,$99,$99,$99,$99
.byte $ff,$ff,$ff,$ff,$bb,$bb,$bb,$bb
.byte $33,$33,$33,$33,$22,$22,$22,$22
.byte $66,$66,$66,$66,$77,$77,$77,$77
.byte $44,$44,$44,$44,$cc,$cc,$cc,$cc
.byte $ee,$ee,$ee,$ee,$dd,$dd,$dd,$dd
.byte $99,$99,$99,$99,$11,$11,$11,$11
.byte $00,$00,$00,$00,$88,$88,$88,$88
.byte $55,$55,$55,$55,$99,$99,$99,$99
.byte $ff,$ff,$ff,$ff,$bb,$bb,$bb,$bb
.byte $33,$33,$33,$33,$22,$22,$22,$22
.byte $66,$66,$66,$66,$77,$77,$77,$77
.byte $44,$44,$44,$44,$cc,$cc,$cc,$cc
.byte $ee,$ee,$ee,$ee,$dd,$dd,$dd,$dd
.byte $99,$99,$99,$99,$11,$11,$11,$11
.byte $00,$00,$00,$00,$88,$88,$88,$88
.byte $55,$55,$55,$55,$99,$99,$99,$99
.byte $ff,$ff,$ff,$ff,$bb,$bb,$bb,$bb
.byte $33,$33,$33,$33,$22,$22,$22,$22
.byte $66,$66,$66,$66,$77,$77,$77,$77
.byte $44,$44,$44,$44,$cc,$cc,$cc,$cc
.byte $ee,$ee,$ee,$ee,$dd,$dd,$dd,$dd
.byte $99,$99,$99,$99,$11,$11,$11,$11
.else
; This table has relatively wide color bands
lores_colors_wide: ; 256
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $88,$88,$88,$88,$88,$88,$88,$88
.byte $88,$88,$88,$88,$88,$88,$88,$88
.byte $55,$55,$55,$55,$55,$55,$55,$55
.byte $55,$55,$55,$55,$55,$55,$55,$55
.byte $22,$22,$22,$22,$22,$22,$22,$22
.byte $22,$22,$22,$22,$22,$22,$22,$22
.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff
.byte $ff,$ff,$ff,$ff,$ff,$ff,$ff,$ff
.byte $bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb
.byte $bb,$bb,$bb,$bb,$bb,$bb,$bb,$bb
.byte $33,$33,$33,$33,$33,$33,$33,$33
.byte $33,$33,$33,$33,$33,$33,$33,$33
.byte $22,$22,$22,$22,$22,$22,$22,$22
.byte $22,$22,$22,$22,$22,$22,$22,$22
.byte $66,$66,$66,$66,$66,$66,$66,$66
.byte $66,$66,$66,$66,$66,$66,$66,$66
.byte $77,$77,$77,$77,$77,$77,$77,$77
.byte $77,$77,$77,$77,$77,$77,$77,$77
.byte $44,$44,$44,$44,$44,$44,$44,$44
.byte $44,$44,$44,$44,$44,$44,$44,$44
.byte $cc,$cc,$cc,$cc,$cc,$cc,$cc,$cc
.byte $cc,$cc,$cc,$cc,$cc,$cc,$cc,$cc
.byte $ee,$ee,$ee,$ee,$ee,$ee,$ee,$ee
.byte $ee,$ee,$ee,$ee,$ee,$ee,$ee,$ee
.byte $dd,$dd,$dd,$dd,$dd,$dd,$dd,$dd
.byte $dd,$dd,$dd,$dd,$dd,$dd,$dd,$dd
.byte $99,$99,$99,$99,$99,$99,$99,$99
.byte $99,$99,$99,$99,$99,$99,$99,$99
.byte $11,$11,$11,$11,$11,$11,$11,$11
.byte $11,$11,$11,$11,$11,$11,$11,$11
.endif
Table1 = $8000
Table2 = $8000+64
.if 0
Table1: ; !fill 64,0
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
Table2: ; !fill 64,0
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.byte $00,$00,$00,$00,$00,$00,$00,$00
.endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,462 @@
; PLASMAGORIA, hi-res version
; original code by French Touch
.include "hardware.inc"
hposn_high=$6000
hposn_low =$6100
hposn_high_div8=$6200
hposn_low_div8 =$6300
hires_colors_even_l0=$8000
hires_colors_odd_l0 =$8100
hires_colors_even_l1=$8200
hires_colors_odd_l1 =$8300
;Table1 = $8000
;Table2 = $8000+64
HGR = $F3E2
HGR2 = $F3D8
; Page Zero
GBASL = $26
GBASH = $27
COMPT1 = $30
COMPT2 = $31
PARAM1 = $60
PARAM2 = $61
PARAM3 = $62
PARAM4 = $63
Table1 = $A0 ; 40 bytes
Table2 = $D0 ; 40 bytes
PAGE = $FC
COUNT = $FD
GBASH_SAVE = $FE
; =============================================================================
; ROUTINE MAIN
; =============================================================================
plasma_debut:
jsr HGR2
jsr HGR ; have table gen appear on hgr page1
bit FULLGR
jsr build_tables
ldx #23
ldy #184
div8_loop:
lda hposn_low,Y
sta hposn_low_div8,X
lda hposn_high,Y
sta hposn_high_div8,X
dey
dey
dey
dey
dey
dey
dey
dey
dex
bpl div8_loop
lda #0
sta PAGE
; ============================================================================
; init lores colors (inline)
; ============================================================================
init_hires_colors:
;==============================================
init_hires_colors_even_l0:
ldx #0
ldy #0
; 347
init_hires_colors_even_l0_loop:
lda hires_colors_even_lookup_l0,X
sta hires_colors_even_l0,Y
iny
sta hires_colors_even_l0,Y
iny
sta hires_colors_even_l0,Y
iny
sta hires_colors_even_l0,Y
iny
beq done_init_hires_colors_even_l0
inx
txa
and #$f
tax
jmp init_hires_colors_even_l0_loop
done_init_hires_colors_even_l0:
;============================
init_hires_colors_odd_l0:
ldx #0
ldy #0
; 347
init_hires_colors_odd_l0_loop:
lda hires_colors_odd_lookup_l0,X
sta hires_colors_odd_l0,Y
iny
sta hires_colors_odd_l0,Y
iny
sta hires_colors_odd_l0,Y
iny
sta hires_colors_odd_l0,Y
iny
beq done_init_hires_colors_odd_l0
inx
txa
and #$f
tax
jmp init_hires_colors_odd_l0_loop
done_init_hires_colors_odd_l0:
;==============================================
init_hires_colors_even_l1:
ldx #0
ldy #0
; 347
init_hires_colors_even_l1_loop:
lda hires_colors_even_lookup_l1,X
sta hires_colors_even_l1,Y
iny
sta hires_colors_even_l1,Y
iny
sta hires_colors_even_l1,Y
iny
sta hires_colors_even_l1,Y
iny
beq done_init_hires_colors_even_l1
inx
txa
and #$f
tax
jmp init_hires_colors_even_l1_loop
done_init_hires_colors_even_l1:
;============================
init_hires_colors_odd_l1:
ldx #0
ldy #0
; 347
init_hires_colors_odd_l1_loop:
lda hires_colors_odd_lookup_l1,X
sta hires_colors_odd_l1,Y
iny
sta hires_colors_odd_l1,Y
iny
sta hires_colors_odd_l1,Y
iny
sta hires_colors_odd_l1,Y
iny
beq done_init_hires_colors_odd_l1
inx
txa
and #$f
tax
jmp init_hires_colors_odd_l1_loop
done_init_hires_colors_odd_l1:
; ============================================================================
; 26+( 24*(11+(40*(39+(38*2))) = 110,690 +2174 = 112,864 = 9fps
; 26+( 24*(11+(40*(39+(38*4))) = 183,650 +2174 = 185,824 = 5.5fps
; 26+( 24*(11+(40*(39+(38*8))) = 329,570 +2174 = = 3fps
do_plasma:
; init
; lda #02
; ldx #5
;init_loop:
; sta COMPT1,X
; dex
; bne init_loop
BP3:
; ============================================================================
; Precalculate some values (inlined)
; ROUTINES PRE CALCUL
; ============================================================================
;
; cycles = 30 + (40*53) -1 + 25 = 2174 cycles
precalc:
; 0
lda PARAM1 ; self modify various parts ; 3
sta pc_off1+1 ; 4
lda PARAM2 ; 3
sta pc_off2+1 ; 4
lda PARAM3 ; 3
sta pc_off3+1 ; 4
lda PARAM4 ; 3
sta pc_off4+1 ; 4
; 28
; Table1(X) = sin1(PARAM1+X)+sin2(PARAM1+X)
; Table2(X) = sin3(PARAM3+X)+sin1(PARAM4+X)
ldx #$28 ; 40 ; 2
; 30
precalc_loop:
pc_off1:
lda sin1 ; 4
pc_off2:
adc sin2 ; 4
sta Table1,X ; 4
; 12
pc_off3:
lda sin3 ; 4
pc_off4:
adc sin1 ; 4
sta Table2,X ; 4
; 24
inc pc_off1+1 ; 6
inc pc_off2+1 ; 6
inc pc_off3+1 ; 6
inc pc_off4+1 ; 6
; 48
dex ; 2
bpl precalc_loop ; 2/3
; 53
inc PARAM1 ; 5
inc PARAM1 ; 5
dec PARAM2 ; 5
inc PARAM3 ; 5
dec PARAM4 ; 5
; 25
; ============================================================================
; Display Routines
; ROUTINES AFFICHAGES
; ============================================================================
; 26+( 24*(11+(40*(39+(38*2))) = 110,690
; 26+( 24*(11+(40*(39+(38*4))) = 183,650
; 26+( 24*(11+(40*(39+(38*8))) = 329,570
; Display "Normal"
; AFFICHAGE "NORMAL"
display_normal:
ldx #23 ; lines 0-23 lignes 0-23 ; 2
display_line_loop:
; 0
lda hposn_low_div8,X ; setup line pointer ; 4
sta GBASL ; 3
; 7
ldy #39 ; col 0-39 ; 2
lda Table2,X ; setup base sine value for row ; 4
sta display_row_sin_smc+1 ; 4
; 17
display_col_loop:
lda Table1,Y ; load in column sine value ; 4
display_row_sin_smc:
adc #00 ; add in row value ; 2
sta display_lookup_smc+1 ; patch in low byte of lookup ; 4
; 8
; pick 0/1 for odd even
lda display_lookup_smc+2 ; 4
eor #$01 ; 2
sta display_lookup_smc+2 ; 4
; 18
; lda hires_colors_even_l0 ; attention: must be aligned
; sta color_smc+1
lda hposn_high_div8,X ; 4
clc ; 2
adc PAGE ; 3
sta GBASH ; 3
; 30
lda #1 ; 2
sta COUNT ; 3
; 35
store_loop:
color_smc:
lda display_lookup_smc+2 ; 4
eor #$02 ; 2
sta display_lookup_smc+2 ; 4
; 10
display_lookup_smc:
lda hires_colors_even_l0 ; attention: must be aligned ; 4
; lda #$fe
sta (GBASL),Y ; 6
clc ; 2
lda #$10 ; 2
adc GBASH ; 3
sta GBASH ; 3
dec COUNT ; 5
bpl store_loop ; 2/3
; 38
dey ; 2
bpl display_col_loop ; 2/3
dex ; 2
bpl display_line_loop ; 2/3
; ============================================================================
lda PAGE ; 3
beq was_page1 ; 2/3
was_page2:
bit PAGE2 ; 4
lda #0 ; 2
beq done_pageflip ; 2/3
was_page1:
bit PAGE1 ; 4
lda #$20 ; 2
done_pageflip:
sta PAGE ; 3
; 15?
inc COMPT1 ; 6
beq display_done2 ; 2/3
; bne BP3
jmp BP3 ; 3
display_done2:
dec COMPT2 ; 6
beq display_done ; 2/3
; bne BP3
jmp BP3 ; 3
display_done:
jmp do_plasma
; beq do_plasma ; bra
hires_colors_even_lookup_l0:
.byte $00 ; black
.byte $A2 ; 01 00 01 0 -> 1 01 00 01 0 = $A2 ; dark orange
.byte $A2 ; 01 00 01 0 -> 1 01 00 01 0 = $A2 ; med orange
.byte $88 ; 01 00 01 0 -> 1 01 00 01 0 = $A2 ; light orange
.byte $AA ; 01 01 01 0 -> 1 01 01 01 0 = $AA ; solid orange
.byte $EE ; 01 11 01 1 -> 1 11 01 11 0 = $EE ; white orange
.byte $EE ; 01 11 01 1 -> 1 11 01 11 0 = $EE ; med white/o
.byte $EE ; 01 11 01 1 -> 1 11 01 11 0 = $EE ; wwo
.byte $FF ; 11 11 11 1 -> 1 11 11 11 1 = $FF ; white
.byte $DD ; 10 11 10 1 -> 1 10 11 10 1 = $DD ; white/blue
.byte $DD ; 10 11 10 1 -> 1 10 11 10 1 = $DD ; med white/blue
.byte $DD ; 10 11 10 1 -> 1 10 11 10 1 = $DD ; blue/white
.byte $D5 ; 10 10 10 1 -> 1 10 10 10 1 = $D5 ; blue
.byte $91 ; 10 00 10 0 -> 1 00 10 00 1 = $91 ; black/blue
.byte $91 ; 10 00 10 0 -> 1 00 10 00 1 = $91 ; med
.byte $91 ; 10 00 10 0 -> 1 00 10 00 1 = $91 ; med/dark
hires_colors_odd_lookup_l0:
.byte $00 ; black
.byte $91 ; 1 00 01 00 -> 1 00 10 00 1 = $91 ; dark orange
.byte $91 ; 1 00 01 00 -> 1 00 10 00 1 = $91 ; med orange
.byte $91 ; 1 00 01 00 -> 1 00 10 00 1 = $91 ; light orange
.byte $D5 ; 1 01 01 01 -> 1 10 10 10 1 = $D5 ; solid orange
.byte $DD ; 1 01 11 01 -> 1 10 11 10 1 = $DD ; white orange
.byte $DD ; 1 01 11 01 -> 1 10 11 10 1 = $DD ; med white/o
.byte $DD ; 1 01 11 01 -> 1 10 11 10 1 = $DD ; wwo
.byte $FF ; 1 11 11 11 -> 1 11 11 11 1 = $FF ; white
.byte $BB ; 1 10 11 10 -> 1 01 11 01 1 = $BB ; white/blue
.byte $BB ; 1 10 11 10 -> 1 01 11 01 1 = $BB ; med white/blue
.byte $BB ; 1 10 11 10 -> 1 01 11 01 1 = $BB ; blue/white
.byte $AA ; 0 10 10 10 -> 1 01 01 01 0 = $AA ; blue
.byte $A2 ; 0 10 00 10 -> 1 01 00 01 0 = $A2 ; black/blue
.byte $A2 ; 0 10 00 10 -> 1 01 00 01 0 = $A2 ; med
.byte $A2 ; 0 10 00 10 -> 1 01 00 01 0 = $A2 ; med/dark
hires_colors_even_lookup_l1:
.byte $00 ; black
.byte $00 ; dark orange
.byte $88 ; 00 01 00 0 -> 1 00 01 00 0 = $88 ; med orange
.byte $AA ; 01 01 01 0 -> 1 01 01 01 0 = $AA ; light orange
.byte $AA ; 01 01 01 0 -> 1 01 01 01 0 = $AA ; solid orange
.byte $AA ; 01 01 01 0 -> 1 01 01 01 0 = $AA ; white orange
.byte $BB ; 11 01 11 0 -> 1 01 11 01 1 = $BB ; med white/o
.byte $FF ; 11 11 11 1 -> 1 11 11 11 1 = $FF ; wwo
.byte $FF ; 11 11 11 1 -> 1 11 11 11 1 = $FF ; white
.byte $FF ; 11 11 11 1 -> 1 11 11 11 1 = $FF ; white/blue
.byte $F7 ; 11 10 11 1 -> 1 11 10 11 1 = $F7 ; med white/blue
.byte $D5 ; 10 10 10 1 -> 1 10 10 10 1 = $D5 ; blue/white
.byte $D5 ; 10 10 10 1 -> 1 10 10 10 1 = $D5 ; blue
.byte $D5 ; 10 10 10 1 -> 1 10 10 10 1 = $D5 ; black/blue
.byte $C4 ; 00 10 00 1 -> 1 10 00 10 0 = $C4 ; med
.byte $00 ; med/dark
hires_colors_odd_lookup_l1:
.byte $00 ; black
.byte $00 ; dark orange
.byte $91 ; 1 00 01 00 -> 1 00 10 00 1 = $91 ; med orange
.byte $D5 ; 1 01 01 01 -> 1 10 10 10 1 = $D5 ; light orange
.byte $D5 ; 1 01 01 01 -> 1 10 10 10 1 = $D5 ; solid orange
.byte $D5 ; 1 01 01 01 -> 1 10 10 10 1 = $D5 ; white orange
.byte $F7 ; 1 11 01 11 -> 1 11 10 11 1 = $F7 ; med white/o
.byte $FF ; 1 11 11 11 -> 1 11 11 11 1 = $FF ; wwo
.byte $FF ; 1 11 11 11 -> 1 11 11 11 1 = $FF ; white
.byte $FF ; 1 11 11 11 -> 1 11 11 11 1 = $FF ; white/blue
.byte $EE ; 0 11 10 11 -> 1 11 01 11 0 = $EE ; med white/blue
.byte $AA ; 0 10 10 10 -> 1 01 01 01 0 = $AA ; blue/white
.byte $AA ; 0 10 10 10 -> 1 01 01 01 0 = $AA ; blue
.byte $AA ; 0 10 10 10 -> 1 01 01 01 0 = $AA ; black/blue
.byte $A2 ; 0 10 00 10 -> 1 01 00 01 0 = $A2 ; med
.byte $00 ; med/dark
.include "hgr_table.s"
.align 256
sin1:
.incbin "tables"
sin2=sin1+256
sin3=sin2+256

View File

@ -0,0 +1,433 @@
; PLASMAGORIA, hi-res version
; original code by French Touch
.include "hardware.inc"
hposn_high=$6000
hposn_low =$6100
hposn_high_div8=$6200
hposn_low_div8 =$6300
hires_colors_even_l0=$8000
hires_colors_odd_l0 =$8100
hires_colors_even_l1=$8200
hires_colors_odd_l1 =$8300
;Table1 = $8000
;Table2 = $8000+64
HGR = $F3E2
; Page Zero
GBASL = $26
GBASH = $27
COMPT1 = $30
COMPT2 = $31
PARAM1 = $60
PARAM2 = $61
PARAM3 = $62
PARAM4 = $63
Table1 = $A0 ; 40 bytes
Table2 = $D0 ; 40 bytes
PAGE = $FC
COUNT = $FD
GBASH_SAVE = $FE
; =============================================================================
; ROUTINE MAIN
; =============================================================================
plasma_debut:
jsr HGR ; have table gen appear on hgr page1
bit FULLGR
jsr build_tables
ldx #23
ldy #184
div8_loop:
lda hposn_low,Y
sta hposn_low_div8,X
lda hposn_high,Y
sta hposn_high_div8,X
dey
dey
dey
dey
dey
dey
dey
dey
dex
bpl div8_loop
lda #0
sta PAGE
; ============================================================================
; init lores colors (inline)
; ============================================================================
init_hires_colors:
;==============================================
init_hires_colors_even_l0:
ldx #0
ldy #0
; 347
init_hires_colors_even_l0_loop:
lda hires_colors_even_lookup_l0,X
sta hires_colors_even_l0,Y
iny
sta hires_colors_even_l0,Y
iny
sta hires_colors_even_l0,Y
iny
sta hires_colors_even_l0,Y
iny
beq done_init_hires_colors_even_l0
inx
txa
and #$f
tax
jmp init_hires_colors_even_l0_loop
done_init_hires_colors_even_l0:
;============================
init_hires_colors_odd_l0:
ldx #0
ldy #0
; 347
init_hires_colors_odd_l0_loop:
lda hires_colors_odd_lookup_l0,X
sta hires_colors_odd_l0,Y
iny
sta hires_colors_odd_l0,Y
iny
sta hires_colors_odd_l0,Y
iny
sta hires_colors_odd_l0,Y
iny
beq done_init_hires_colors_odd_l0
inx
txa
and #$f
tax
jmp init_hires_colors_odd_l0_loop
done_init_hires_colors_odd_l0:
;==============================================
init_hires_colors_even_l1:
ldx #0
ldy #0
; 347
init_hires_colors_even_l1_loop:
lda hires_colors_even_lookup_l1,X
sta hires_colors_even_l1,Y
iny
sta hires_colors_even_l1,Y
iny
sta hires_colors_even_l1,Y
iny
sta hires_colors_even_l1,Y
iny
beq done_init_hires_colors_even_l1
inx
txa
and #$f
tax
jmp init_hires_colors_even_l1_loop
done_init_hires_colors_even_l1:
;============================
init_hires_colors_odd_l1:
ldx #0
ldy #0
; 347
init_hires_colors_odd_l1_loop:
lda hires_colors_odd_lookup_l1,X
sta hires_colors_odd_l1,Y
iny
sta hires_colors_odd_l1,Y
iny
sta hires_colors_odd_l1,Y
iny
sta hires_colors_odd_l1,Y
iny
beq done_init_hires_colors_odd_l1
inx
txa
and #$f
tax
jmp init_hires_colors_odd_l1_loop
done_init_hires_colors_odd_l1:
; ============================================================================
do_plasma:
; init
; lda #02
; ldx #5
;init_loop:
; sta COMPT1,X
; dex
; bne init_loop
BP3:
; ============================================================================
; Precalculate some values (inlined)
; ROUTINES PRE CALCUL
; ============================================================================
precalc:
lda PARAM1 ; self modify various parts
sta pc_off1+1
lda PARAM2
sta pc_off2+1
lda PARAM3
sta pc_off3+1
lda PARAM4
sta pc_off4+1
; Table1(X) = sin1(PARAM1+X)+sin2(PARAM1+X)
; Table2(X) = sin3(PARAM3+X)+sin1(PARAM4+X)
ldx #$28 ; 40
pc_b1:
pc_off1:
lda sin1
pc_off2:
adc sin2
sta Table1,X
pc_off3:
lda sin3
pc_off4:
adc sin1
sta Table2,X
inc pc_off1+1
inc pc_off2+1
inc pc_off3+1
inc pc_off4+1
dex
bpl pc_b1
inc PARAM1
inc PARAM1
dec PARAM2
inc PARAM3
dec PARAM4
; ============================================================================
; Display Routines
; ROUTINES AFFICHAGES
; ============================================================================
; Display "Normal"
; AFFICHAGE "NORMAL"
display_normal:
ldx #23 ; lines 0-23 lignes 0-23
display_line_loop:
lda hposn_low_div8,X
sta GBASL
ldy #39 ; col 0-39
lda Table2,X ; setup base sine value for row
sta display_row_sin_smc+1
display_col_loop:
lda Table1,Y ; load in column sine value
display_row_sin_smc:
adc #00 ; add in row value
sta display_lookup_smc+1 ; patch in low byte of lookup
; pick 0/1 for odd even
lda display_lookup_smc+2
eor #$01
sta display_lookup_smc+2
; lda hires_colors_even_l0 ; attention: must be aligned
; sta color_smc+1
lda hposn_high_div8,X
clc
adc PAGE
sta GBASH
lda #7
sta COUNT
store_loop:
color_smc:
lda display_lookup_smc+2
eor #$02
sta display_lookup_smc+2
display_lookup_smc:
lda hires_colors_even_l0 ; attention: must be aligned
; lda #$fe
sta (GBASL),Y
clc
lda #$4
adc GBASH
sta GBASH
dec COUNT
bpl store_loop
dey
bpl display_col_loop
dex
bpl display_line_loop
; ============================================================================
lda PAGE
beq was_page1
was_page2:
bit PAGE2
lda #0
beq done_pageflip
was_page1:
bit PAGE1
lda #$20
done_pageflip:
sta PAGE
inc COMPT1
beq display_done2
; bne BP3
jmp BP3
display_done2:
dec COMPT2
beq display_done
; bne BP3
jmp BP3
display_done:
jmp do_plasma
; beq do_plasma ; bra
hires_colors_even_lookup_l0:
.byte $00 ; black
.byte $A2 ; 01 00 01 0 -> 1 01 00 01 0 = $A2 ; dark orange
.byte $A2 ; 01 00 01 0 -> 1 01 00 01 0 = $A2 ; med orange
.byte $88 ; 01 00 01 0 -> 1 01 00 01 0 = $A2 ; light orange
.byte $AA ; 01 01 01 0 -> 1 01 01 01 0 = $AA ; solid orange
.byte $EE ; 01 11 01 1 -> 1 11 01 11 0 = $EE ; white orange
.byte $EE ; 01 11 01 1 -> 1 11 01 11 0 = $EE ; med white/o
.byte $EE ; 01 11 01 1 -> 1 11 01 11 0 = $EE ; wwo
.byte $FF ; 11 11 11 1 -> 1 11 11 11 1 = $FF ; white
.byte $DD ; 10 11 10 1 -> 1 10 11 10 1 = $DD ; white/blue
.byte $DD ; 10 11 10 1 -> 1 10 11 10 1 = $DD ; med white/blue
.byte $DD ; 10 11 10 1 -> 1 10 11 10 1 = $DD ; blue/white
.byte $D5 ; 10 10 10 1 -> 1 10 10 10 1 = $D5 ; blue
.byte $91 ; 10 00 10 0 -> 1 00 10 00 1 = $91 ; black/blue
.byte $91 ; 10 00 10 0 -> 1 00 10 00 1 = $91 ; med
.byte $91 ; 10 00 10 0 -> 1 00 10 00 1 = $91 ; med/dark
hires_colors_odd_lookup_l0:
.byte $00 ; black
.byte $91 ; 1 00 01 00 -> 1 00 10 00 1 = $91 ; dark orange
.byte $91 ; 1 00 01 00 -> 1 00 10 00 1 = $91 ; med orange
.byte $91 ; 1 00 01 00 -> 1 00 10 00 1 = $91 ; light orange
.byte $D5 ; 1 01 01 01 -> 1 10 10 10 1 = $D5 ; solid orange
.byte $DD ; 1 01 11 01 -> 1 10 11 10 1 = $DD ; white orange
.byte $DD ; 1 01 11 01 -> 1 10 11 10 1 = $DD ; med white/o
.byte $DD ; 1 01 11 01 -> 1 10 11 10 1 = $DD ; wwo
.byte $FF ; 1 11 11 11 -> 1 11 11 11 1 = $FF ; white
.byte $BB ; 1 10 11 10 -> 1 01 11 01 1 = $BB ; white/blue
.byte $BB ; 1 10 11 10 -> 1 01 11 01 1 = $BB ; med white/blue
.byte $BB ; 1 10 11 10 -> 1 01 11 01 1 = $BB ; blue/white
.byte $AA ; 0 10 10 10 -> 1 01 01 01 0 = $AA ; blue
.byte $A2 ; 0 10 00 10 -> 1 01 00 01 0 = $A2 ; black/blue
.byte $A2 ; 0 10 00 10 -> 1 01 00 01 0 = $A2 ; med
.byte $A2 ; 0 10 00 10 -> 1 01 00 01 0 = $A2 ; med/dark
hires_colors_even_lookup_l1:
.byte $00 ; black
.byte $00 ; dark orange
.byte $88 ; 00 01 00 0 -> 1 00 01 00 0 = $88 ; med orange
.byte $AA ; 01 01 01 0 -> 1 01 01 01 0 = $AA ; light orange
.byte $AA ; 01 01 01 0 -> 1 01 01 01 0 = $AA ; solid orange
.byte $AA ; 01 01 01 0 -> 1 01 01 01 0 = $AA ; white orange
.byte $BB ; 11 01 11 0 -> 1 01 11 01 1 = $BB ; med white/o
.byte $FF ; 11 11 11 1 -> 1 11 11 11 1 = $FF ; wwo
.byte $FF ; 11 11 11 1 -> 1 11 11 11 1 = $FF ; white
.byte $FF ; 11 11 11 1 -> 1 11 11 11 1 = $FF ; white/blue
.byte $F7 ; 11 10 11 1 -> 1 11 10 11 1 = $F7 ; med white/blue
.byte $D5 ; 10 10 10 1 -> 1 10 10 10 1 = $D5 ; blue/white
.byte $D5 ; 10 10 10 1 -> 1 10 10 10 1 = $D5 ; blue
.byte $D5 ; 10 10 10 1 -> 1 10 10 10 1 = $D5 ; black/blue
.byte $C4 ; 00 10 00 1 -> 1 10 00 10 0 = $C4 ; med
.byte $00 ; med/dark
hires_colors_odd_lookup_l1:
.byte $00 ; black
.byte $00 ; dark orange
.byte $91 ; 1 00 01 00 -> 1 00 10 00 1 = $91 ; med orange
.byte $D5 ; 1 01 01 01 -> 1 10 10 10 1 = $D5 ; light orange
.byte $D5 ; 1 01 01 01 -> 1 10 10 10 1 = $D5 ; solid orange
.byte $D5 ; 1 01 01 01 -> 1 10 10 10 1 = $D5 ; white orange
.byte $F7 ; 1 11 01 11 -> 1 11 10 11 1 = $F7 ; med white/o
.byte $FF ; 1 11 11 11 -> 1 11 11 11 1 = $FF ; wwo
.byte $FF ; 1 11 11 11 -> 1 11 11 11 1 = $FF ; white
.byte $FF ; 1 11 11 11 -> 1 11 11 11 1 = $FF ; white/blue
.byte $EE ; 0 11 10 11 -> 1 11 01 11 0 = $EE ; med white/blue
.byte $AA ; 0 10 10 10 -> 1 01 01 01 0 = $AA ; blue/white
.byte $AA ; 0 10 10 10 -> 1 01 01 01 0 = $AA ; blue
.byte $AA ; 0 10 10 10 -> 1 01 01 01 0 = $AA ; black/blue
.byte $A2 ; 0 10 00 10 -> 1 01 00 01 0 = $A2 ; med
.byte $00 ; med/dark
.include "hgr_table.s"
.align 256
sin1:
.incbin "tables"
sin2=sin1+256
sin3=sin2+256

View File

@ -0,0 +1,202 @@
; PLASMAGORIA, hi-res version
; original code by French Touch
.include "hardware.inc"
hposn_high=$6000
hposn_low =$6100
;Table1 = $8000
;Table2 = $8000+64
HGR = $F3E2
; Page Zero
GBASL = $26
GBASH = $27
COMPT1 = $30
COMPT2 = $31
PARAM1 = $60
PARAM2 = $61
PARAM3 = $62
PARAM4 = $63
Table1 = $A0 ; 40 bytes
Table2 = $D0 ; 40 bytes
; =============================================================================
; ROUTINE MAIN
; =============================================================================
plasma_debut:
jsr HGR ; have table gen appear on hgr page1
bit FULLGR
jsr build_tables
lores_colors_fine=$8100
; ============================================================================
; init lores colors (inline)
; ============================================================================
init_lores_colors:
ldx #0
ldy #0
; 347
init_lores_colors_loop:
lda lores_colors_lookup,X
sta lores_colors_fine,Y
iny
sta lores_colors_fine,Y
iny
sta lores_colors_fine,Y
iny
sta lores_colors_fine,Y
iny
beq done_init_lores_colors
inx
txa
and #$f
tax
jmp init_lores_colors_loop
done_init_lores_colors:
; ============================================================================
do_plasma:
; init
; lda #02
; ldx #5
;init_loop:
; sta COMPT1,X
; dex
; bne init_loop
BP3:
; ============================================================================
; Precalculate some values (inlined)
; ROUTINES PRE CALCUL
; ============================================================================
precalc:
lda PARAM1 ; self modify various parts
sta pc_off1+1
lda PARAM2
sta pc_off2+1
lda PARAM3
sta pc_off3+1
lda PARAM4
sta pc_off4+1
; Table1(X) = sin1(PARAM1+X)+sin2(PARAM1+X)
; Table2(X) = sin3(PARAM3+X)+sin1(PARAM4+X)
ldx #$28 ; 40
pc_b1:
pc_off1:
lda sin1
pc_off2:
adc sin2
sta Table1,X
pc_off3:
lda sin3
pc_off4:
adc sin1
sta Table2,X
inc pc_off1+1
inc pc_off2+1
inc pc_off3+1
inc pc_off4+1
dex
bpl pc_b1
inc PARAM1
inc PARAM1
dec PARAM2
inc PARAM3
dec PARAM4
; ============================================================================
; Display Routines
; ROUTINES AFFICHAGES
; ============================================================================
; Display "Normal"
; AFFICHAGE "NORMAL"
display_normal:
ldx #23 ; lines 0-23 lignes 0-23
display_line_loop:
txa
pha
asl
asl
asl
tax
lda hposn_high,X
sta output_smc+2
lda hposn_low,X
sta output_smc+1
pla
tax
ldy #39 ; col 0-39
lda Table2,X ; setup base sine value for row
sta display_row_sin_smc+1
display_col_loop:
lda Table1,Y ; load in column sine value
display_row_sin_smc:
adc #00 ; add in row value
sta display_lookup_smc+1 ; patch in low byte of lookup
display_lookup_smc:
lda lores_colors_fine ; attention: must be aligned
output_smc:
sta $2000,Y
dey
bpl display_col_loop
dex
bpl display_line_loop
; ============================================================================
inc COMPT1
bne BP3
dec COMPT2
bne BP3
beq do_plasma ; bra
lores_colors_lookup:
.byte $00,$88,$55,$99,$ff,$bb,$33,$22,$66,$77,$44,$cc,$ee,$dd,$99,$11
.include "hgr_table.s"
.align 256
sin1:
.incbin "tables"
sin2=sin1+256
sin3=sin2+256