Program read boot sector of diskette and separe LABEL
Delphi & Pascal (česká wiki)
Category: Source in Pascal
Program: Label.pas
File exe: Label.exe
File ubuntu: Label
Program: Label.pas
File exe: Label.exe
File ubuntu: Label
The program reads the floppy disk's boot sector and finds out the so-called "label" of the disk.
{ LABEL.PAS Copyright (c) TrSek alias Zdeno Sekerak } { Program precita boot sektor diskety a zisti menovku, tzv. label. } { } { Datum:28.05.1996 http://www.trsek.com } program na_fyzicke_zistenie_label; uses crt,dos; function DiskLabel(disk:char):string; var boot:array[0..1024] of char; reg:registers; i:integer; s:string; begin reg.ah:=$0; reg.dl:=$0; intr($13,reg); reg.ah:=2; reg.al:=1; {pocet sektorov 1} reg.cl:=2; {cislo pociatku sektorov 1} reg.ch:=0; {cislo stopy 0} reg.dh:=1; {cislo hlavy 1} if UpCase(disk)='A' then reg.dl:=0 { cislo disku 0 - A } else reg.dl:=1; { 1 - B } reg.es:=seg(boot); {adresa pameti} reg.bx:=ofs(boot); intr($13,reg); {ak chyba cislo v reg.ah} s:=''; for i:=$120 to $12A do s:=s+boot[i]; DiskLabel:=s; end; begin WriteLn; WriteLn('Disketa A: ma meno: ',DiskLabel('a')); end.