1.0 Identification: RTCDRIVE 1.1 Program Title RTC driver for Altair Disk Extended BASIC Ver. 4.1 1.2 Program Language 8080 Assembly language 1.3 Program Type Subroutine 1.4 Contributor ID Eric P. Scott Computer Store of New York 2.0 Program Description This program provides the current time-of-day (in 24-hour time) and can initiate a user-defined procedure at a specified time. It uses the Real Time Clock board strapped for line frequency /1, and interrupt level 7. If a time limit is set, an "ERROR 21" is generated when it is reached. A "RESUME NEXT" will resume program execution after the appropriate user-specified action has been taken. 3.0 Operating Environment Real-time 3.1 Special Software Required Altair Disk Extended BASIC Ver. 4.1 3.2 Special Hardware Required 88-VI/RTC Vectored Interrupt/Real Time Clock board 4.0 Literature References Altair 8800 BASIC Reference Manual Version 4.1 88-Vector Interrupt Theory of Operation/88-Real Time Clock Theory of Ope ration 5.0 Operating Instructions The program is loaded in the highest part of memory (%77400 for a 32K machine, %137400 for a 48K machine. The examples that follow assume a 32K machine is being used.) A linkage to the entry point is set up by DEFUSRx=&O77400. There are six operations available: CALL FUNCTION A=USRx(0) Returns address of "HOUR" byte of current time. "MINUTE" will be found at A-1, "SECOND" at A-2. A=USRx(1) Start Clock. This initializes the 88-VI/RTC board, sets up the interrupt vector, and enables interrupts. A=USRx(2) Stop Clock. This disables interrupts, dissolves the interrupt vector, and shuts off the 88-VI/RTC. A=USRx(3) Returns address of "HOUR" byte of time limit. "MINUTE" will be found at A-1, "SECOND" at A-2. A=USRx(4) Enable time limit. This patches BASIC to permit a "software interrupt" (ERROR 21) to occur between statements or during INPUTs. A=USRx(5) Disable time limit. This "unpatches" BASIC to inhibit further "software interrupts." This is done automaticall y when the time limit is reached, and by the "stop clock" function. If a time limit is enabled, an error-handling routine must be provided: 10 ON ERROR GOTO 9000 . . (main program code) . . END 9000 IF ERR<>21 THEN ON ERROR GOTO 0 . . (tasks to be performed when limit is reached) . . RESUME NEXT 5.1 Diagnostic messages including "cause" and "cure" Message Cause Cure ILLEGAL FUNCTION CALL DEFUSRx was not done or does not match USRx call. Execute appropriate DEFUSR. ILLEGAL FUNCTION CALL USRx parameter not Use a valid parameter. in range 0 to 5. UNPRINTABLE ERROR Time limit was Add an error handler to reached but no your BASIC program(s) to "ON ERROR GOTO" process the ERROR 21 statement was generated when the time present. limit was reached. 6.0 Special considerations, restrictions, and/or limitations 1. Works with Altair Disk Extended BASIC Ver. 4.1 ONLY. 2. If the time limit is reached during execution of an "INPUT" statement, RESUME NEXT will resume execution with the next instruction, i.e. the INPUT statement will have been ignored. 3. The "MEMORY SIZE? " question asked during BASIC's initialization dialog should be answered with a number no larger than 32511 for a 32K machine, or 48895 for a 48K machine. 4. No devices other than the 88-VI/RTC should be able to interrupt on level 7. Also, no user software should alter the level 7 interrupt vector. 7.0 Test Case Information SET TIME 10 DEFINT A-Z 20 DEFUSR0=&O77400 30 A=USR0(2):A=USR0(0) 40 INPUT "TIME (HH,MM,SS)";H,M,S 50 IF H<0 OR H>23 OR M<0 OR M>59 OR S<0 OR S>59 THEN 40 60 POKE A,H:POKE A-1,M:POKE A-2,S 70 A=USR0(1) TIME 10 DEFINT A 20 DEFUSR0=&O77400 30 A=USR0(0) 40 PRINT USING "THE TIME IS NOW: ##:##:##";PEEK(A),PEEK(A-1),PEEK(A-2) SET TIME LIMIT 10 DEFINT A-Z 20 DEFUSR0=&O77400 30 A=USR0(5):A=USR0(3) 40 INPUT "LIMIT (HH,MM,SS)";H,M,S 50 IF H<0 OR H>23 OR M<0 OR M>59 OR S<0 OR S>59 THEN 40 60 POKE A,H:POKE A-1,M:POKE A-2,S 70 A=USR0(4) RUN "SET TIME" TIME (HH,MM,SS)? 14,35,44 OK RUN "TIME" THE TIME IS NOW: 14:35:48 OK