128b Plasma contest
category: general [glöplog]
OK, here's a static plasma effect which I programmed 12 years ago. I'm curious if you'll be able to size-optimize it to 128 bytes or less.
Code:
// Plasma coded 1996 by The Real Adok
#include <stdlib.h>
char point13h(int x,int y)
{
asm {
mov dx,word ptr y
mov ax,320
mul dx
mov bx,word ptr x
add bx,ax
mov al,byte ptr es:[bx]
}
}
void pset13h(int x,int y,int col)
{
asm {
mov ax,320
mov dx,word ptr y
mul dx
mov bx,word ptr x
add bx,ax
mov ax,word ptr col
mov es:[bx],al
}
}
void setpal(char col,char r,char g,char b)
{
asm {
mov al,byte ptr col
mov dx,3c8h
out dx,al
mov al,byte ptr r
inc dx
out dx,al
mov al,byte ptr g
out dx,al
mov al,byte ptr b
out dx,al
}
}
void plasmacol(int xl,int yo,int x,int y,int xr,int yu)
{
int col;
if(point13h(x,y)==0)
{
col=xr-xl+yu-yo;
col=random(col*3)-col;
col=col+point13h(xl,yo)+point13h(xr,yu)>>1;
if(col<1) col=1;
if(col>189) col=189;
pset13h(x,y,col);
}
}
void makeplasma(unsigned int x1,unsigned int y1,
unsigned int x2,unsigned int y2)
{
int col;
unsigned int x,y;
if((x2-x1)>1)
{
x=(x1+x2)>>1;
y=(y1+y2)>>1;
plasmacol(x1,y1,x,y1,x2,y1);
plasmacol(x2,y1,x2,y,x2,y2);
plasmacol(x1,y2,x,y2,x2,y2);
plasmacol(x1,y1,x1,y,x1,y2);
col=(point13h(x,y1)+point13h(x2,y)+point13h(x,y2)+point13h(x1,y))>>2;
pset13h(x,y,col);
makeplasma(x1,y1,x,y);
makeplasma(x,y,x2,y2);
makeplasma(x1,y,x,y2);
makeplasma(x,y1,x2,y);
}
}
void plasmapal(char j)
{
char i;
for(i=63;i;i--)
{
setpal(i+j,0,i,i);
setpal(i+63+j,i,0,53-i);
setpal(i+126+j,43-i,i,i<<1);
}
}
void main(void)
{
unsigned int i;
unsigned char j=0;
char direction=1;
asm {
mov ax,13h
int 10h
mov ax,0a000h
mov es,ax
}
plasmapal(j++);
makeplasma(0,0,319,199);
for(i=0;i<=1000;i++)
{
if(j!=0) plasmapal(j);
j+=direction;
if(j==0) direction*=-1;
asm {
mov ah,86h
xor cx,cx
mov dx,ax
shl dx,1
int 15h
}
}
asm {
mov ax,3
int 10h
}
}
Quote:
// Plasma coded 1996 by The Real Adok
Ahhh... I see.. THE REAL ADOK...
Supplying that code is pretty pointless.
use crinkler lol :D
See If You Can Beat The Real Adok Contest '08
please stand up.
adok: Where do you get the idea that a 128 byte plasma effect is so impossible? Do you just start a new thread every time you see a comment on a random prod?
bash the adok with salt-less arguments round 57!
how about showing 128b plasmas or drink cup of stfu?
and yes, ofcourse it's possible and been done already, im quite sure pure asm versions with their source available are around in the database even. pirx will paste the urls soon.
how about showing 128b plasmas or drink cup of stfu?
and yes, ofcourse it's possible and been done already, im quite sure pure asm versions with their source available are around in the database even. pirx will paste the urls soon.
Pirx will also prove that 64kbytes for debris is a bit too much.
Advanced 128b plasma tutorial in the next Hugi \o/
doesn't compile
That code is horrible.
Code:
MODEL TINY
CODESEG
.386
IDEAL
ORG 100h
XSize = 25
YSize = 25
Start: mov al,13h
int 10h
push 0a000h
pop ds
Main: in al,40h
sbb di,ax
mov cl,YSize
Vert: push cx
mov cl,XSize
Horiz: inc byte ptr ds:[di]
inc di
loop Horiz
add di,320-XSize
pop cx
loop Vert
in al,60h
cmp al,3 ; \o/
jne Main
int 10h
ret
END Start
Quote:
The Real Adok
Quote:
The Real Adok
Quote:
The Real Adok
Quote:
The Real Adok
and for emphasis:
Quote:
The Real Adok
That boy is ooooon~~~~~~~ holler!
Doesn't look too nice when ported to processing. Is it supposed to have this kind of palette?
Ah I think I know what I did wrong now... You are writing colors outside the palette memory, and I simply %=256'd those outside values!
Looks a bit better now.
Most 128b's have really crappy palettes, but their motion and patterns are IMO often better than this.
Most 128b's have really crappy palettes, but their motion and patterns are IMO often better than this.
Yes, I've even seen a "plasma" effect sized 64b, but can you make this plasma in 128b or less?
BTW: The above code compiles with Borland C++ 3.1. The resulting executable worked on my PC using the DOSBox emulator.
http://www.pouet.net/prod.php?which=17702 (A good example)
http://www.pouet.net/prod.php?which=30528 (C16 PETSCII)
http://www.pouet.net/prod.php?which=28781 (Can't watch. Wrong screenshot?)
http://www.pouet.net/prod.php?which=30528 (C16 PETSCII)
http://www.pouet.net/prod.php?which=28781 (Can't watch. Wrong screenshot?)
Oh and.. http://www.pouet.net/prod.php?which=11680 (not exactly a good plasma :P)
Mmm,. I've just seen that the plasma wave is too ..wavy. Not my good plazma.
http://www.pouet.net/prod.php?which=50542
I just figured out that it could be quite easy to take my old code from siback, remove the blobs, remove several random stuff from the plasma calcs (but as much as it needed to still have nice plasma moves/shapes), maybe changed a bit the colors and voila. With vsync, escape button and proper exit to 03h. And even a non standard generated pallete.
I also remember that I once had a dream to make a 128b intro because I already did 32b, 64b and 256b and that was the only number remaining. But that was not what I had in mind :P
I believe it can be sort of done in 64b too but I a suck at size optimizing compared to some other people.
I just figured out that it could be quite easy to take my old code from siback, remove the blobs, remove several random stuff from the plasma calcs (but as much as it needed to still have nice plasma moves/shapes), maybe changed a bit the colors and voila. With vsync, escape button and proper exit to 03h. And even a non standard generated pallete.
I also remember that I once had a dream to make a 128b intro because I already did 32b, 64b and 256b and that was the only number remaining. But that was not what I had in mind :P
I believe it can be sort of done in 64b too but I a suck at size optimizing compared to some other people.
adok, this is not a plasma but a subdivision-cloud with color-cycling.
go learn your roots.
go learn your roots.
OK, nevertheless it's beautiful :)