Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- program zad2;
- uses dos, crt;
- var
- rej:registers;
- seg,ofs:word;
- i,j:byte;
- {-------------------------------------------------}
- function getAddress(r:registers):word;
- begin
- r.AH:=$52;
- intr($21,r);
- getAddress:=memw[r.ES:r.BX-2];
- end;
- function processName(seg:word):string;
- var
- i:byte;
- s:string;
- begin
- s:='';
- for i:=8 to 15 do
- s:=s+chr(mem[seg:i]);
- processName:=s;
- end;
- function writeMCB(seg:word;i:byte):word;
- begin
- gotoxy(2,i);
- write(seg);
- gotoxy(16,i);
- write(chr(mem[seg:0]));
- gotoxy(33,i);
- write(memw[seg:1]);
- gotoxy(39,i);
- write(memw[seg:3]);
- gotoxy(55,i);
- write(processName(seg));
- writeln;
- writeMCB:=memw[seg:3];
- gotoxy(1,i);
- end;
- {-------------------------------------------------}
- procedure writeLabels;
- begin
- gotoxy(2,2);
- write('Segment MCB');
- gotoxy(16,2);
- write('Rodzaj procesu');
- gotoxy(33,2);
- write('ID');
- gotoxy(39,2);
- write('Wielkosc bloku');
- gotoxy(55,2);
- write('Nazwa programu');
- gotoxy(2,4);
- end;
- {-------------------------------------------------}
- procedure verFrame(x:byte);
- var i:byte;
- begin
- if (x<>1) and (x<>80) then
- begin
- gotoxy(x,1);
- write(chr(203));
- gotoxy(x,24);
- write(chr(202));
- end;
- for i:=2 to 23 do
- begin
- gotoxy(x,i);
- write(chr(186));
- end;
- gotoxy(x,3);
- if (x<>1) and (x<>80) then
- write(chr(206))
- else if x=1 then
- write(chr(204))
- else write(chr(185));
- end;
- procedure frame;
- var i:byte;
- begin
- gotoxy(1,1);
- write(chr(201));
- for i:=2 to 79 do
- begin
- gotoxy(i,1);
- write(chr(205));
- end;
- gotoxy(80,1);
- write(chr(187));
- for i:=2 to 79 do
- begin
- gotoxy(i,3);
- write(chr(205));
- end;
- gotoxy(1,24);
- write(chr(200));
- for i:=2 to 79 do
- begin
- gotoxy(i,24);
- write(chr(205));
- end;
- gotoxy(80,24);
- write(chr(188));
- verFrame(1);
- verFrame(15);
- verFrame(32);
- verFrame(38);
- verFrame(54);
- verFrame(80);
- end;
- {-------------------------------------------------}
- begin
- clrscr;
- textbackground(1);
- for i:=1 to 24 do
- for j:=1 to 80 do
- begin
- gotoxy(j,i);
- write(' ');
- end;
- textbackground(3);
- textcolor(0);
- frame;
- textbackground(1);
- textcolor(15);
- writeLabels;
- readln;
- i:=4;
- seg:=getAddress(rej);
- ofs:=writeMCB(seg,i);
- repeat
- i:=i+1;
- seg:=seg+ofs+1;
- ofs:=writeMCB(seg,i);
- until (mem[seg:0]=90);
- readln;
- end.
Advertisement
Add Comment
Please, Sign In to add comment