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
/
MBUG
/
MBUG094.ARC
/
DISPSECT.PRO
< prev
next >
Wrap
Text File
|
1979-12-31
|
2KB
|
80 lines
{This will display a sector
**** SectorBuff is a type = array [0..127] of byte }
Procedure DisplaySector(Var Sector:SectorBuff);
var
ch :char;
count :integer;
x:integer;
const
InvB:string[2]=#27')';
InvE:string[2]=#27'(';{begin and end inverse}
CR :string[2]=#13#10;
Function Hex(x:byte) :char;
Var
HexDigit:String[1];
begin
if x<10 then str(x,hexDigit) else hexDigit:= Chr(x+55);
Hex:=HexDigit;
end;
Procedure BytetoHex(byt:byte);
Var
HexDigit1,HexDigit2:Char;
begin
HexDigit1 := Hex(trunc(byt/16));
HexDigit2 := Hex(byt mod 16);
Write(HexDigit1,HexDigit2);
end;
Procedure BytetoAscii(Byt:Byte);
Var
Ch:char;
Byt2:byte;
Highlight:Boolean;
begin
Highlight:=False;
If (Byt and $80) = $80 then begin
Highlight:=True;
Byt := $7F and Byt;
end;
If NOT(Byt in [32..125]) then begin
Highlight:=False;
Byt := Ord('.');
end;
If Highlight then lowvideo;
Write(Chr(Byt));
If Highlight then HighVideo;
end;
begin
Writeln;
writeln;
write(' ');
for x:=0 to 15 do write(' ',Hex(x));
write(' ');
for x:=0 to 15 do write(Hex(x));
writeln;
for count:=0 to 7 do begin
write(Hex(count),'0: ');
for x:=0 to 15 do
begin
BytetoHex(Sector[count*16+x]);
write(' ');
end;
Write(' ');
for x:=0 to 15 do BytetoAscii(Sector[count*16+x]);
Writeln;
end;
end;