0 ' ******************* K484TIMR.BAS ********************** 1 ' 2 ' Revision 1.484 for Kaypro 4/84 clock 12/18/84 by Craig Thomas 3 ' 4 ' Alteration of Ver 1.4 by Steve Sanders 11/26/84 from MTIMER10.BAS 5 ' by Lawrence Davis 9/25/84 6 ' 7 ' This program must be compiled using BASCOM and OBSLIB.REL (/O) 8 ' A>BASCOM =K484TIMR /O 9 ' A>L80 K484TIMR/N/E 10 ' 11 ESC$=CHR$(27) 'ESCape (prefixes all video calls) 12 INVON$=ESC$+"B0" 'Inverse video ON 13 INVOFF$=ESC$+"C0" 'Inverse video OFF 14 DIMON$=ESC$+"B1" '1/2 intensity (dim mode) ON 15 DIMOFF$=ESC$+"C1" '1/2 OFF 16 BLINKON$=ESC$+"B2" 'blinking mode ON 17 BLINKOF$=ESC$+"C2" 'blinking OFF 18 BELL$=CHR$(7) 'bell 19 CLR$=CHR$(26) 'clear screen/home cursor 20 CURSRON$=ESC$+"B4" 21 CURSROFF$=ESC$+"C4" 22 ' 23 DIM L$(128),TIME(4) 24 PRINT CLR$ + INVON$; 25 PRINT " ** Kaypro 4'84 MEX Auto-Timer Program by Craig Thomas ** " +INVOFF$ 26 PRINT:PRINT 30 PRINT:PRINT 31 GOSUB 180 'gosub clock 32 PRINT "All clock times are 24-hour mode only ( 1:15pm = 13:15 )" 33 PRINT "Zeroes must be added for single digit times ( 1:12am = 01:12 )" 34 PRINT 35 PRINT "The current time is " + TM$ 36 PRINT BELL$ 40 INPUT "Enter desired STARTUP TIME (HH:MM) ",A$ 41 IF LEN(A$)<5 THEN 36 45 PRINT BELL$ 46 PRINT "Enter the Mex COMMAND LINE, max 128 chrs (eg. READ AUTO) " 47 INPUT "[MEX] >> ",M$ 48 IF M$ = "" THEN 45 49 IF LEN(M$)>128 THEN 45 50 PRINT CLR$ + INVON$+BLINKON$; 51 PRINT " MEX timer is running - leave computer turned ON "+INVOFF$+BLINKOF$ 52 PRINT:PRINT "[ Press K or CTRL-K to abort timer mode ]" 55 PRINT:PRINT "The COMMAND LINE is <"+M$+">" 56 PRINT:PRINT:PRINT "The STARTUP TIME is set for ";A$;":00" 60 PRINT 70 PRINT CURSROFF$ 80 GOSUB 180 'read clock 81 ' 82 ' The next routine will continuously update the current 83 ' time displayed on CRT until the timer runs MEX 84 ' 85 PRINT CHR$(13);"The CURRENT TIME is ";TIME$; 86 ' 90 IF TM$=A$ THEN 165 'Is it time? Yes, then run MEX No, keep looping 95 ' 96 ' The following routine checks the keyboard for an abort request 97 ' 100 BI=ASC(INKEY$+ " ") 101 IF BI=&HB OR BI=&H4B OR BI=&H6B THEN 202 102 ' 130 GOTO 80 'loop until set time = current time 150 ' 151 ' The following routine POKEs the MEX command into the 152 ' command buffer starting at 080h 153 ' 164 PRINT CURSRON$ 165 L=LEN(M$)+1 'Length of command line + space (20h) 166 POKE &H80,L 'Poke length into default buffer 167 POKE &H81,&H20 'poke space (20h) 168 J=130 'Decimal equivalent of 82h 169 FOR I%=1 TO LEN(M$) 'Loop times number of chars in command line 170 L$(I%)=MID$(M$,I%,1)'Assign a string variable to each char in comm. line 171 POKE J,ASC(L$(I%)) 'Poke command line into default buffer addresses 172 J=J+1 'Increment address counter 173 NEXT I% 'loop until done 174 ' 175 PRINT CLR$ + BELL$; 176 PRINT INVON$+BLINKON$+" Timer is auto-starting MEX "+BLINKOF$+INVOFF$ 177 PRINT:PRINT 178 RUN "MEX" 179 ' 180 ' clock routines for Kaypro 4/84 ports only 181 ' 182 DAT=36 ' port B data (024h) 183 COM=32 ' port B command (020h) 184 STAT=34 ' port B status (022h) 185 FOR DIGIT=2 TO 4 186 OUT STAT,15 187 OUT COM,12 188 OUT COM,DIGIT 189 BCD=INP(DAT) 190 TEN=INT(BCD/16) 191 ONE=BCD-TEN*16 192 TIME(DIGIT)=10*TEN+ONE 193 NEXT DIGIT 194 ' 195 ' TM$ is in HH:MM format TIME$ is in HH:MM:SS format 196 ' 197 TM$=STR$(TIME(4)+100)+":"+STR$(TIME(3)+100) 198 TM$=MID$(TM$,3,3)+MID$(TM$,8,2) 199 TIME$=STR$(TIME(2)+100) 200 TIME$=TM$+":"+MID$(TIME$,3,2) 201 RETURN 'got the time, now return 202 ' 203 ' Abort msg 204 PRINT CLR$+BLINKON$+">> MEX AUTO-TIMER ABORTED <<"+BLINKOF$+BELL$ 205 PRINT CURSRON$ 206 END