User Tools

Site Tools


base:8x8-plasma-basic

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

base:8x8-plasma-basic [2015-04-17 04:30] (current)
Line 1: Line 1:
 +====== 8x8 Plasma / Basic Speedcode Generator ======
 +<code>
 +//--------------------------------------------------------------------------------------------------
 +// 8x8 Plasma Crap w/ Basic Generated Speedcode
 +// For Codebase64
 +// By Cruzer/CML 2009
 +// Asm: KickAss 3.1
 +//--------------------------------------------------------------------------------------------------
 +// memory...
 +.var plasmaCnt = $02
 +.var add = $04
 +.var codePnt = $05
 +.var xPos = $07
 +.var yPos = $08
 +.var screen = $0400
 +.var basic = $0800
 +.var sine64 = $1000
 +.var sine128 = $1200
 +.var colorTable = $1400
 +.var bitmap = $2000
 +.var code = $4000
 +.var codeSrc = $5000
 +.var plasmer = $6000
 +//--------------------------------------------------------------------------------------------------
 +.pc = sine64 "sine64"
 +.for (var i=0; i<$200; i++)
 + .by 32 + 32 * sin(i/[$100/2/PI])
 +.pc = sine128 "sine128"
 +.for (var i=0; i<$200; i++)
 + .by 64 + 64 * sin(i/[$100/2/PI])
 +//--------------------------------------------------------------------------------------------------
 +.pc = basic "basic"
 +// dump of the following basic program, which generates the plasmer speedcode based on the two
 +// chunks of code from codeSrc...
 +/*
 +10 IL = 12
 +20 PL = 12
 +40 IS = 5*16*256
 +45 PS = IS + IL
 +50 TA = 6*16*256
 +100 FOR Y=0 TO 24
 +200 REM -- LINE INIT --
 +202 POKE IS+6,Y*4
 +204 POKE IS+9,Y*7
 +210 FOR I=0 TO IL-1
 +220 POKE TA+I, PEEK(IS+I) :NEXT I
 +240 TA=TA+IL
 +300 REM -- PLASMER --
 +330 FOR X=0 TO 39
 +331 CC=CC+1: PRINT CC"/ 1000"
 +342 POKE PS+1, (X*3 + Y*1)AND 255
 +344 POKE PS+7, (X*1 + Y*2)AND 255
 +346 SA=1024+X+Y*40
 +347 POKE PS+10, SA AND 255
 +348 POKE PS+11, SA / 256
 +350 FOR I=0 TO PL-1
 +360 POKE TA+I, PEEK(PS+I) :NEXT I
 +370 TA=TA+PL
 +390 NEXT X
 +400 NEXT Y
 +500 POKE TA,96
 +1000 SYS16384
 +*/
 +  .by $00,$0d,$08,$0a,$00,$49,$4c,$20,$b2,$20,$31,$32,$00,$19,$08,$14
 +  .by $00,$50,$4c,$20,$b2,$20,$31,$32,$00,$2b,$08,$28,$00,$49,$53,$20
 +  .by $b2,$20,$35,$ac,$31,$36,$ac,$32,$35,$36,$00,$3c,$08,$2d,$00,$50
 +  .by $53,$20,$b2,$20,$49,$53,$20,$aa,$20,$49,$4c,$00,$4e,$08,$32,$00
 +  .by $54,$41,$20,$b2,$20,$36,$ac,$31,$36,$ac,$32,$35,$36,$00,$5d,$08
 +  .by $64,$00,$81,$20,$59,$b2,$30,$20,$a4,$20,$32,$34,$00,$73,$08,$c8
 +  .by $00,$8f,$20,$2d,$2d,$20,$4c,$49,$4e,$45,$20,$49,$4e,$49,$54,$20
 +  .by $2d,$2d,$00,$82,$08,$ca,$00,$97,$20,$49,$53,$aa,$36,$2c,$59,$ac
 +  .by $34,$00,$91,$08,$cc,$00,$97,$20,$49,$53,$aa,$39,$2c,$59,$ac,$37
 +  .by $00,$a2,$08,$d2,$00,$81,$20,$49,$b2,$30,$20,$a4,$20,$49,$4c,$ab
 +  .by $31,$00,$bb,$08,$dc,$00,$97,$20,$54,$41,$aa,$49,$2c,$20,$c2,$28
 +  .by $49,$53,$aa,$49,$29,$20,$3a,$82,$20,$49,$00,$c8,$08,$f0,$00,$54
 +  .by $41,$b2,$54,$41,$aa,$49,$4c,$00,$dc,$08,$2c,$01,$8f,$20,$2d,$2d
 +  .by $20,$50,$4c,$41,$53,$4d,$45,$52,$20,$2d,$2d,$00,$eb,$08,$4a,$01
 +  .by $81,$20,$58,$b2,$30,$20,$a4,$20,$33,$39,$00,$05,$09,$4b,$01,$43
 +  .by $43,$b2,$43,$43,$aa,$31,$3a,$20,$99,$20,$43,$43,$22,$2f,$20,$31
 +  .by $30,$30,$30,$22,$00,$22,$09,$56,$01,$97,$20,$50,$53,$aa,$31,$2c
 +  .by $20,$28,$58,$ac,$33,$20,$aa,$20,$59,$ac,$31,$29,$af,$20,$32,$35
 +  .by $35,$00,$3f,$09,$58,$01,$97,$20,$50,$53,$aa,$37,$2c,$20,$28,$58
 +  .by $ac,$31,$20,$aa,$20,$59,$ac,$32,$29,$af,$20,$32,$35,$35,$00,$52
 +  .by $09,$5a,$01,$53,$41,$b2,$31,$30,$32,$34,$aa,$58,$aa,$59,$ac,$34
 +  .by $30,$00,$68,$09,$5b,$01,$97,$20,$50,$53,$aa,$31,$30,$2c,$20,$53
 +  .by $41,$20,$af,$20,$32,$35,$35,$00,$7e,$09,$5c,$01,$97,$20,$50,$53
 +  .by $aa,$31,$31,$2c,$20,$53,$41,$20,$ad,$20,$32,$35,$36,$00,$8f,$09
 +  .by $5e,$01,$81,$20,$49,$b2,$30,$20,$a4,$20,$50,$4c,$ab,$31,$00,$a8
 +  .by $09,$68,$01,$97,$20,$54,$41,$aa,$49,$2c,$20,$c2,$28,$50,$53,$aa
 +  .by $49,$29,$20,$3a,$82,$20,$49,$00,$b5,$09,$72,$01,$54,$41,$b2,$54
 +  .by $41,$aa,$50,$4c,$00,$bd,$09,$86,$01,$82,$20,$58,$00,$c5,$09,$90
 +  .by $01,$82,$20,$59,$00,$d1,$09,$f4,$01,$97,$20,$54,$41,$2c,$39,$36
 +  .by $00,$dc,$09,$e8,$03,$9e,$31,$36,$33,$38,$34,$00,$00,$00,$49,$4c
 +  .by $84,$40,$00,$00,$00,$50,$4c,$84,$40,$00,$00,$00,$49,$53,$8f,$20
 +  .by $00,$00,$00,$50,$53,$8f,$20,$18,$00,$00,$54,$41,$8f,$4d,$20,$00
 +  .by $00,$59,$00,$82,$40,$00,$00,$00,$49,$00,$84,$10,$00,$00,$00,$58
 +  .by $00,$85,$00,$00,$00,$00,$43,$43,$88,$09,$00,$00,$00,$53,$41,$8b
 +  .by $11,$00,$00,$00,$38,$34,$00,$00,$00,$82,$20,$59,$00,$39,$0a,$f4
 +  .by $01,$97,$20,$54,$41,$2c,$39,$36,$00,$44,$0a,$e8,$03,$9e,$31,$36
 +  .by $33,$38,$34,$00,$00,$00,$82,$20,$59,$00,$56,$0a,$f4,$01,$97,$20
 +  .by $54,$41,$2c,$39,$36,$00,$61,$0a,$e8,$03,$9e,$31,$36,$33,$38,$34
 +  .by $00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00,$00
 +//--------------------------------------------------------------------------------------------------
 +.pc = code "code"
 + jmp start
 +//--------------------------------------------------------------------------------------------------
 +// plasma params...
 +.var width = 40
 +.var height = 25
 +.var sineSpreadX = $03
 +.var sineSpreadY = $01
 +.var colorSpreadX = $01
 +.var colorSpreadY = $02
 +.var realtimeSpread0 = $04
 +.var realtimeSpread1 = $07
 +sineSpeeds: .byte $03,$fe
 +addSpeed: .byte $ff
 +colors: .byte $a7,$aa,$8a,$2a,$b8,$95,$b5,$c5,$55,$5f,$cd,$5d,$37,$dd,$d1,$11
 +//--------------------------------------------------------------------------------------------------
 +start:
 + sei
 +
 +// fill bitmap...
 + ldx #0
 + ldy #$1f
 + lda #%01010101
 +!: sta bitmap,x
 + eor #%11111111
 + inx
 + bne !-
 + inc !- +2
 + dey
 + bpl !-
  
 +// generate color table...
 + ldx #0
 +
 +!loop:
 + txa
 + asl
 + asl
 + asl
 + bcc !+
 + eor #$ff
 +!: lsr
 + lsr
 + lsr
 + lsr
 + tay
 + lda colors,y
 + sta colorTable,x
 + sta colorTable+$100,x
 + inx
 + bne !loop-
 +
 +// init vic...
 + lda #$3b
 + sta $d011
 + lda #$18
 + sta $d018
 +
 +//--------------------------------------------------------------------------------------------------
 +mainLoop:
 + lda #$00
 + sta $d020
 + lda #$44
 +!: cmp $d012
 + bne !-
 + sta $d020
 +
 + lda plasmaCnt+0
 + clc
 + adc sineSpeeds+0
 + sta plasmaCnt+0
 + lda plasmaCnt+1
 + clc
 + adc sineSpeeds+1
 + sta plasmaCnt+1
 + lda add
 + clc
 + adc addSpeed
 + anc #$3f
 + sta add
 +
 + jsr plasmer
 + jmp mainLoop
 +//--------------------------------------------------------------------------------------------------
 +.pc = codeSrc "codeSrc"
 +lineInitSrc:
 + ldx plasmaCnt+0
 + ldy plasmaCnt+1
 + clc
 + lda sine128,x
 + adc sine64,y
 + tax
 +
 +plasmerSrc:
 + lda sine64,x
 + adc add
 + tay
 + lda colorTable,y
 + sta screen
 +</code>
base/8x8-plasma-basic.txt ยท Last modified: 2015-04-17 04:30 (external edit)