Was wondering off the top of my head how to make an old laptop (with a working clock battery) into a clock. I needed for this to be able to run from a floppy with no hard disk required. We can use either freedos or msdos for an operating system. Ancient stuff, but they have their rare uses.

Looked around the net for programs that could be compiled in basic. Most of the ones I found were no longer available or just were not what I was looking for. I found one and knew of a second one, but the source has long been lost.

So I took the one I had source code for and then wrote one of my own. you will be presented with a screen shot and the the code for the project.

Program 1.


'UNSEEN'S NOT A STANDARD CLOCK
DIM SEC AS STRING, MIN AS STRING, HR AS STRING
SCREEN 0: COLOR 3, 15: WIDTH 40, 25
CLS
DO
HR$ = LEFT$(TIME$, 2): MIN$ = MID$(TIME$, 4, 2): SEC$ = RIGHT$(TIME$, 2)
LOCATE 1, 1: PRINT HR$; ":"; MIN$; ":"; SEC$
'MINUTES
IF (VAL(MIN$) <  10 and val(min$) >= 5) OR (VAL(MIN$) >= 55 AND VAL(MIN$) < 60) THEN COLOR 12, 15
LOCATE 3, 2: PRINT "FIVE": COLOR 3, 15
IF VAL(MIN$) >= 10 AND VAL(MIN$) < 15 OR VAL(MIN$) >= 50 AND VAL(MIN$) < 55 THEN COLOR 12, 15
LOCATE 3, 8: PRINT "TEN": COLOR 3, 15
IF VAL(MIN$) >= 15 AND VAL(MIN$) < 20 OR VAL(MIN$) >= 45 AND VAL(MIN$) < 50 THEN COLOR 12, 15
LOCATE 3, 13: PRINT "FIFTEEN": COLOR 3, 15
IF VAL(MIN$) >= 20 AND VAL(MIN$) < 25 OR VAL(MIN$) >= 40 AND VAL(MIN$) < 45 THEN COLOR 12, 15
LOCATE 3, 21: PRINT "TWENTY": COLOR 3, 15
IF VAL(MIN$) >= 25 AND VAL(MIN$) < 30 OR VAL(MIN$) >= 35 AND VAL(MIN$) < 40 THEN COLOR 12, 15
LOCATE 3, 28: PRINT "TWENTY FIVE": COLOR 3, 15
LOCATE 7, 12: PRINT "MIN'S"
'EXTRA MINUTES
IF VAL(MIN$) > 30 THEN COLOR 12, 15
LOCATE 5, 3: PRINT "MINUS": COLOR 3, 15
IF VAL(MIN$) < 30 THEN COLOR 12, 15
LOCATE 5, 10: PRINT "PLUS": COLOR 3, 15
IF VAL(MID$(TIME$, 5, 1)) = 6 OR VAL(MID$(TIME$, 5, 1)) = 4 THEN COLOR 12, 15
LOCATE 7, 3: PRINT "1": COLOR 3, 15
IF VAL(MID$(TIME$, 5, 1)) = 7 OR VAL(MID$(TIME$, 5, 1)) = 3 THEN COLOR 12, 15
LOCATE 7, 5: PRINT "2": COLOR 3, 15
IF VAL(MID$(TIME$, 5, 1)) = 8 OR VAL(MID$(TIME$, 5, 1)) = 2 THEN COLOR 12, 15
LOCATE 7, 7: PRINT "3": COLOR 3, 15
IF VAL(MID$(TIME$, 5, 1)) = 9 OR VAL(MID$(TIME$, 5, 1)) = 1 THEN COLOR 12, 15
LOCATE 7, 9: PRINT "4": COLOR 3, 15
'TO PAST
IF VAL(MIN$) > 30 THEN COLOR 12, 15
LOCATE 9, 10: PRINT "TO THE NEXT HOUR": COLOR 3, 15
IF VAL(MIN$) <= 30 THEN COLOR 12, 15
LOCATE 9, 30: PRINT "PAST": : COLOR 3, 15
IF VAL(MIN$) = 30 THEN COLOR 12, 15
LOCATE 9, 36: PRINT "HALF ": COLOR 3, 15
'HOURS
IF VAL(HR$) = 1 OR VAL(HR$) = 13 THEN COLOR 12, 15
LOCATE 11, 2: PRINT "ONE": COLOR 3, 15
IF VAL(HR$) = 2 OR VAL(HR$) = 14 THEN COLOR 12, 15
LOCATE 11, 7: PRINT "TWO": COLOR 3, 15
IF VAL(HR$) = 3 OR VAL(HR$) = 15 THEN COLOR 12, 15
LOCATE 11, 12: PRINT "THREE": COLOR 3, 15
IF VAL(HR$) = 4 OR VAL(HR$) = 16 THEN COLOR 12, 15
LOCATE 11, 19: PRINT "FOUR": COLOR 3, 15
IF VAL(HR$) = 5 OR VAL(HR$) = 17 THEN COLOR 12, 15
LOCATE 11, 25: PRINT "FIVE": COLOR 3, 15
IF VAL(HR$) = 6 OR VAL(HR$) = 18 THEN COLOR 12, 15
LOCATE 11, 30: PRINT "SIX": COLOR 3, 15
IF VAL(HR$) = 7 OR VAL(HR$) = 19 THEN COLOR 12, 15
LOCATE 11, 35: PRINT "SEVEN": COLOR 3, 15
IF VAL(HR$) = 8 OR VAL(HR$) = 20 THEN COLOR 12, 15
LOCATE 12, 5: PRINT "EIGHT": COLOR 3, 15
IF VAL(HR$) = 9 OR VAL(HR$) = 21 THEN COLOR 12, 15
LOCATE 12, 12: PRINT "NINE": COLOR 3, 15
IF VAL(HR$) = 10 OR VAL(HR$) = 22 THEN COLOR 12, 15
LOCATE 12, 18: PRINT "TEN": COLOR 3, 15
IF VAL(HR$) = 11 OR VAL(HR$) = 23 THEN COLOR 12, 15
LOCATE 12, 23: PRINT "ELEVEN": COLOR 3, 15
IF VAL(HR$) = 0 OR VAL(HR$) = 12 THEN COLOR 12, 15
LOCATE 12, 31: PRINT "TWELVE": COLOR 3, 15
'AM-PM
IF VAL(HR$) >= 12 THEN COLOR 12, 15
LOCATE 16, 5: PRINT "PM": COLOR 3, 15
IF VAL(HR$) < 12 THEN COLOR 12, 15
LOCATE 16, 2: PRINT "AM": COLOR 3, 15
'SECONDS
COLOR 12, 15: LOCATE 19, 2: PRINT "AND"
COLOR 3, 15
IF VAL(SEC$) = 5 THEN COLOR 12, 15
LOCATE 21, 1: PRINT "5": COLOR 3, 15
IF VAL(SEC$) = 10 THEN COLOR 12, 15
LOCATE 21, 3: PRINT "10": COLOR 3, 15
IF VAL(SEC$) = 15 THEN COLOR 12, 15
LOCATE 21, 7: PRINT "15": COLOR 3, 15
IF VAL(SEC$) = 20 THEN COLOR 12, 15
LOCATE 21, 11: PRINT "20": COLOR 3, 15
IF VAL(SEC$) = 25 THEN COLOR 12, 15
LOCATE 21, 15: PRINT "25": COLOR 3, 15
IF VAL(SEC$) = 30 THEN COLOR 12, 15
LOCATE 21, 19: PRINT "30": COLOR 3, 15
IF VAL(SEC$) = 35 THEN COLOR 12, 15
LOCATE 21, 23: PRINT "35": COLOR 3, 15
IF VAL(SEC$) = 40 THEN COLOR 12, 15
LOCATE 21, 27: PRINT "40": COLOR 3, 15
IF VAL(SEC$) = 45 THEN COLOR 12, 15
LOCATE 21, 31: PRINT "45": COLOR 3, 15
IF VAL(SEC$) = 50 THEN COLOR 12, 15
LOCATE 21, 35: PRINT "50": COLOR 3, 15
IF VAL(SEC$) = 55 THEN COLOR 12, 15
LOCATE 21, 39: PRINT "55": COLOR 3, 15
COLOR 12, 15: LOCATE 23, 32: PRINT "SECONDS"
COLOR 3, 15
LOOP

