Предмет:
Тип роботи:
Курсова робота
К-сть сторінок:
82
Мова:
Українська
justify;">{$ELSE}
next_method,w6,w7:word;
{$ENDIF}
func_type : func_type_rec;
end;
system_info_ptr = ^system_info_rec;
system_info_rec = record
addr_ofs, flags : byte;
end;
const
record_id = 2;
object_id = 3;
objpriv_id = 4;
{$IFDEF UNIT60}
const_id = 80;
type_id = 81;
var_id = 82;
proc_id = 83;
sys_proc_id = 84;
sys_fn_id = 85;
sys_new_id = 86;
sys_port_id = 87;
sys_mem_id = 88;
unit_id = 89;
{$ELSE}
{BP 7.0}
const_id = $4f;
type_id = $50;
var_id = $51;
proc_id = $52;
unit_id = $53;
sys_proc_id = $56;
sys_fn_id = $57;
sys_new_id = $58;
sys_port_id = $59;
sys_mem_id = $5a;
sys_openstr_id = $5b;
{$ENDIF}
init_id = 128;
uses_id = 129;
local_id = 130;
referenced_id = 131;
refconst_id = 132;
var
known_types : tbyteset;
dump_types : tbyteset;
implementation
begin
known_types := [var_id,unit_id,const_id,type_id,proc_id,
sys_proc_id,sys_fn_id,sys_mem_id,sys_port_id,
sys_new_id
{$IFNDEF UNIT60}
,sys_openstr_id
{$ENDIF}
];
dump_types := [0..255] - known_types;
end.
Dump.pas
unit dump;
{$I SWITCHES.INC}
{ Various routines to dump memory to system.output }
interface
procedure dumpbytes(var loc;start,num:word);
procedure dumpwords(var loc;start,num:word);
function decword(w:word):string;
function hexbyte(b:byte):string;
function hexword(w:word):string;
function hexwordblank(w:word):string;
function hexwordasm(w:word):string;
implementation
uses
util;
function decword(w:word):string;
var S:string;
begin
Str(w,S);
decword:=S;
end;
function hexbyte(b:byte):string;
const
symbol : array[0..$f] of char = ('0','1','2','3','4','5','6','7',
'8','9','A','B','C','D','E','F');
begin
hexbyte := symbol[b shr 4] + symbol[b and $f];
end;
function hexword(w:word):string;
begin
hexword := hexbyte(hi(w))+hexbyte(lo(w));
end;
function hexwordblank(w:word):string;
var
i : byte;
h : string;
begin
h := hexword(w);
for i:=1 to length(h)-1 do
begin
if h[i] <> '0' then
begin
hexwordblank := h;
exit;
end;
h[i] := ' ';
end;
hexwordblank := h;
end;
function hexwordasm(w:word):string;
var
i : byte;
b : boolean;
h, h1 : string;
begin
h := hexword(w);
b:=false;
h1[0]:=#0;
for i := 1 to length(h) do
if b or (h[i]<>'0') then
begin
if not b and (h[i] in ['A'..'F']) then
begin
h1[1]:='0';
Inc(h1[0]);
end;
b:=true;
Inc(h1[0]);
h1[Ord(h1[0])]:=h[i];
end;
Inc(h1[0]);
h1[Ord(h1[0])]:='h';
hexwordasm:=h1;
end;
function legal(b:byte):char;
begin
if b<32 then
legal := '.'
else
legal := char(b);
end;
procedure dumpbytes(var loc;start,num:word);
var
bytes:array[0..65520] of byte absolute loc;
i,j:word;
procedure dumpascii(last:word);
var
j : word;
begin
for j:=0 to last do
begin
write(legal(bytes[i+start-$F+j]));
end;
end;
begin
if num = 0 then
exit;
for i:=0 to num-1 do
begin
case i mod 16 of
0: begin
writeln;