Pasteur wrote in the message: <6pavvf$pq...@nslave1.tin.it>...
Quote
>I Have read an HTML page about SVGA programming :
>http://www.escape.ca/~rrrobins/Forum/fr070296.html
>An I Have tried to create a trial program that must draw all the screen
with
>a single color. It isn't very usefull but 'll must explain me how to use
>SVGA.
>It don't function, it draws always first 64 K pixel.
>PROGRAM Prova;
>USES DOS,CRT;
>VAR Reg : Registers;
> A:CHAR;
> I,L : WORD;
>BEGIN
>Reg.AX := $4F02;
>Reg.BX := $103;
>intr ($10,Reg);
>FOR L:= 0 TO 4 DO
>BEGIN
>Reg.AX := $4F05;
>Reg.BX := L;
>Reg.BH := 0;
>Reg.DX := 65535;
>Intr ($10,Reg);
>FOR I:= 0 To 65535 DO
>BEGIN
> MEM [$A000:I] := 68;
>END;
>END;
>END.
>If someone can expalin me where is the problem !!!
>Thank you!!
Maybe I can help you.
I propose you use BIOS it's will work correctly with DOS inside Windows 95 &
NT.
That's procedures:
procedure PutPixel(x,y : integer;Color : word); assembler;
asm
mov cx, X
mov dx, Y
mov ax, Color
mov ah, $0C
int $10
end;
function GetPixel(x,y : integer): word; assembler;
asm
mov cx, X
mov dx, Y
mov ah, $0D
int $10
mov ah, 0
end;
procedure Line(XA,YA,XB,YB : integer;Color : word); assembler;
var
K, DeltaX,DeltaY,StepX,StepY : integer;
asm
mov ax, YB
sub ax, YA
jns @001
neg ax
@001:
mov DeltaY, ax
mov ax, XB
sub ax, XA
jns @002
neg ax
@002:
mov DeltaX, ax
cmp ax, 0
jnz @003
mov ax, 0
mov K, ax
jz @004
@003:
mov ax, DeltaX
shr ax, 1
neg ax
mov K, ax
@004:
mov ax, 1
mov bx, XB
cmp bx, XA
ja @005
neg ax
@005:
mov StepX, ax
mov ax, 1
mov bx, YB
cmp bx, YA
ja @006
neg ax
@006:
mov StepY, ax
mov cx, XA
mov dx, YA
mov ax, Color
push dx
mov ah, $0C
int $10
pop dx
@loop:
cmp cx, XB
jnz @007
cmp dx, YB
jz @008
@007:
mov ax, K
sub ax, 0
jns @009
add cx, StepX
add ax, DeltaY
mov K, ax
@009:
cmp dx, YB
jz @010
add dx, StepY
sub ax, DeltaX
mov K, ax
@010:
mov ax, Color
push dx
mov ah, $0C
int $10
pop dx
jmp @loop
@008:
end;
procedure Circle(x,y,r : integer;Color : word);
var
StepX,StepY,i : integer;
begin
for i:=0 to r-(r shr 2) do
begin
StepX:=Round(sqrt(sqr(R)-sqr(i)));
PutPixel(x+stepx,y+i,Color);
PutPixel(x-stepX,y+i,color);
putpixel(x+stepx,y-i,color);
putpixel(x-stepx,y-i,color);
end;
for i:=0 to r-(r shr 2) do
begin
StepY:=round(sqrt(sqr(r)-sqr(i)));
putpixel(x+i,y+stepy,color);
putpixel(x-i,y+stepy,color);
putpixel(x+i,y-stepy,color);
putpixel(x-i,y-stepy,color);
end;
end;
procedure SetRGBPal(Palette : RGBPalette);
var
reg : registers;
begin
reg.ax:=$1012;
reg.bx:=$0;
reg.cx:=256;
reg.es:=Seg(Palette);
reg.dx:=Ofs(Palette);
Intr($10,reg);
end;
procedure DefaultRGBPal(var Palette : RGBPalette);
var
Color: word;
begin
for Color:=1 to 63 do
begin
Palette[Color,1]:=255-Color;
Palette[Color,2]:=20;
Palette[Color,3]:=192+Color;
end;
for Color:=64 to 127 do
begin
Palette[Color,1]:=10;
Palette[Color,2]:=64+Color;
Palette[Color,3]:=255-Color+64;
end;
for Color:=128 to 191 do
begin
Palette[Color,1]:=192+Color-128;
Palette[Color,2]:=255;
Palette[Color,3]:=15;
end;
for Color:=192 to 254 do
begin
Palette[Color,1]:=255;
Palette[Color,2]:=255-Color+192;
Palette[Color,3]:=192+Color-192;
end;
Palette[255,1]:=63;
Palette[255,2]:=63;
Palette[255,3]:=63;
end;
If you want change segment of video memory only put one pixel via procedure
PutPixel and you have new 64k block to addres.
I have somewhere procedures to not BIOS and if I find & remember I write to
you.
Bye !!!
rade...@friko6.onet.pl
Rados3aw Kapu?ci?ski
Gliwice, Poland