Initialize_Time IDNT ; Title Initialize Time. SECTION Sect_Initialize_Time,4,C ; Declare a noncommon code ; section. Align to Longwords. ****************************************************************************** * * * Initialize Time Rev. 5-MAY-1992 * * * ****************************************************************************** ****************************************************************************** * * * L1 Trigger Absolute Time Stamp Specification Rev. 5-DEC-1991 * * * * The ACnet BCD time format that will be read from the Goodwin-Shea * * front-end crate is shown below as it appears in the crate's * * VME address space. * * * * Longword at Address $788 Longword at Address $78C * * -------------------------- -------------------------------- * * MSB LSB MSB LSB * * * * ------------ ---------- --------------- ------------- * * |Year|Month| |Day|Hour| |Minute|Second| |15Hz | 2KHz| * * ------------ ---------- --------------- ------------- * * * * Byte Byte Byte Byte Byte Byte Byte Byte * * $788 $789 $78A $78B $78C $78D $78E $78F * * * * * * The format of the absolute time stamp as it appears in the L1 Data * * Block in VAX address space is shown below. * * * * Longword at Address N Longword at Address N+4 * * ---------------------------- -------------------------------- * * MSB LSB MSB LSB * * * * ------------ ------------ ------------- --------------- * * |Day | Hour| |Year|Month| |15Hz | 2KHz| |Minute|Second| * * ------------ ------------ ------------- --------------- * * * * Byte Byte Byte Byte Byte Byte Byte Byte * * N+3 N+2 N+1 N N+7 N+6 N+5 N+4 * * * ****************************************************************************** ****************************************************************************** * * * This routine uses the following registers: * * D0, D1, D2, D3, D4, * * * ****************************************************************************** ****************************************************************************** * * * Include the "system calls" to the 133A Bug Monitor. * ****************************************************************************** INCLUDE 68020_EQUATES.INC ****************************************************************************** * * * Clear the location that flags bus errors while trying to talk to * * the Absolute Time source. * * * * Change the Bus Error Vector to point to our own Bus Error exception * * handler. This exception handler routing starts at BUSEREXHD. * ****************************************************************************** Begin_Initialize_Time CLR.L IntTimeError ; Clear the Initialize Time ; Error Flag. If this flag ; .NEQ. zero than there has ; been a read Time error. MOVE.L #BUSEREXHD,$00000008 ; Point the Bus Error vector ; to our exception handler. ***************************************************************************** * * * Do the work to read the Absolute Time from the Front-End crate. * * * ***************************************************************************** Move.L RdTimeBA,D1 ; Read the two longwords Move.L RdTimeBA+4,D2 ; of Absolute Time data. ***************************************************************************** * * * We are finished reading the time so restore the normal 133A Bug * * Bus Error Vector. * ***************************************************************************** MOVE.L #$FFF149E2,$00000008 ; Restore normal 133A Bug ; Bus Error vector. ***************************************************************************** * * * Now put the Absolute Time data into the L1 Trigger Data Block. * * * ***************************************************************************** Swap D1 ; Build the Absolute Time data Swap D2 ; that is in the proper byte ; order for Fritz Bartlett's time ; conversion routines on either ; VMS or ELN VAX's. i.e. Swap ; the words in each longword. ;* This is where you would store ;* the Abso Time in the L1 Data ;* Block e.g. with A0 loaded ;* with BAAbsoTime. ;* Move.L D1,(A0)+ ;* Move.L D2,(A0) Swap D1 ; Now put the words back in Swap D2 ; their original order for ; use in the display routine. *************************************************************************** * * * Send a message to the 68K console to indicate whether or not the * * read time initialization has been successful. * *************************************************************************** PEA.L BlankLine SYSCALL .WRITELN IF.L IntTimeError #0 THEN.L PEA.L TimeIntOK ; Time Error Flag is zero SYSCALL .WRITELN ; so send an OK message. ; Now display the Absolute Time PEA.L ChrYears ; First display the Years. JSR ChrWrtOut ; Label the years information. ROL.L #4,D1 ; Get the 1st char of years into Move.L D1,-(A7) ; position and push it on the stack. JSR BinASCII ; Convert to ASCII and sent it out. ROL.L #4,D1 ; Get the 2nd char of years into Move.L D1,-(A7) ; position and push it on the stack. JSR BinASCII ; Convert to ASCII and sent it out. PEA.L ChrMonth ; Next display the Months. JSR ChrWrtOut ; Label the month information. ROL.L #4,D1 ; Get the 1st char of months into Move.L D1,-(A7) ; position and push it on the stack. JSR BinASCII ; Convert to ASCII and sent it out. ROL.L #4,D1 ; Get the 2nd char of months into Move.L D1,-(A7) ; position and push it on the stack. JSR BinASCII ; Convert to ASCII and sent it out. PEA.L ChrDays ; Next display the Days. JSR ChrWrtOut ; Label the days information. ROL.L #4,D1 ; Get the 1st char of days into Move.L D1,-(A7) ; position and push it on the stack. JSR BinASCII ; Convert to ASCII and sent it out. ROL.L #4,D1 ; Get the 2nd char of days into Move.L D1,-(A7) ; position and push it on the stack. JSR BinASCII ; Convert to ASCII and sent it out. PEA.L ChrHours ; Next display the Hours. JSR ChrWrtOut ; Label the hours information. ROL.L #4,D1 ; Get the 1st char of hours into Move.L D1,-(A7) ; position and push it on the stack. JSR BinASCII ; Convert to ASCII and sent it out. ROL.L #4,D1 ; Get the 2nd char of hours into Move.L D1,-(A7) ; position and push it on the stack. JSR BinASCII ; Convert to ASCII and sent it out. PEA.L BlankLine ; Skip down to the next line. JSR ChrStrgOut ; Send out a space, CR, LF. PEA.L ChrMinute ; Next display the Minutes. JSR ChrWrtOut ; Label the minute information. ROL.L #4,D2 ; Get the 1st char of minute into Move.L D2,-(A7) ; position and push it on the stack. JSR BinASCII ; Convert to ASCII and sent it out. ROL.L #4,D2 ; Get the 2nd char of minute into Move.L D2,-(A7) ; position and push it on the stack. JSR BinASCII ; Convert to ASCII and sent it out. PEA.L ChrSecond ; Next display the Seconds. JSR ChrWrtOut ; Label the seconds information. ROL.L #4,D2 ; Get the 1st char of seconds into Move.L D2,-(A7) ; position and push it on the stack. JSR BinASCII ; Convert to ASCII and sent it out. ROL.L #4,D2 ; Get the 2nd char of seconds into Move.L D2,-(A7) ; position and push it on the stack. JSR BinASCII ; Convert to ASCII and sent it out. PEA.L ChrHertz ; Lastly display the Hertz. JSR ChrWrtOut ; Label the Hertz information. ROL.L #4,D2 ; Get the 1st char of Hertz into Move.L D2,-(A7) ; position and push it on the stack. JSR BinASCII ; Convert to ASCII and sent it out. ROL.L #4,D2 ; Get the 2nd char of Hertz into Move.L D2,-(A7) ; position and push it on the stack. JSR BinASCII ; Convert to ASCII and sent it out. ELSE PEA.L TimeIntBad ; Time Error Flag is not SYSCALL .WRITELN ; zero so send a Time ENDI ; Init failed message. PEA.L BlankLine SYSCALL .WRITELN RTS ; Now return from the ; Initialize Time Routine. ************************************************************************* * Bus Error Exception Handler for Initialize Time. * * * * Mask the rerun bit in the Special Status Word, then set the Time * * Error Flag, and then Return. * ************************************************************************* BUSEREXHD MOVE.W (SP)+,D0 ; pull the Status Register MOVE.L (SP)+,D1 ; pull the Program Counter MOVE.W (SP)+,D2 ; pull the Format - Vector Offset MOVE.W (SP)+,D3 ; pull the Internal Register MOVE.W (SP)+,D4 ; pull the Special Status Register ANDI.W #$FEFF,D4 ; Mask the rerun bus cycle bit MOVE.W D4,-(SP) ; push the Special Status Register MOVE.W D3,-(SP) ; push the Internal Register MOVE.W D2,-(SP) ; push the Format - Vector Offset MOVE.L D1,-(SP) ; push the Program Counter MOVE.W D0,-(SP) ; push the Status Register MOVE.L #$FF,IntTimeError ; Set the Time Error Flag. CLR.L D1 ; Zero both longwords of CLR.L D2 ; Absolute Time data. RTE *************************************************************************** * * * Constants Section for Initialize Time * * * *************************************************************************** XDEF Begin_Initialize_Time ; Export this symbol ; to other modules. XREF RdTimeBA ; Import this symbol from ; the main symbol include file. XREF ChrStrgOut,ChrWrtOut ; Import the names of external XREF BinASCII ; routined that are called from ; this module. ALIGN 4 ; Align to Long words. IntTimeError DS.L 1 ; Storage location for the ; Init Absolute Time error flag. BlankLine DC.B 1,' ' TimeIntOK DC.B 47,' Time has been initialized without any errors. ' TimeIntBad DC.B 47,' There were errors during Time initialization. ' ChrYears DC.B 8,' Year ' ChrMonth DC.B 9,' Month ' ChrDays DC.B 7,' Day ' ChrHours DC.B 8,' Hour ' ChrMinute DC.B 10,' Minute ' ChrSecond DC.B 11,' Seconds ' ChrHertz DC.B 12,' 1/15 sec ' END