1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69
|
#include <stdlib.h>
#include <stdio.h>
#include <dos.h>
#include <io.h>
static char Palette[4*3] = {0,0,0,0,0,63,0,63,0,63,0,0};
union REGS regset;
struct SREGS sregs;
void load13h()
{
regset.x.ax = 0x0013;
int86(0x10, ®set, ®set);
}
void exit13h()
{
getch();
regset.x.ax = 0x0003;
int86(0x10, ®set, ®set);
}
void drawpx(int x, int y, int coul)
{
int ptr = (320*y+x);
poke(0xA000,ptr,coul);
}
int getpx(int x, int y)
{
int ptr = (320*y+x);
return peek(0xA000,ptr);
}
void pal( unsigned char i, unsigned char r, unsigned char v, unsigned char b)
{
outp(0x3c8, i);
outp(0x3c9, r);
outp(0x3c9, v);
outp(0x3c9, b);
}
int main()
{
int color;
int CA,CB,CC,CD,CE,CF,CG,CH,CI;
long ptr;
load13h();
for(ptr=0; ptr<=64000;ptr++)
{
color=rand()%255;
poke(0xA000,ptr,color);
}
for(ptr=321; ptr<=63677;ptr++)
{
CA=peek(0xA000,ptr+321);
CB=peek(0xA000,ptr+320);
CC=peek(0xA000,ptr-321);
CD=peek(0xA000,ptr-320);
CE=peek(0xA000,ptr+319);
CF=peek(0xA000,ptr-319);
CG=peek(0xA000,ptr+1);
CH=peek(0xA000,ptr-1);
CI=peek(0xA000,ptr);
color = (CA+CB+CC+CD+CE+CF+CG+CH+CI)/10;
poke(0xA000,ptr,color);
}
exit13h();
} |
Partager