1
ASM / Plasma in 128b FASM source
« on: October 31, 2018 »
Because the world needs more cruddy asm lol. At one point I had this down to like 106b but I was losing quality, it looked less plasma-y and more like some weird sinusoidal blob. This captures some of the feel of Argon by Matrix which I really like
Code: [Select]
;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
;▒ 10/2018 by Boogop
;▒ Plasma in 128 bytes
;▒ FASM source
;▒
;▒ Acknowledgements:
;▒ - wally/rage for the sin generator and rbz for
;▒ the analysis thereof
;▒
;▒
;▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒
org 100h
use16
Start:
mov al,13h ; set mode 13
int 10h
push 0a000h ; stick video segment in es
pop es
;------- set palette ---------
xor ax,ax
mov dx, 3c9h ; who needs 3c8h!
@redup: ; red-blue palette
out dx,al
xchg al,ah
out dx,al
out dx,al
xchg al,ah
inc al
cmp al,127
jne @redup
@bluedn:
xchg al,ah
out dx,al
out dx,al
xchg al,ah
out dx,al
dec al
jnz @bluedn
mov cx,783Fh ; harmonic oscillator by wally/rage
xor si,si
sin1:
mov ax,65497
imul cx
add si,dx
add cx,si
mov [bx],ch
sar byte [bx],1
dec bx
cmp bx,16383
jne sin1
mov si,bx
@main:
xor di,di ; Reset vga position
mov cx,[p_pos1] ; stick position val into cx
@y_loop:
mov ax,255 ; magic number. imul leaves result
imul cx ; in dx:ax which will do for dx vals
mov ah,160 ; X counter. since we're using stosw
; we only have to loop 320/2 times
@x_loop:
push ax
; plasma calcs
mov bl,dl
add ax,[si+bx]
mov bl,dh
add bl,cl
add ax,[si+bx]
mov bl,cl
add ax,[si+bx]
mov bl,ch
sub bl,dl
add ax,[si+bx]
stosw
pop ax
add dx,0102h ; add movement
dec ah ; decrement the x counter
jnz @x_loop ; test for 0
add cx,0102h ; add movement
cmp di,320*200 ; use di for the y_loop counter
jb @y_loop ; test for 0
inc [p_pos1]
nop ; pad to 128 bytes lol
nop
jmp @main
p_pos1 dw 0