{ DISKREAD.PAS Copyright (c) TrSek alias Zdeno Sekerak } { Fyzicky cita disketu a nasledne zobrazuje jej obsah. } { Sipkami a klavesami PgUp, PgDn sa da zmenit stopa/sektor/hlava } { } { Datum:24.07.1997 http://www.trsek.com } program fyzicke_citanie_disku; uses crt,dos; const poc=1; dlz=512; hex:array[0..15] of char= ('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F'); var reg:registers; x,y,i,za,st,hl:integer; ch:char; s:string; ako,auto:boolean; text:array[0..poc*dlz] of byte; procedure farba(f,g:integer); begin textbackground(f); textcolor(g); lowvideo; end; procedure hexa(p:integer); begin clrscr; writeln('stav operacie:',reg.ah,' pocet nacitanych sektorov:',reg.al,' sektor:',za,' stopa:',st,' hlava:',hl); for i:=1 to 8 do write('ÄÄÄÄ5ÄÄÄÄ0'); for x:=0 to 25 do for y:=0 to 20 do begin gotoxy(x+1,y+3); i:=x+y*26; if p=i then farba(white,black); if ord(text[i])>31 then write(chr(text[i])) else write('.'); gotoxy(29+x*2,y+3); if (i/2)=int(i/2) then farba(black,white) else farba(white,black); write(hex[text[i] div 16],hex[text[i] mod 16]); farba(black,white); if (x+y*26)=511 then begin gotoxy(x,y+3);write('°');end; end; for i:=1 to 8 do write('ÄÄÄÄ5ÄÄÄÄ0'); write('Zmena sektoru: ',+chr(26)+''+chr(27)+' Zmena stopy: '+chr(24)+''+chr(25)+' Zmena vypisu: F3 Ukoncit: ESC '); end; procedure norm(p:integer); begin clrscr; writeln('stav operacie:',reg.ah,' pocet nacitanych sektorov:',reg.al,' sektor:',za,' stopa:',st,' hlava:',hl); for i:=1 to 8 do write('ÄÄÄÄ5ÄÄÄÄ0'); for x:=0 to poc*dlz-1 do begin if p=x then farba(white,black); if ord(text[x])>31 then write(chr(text[x])) else write('.'); if p=x then farba(black,white); end; write('Û'); writeln; for i:=1 to 8 do write('ÄÄÄÄ5ÄÄÄÄ0'); write('Zmena sektoru: ',+chr(26)+''+chr(27)+' stopy: '+chr(24)+''+chr(25)+ ' hlavy: F4 vypisu: F3 Ukoncit: ESC '); end; procedure citaj; begin for x:=0 to poc*dlz do text[x]:=176; reg.ah:=$0; reg.dl:=$0; intr($13,reg); reg.ah:=2; reg.al:=poc; {pocet sektorov 1} reg.cl:=za; {cislo pociatku sektorov 1} reg.ch:=st; {cislo stopy 0} reg.dh:=hl; {cislo hlavicky 0} reg.dl:=0; {cislo disku 0} reg.es:=seg(text); {adresa pameti} reg.bx:=ofs(text); intr($13,reg); end; function pos(s:string):integer; var i,ip:integer; z:string; begin for i:=0 to poc*dlz-length(s)+1 do if chr(text[i])=s[1] then begin z:=''; for ip:=0 to length(s)-1 do z:=z+chr(text[i+ip]); if z=s then begin pos:=i;exit;end; end; pos:=0; end; begin clrscr;za:=1;st:=0;ako:=true;hl:=0;auto:=false; repeat citaj; if auto then begin repeat za:=za+1; citaj; if (reg.al=0) and (za=1) then begin hl:=hl+1;st:=0;za:=0;reg.al:=1;end; if reg.al=0 then begin za:=0;st:=st+1;end; farba(black,white); gotoxy(1,4);write('Stopa:',za,' sektor:',st,' hlava:',hl,' '); i:=pos(s); if i>0 then begin if ako then norm(i) else hexa(i); repeat until (readkey in [#13,#27]); clrscr;end; until ((hl>=2) or keypressed); ch:=readkey;ch:=chr(65); auto:=false;end; if ako then norm(-1) else hexa(-1); repeat ch:=readkey; if ch=#13 then begin clrscr;gotoxy(1,3);write('Sektor:');read(za); clrscr;gotoxy(1,3);write('Stopa :');read(st); clrscr;gotoxy(1,3);write('Hlava :');read(hl); clrscr;end; if ch=#0 then begin ch:=readkey; if ch=#72 then za:=za-1; if ch=#80 then za:=za+1; if ch=#75 then st:=st-1; if ch=#77 then st:=st+1; if ch=#62 then hl:=hl+1; if ch=#65 then begin clrscr;gotoxy(1,3);write('Retazec:');readln(s); auto:=true;end; if ch=#61 then begin ako:=not(ako); if ako then norm(-1) else hexa(-1); end; if hl>1 then hl:=0; if za<1 then za:=1; if st<0 then st:=0; end; until (ch in [#13,#27,#72,#80,#75,#77,#62,#65]); until (ch in [#27]); end.