home *** CD-ROM | disk | FTP | other *** search
- { }
- { SHADING BOBS ;) }
- { Pascal version- No coprocesor ;( }
- { March 96 Crom / Spanish Lords }
- Program ShadingBobs;
-
- Uses
- DemoVga, Crt;
-
- Const
- SprPic : array[0..15,0..15] of byte = (
- (0,0,0,0,0,0,2,2,2,2,0,0,0,0,0,0),
- (0,0,0,0,2,2,2,2,2,2,2,2,0,0,0,0),
- (0,0,0,2,2,2,2,2,2,2,2,2,2,0,0,0),
- (0,0,2,2,2,2,2,4,4,2,2,2,2,2,0,0),
- (0,2,2,2,2,2,4,4,4,4,2,2,2,2,2,0),
- (0,2,2,2,2,4,4,8,8,4,4,2,2,2,2,0),
- (2,2,2,2,4,4,8,8,8,8,4,4,2,2,2,2),
- (2,2,2,2,4,4,8,16,16,8,4,4,2,2,2,2),
- (2,2,2,2,4,4,8,8,8,8,4,4,2,2,2,2),
- (0,2,2,2,2,4,4,8,8,4,4,2,2,2,2,0),
- (0,2,2,2,2,2,4,4,4,4,2,2,2,2,2,0),
- (0,0,2,2,2,2,2,4,4,2,2,2,2,2,0,0),
- (0,0,2,2,2,2,2,2,2,2,2,2,2,2,0,0),
- (0,0,0,2,2,2,2,2,2,2,2,2,2,0,0,0),
- (0,0,0,0,2,2,2,2,2,2,2,2,0,0,0,0),
- (0,0,0,0,0,0,2,2,2,2,0,0,0,0,0,0));
-
- Procedure PutSpriteShading (SegDes:Word; X,Y:Integer; Wide,Height:Byte; Sprite:pointer); assembler;
- asm
- push ds
- lds si,[Sprite]
- mov ax,SegDes
- mov es,ax
- cld
- mov ax,Y
- shl ax,6
- mov di,ax
- shl ax,2
- add di,ax
- add di,X
- mov bh,[Height]
- mov cx,320
- sub cl,[Wide]
- sbb ch,0
- @@AnotherLine:
- mov bl,[Wide]
- @@AnotherPix:
- mov al,ds:[si]
- inc si
- or al,al
- jz @@NoPutPix
- mov dl,es:[di]
- add dl,al
- and dl,7Fh
- mov es:[di],dl
- @@NoPutPix:
- inc di
- dec bl
- jnz @@AnotherPix
- add di,cx
- dec bh
- jnz @@AnotherLine
- pop ds
- end;
-
- Procedure Setpalette;
- Var
- NumCol : Byte;
- RGB : Byte;
- Begin
- For NumCol := 0 to 63 do
- Begin
- port[$3c8] := NumCol;
- port[$3c9] := 0;
- port[$3c9] := 0;
- port[$3c9] := NumCol;
- End;
- RGB:=NumCol;
- For NumCol := 64 to 127 do
- Begin
- port[$3c8] := NumCol;
- port[$3c9] := RGB;
- port[$3c9] := RGB;
- port[$3c9] := 63;
- Dec (RGB);
- End;
- End;
-
- Procedure LissajousShadeBobs;
- Const
- A1 = 145;
- A2 = 85;
- Var
- X,Y : Integer;
- Incw : Byte;
- t : Real;
- f : Real;
-
- Begin
- Incw := 2;
- f := 0;
- Repeat
- t:=0;
- Repeat
- X :=150+Trunc(A1*Cos(t));
- Y := 90+Trunc(A2*Cos((Incw*t)+f));
- t:=t+0.02;
- VerticalRetrace;
- PutSpriteShading ($A000,X,Y,16,16,addr(SprPic));
- Until (t>2*PI) or keypressed;
- f:=f+0.6;
- If f>=2*PI then f:=0;
- until (Keypressed);
- End;
-
- BEGIN
- McgaOn;
- SetPalette;
- LissajousShadeBobs;
- McgaOff;
- END.