phat code Is the glass half empty, half full, or twice as large as it needs to be?
Main

Projects

Downloads

Articles

Links

Forum

 

View Message

Back to Messages
Peter Swinkels Tue Oct 1 2024 at 2:09 pm
A small QBasic program that can read from CLOCK$->
 
 
'Does not work in DOSBox without booting into actual MS-DOS.

DEFINT A-Z

TYPE ClockStr
 Days AS INTEGER
 Minutes AS STRING * 1
 Hours AS STRING * 1
 Seconds100ths AS STRING * 1
 Seconds AS STRING * 1
END TYPE

DECLARE SUB ReadClock (Clock AS ClockStr)

DIM Clock AS ClockStr

CLS

DO
 ReadClock Clock
 LOCATE 1, 1
 PRINT USING " Days since 01-jan-1980: #####"; Clock.Days
 PRINT USING "                  Hours: ##"; ASC(Clock.Hours)
 PRINT USING "                Minutes: ##"; ASC(Clock.Minutes)
 PRINT USING "                Seconds: ##"; ASC(Clock.Seconds)
 PRINT USING "   Hundreths of seconds: ##"; ASC(Clock.Seconds100ths)
LOOP

SUB ReadClock (Clock AS ClockStr)
DIM FileH AS INTEGER

 FileH = FREEFILE
 OPEN "CLOCK$" FOR BINARY LOCK READ WRITE AS FileH
  GET #FileH, , Clock
 CLOSE FileH
END SUB
 
 
 
 

Reply to this Message

Name
Subject
Message

No HTML is allowed, except for <code> <b> <i> <u> in the message only.
All URLs and email addresses will automatically be converted to hyperlinks.