home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
ftp.barnyard.co.uk
/
2015.02.ftp.barnyard.co.uk.tar
/
ftp.barnyard.co.uk
/
cpm
/
walnut-creek-CDROM
/
BEEHIVE
/
UTILITYS
/
FNTM2-11.ARK
/
WINDOWS.INC
< prev
Wrap
Text File
|
1989-09-27
|
4KB
|
131 lines
{This is the windows.inc window handling module.
It needs some of the constructs etc defined for the SCRH.INC module
VAR
screen_data:array[1..8192] of byte;
screen_pointer:integer; <---- this is the pointer into the array!
NB this same sort of routine was whipped up by me in assembler, but i have no
idea how to interface T.P. to it!
Summary of accessible routines contained in this file:
PushWind (x,y,w,h) Takes the screen data at x,y and saves w columns
and h rows (including colour and attributes) to
memory
PopWind Pops the most recent window off the stack
Window (x,y,w,h,title,opt) Draws a border around the area w by h at x,y and
titles it. What's behind it is saved if opt is true
}
procedure get_ret(i:integer;opt:boolean;var t2:integer);
begin
if opt then
begin
screen_data[t2]:=mem[i]; t2:=t2+1;
if colour then
begin
port [8]:=$40; screen_data[t2]:=mem[i+2048]; port[8]:=0; t2:=t2+1;
end;
if premium then
begin
port[$1c]:=port[$1c] or $10;
screen_data[t2]:=mem[i]; t2:=t2+1;
port[$1c]:=port[$1c] and $ef;
end;
end
else
begin
if premium then
begin
port[$1c]:=port[$1c] or $10;
t2:=t2-1; mem[i]:=screen_data[t2];
port[$1c]:=port[$1c] and $ef;
end;
if colour then
begin
t2:=t2-1; port [8]:=$40; mem[i+2048]:=screen_data[t2]; port[8]:=0;
end;
t2:=t2-1; mem[i]:=screen_data[t2];
end;
end;
procedure pushwind(x,y,b,l:integer);
var
temp,j,k,z:integer;
begin
if (l>0) and (b>0) and (x>0) and (y>0) then
begin
temp:=screen_pointer;
z:=$f000+(y-1)*80+(x-1);
for j:=1 to l do
begin
for k:=1 to b do
begin
get_ret(z+(j-1)*80+k-1,true,temp);
end;
end;
screen_data[temp]:=l;
temp:=temp+1; screen_data[temp]:=b;
temp:=temp+1; screen_data[temp]:=x;
temp:=temp+1; screen_data[temp]:=y; temp:=temp+1;
if temp<8192 then screen_pointer:=temp;
end;
end;
procedure popwind;
var
t,i,j,z,x,y,l,b: integer;
begin
t:=screen_pointer;
t:=t-1; y:=screen_data[t];
t:=t-1; x:=screen_data[t];
t:=t-1; b:=screen_data[t];
t:=t-1; l:=screen_data[t];
z:=$f000+(y-1)*80+x-1;
for i:=l downto 1 do
begin
for j:=b downto 1 do get_ret(z+(i-1)*80+j-1,false,t);
end;
screen_pointer:=t;
end;
{
This procedure draws a window of width w,height h lines, at
co-ordinates specified by x,y (1,1 being top right-hand corner
of screen)
the dimensions include the delimiting character at the borders
of the screen.
}
procedure window(x,y,w,h:integer;title:str80;opt:boolean);
var
z,i,j,k,centre:integer;
begin
if opt then pushwind(x,y,w,h);
setpcg(0); setcolor(3);
z:=$f000+(y-1)*80+x-1;
putchar(z,$a0);
for i:=1 to w-2 do putchar(z+i,$a0);
putchar(z+i+1,$a0);
if h>=2 then
begin
for i:= 1 to h-2 do
begin
k:=z+i*80;
putchar(k,$a0);
for j:=1 to w-2 do putchar(k+j,$20);
putchar(k+w-1,$a0);
end;
k:=z+(h-1)*80;
putchar(k,$a0);
for i:=1 to w-2 do putchar(k+i,$a0);
putchar(k+w-1,$a0);
i:=(w-length(title)) div 2;
putat(x+i-1,y); use('P'); setcolor(11); {centre justify the title}
print (' '+title+' '); setcolor(3); use('p'); {inverse characters}
end;
end;