320 X 200 with 256 colours
Author Message
320 X 200 with 256 colours

I wrote this in  Pascal 3.0
type reg_pack = record
ax,bx,cx,dx,bp,ds,es,di,flags : integer
end;
var screen : array[1..2,1..32767] of byte absolute \$A000 : \$0;
registers : reg_pack;
procedure initscreen;
begin
fillchar(screen,sizeof(screen),chr(0));
registers.ax := 19;
intr(\$10,registers);
end;
procedure pixel(x,y : integer; colour : byte);
begin
if X > 640 then begin
pos := 2;
x := x - 320;
end
else pos := 1;
if (x < 0) or (x > 320) or (y > 200) or (y < 0) then exit;
beeldscherm[pos,x * 320 + y - 320] := kleur
end;

is there anyone who could make an better pixel-assignement?

Wed, 18 Jun 1902 08:00:00 GMT
320 X 200 with 256 colours

Hmm.... I think you have something messed up a little here :)
You say you are using pascal 3.0 - that's a VERY old version so I don't
know if the following code will work...

Quote:
> type reg_pack = record
>                                ax,bx,cx,dx,bp,ds,es,di,flags : integer
>                              end;
> var screen : array[1..2,1..32767] of byte absolute \$A000 : \$0;
>        registers : reg_pack;

Why do you define your screen as a 2D-array ?? Why not just :

var
Screen : array[0..64000] of byte absolute \$A000:\$0;

Quote:
> procedure pixel(x,y : integer; colour : byte);
>  begin
>   if X > 640 then begin
>                                 pos := 2;
>                                 x := x - 320;
>                             end
>                     else pos := 1;
>  if (x < 0) or (x > 320) or (y > 200) or (y < 0) then exit;
> beeldscherm[pos,x * 320 + y - 320] := kleur
> end;

I really don't catch your idea here ??? If (X > 640) ???  But we're in a
screenmode where X always should be < 320 ??
Take a look at this PutPixel Procedure :

PROCEDURE PutPixel(x,y : word; color : byte);
BEGIN
Screen[ Y * 320 + X] := color;
END;

If you DO have a limitation on your Screen-Array you should define it as
two Screenhalves like this : (Note that 32000 bytes is EXACTLY half the
screen)

VAR
Screen : Array[1..2,0..32000] of byte absolute \$A000:\$0

And then the PutPixel would be :

PROCEDURE PutPixel(x,y : word; color : byte);
BEGIN
if (y<100) then  {we're in upper half of screen}
Screen[1, Y * 320 + X] := color
else                 {in lower half of screen}
Screen[2, Y * 160 + X] := color;
END;

CU
Telemachos ~ PXD

Wed, 18 Jun 1902 08:00:00 GMT

 Page 1 of 1 [ 2 post ]

Relevant Pages