home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Simtel MSDOS - Coast to Coast
/
simteldosarchivecoasttocoast.iso
/
pcmag
/
vol8n05.zip
/
BINARY.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1989-02-06
|
827b
|
32 lines
PROGRAM Binary;
USES Crt; {<== Comment out this line for TP3}
{ This program displays a binary number from 0 to 7
using the Caps/Num/Scroll Lock LED indicators. }
TYPE LEDnum = 0..7;
VAR B : Byte;
dummy : char;
PROCEDURE BinLed(L : LEDnum);
VAR ShiftByte : byte absolute $0000:$0417;
{ shift status byte }
BEGIN
ShiftByte := L SHL 4;
END;
BEGIN
WriteLn('Press a key to display binary numbers on the LEDs.');
WriteLn('Press another key to stop the display.');
dummy := ReadKey; {<== comment out this line for TP3}
{Read(Kbd,dummy);} {<== UN-comment this line for TP3}
B := 0;
REPEAT
WriteLn('Displaying ',B);
BinLed(B);
Delay(1000);
B := Succ(B) MOD 8;
UNTIL KeyPressed;
BinLed(0); {Turn off shift states!}
END. { PROGRAM Binary }