home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC Interdit
/
pc-interdit.iso
/
rtclock
/
rtc.pas
< prev
next >
Wrap
Pascal/Delphi Source File
|
1994-10-11
|
5KB
|
225 lines
program rtc_unit;
uses crt,dos;
const
Rtc_Secondes = $00;
Rtc_Secondes_alarm = $01;
Rtc_Minutes = $02;
Rtc_Minutes_alarm = $03;
Rtc_Heures = $04;
Rtc_Heures_alarm = $05;
Rtc_Jour_semaine = $06;
Rtc_Jour_mois = $07;
Rtc_Mois = $08;
Rtc_Annee = $09;
Rtc_Etat_A = $0A;
Rtc_Etat_B = $0B;
Rtc_Etat_C = $0C;
Rtc_Etat_D = $0D;
Rtc_Diagnost_Etat = $0E;
Rtc_Shutdown_Etat = $0F;
Rtc_Floppy_Type = $10;
Rtc_HD_Type = $12;
Rtc_Equipement = $14;
Rtc_Lo_Basememory = $15;
Rtc_Hi_Basememory = $16;
Rtc_Lo_Extendedmem = $17;
Rtc_Hi_Extendedmem = $18;
Rtc_HD1_extended = $19;
Rtc_HD2_extended = $1A;
Rtc_Features = $1F;
Rtc_HD1_Lo_Cylinder = $20;
Rtc_HD1_Hi_Cylinder = $21;
Rtc_HD1_Tetes = $22;
Rtc_HD1_Lo_Precom = $23;
Rtc_HD1_Hi_Precom = $24;
Rtc_HD1_Lo_Landing = $25;
Rtc_HD1_Hi_Landing = $26;
Rtc_HD1_Secteurs = $27;
Rtc_Options1 = $28;
Rtc_Options2 = $2B;
Rtc_Options3 = $2C;
Rtc_Lo_Checksum = $2E;
Rtc_Hi_Checksum = $2F;
Rtc_Extendedmem_Lo = $30;
Rtc_Extendedmem_Hi = $31;
Rtc_Siecle = $32;
Rtc_Setup_Info = $33;
Rtc_CPU_speed = $34;
Rtc_HD2_Lo_Cylinder = $35;
Rtc_HD2_Hi_Cylinder = $36;
Rtc_HD2_Tetes = $37;
Rtc_HD2_Lo_Precom = $38;
Rtc_HD2_Hi_Precom = $39;
Rtc_HD2_Lo_Landing = $3A;
Rtc_HD2_Hi_Landing = $3B;
Rtc_HD2_Secteurs = $3C;
function wrhexb(b : byte) : string;
const hexcar : array[0..15] of char =
('0','1','2','3','4','5','6','7','8','9','A','B','C','D','E','F');
begin;
wrhexb := hexcar[(b shr 4)] + hexcar[(b AND $0F)];
end;
function wrhexw(w : word) : string;
begin;
wrhexw := '$'+wrhexb(hi(w))+wrhexb(lo(w));
end;
procedure write_rtc(Reg,val : byte);
{
Ecrit une valeur dans le registre RTC indiqué dans Reg
}
begin;
port[$70] := Reg;
port[$71] := val;
end;
function read_rtc(Reg : byte) : byte;
{Lit une valeur dans le registre RTC indiqué dans Reg}
begin;
port[$70] := Reg;
read_rtc := port[$71];
end;
Procedure Write_Floppy;
{
Affiche des informations sur les lecteurs de disquettes installés
}
Var Fl : byte;
Fls : array[1..2] of byte;
begin;
Fl := Read_Rtc(Rtc_Floppy_Type);
Fls[2] := Fl AND $0F;
Fls[1] := Fl SHR 4;
for Fl := 1 to 2 do begin;
write('Floppy ',Fl,': ');
case Fls[Fl] of
0 : begin;
writeln('No Floppy ');
end;
1 : begin;
writeln('5¼" Floppy, 360 KO');
end;
2 : begin;
writeln('5¼" Floppy, 1.2 MO');
end;
3 : begin;
writeln('3½" Floppy, 720 KO');
end;
4 : begin;
writeln('3½" Floppy, 1.44 MO');
end;
end;
end;
end;
Procedure Write_Hd;
{
Affiche le type du disque dur installé
}
Var Hd : byte;
Hds : array[1..2] of byte;
begin;
Hd := Read_Rtc(Rtc_HD_Type);
Hds[2] := Hd AND $0F;
Hds[1] := Hd SHR 4;
If HDs[1] = $F then HDs[1] := Read_Rtc(Rtc_HD1_extended);
If HDs[2] = $F then HDs[2] := Read_Rtc(Rtc_HD2_extended);
writeln('HD 1 : Type ',Hds[1]);
writeln('HD 2 : Type ',Hds[2]);
end;
procedure Write_Memory;
{
Affiche la mémoire disponible
}
var base,extended : word;
begin;
Base := 256 * Read_Rtc(Rtc_Hi_Basememory) +
Read_Rtc(Rtc_Lo_Basememory);
extended := 256 * Read_Rtc(Rtc_Hi_Extendedmem) +
Read_Rtc(Rtc_Lo_Extendedmem);
writeln('Base memory: ',Base,' KO');
writeln('Extended memory: ',extended,' KO');
end;
procedure Write_Display;
{
Affiche le type de la carte graphique et indique si un coprocesseur est installé
}
var dType : byte;
Copro : byte;
begin;
dType := Read_Rtc(Rtc_Equipement);
Copro := (dType AND 3) SHR 1;
dType := (dType AND 63) SHR 4;
case dType of
0 : begin;
writeln('Extended functionality GFX-Controller');
end;
1 : begin;
writeln('Color Display sur 40 colonnes');
end;
2 : begin;
writeln('Color Display sur 80 colonnes');
end;
3 : begin;
writeln('Monochrome Display Controller');
end;
end;
if Copro = 1 then
writeln('Coprocesseur trouvé')
else
writeln('Pas de coprocesseur trouvé');
end;
procedure write_shadow;
{
Indique les secteurs supportés par la shadow-Ram
}
var shadow : byte;
begin;
shadow := read_rtc(Rtc_Options1);
shadow := shadow AND 3;
case shadow of
0 : begin;
writeln('Shadow System AND Video Bios');
end;
1 : begin;
writeln('Shadow System Bios');
end;
2 : begin;
writeln('Shadow disabled');
end;
end;
end;
procedure write_cpuspeed;
{
Indique si l'unité centrale se trouve en mode Turbo
}
var speed : byte;
begin;
speed := read_rtc(Rtc_CPU_speed);
if speed = 1 then
writeln('CPU in Turbo-Mode')
else
writeln('CPU in Deturbo-Mode');
end;
begin;
clrscr;
Write_Floppy;
Write_Hd;
Write_Memory;
Write_Display;
Write_Shadow;
Write_CPUSpeed;
readln;
end.