Program 2.

'=====================================================================
' thetimeis
' author: computothought
'---------------------------------------------------------------------
' housekeeping
' arrays (data storage)
dim blank$(7)
dim num$(10,10)
dim colon$(7)
' data (ascii art 0-9 and a colon)
num$(0, 1) = "  ###  "
num$(0, 2) = " #   # "
num$(0, 3) = "# #   #"
num$(0, 4) = "#  #  #"
num$(0, 5) = "#   # #"
num$(0, 6) = " #   # "
num$(0, 7) = "  ###  "
num$(1, 1) = "   #   "
num$(1, 2) = "  ##   "
num$(1, 3) = " # #   "
num$(1, 4) = "   #   "
num$(1, 5) = "   #   "
num$(1, 6) = "   #   "
num$(1, 7) = " ##### "
num$(2, 1) = " ##### "
num$(2, 2) = "#     #"
num$(2, 3) = "      #"
num$(2, 4) = " ##### "
num$(2, 5) = "#      "
num$(2, 6) = "#      "
num$(2, 7) = "#######"
num$(3, 1) = " ##### "
num$(3, 2) = "#     #"
num$(3, 3) = "      #"
num$(3, 4) = " ##### "
num$(3, 5) = "      #"
num$(3, 6) = "#     #"
num$(3, 7) = " ##### "
num$(4, 1) = "#      "
num$(4, 2) = "#    # "
num$(4, 3) = "#    # "
num$(4, 4) = "#######"
num$(4, 5) = "     # "
num$(4, 6) = "     # "
num$(4, 7) = "     # "
num$(5, 1) = "#######"
num$(5, 2) = "#      "
num$(5, 3) = "#      "
num$(5, 4) = " ##### "
num$(5, 5) = "      #"
num$(5, 6) = "#     #"
num$(5, 7) = " ##### "
num$(6, 1) = " ##### "
num$(6, 2) = "#     #"
num$(6, 3) = "#      "
num$(6, 4) = "###### "
num$(6, 5) = "#     #"
num$(6, 6) = "#     #"
num$(6, 7) = " ##### "
num$(7, 1) = "#######"
num$(7, 2) = "#    # "
num$(7, 3) = "    #  "
num$(7, 4) = "   #   "
num$(7, 5) = "  #    "
num$(7, 6) = "  #    "
num$(7, 7) = "  #    "
num$(8, 1) = " ##### "
num$(8, 2) = "#     #"
num$(8, 3) = "#     #"
num$(8, 4) = " ##### "
num$(8, 5) = "#     #"
num$(8, 6) = "#     #"
num$(8, 7) = " ##### "
num$(9, 1) = " ##### "
num$(9, 2) = "#     #"
num$(9, 3) = "#     #"
num$(9, 4) = " ######"
num$(9, 5) = "      #"
num$(9, 6) = "#     #"
num$(9, 7) = " ##### "
colon$(1) = "  # "
colon$(2) = " # #"
colon$(3) = "  # "
colon$(4) = "    "
colon$(5) = "  # "
colon$(6) = " # #"
colon$(7) = "  # "
'-------------------------------------------------------------------- 
'the logic
'clear the string and print the header.
cls
locate 10,2: print"                                                                            #"
locate 11,2: print"  #####  #    #  ######     #####     #    #    #  ######    #     ####    # #" 
locate 12,2: print"    #    #    #  #            #       #    ##  ##  #         #    #         #"
locate 13,2: print"    #    ######  #####        #       #    # ## #  #####     #     ####"
locate 14,2: print"    #    #    #  #            #       #    #    #  #         #         #    #"
locate 15,2: print"    #    #    #  #            #       #    #    #  #         #    #    #   # #"
locate 16,2: print"    #    #    #  ######       #       #    #    #  ######    #     ####     #"
locate 17,2: print ""
'display left and right colons
locate 20,20: print colon$(1);
locate 21,20: print colon$(2);
locate 22,20: print colon$(3);
locate 23,20: print colon$(4);
locate 24,20: print colon$(5);
locate 25,20: print colon$(6);
locate 26,20: print colon$(7);
locate 20,50: print colon$(1);
locate 21,50: print colon$(2);
locate 22,50: print colon$(3);
locate 23,50: print colon$(4);
locate 24,50: print colon$(5);
locate 25,50: print colon$(6);
locate 26,50: print colon$(7);
'The big loop
true% = -1
while true%
'Get the time and separate
hrl$ = mid$(TIME$, 1,1): minl$ = MID$(TIME$, 4, 1): secl$ = mid$(TIME$, 7,1)
hrr$ = mid$(TIME$, 2,1): minr$ = MID$(TIME$, 5, 1): secr$ = mid$(TIME$, 8,1)
' display hour left
	locate 20,1: print num$(val(hrl$), 1);
	locate 21,1: print num$(val(hrl$), 2);
	locate 22,1: print num$(val(hrl$), 3);
	locate 23,1: print num$(val(hrl$), 4);
	locate 24,1: print num$(val(hrl$), 5);
	locate 25,1: print num$(val(hrl$), 6);
	locate 26,1: print num$(val(hrl$), 7);
