base:8x8-plasma-looped
no way to compare when less than two revisions
Differences
This shows you the differences between two versions of the page.
— | base:8x8-plasma-looped [2015-04-17 04:30] (current) – created - external edit 127.0.0.1 | ||
---|---|---|---|
Line 1: | Line 1: | ||
+ | < | ||
+ | // | ||
+ | // 8x8 Plasma Crap w/o Speedcode | ||
+ | // For Codebase64 | ||
+ | // By Cruzer/CML 2009 | ||
+ | // Asm: KickAss 3.1 | ||
+ | // | ||
+ | // memory... | ||
+ | .var plasmaCnt = $02 | ||
+ | .var add = $04 | ||
+ | .var yPos = $05 | ||
+ | .var screen = $0400 | ||
+ | .var basic = $0801 | ||
+ | .var sine64 = $1000 | ||
+ | .var sine128 = $1200 | ||
+ | .var colorTable = $1400 | ||
+ | .var bitmap = $2000 | ||
+ | .var code = $4000 | ||
+ | // | ||
+ | .pc = sine64 " | ||
+ | .for (var i=0; i<$200; i++) | ||
+ | .by 32 + 32 * sin(i/ | ||
+ | .pc = sine128 " | ||
+ | .for (var i=0; i<$200; i++) | ||
+ | .by 64 + 64 * sin(i/ | ||
+ | // | ||
+ | .pc = $0801 " | ||
+ | : | ||
+ | // | ||
+ | .pc = code " | ||
+ | jmp start | ||
+ | // | ||
+ | // plasma params... | ||
+ | .var width = 20 | ||
+ | .var height = 20 | ||
+ | .var sineSpreadX = $03 | ||
+ | .var sineSpreadY = $01 | ||
+ | .var colorSpreadX = $01 | ||
+ | .var colorSpreadY = $02 | ||
+ | .var realtimeSpread0 = $04 | ||
+ | .var realtimeSpread1 = $07 | ||
+ | sineSpeeds: | ||
+ | addSpeed: | ||
+ | colors: | ||
+ | // | ||
+ | start: | ||
+ | sei | ||
+ | //clear screen... | ||
+ | ldx #$00 | ||
+ | txa | ||
+ | !: sta $0400,x | ||
+ | sta $0500,x | ||
+ | sta $0600,x | ||
+ | sta $0700,x | ||
+ | inx | ||
+ | bne !- | ||
+ | |||
+ | // 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, | ||
+ | sta colorTable+$100, | ||
+ | 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 | ||
+ | |||
+ | lda #<screen | ||
+ | sta store+1 | ||
+ | lda #>screen | ||
+ | sta store+2 | ||
+ | |||
+ | lda #0 | ||
+ | sta sine0+1 | ||
+ | sta sine1+1 | ||
+ | sta rtSine+1 | ||
+ | sta color+1 | ||
+ | |||
+ | lda #height-1 | ||
+ | sta yPos | ||
+ | yLoop: | ||
+ | ldx plasmaCnt + 0 | ||
+ | ldy plasmaCnt + 1 | ||
+ | clc | ||
+ | sine0: lda sine128,x | ||
+ | sine1: adc sine64,y | ||
+ | sta lineOffset | ||
+ | |||
+ | lda sine0+1 | ||
+ | clc | ||
+ | adc # | ||
+ | sta sine0+1 | ||
+ | |||
+ | lda sine1+1 | ||
+ | clc | ||
+ | adc # | ||
+ | sta sine1+1 | ||
+ | |||
+ | ldx #width-1 | ||
+ | xLoop: | ||
+ | lda sineOffsets, | ||
+ | clc | ||
+ | adc lineOffset | ||
+ | tay | ||
+ | lda colorOffsets, | ||
+ | clc | ||
+ | rtSine: adc sine64,y | ||
+ | adc add | ||
+ | tay | ||
+ | color: lda colorTable, | ||
+ | store: sta screen,x | ||
+ | dex | ||
+ | bpl xLoop | ||
+ | |||
+ | lda rtSine+1 | ||
+ | clc | ||
+ | adc # | ||
+ | sta rtSine+1 | ||
+ | |||
+ | lda color+1 | ||
+ | clc | ||
+ | adc # | ||
+ | sta color+1 | ||
+ | |||
+ | lda store+1 | ||
+ | clc | ||
+ | adc #40 | ||
+ | sta store+1 | ||
+ | bcc !+ | ||
+ | inc store+2 | ||
+ | !: | ||
+ | dec yPos | ||
+ | bpl yLoop | ||
+ | |||
+ | jmp mainLoop | ||
+ | |||
+ | sineOffsets: | ||
+ | .fill 40, i*sineSpreadX | ||
+ | colorOffsets: | ||
+ | .fill 40, i*colorSpreadX | ||
+ | lineOffset: | ||
+ | .by 0 | ||
+ | </ | ||
base/8x8-plasma-looped.txt · Last modified: 2015-04-17 04:30 by 127.0.0.1