Diagnostic Programs
BASIC Code Listings
AT CMOS SETUP UTILTY

1200 REM ==== CMOS SETUP UTILITY ====
1205 DIM C%(64)
1210 GOSUB 1600: REM get current setup
1220 GOSUB 1800: REM display it
1230 GOSUB 1500: REM display menu
1240 IF A$ = "E" OR A$ = "e" THEN GOSUB 1400: GOTO 1220
1242 IF A$ = "R" OR A$ = "r" THEN GOSUB 1700: GOTO 1220
1246 IF A$ = "S" OR A$ = "s" THEN GOSUB 1650: GOTO 1220
1248 IF A$ = "W" OR A$ = "w" THEN GOSUB 1750: GOTO 1210
1250 END
1400 REM ==== Edit date/time ====
1403 LOCATE 22, 1: INPUT "Enter time - HH:", A$
1406 C%(5) = VAL("&H" + A$)
1408 LOCATE 22, 21: INPUT " MM:", A$
1410 C%(3) = VAL("&H" + A$)
1412 LOCATE 22, 29: INPUT " SS:", A$
1414 C%(1) = VAL("&H" + A$)
1420 LOCATE 23, 1: INPUT "Enter date - MM:", A$
1422 C%(9) = VAL("&H" + A$)
1424 LOCATE 23, 21: INPUT " DD:", A$
1426 C%(8) = VAL("&H" + A$)
1428 LOCATE 23, 29: INPUT " YY:", A$
1430 C%(10) = VAL("&H" + A$)
1432 S% = 0
1434 RETURN
1500 REM ==== Display menu ====
1510 LOCATE 25, 1
1520 PRINT "[R]ead from disk [S]ave to disk [W]rite to CMOS [E]dit date/time e[X]it";
1534 A$ = INKEY$: IF A$ = "" THEN 1534
1536 IF A$ = "E" OR A$ = "R" OR A$ = "S" OR A$ = "W" OR A$ = "X" THEN 1550
1538 IF A$ = "e" OR A$ = "r" OR A$ = "s" OR A$ = "w" OR A$ = "x" THEN 1550
1540 GOTO 1534
1550 RETURN
1600 REM ==== Get CMOS contents ====
1610 C$ = "Current CMOS settings": S% = 10
1620 FOR I% = 0 TO 63: OUT 112, I%: C%(I% + 1) = INP(113): NEXT I%
1630 RETURN
1650 REM ==== Save CMOS contents ====
1652 LOCATE 22, 1
1655 INPUT "Enter filename : ", F$
1660 INPUT "Enter description: ", C$
1665 OPEN F$ FOR OUTPUT AS #1
1670 PRINT #1, C$
1675 FOR I% = 0 TO 63: PRINT #1, C%(I% + 1): NEXT I%
1680 CLOSE #1
1690 RETURN
1700 REM ==== Load data from file ====
1702 ON ERROR GOTO 1730: S% = 10
1705 LOCATE 22, 1: INPUT "Enter filename : ", F$
1710 OPEN F$ FOR INPUT AS #1
1715 INPUT #1, C$
1720 FOR I% = 0 TO 63: INPUT #1, C%(I% + 1): NEXT I%
1725 FOR I% = 1 TO 6: C%(I%) = 0: NEXT I%
1728 GOTO 1740
1730 PRINT "File not found. Press any key"
1732 C$ = INKEY$: IF C$ = "" THEN 1732
1735 RESUME 1745
1740 ON ERROR GOTO 0
1742 CLOSE #1
1745 RETURN
1750 REM ==== Write data to CMOS RAM ====
1760 FOR I% = S% TO 63: OUT 112, I%: OUT 113, C%(I% + 1): NEXT I%
1770 RETURN
1800 REM ==== Display CMOS contents ====
1810 I% = C%(1): GOSUB 1950: SS% = I%: REM Time (seconds)
1811 I% = C%(3): GOSUB 1950: MM% = I%: REM Time (minutes)
1812 I% = C%(5): GOSUB 1950: HH% = I%: REM Time (hours)
1813 I% = C%(8): GOSUB 1950: DD% = I%: REM Date (day)
1814 I% = C%(9): GOSUB 1950: MN% = I%: REM Date (month)
1815 I% = C%(10): GOSUB 1950: YY% = I%: REM Date (year)
1820 MB% = C%(22) + C%(23) * 256
1821 MX% = C%(24) + C%(25) * 256
1825 DA% = INT(C%(17) / 16): DB% = C%(17) - DA% * 16: REM Drives A: and B:
1830 D0% = C%(26): REM Hard drive 0 (C)
1831 D1% = C%(27): REM Hard drive 1 (D)
1840 CLS
1841 PRINT , "AT CMOS Setup Utility": PRINT
1842 PRINT , C$: PRINT
1850 PRINT " Time:", , RIGHT$(STR$(HH% + 100), 2); ":"; RIGHT$(STR$(MM% + 100), 2); ":"; RIGHT$(STR$(SS% + 100), 2)
1852 PRINT " Date:", , RIGHT$(STR$(MN% + 100), 2); "/"; RIGHT$(STR$(DD% + 100), 2); "/"; RIGHT$(STR$(YY% + 100), 2)
1854 PRINT " Base memory size:", MB%; "K bytes"
1856 PRINT " Extended memory size:", MX%; "K bytes"
1858 PRINT " Diskette drive A:", : I% = DA%: GOSUB 1990
1860 PRINT " Diskette drive B:", : I% = DB%: GOSUB 1990
1862 PRINT " Hard disk 0:", , : I% = D0%: GOSUB 1980
1864 PRINT " Hard disk 1:", , : I% = D1%: GOSUB 1980
1880 RETURN
1950 REM == Convert BCD to decimal ===
1952 I% = I% - INT(I% / 16) * 16 + INT(I% / 16) * 10
1954 RETURN
1980 REM == Print hard disk type ==
1981 IF I% = 0 THEN PRINT "Not installed" ELSE PRINT I%
1989 RETURN
1990 REM == Print diskette type ==
1991 IF I% = 0 THEN PRINT "Not installed"
1992 IF I% = 1 THEN PRINT "5' 360Kb DS/DD"
1993 IF I% = 2 THEN PRINT "5' 1.2Mb DS/HD"
1994 IF I% = 3 THEN PRINT "3' 720Kb DS/DD"
1995 IF I% = 4 THEN PRINT "3' 1.44Mb DS/HD"
1996 IF I% > 4 THEN PRINT "unknown"
1998 RETURN