' display hour right
	locate 20,10: print num$(val(hrr$), 1);
	locate 21,10: print num$(val(hrr$), 2);
	locate 22,10: print num$(val(hrr$), 3);
	locate 23,10: print num$(val(hrr$), 4);
	locate 24,10: print num$(val(hrr$), 5);
	locate 25,10: print num$(val(hrr$), 6);
	locate 26,10: print num$(val(hrr$), 7);
' display minute left
	locate 20,30: print num$(val(minl$), 1);
	locate 21,30: print num$(val(minl$), 2);
	locate 22,30: print num$(val(minl$), 3);
	locate 23,30: print num$(val(minl$), 4);
	locate 24,30: print num$(val(minl$), 5);
	locate 25,30: print num$(val(minl$), 6);
	locate 26,30: print num$(val(minl$), 7);
' display minute right
	locate 20,40: print num$(val(minr$), 1);
	locate 21,40: print num$(val(minr$), 2);
	locate 22,40: print num$(val(minr$), 3);
	locate 23,40: print num$(val(minr$), 4);
	locate 24,40: print num$(val(minr$), 5);
	locate 25,40: print num$(val(minr$), 6);
	locate 26,40: print num$(val(minr$), 7);
'display second left
	locate 20,60: print num$(val(secl$), 1);
	locate 21,60: print num$(val(secl$), 2);
	locate 22,60: print num$(val(secl$), 3);
	locate 23,60: print num$(val(secl$), 4);
	locate 24,60: print num$(val(secl$), 5);
	locate 25,60: print num$(val(secl$), 6);
	locate 26,60: print num$(val(secl$), 7);
'display second right
	locate 20,70: print num$(val(secr$), 1);
	locate 21,70: print num$(val(secr$), 2);
	locate 22,70: print num$(val(secr$), 3);
	locate 23,70: print num$(val(secr$), 4);
	locate 24,70: print num$(val(secr$), 5);
	locate 25,70: print num$(val(secr$), 6);
	locate 26,70: print num$(val(secr$), 7);
wend

Anyway once you have compiled the code, copy the executable to boot-able floppy and add the program’s name to the end of autoexec.bat so that it will auto-start. Reboot or start the laptop and you have an interesting possibly collectible clock.

Redid the eggs in purgatory with a little salad and added a pice of toast.

Good day.

Advertisements