home *** CD-ROM | disk | FTP | other *** search
Text File | 1993-06-07 | 43.0 KB | 1,656 lines |
- ;
- ;
- ; SWTIME01.Z80 07/07/87
- ;
- ;
- ; This program is designed to interface to the Dallas
- ; Semiconductor SmartWatch/TimeKeeper family of Real Time Clock
- ; (RTC) parts.
- ;
- ; The SmartWatch includes its own crystal time base and
- ; lithium battery. The SmartWatch maintains time information,
- ; including hundredths of a seconds, seconds, minutes, hours, day
- ; of week, day of month, month and year. The date at the end of
- ; the month is automatically adjusted for months with fewer than 31
- ; days, including correction for leap year. Hours of the day can
- ; be tracked in either 12- or 24-hour format.
- ;
- ; These time keeping devices are offered in several socket-
- ; style hybrid versions of the DS1215--"TimeKeeper". These
- ; clock/calendar devices, fit into 28-pin 0.6-inch-wide DIP (Dual
- ; In-line Package) memory sockets. The following summarizes the
- ; different devices:
- ;
- ;
- ; DS1216: Intended for a 2K or 8K byte low power CMOS static RAM.
- ; When system power is lost, the RAM draws power from the DS1216's
- ; battery.
- ;
- ; DS1216C: Intended for a 8K or 32K byte low power CMOS static RAM.
- ; When system power is lost, the RAM draws power from the DS1216's
- ; battery.
- ;
- ; DS1216E: Intended for a 8K or larger EPROM.
- ;
- ; The SmartWatch requires no interfacing, it merely plugs in
- ; between a existing 28 pin socket and a existing 24 or 28 pin RAM
- ; or EPROM.
- ;
- ;
- ; ACCURACY:
- ;
- ; The data sheet for the SmartWatch rates the part to be
- ; "Accurate to within one minute per month @ 25'C". However there
- ; are two things that the data sheet doesn't tell you, that will
- ; cause the SmartWatch to lose time (appear to run slowly):
- ;
- ; The first problem is related only to the nonvolatile RAM
- ; type device. On these devices the voltage powering the RAM must
- ; not go below three (3) volts.
- ;
- ; The other problem, that effects all types of SmartWatchs, is
- ; that the voltage at the Write* input, (pin-27 on all devices
- ; except the DS1216E, which has Write* on pin-8), must not go above
- ; the Vcc voltage (pin-28). This usually only happens if you are
- ; driving the SmartWatch with a CMOS logic level, and the Write*
- ; voltage 'over-shoots' Vcc.
- ;
- ; There are two disadvantage of inserting the SmartWatch
- ; between the existing socket and the existing devices:
- ;
- ; The main disadvantage is that it raises the hight of the
- ; RAM, or EPROM, by about one-half inch. So if your existing
- ; socket has low head room, the SmartWatch may not be the clock for
- ; you.
- ;
- ; The other disadvantage is that there is a slight increase
- ; in memory access time, in most situations this is of little
- ; concern.
- ;
- ;
- ;
- ; Be careful when trying to plug the SmartWatch-Socket into an
- ; other socket. Some types of sockets, such as machine-contact-pin
- ; sockets, may not readily accept the flat pins of the
- ; SmartWatch.
- ;
- ; Contact Dallas Semiconductor directly for data sheets, and
- ; to find out who distributes the SmartWatch in your area.
- ;
- ; Dallas Semiconductor Corporation
- ; 4350 Beltwood Parkway South
- ; Dallas, TX 75244
- ;
- ; (214) 450-0400
- ; FAX# 214-450-0470
- ; TELEX# 6502441669
- ;
- ;
- ; [Information pertaining to Dallas Semiconductor components
- ; are reprinted by permission.]
- ;
- ; {By the way I have no connection to Dallas Semiconductor,
- ; other than being a user of their parts.}
- ;
- ;
- ;
- ; NOTE:
- ; This program is "Copyright (C) 1986-1987 by Robert Paddock".
- ; All rights reserved. Users are hereby granted a limited license
- ; to copy this program for personal use only. The program may be
- ; distributed unmodified to all interested parties. No fee or
- ; other consideration shall be accepted by any party or parties.
- ; In accordance with the Copyright Law of 1978, form TX has been
- ; sent to the U.S. Government Copyright Office.
- ;
- ;
- ; If you have changes that you would like to see in a
- ; forthcoming general release, please forward them for
- ; consideration.
- ;
- ; Send/call any suggestions or requests for help to:
- ;
- ;
- ; Z-NODE #38
- ; (814) 437-5647
- ; 24 hours/ 7 days
- ; 300/1200/2400 Baud, 8/N/1
- ; Robert Paddock, KA8BMT, SYSOP
- ;
- ;
- ; May time be on your side................
- ;
- ;
- MAIN EQU 1 ; Main version number
- VERS EQU 0 ; Revision number
- ;
- VMONTH EQU 07 ; Date of revision
- VDAY EQU 07
- VYEAR EQU 87
- ;
- ;
- ; -------------------------------------------------------------
- ;
- NO EQU 0
- YES EQU NOT NO
- ;
- ;
- SB180 EQU NO ; 'YES', if using a SB180
- SB180FX EQU YES ; 'YES', if using a SB180FX
- ;
- ; If using a SB180, or SB180FX, then we must deal with the
- ; Memory Management Unit, of the 64180. Also we can set the
- ; BIOS clock from the SmartWatch.
- ;
- ;
- IF SB180 AND SB180FX
- ERROR: Select only SB180, or SB180FX, not both.
- ENDIF ; SB180 AND SB180FX
- ;
- ;
- USEEI EQU NO ; 'NO' if your system doesn't want the
- ; ; interrupts turned on.
- ;
- INTEI EQU USEEI OR SB180 OR SB180FX
- ;
- ; Since some systems need the interrupts on (like the SB180)
- ; and some need them off, it is best that we put the interrupt
- ; enable bit back the way the system wants it.
- ;
- ;
- ;
- EDATE EQU NO ; NO=Month/Date/Year, YES=Date/Month/Year.
- WEKDAY EQU YES ; Print 'SUN,MON,.....SAT'.
- ;
- ;
- BASE EQU 0000H ; BASE of CP/M
- ;
- BIOS EQU BASE
- BDOS EQU BASE+5
- FCB EQU BASE+5CH
- TBUFF EQU BASE+80H
- TPA EQU BASE+100H
- ;
- LF EQU 0AH ; Line Feed
- CR EQU 0DH ; Carriage Return
- ;
- ;
- ;
- ; From SYSLIB 3.6:
- EXTRN COUT,CONDIN,PSTR,PRINT,PA2HC,CATH,CRLF
- ;
- ; To assemble and link, using SLR's assembler/linker:
- ;
- ; SLR180 SWTIME
- ; LNK180 SWTIME/A:100,SYSLIB/S,SWTIME/N/E
- ;
- ;
- ; SmartWatch and TimeKeeper,
- ; are trademarks of Dallas Semiconductor.
- ;
- ; 'SB180' and 'SB180FX' are trademark's of Micromint Inc.
- ;
- ; Z80 and Z180 are trademark's of Zilog.
- ;
- ; HD64180 is a trademark of Hitachi.
- ;
- ; -------------------------------------------------------------
- ;
- .Z80 ; For M80 (SLR180 ignores it)
- .SALL ; Don't list expanded macros.
- ;
- ;
- SWAP MACRO ; Exchange nibbles.
- RLCA
- RLCA
- RLCA
- RLCA
- ENDM
- ;
- ; -------------------------------------------------------------
- ;
- IF SB180 OR SB180FX
- ;
- ; If SB180 or SB180FX then we must relocate the program so
- ; it is not within the first 4K of RAM (40000H-40FFFH), so that
- ; when we access the SmartWatch at address 00000H, we don't get
- ; lost.
- ;
- ; .XLIST ; Don't list these
- ; MACLIB PORTS.LIB ; .LIB file(s)
- ;
- ;
- .XLIST ; Don't list .LIB's
- ;
- MACLIB PORTS.LIB ; 64180 (and SB180) ports.
- ; ; [Supplied with the SB180(FX)]
- ;
- ; MACLIB OP-CODES ; 64180 OP-CODE MACROS (For M80)
- ; ; [Can be found in the BYE5
- ; ; insert for the SB180(FX)]
- ;
- ; .HD64 ; (For ZAS)
- ; ; (SLR180 doesn't need either)
- ;
- .LIST ; Listing back on
- ;
- ;
- ; -------------------------------------------------------------
- ;
- ;
- RUNADR EQU 3000H ; Could be any RAM address below the CCP,
- ; ; and above 40FFFH; on the SB180(FX).
- ;
- ;
- LD HL,FSTADR ; Relocate the program
- LD DE,RUNADR ; so that it is not
- LD BC,LSTADR-FSTADR
- LDIR ; in the first 4K of RAM.
- ;
- ENDIF ; SB180 OR SB180FX
- ;
- ;
- JP START ; Ok, lets get some useful work done now.
- ;
- ; -------------------------------------------------------------
- ;
- FSTADR EQU $ ; Start of section that may need relocated.
- ;
- ;
- IF SB180 OR SB180FX
- ;
- .PHASE RUNADR ; Generate code at the current location
- ; ; for later transfer and execution at
- ; ; RUNADR.
- ENDIF ; SB180 OR SB180FX
- ;
- ;
- ; Since you most likely want to see how to deal with the
- ; SmartWatch, the code for doing just that, is listed here in the
- ; beginning:
- ;
- ;
- ; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- ;
- ; Because EPROMs don't have write (WE*) inputs and your data
- ; bus may not be bidirectional at the EPROM data output pins,
- ; address lines A0 and A2 serve as the DS1216E's data input and
- ; WE* pins, respectively.
- ;
- ;
- DS1216 EQU NO ; Nonvolatile RAM type SmartWatch
- DSEPRM EQU YES ; EPROM type SmartWatch [DS1216E]
- ;
- IF DS1216 AND DSEPRM
- ERROR: Select only DS1216 or DSEPRM not both.
- ENDIF ; DS1216 AND DSEPRM
- ;
- ; NOTE: The above equates only affect the way that the device
- ; is written, they both use the same read routine.
- ;
- ;
- WATCH EQU 0000H ; Base address of the SmartWatch.
- ;
- ;
- ; *** NOTE: The WATCH equate above MUST match the hardware address
- ; of the SmartWatch, other-wise this program will not be
- ; able to access the SmartWatch. ***
- ;
- ; Most systems have a boot-strap-EPROM at address zero, so
- ; this seems like the most logically place to put the SmartWatch.
- ; This boot-strap-EPROM can usually be switched in and out of
- ; memory, so make sure you account for this switching.
- ;
- ; If you are using a 64180 be aware of what the 64180 Memory
- ; Management Unit is doing.
- ;
- ;
- SWWRB0 EQU WATCH ; Address to write a zero bit. (DS1216E)
- SWWRB1 EQU WATCH+1 ; Address to write a one bit. (DS1216E)
- SWRDD0 EQU WATCH+4 ; Address to read a bit from. (DS1216[E])
- ;
- ;
- ; OSCILLATOR AND RESET BITS:
- ;
- ; Bits 4 and 5 of the day register are used to control the
- ; reset and oscillator function. Bit 4 controls the reset (pin
- ; 1). When the reset bit is set to a logical 1, the reset input
- ; pin is ignored. When the reset bit is set to logical 0, a low
- ; input on the reset pin will cause the SmartWatch to abort data
- ; transfer without changing data in the watch register. Bit 5
- ; controls the oscillator. This bit is shipped from Dallas
- ; Semiconductor set to logical 1, which turns the oscillator off.
- ; When set to logical 0, the oscillator turns on and the watch
- ; becomes operational.
- ;
- ;
- RSTPIN EQU 00010000B ; We want to ignore the reset pin.
- ;
- OSCOFF EQU 00100000B ; Bit 5 is high if not set.
- OSCON EQU NOT OSCOFF AND 0FFH ; Bit 5 is low if set.
- ;
- OSCRST EQU OSCOFF OR RSTPIN ; OSC off, and ignore the
- ; ; reset pin.
- ;
- ;
- ; -------------------------------------------------------------
- ;
- ;
- ACCESS: DI ; We must turn the interrupts off!
- ;
- ;
- ; If the interrupt service routine (assuming there is one),
- ; would happen to read or write to the MEMORY location of the
- ; SmartWatch, while we are trying to read or write the CLOCK
- ; section of the SmartWatch it is possible that the SmartWatch
- ; and/or the interrupt routine could get confused, since neither
- ; know about the other.
- ;
- ; Cycles to other locations outside of the SmartWatch's
- ; memory block, (ie. the SmartWatch's Chip-Enable [pin 20] not
- ; active) can be interleaved with SmartWatch cycles without
- ; interrupting the pattern recognition sequence or data transfer
- ; sequence.
- ;
- ; Since some systems need the interrupts on (like the SB180)
- ; and some need them off, it is best that we put the interrupt
- ; enable bit back the way we found it, before we turned it off.
- ;
- ; Unfortunately some other type of interrupt, such as a Non-
- ; Maskable-Interrupt (NMI), could still come along and mess
- ; everything up, if it accesses a SmartWatch address. Oh well, at
- ; least we tried....
- ;
- ; Probability says that nothing bad will happen. On the
- ; other hand Murphy's law says that the worst possible thing
- ; will happen at the worst possible moment.
- ;
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- IF SB180 OR SB180FX
- ;
- ; We have to turn the DRAM hardware refresh off, to
- ; prevent spurious EPROM chip selects.
- ;
- IF SB180
- ;
- XOR A ; Do a software refresh
- LD B,A ; so that we will have a whole
- LD L,A ; 4 mS to deal with the SmartWatch,
- LD H, HIGH $ ; before we have to worry about
- ; ; the DRAM refresh again.
- ;
- REFIT: LD C,(HL) ; We do this by reading 256
- INC HL ; bytes of the 256k DRAM.
- DJNZ REFIT
- ;
- ;
- ELSE ; SB180FX
- ;
- XOR A ; Do a software refresh
- LD B,A ; so that we will have a whole
- LD L,A ; 4 mS to deal with the SmartWatch,
- LD H, HIGH $ ; before we have to worry about
- LD D,A ; the DRAM refresh again.
- LD E,A
- ;
- REFIT: LD C,(HL) ; We do this by reading 512
- LD A,(DE) ; bytes of the 512k DRAM.
- INC DE
- INC HL
- DJNZ REFIT
- ;
- ENDIF ; SB180
- ;
- ; -------------------------------------------------------------
- ;
- IN0 A,(RCR) ; We have to turn the DRAM
- LD (SVRCR),A ; hardware refresh off, to
- AND 7FH ; prevent spurious EPROM chip
- ; ; selects.
- OUT0 (RCR),A ; Turn the hardware refresh off, now
- ; ; that the software refresh is done.
- ;
- ; -------------------------------------------------------------
- ;
- IF SB180FX
- LD HL,(BIOS+1) ; Get the BIOS's page address, then
- LD L,3FH ; point to the BIOS LATCH stuff.
- LD (BIOSLATCH),HL
- ;
- XOR A ; Read the FX latch.
- CALL LATCHVAL
- LD (LTCHIMG),BC ; Save the latch image.
- RES 3,B ; Select EPROM [RAM/ROM*].
- CALL SETLATCH ; Set the FX latch.
- ENDIF ; SB180FX
- ;
- ; -------------------------------------------------------------
- ;
- IN0 A,(CBAR) ; Save the current CBAR value,
- LD (SVCBAR),A ; then map the first for 4K
- AND 0F0H ; of ROM into Common Area 0.
- OR 01H
- OUT0 (CBAR),A
- ;
- ENDIF ; SB180 OR SB180FX
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- ; Communication with the SmartWatch is established by
- ; pattern recognition of a serial bit stream of 64 bits which
- ; must be matched by executing 64 consecutive write cycles
- ; containing the proper data on the Data In pin (D) [D=D0 (pin 11
- ; of the 28 pin socket) for the DS1216, D=A0 (pin 10 of the 28
- ; pin socket) for the DS1216E]. All accesses which occur prior to
- ; recognition of the 64 bit pattern are directed to memory.
- ;
- ;
- ; A read cycle to any memory location of the SmartWatch
- ; starts the pattern recognition sequence by moving a pointer to
- ; the first bit of the 64 bit comparison register.
- ;
- ;
- LD A,(SWRDD0) ; Initialize the access pointer
- ; ; in the SmartWatch.
- ;
- ; Next, 64 consecutive write cycles are executed. These 64
- ; write cycles are used only to gain access to the SmartWatch.
- ;
- LD B,2 ; Make two passes.
- UNLOCK: PUSH BC
- ;
- LD A,0C5H ; Begin the unlock sequence.
- CALL WRTCLK ; The odds of this pattern being
- LD A,3AH ; accidentally duplicated and
- CALL WRTCLK ; causing inadvertent entry to
- LD A,0A3H ; the SmartWatch is less than
- CALL WRTCLK ; 1 in 10^19.
- LD A,05CH
- CALL WRTCLK
- ;
- POP BC
- DJNZ UNLOCK ; Repeat one more time if needed.
- ;
- RET
- ;
- ; -------------------------------------------------------------
- ;
- DB 'Copyright (C) 1986-1987 Robert Paddock.'
- ;
- ; -------------------------------------------------------------
- ;
- ;
- WRTCLK: LD B,8 ; We must deal with 8 bits at a time.
- ;
- ;
- ; -------------------------------------------------------------
- ;
- IF DS1216 ; If we are using the SmartWatch
- ; ; with nonvolatile RAM then we
- ; ; do thus:
- ;
- LD HL,SWRDD0
- ;
- RTCWR: LD (HL),A ; Send out a bit on D0
- RRCA ; shift right one place
- DJNZ RTCWR ; do all 8 bits.
- ;
- ENDIF ; DS1216
- ;
- ; -------------------------------------------------------------
- ;
- IF DSEPRM ; If we are using the EPROM version
- ; ; of the SmartWatch [DS1216E] then
- ; ; we do thus:
- LD C,A
- ;
- ;
- RTCWR: RRC C ; Is this bit a one or zero?
- JR C,WRTONE; Jump if its a one.
- ;
- LD A,(SWWRB0) ; Write a zero by reading.
- JR RTCWRL
- ;
- WRTONE: LD A,(SWWRB1) ; Write a one by reading.
- ;
- RTCWRL: DJNZ RTCWR ; Do all 8 bits.
- ;
- ;
- ENDIF ; DSEPRM
- ;
- ; -------------------------------------------------------------
- ;
- RET
- ;
- ; *************************************************************
- ;
- ;
- ; NOTE: This read routine will work for all of the devices
- ; as long as address line A2 is high when reading
- ; the DS1216E.
- ;
- ;
- RDCLK: LD HL,SWRDD0
- XOR A ; Set all bits to zero.
- LD B,8 ; 8 bits make one byte.
- ;
- RTCRD: BIT 0,(HL) ; Does bit D0=0?
- JR Z,RDBITL ; Jump if the bit is
- ; ; already zero.
- SET 0,A ; Set the bit.
- ;
- RDBITL: RRCA ; Rotate right one bit.
- DJNZ RTCRD ; Do all of the bits.
- ;
- RET
- ;
- ; -------------------------------------------------------------
- ;
- ; Smartwatch Register Information
- ;
- ; The SmartWatch information is contained in 8 registers, of 8
- ; bits each, which are sequentially accessed one bit at a time
- ; after the 64-bit pattern recognition sequence has been
- ; completed. When updating the SmartWatch registers, each must be
- ; handled in groups of 8 bits. Writing and reading individual bits
- ; within a register could produce erroneous results.
- ;
- ;
- ; Data contained in the SmartWatch registers are always in
- ; binary coded decimal format (BCD). Reading and writing the
- ; registers is always accomplished by stepping through all 8
- ; registers, starting with bit 0 of register 0 and ending with
- ; bit 7 of register 7.
- ;
- ;
- ; These read/write registers are defined below:
- ;
- ;
- ; Register, range (BCD), and bit number:
- ;
- ; 0: 00-99 7 = 0, 6-4 = 0.1 SEC, 3-0 = 0.01 SEC
- ;
- ; 1: 00-59 7 = 0, 6-4 = 10 SEC, 3-0 = SECONDS
- ;
- ; 2: 00-59 7 = 0, 6-4 = 10 MIN, 3-0 = MINUTES
- ;
- ; 3: 01-12/00-23 7 = 12/24, 6 = 0, 5 = 10|A/P, 4 = HR, 3-0 = HOUR
- ;
- ; 4: 01-07 7,6 & 3 = 0, 5 = OSC, 4 = RST, 2-0 = DAY
- ;
- ; 5: 01-31 7 & 6 = 0, 5-4 = 10 DATE, 3-0 = DATE
- ;
- ; 6: 01-12 7,6 & 5 = 0, 4 = 10 MONTH, 3-0 = MONTH
- ;
- ; 7: 00-99 7-4, 10 YEAR, 3-0 = YEAR
- ;
- ;
- ; ZERO BITS:
- ;
- ; Registers one trough six, contain one or more bits which
- ; will always read logical 0. When writing these locations,
- ; either a logical 1 or 0 is acceptable.
- ;
- ; *************************************************************
- ;
- ;
- GETCLK:
- IF DS1216
- LD A,(SWRDD0) ; Preserve the byte at
- LD (SVRAM),A ; 'SWRDD0'
- ENDIF ; DS1216
- ;
- CALL ACCESS ; Select the clock, put 8
- LD DE,FRACT ; bytes of data in the
- ; ; following order:
- ;
- CALL RDCLK ; Fractions of a second,
- LD (DE),A
- INC DE
- CALL RDCLK ; Seconds,
- LD (DE),A
- INC DE
- CALL RDCLK ; Minutes,
- LD (DE),A
- INC DE
- CALL RDCLK ; AM/PM, Hours,
- LD (DE),A
- INC DE
- CALL RDCLK ; OSC,RST,DAY,
- LD (DE),A
- INC DE
- CALL RDCLK ; Date (Day of month),
- LD (DE),A
- INC DE
- CALL RDCLK ; Month,
- LD (DE),A
- INC DE
- CALL RDCLK ; Years.
- LD (DE),A
- INC DE
- ;
- IF DS1216
- LD A,(SVRAM) ; Restore the byte
- LD (SWRDD0),A ; at 'SWRDD0'.
- ENDIF ; DS1216
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- IF SB180FX
- LD BC,(LTCHIMG) ; Get back original latch
- CALL SETLATCH ; image, then write it.
- ENDIF ; SB180FX
- ;
- ; -------------------------------------------------------------
- ;
- IF SB180 OR SB180FX
- LD A,(SVCBAR) ; Back to the normal memory map.
- OUT0 (CBAR),A
- ;
- ; -------------------------------------------------------------
- ;
- LD A,(SVRCR) ; Turn the hardware DRAM
- OUT0 (RCR),A ; refresh back on.
- ENDIF ; SB180 OR SB180FX
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- ; Since some systems need the interrupts on (like the SB180)
- ; and some need them off, it is best that we put the interrupt
- ; enable bit back the way the system wants it.
- ;
- IF INTEI
- EI
- ENDIF ; INTEI
- ;
- ; -------------------------------------------------------------
- ;
- LD A,(DAYS) ; Make sure there really is a
- ; ; SmartWatch present.
- ;
- LD HL,FRACT ; Point to BCD time.
- ;
- CP 0FFH ; All of the bits will be the same
- RET Z ; if there is no SmartWatch.
- OR A ; Return with the 'Z'-flag set
- RET Z ; if no SmartWatch is found.
- ;
- AND OSCOFF ; See if the SmartWatch has been set,
- CPL ; '0DFH' means that the SmartWatch is present
- OR A ; but not set.
- ; ; '0FFH', and the 'Z'-flag clear, means
- ; ; the SmartWatch is present and set.
- ;
- RET
- ;
- ; -------------------------------------------------------------
- ;
- PUTCLK:
- IF DS1216
- LD A,(SWRDD0) ; Preserve the byte at
- LD (SVRAM),A ; 'SWRDD0'
- ENDIF ; DS1216
- ;
- CALL ACCESS ; Select the SmartWatch.
- LD DE,FRACT
- ;
- LD A,(DE) ; Fractions of a second,
- CALL WRTCLK
- INC DE
- LD A,(DE) ; Seconds,
- CALL WRTCLK
- INC DE
- LD A,(DE) ; Minutes,
- CALL WRTCLK
- INC DE
- LD A,(DE) ; AM/PM, Hours,
- CALL WRTCLK
- INC DE
- LD A,(DE) ; OSC,RST,Days,
- CALL WRTCLK
- INC DE
- LD A,(DE) ; Date,
- CALL WRTCLK
- INC DE
- LD A,(DE) ; Month,
- CALL WRTCLK
- INC DE
- LD A,(DE) ; Year.
- CALL WRTCLK
- ;
- IF DS1216
- LD A,(SVRAM) ; Restore the byte
- LD (SWRDD0),A ; at 'SWRDD0'.
- ENDIF ; DS1216
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- IF SB180FX
- LD BC,(LTCHIMG) ; Get back original latch
- CALL SETLATCH ; image, then write it.
- ENDIF ; SB180FX
- ;
- ; -------------------------------------------------------------
- ;
- IF SB180 OR SB180FX
- LD A,(SVCBAR) ; Back to the normal memory map.
- OUT0 (CBAR),A
- ;
- ; -------------------------------------------------------------
- ;
- LD A,(SVRCR) ; DRAM Hardware refresh back on.
- OUT0 (RCR),A
- ENDIF ; SB180 OR SB180FX
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- IF INTEI
- EI
- ENDIF ; INTEI
- ;
- ; -------------------------------------------------------------
- ;
- RET
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- ;
- IF SB180FX
- SETLATCH:XOR A ; Indicate that we want to
- DEC A ; write to the latch.
- ;
- LATCHVAL:LD HL,(BIOSLATCH) ; Go to the BIOS LATCHVAL
- JP (HL) ; routine.
- ENDIF ; SB180FX
- ;
- ;
- ;
- ;
- ; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- ; !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
- ; $$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$$
- ;
- ;
- ; The command section of SWTIME:
- ;
- START: LD HL,0 ; Save the stack pointer.
- ADD HL,SP ; (We can't use Z80
- LD (STACK),HL ; instructions yet.)
- ;
- LD A,7FH ; Test for Z80 CPU.
- ADD A,A
- LD HL,Z80MSG ; Z80 Only error message.
- JP PO,MSGEXT ; Jump if not a Z80.
- ;
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- IF SB180 OR SB180FX
- ;
- ; If this is a real Z-80 CPU, and not a HD64180/Z180 CPU.
- ; Then we can't run this version of SWTIME, because of the IO/MMU
- ; instructions.
- ;
- ;
- LD HL,Z180MSG ; Point to '180 only' message.
- SCF ; Set the carry flag.
- TST A ; This will clear the carry flag
- ; ; on the HD64180/Z180, but it will
- JP C,MSGEXT ; remain set on the Z-80.
- ;
- ;
- ; On a Zilog Z-80, the 'TST A' (ED3CH) instruction is a NOP.
- ; The ED3CH op-code is an undocumented Z-80 instruction, so it is
- ; a gamble using it. Does any one have any other ideas, that
- ; don't need to resort to 'tricks'?
- ;
- ; Keep in mind this code may only be a problem if the
- ; SB180(FX) equate is set when the code is assembled, AND THEN we
- ; try to run this program on a Z-80. [I kept erroneously doing
- ; this when I was developing this program, that is why the code is
- ; here at all.]
- ;
- ;
- ENDIF ; SB180 OR SB180FX
- ;
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- ; At long last we can get down to doing some useful work.
- ;
- LD SP,STACK ; Set up our own stack.
- ;
- ;
- CALL GETCLK ; Get all of the info from the
- ; ; SmartWatch.
- ;
- LD HL,NOSWPR ; Jump if no SmartWatch is present
- JP Z,MSGEXT ; in the system.
- ;
- LD C,A ; Save the watch status code.
- ;
- LD A,(FCB+1) ; What should we do?
- ;
- AND 01011111B ; Make it upper case.
- ;
- CP 'S' ; Command to set the
- JP Z,SETTIM ; SmartWatch?
- ;
- LD B,A ; Save the command for a while.
- ;
- LD A,C ; If the command was not the set command
- LD HL,SWNSET ; then check to see that the
- CP OSCON ; SmartWatch is already set, if
- JP Z,MSGEXT ; it is not set, then print an error
- ; ; message, then the help message.
- ;
- LD A,B ; Get back the users command.
- OR A ; print out the time?
- JP Z,TELTIM ; Jump if yes.
- CP 'R' ; Print out the time continuously.
- JP Z,REPTIM ; Jump if yes.
- CP 'O' ; Turn the SmartWatch off?
- JP Z,TUROFF ; Jump if yes.
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- IF SB180 OR SB180FX
- CP 'C' ; Clear the elapsed time clock.
- JP Z,CLRETM
- CP 'X' ; Display the elapsed time clock.
- JP Z,DISETM
- CP 'T' ; Transfer the SmartWatch time
- JP Z,TRNSFR ; to the BIOS clock.
- ENDIF ; SB180 OR SB180FX
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- HELP: LD HL,HLPMSG ; HELP !!!
- ;
- MSGEXT: CALL PSTR ; Print the string pointed to
- ; ; by HL.
- ;
- EXIT: LD HL,(STACK) ; (Only use 8080 instructions
- LD SP,HL ; here.)
- RET
- ;
- ; *************************************************************
- ;
- GETTIM: LD A,(HL)
- INC HL
- SUB '0' ; Remove the ASCII bias.
- CP 9+1 ; 0->9?
- JP NC,HELP ; If it is not, then print
- ; ; the help message.
- SWAP ; Swap the nibbles,
- AND 0F0H ; and do the other nibble.
- LD C,A ; Save this binary nibble.
- ;
- LD A,(HL) ; Do the same as above.
- INC HL
- SUB '0'
- CP 9+1
- JP NC,HELP
- ;
- OR C ; Make the two BCD digits,
- ; ; one 8 bit binary value.
- RET
- ;
- ; -------------------------------------------------------------
- ;
- ; Set the time:
- ;
- SETTIM: LD A,(TBUFF) ; Read the command buffer.
- CP 18 ; ' S hhmmssMMDDYYdm'?
- JP NC,HELP
- LD HL,TBUFF+4
- CALL GETTIM
- CP 23H+1 ; Check for valid range
- JP NC,HELP ; (We'll check 12-hours latter).
- LD (HRS),A ; Store the Hours.
- ;
- CALL GETTIM ; Minutes
- CP 59H+1
- JP NC,HELP
- LD (MIN),A
- ;
- CALL GETTIM ; Seconds
- CP 59H+1
- JP NC,HELP
- LD (SEC),A
- ;
- CALL GETTIM ; Month
- CP 12H+1
- JP NC,HELP
- LD (MON),A
- ;
- CALL GETTIM ; Day of month
- CP 31H+1
- JP NC,HELP
- LD (DATE),A
- ;
- CALL GETTIM ; Year
- CP 99H+1
- JP NC,HELP
- LD (YEAR),A
- ;
- LD A,(HL) ; Days
- INC HL
- CALL CATH ; Convert ASCII to HEX.
- CP 7+1
- JP NC,HELP
- OR RSTPIN ; Ignore the reset pin (Pin #1).
- LD (DAYS),A
- ;
- ; AM-PM/12/24/ MODE:
- ;
- ; Bit 7 of the hours register is defined as the 12- or 24-
- ; hour mode select bit. When high, the 12-hour mode is selected.
- ; In the 12-hour mode, bit 5 is the AM/PM bit with logic high
- ; being PM. In the 24-hour mode, bit 5 is the second 10-hours
- ; bit (00-23 hours).
- ;
- LD A,(HL) ; 'A'm,'P'm or 24-hour?
- AND 01011111B ; Make it upper case.
- JR Z,IS24HR ; Jump if it is 24 hour time.
- ;
- CP 'A' ; AM?
- JR NZ,TRYPM
- LD C,10000000B ; Yes: Set the 12-hour mode
- JR IS12HR ; bit.
- ;
- TRYPM: CP 'P' ; PM?
- JP NZ,HELP
- LD C,10100000B ; Yes: Set the 12-hour, and the
- ; ; PM mode bits.
- ;
- IS12HR: LD A,(HRS) ; Now we'll check the 12 hour
- CP 12H+1 ; time.
- JP NC,HELP
- OR C ; Put the mode bits, and the hours
- LD (HRS),A ; together, and save them.
- ;
- IS24HR: CALL PUTCLK ; Write all of the info to the
- ; ; SmartWatch.
- ;
- ; Fall trough to Tell Time.
- ;
- ; -------------------------------------------------------------
- ;
- ; Tell the Time:
- ;
- TELTIM: CALL GETCLK ; Get the info from the
- ; ; SmartWatch.
- CALL ASCTIM ; Print out the time
- JP MSGEXT ; on the way back to the
- ; ; operating system.
- ;
- ; -------------------------------------------------------------
- ;
- ;
- ;
- REPTIM: XOR A ; Print the time now!
- DEC A
- LD (LSTSEC),A ; Not a second from now.
- ;
- TREPLP: CALL CONDIN ; Check for abort by the user,
- JP NZ,EXIT ; on the console.
- ; If there was a abort request then
- ; ; go back to the operating system.
- ;
- CALL GETCLK ; Get the time from the
- ; ; SmartWatch.
- ;
- LD A,(LSTSEC) ; Is this a new second?
- LD C,A
- LD A,(SEC) ; Read the current second
- CP C
- JR Z,TREPLP ; Jump if its not.
- ;
- LD (LSTSEC),A ; Save for the next second.
- ;
- CALL ASCTIM ; Convert from BCD to ASCII
- CALL PSTR ; and print it on the
- ; ; console.
- ;
- LD A,CR ; Get ready to over-write
- CALL COUT ; this time, with the time
- ; ; a second from now.
- ;
- JR TREPLP ; On to the next second.
- ;
- ;
- ; -------------------------------------------------------------
- ;
- ; Turn off, the SmartWatch for long term storage.
- ;
- TUROFF: LD A,(DAYS)
- OR OSCRST ; Turn the SmartWatch off.
- LD (DAYS),A
- CALL PUTCLK ; Write the info.
- ;
- LD HL,SWSOFF ; Tell'em that the SmartWatch
- JP MSGEXT ; is now off.
- ;
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- ; The following are to maintain compatibility with the
- ; SB180(FX)'s, software clock.
- ;
- IF SB180 OR SB180FX
- ;
- TRNSFR: CALL GETCLK ; Get the info from the SmartWatch.
- ;
- LD A,(HRS) ; If in the 24 hour mode, then we
- BIT 7,A ; have no problem.
- JR Z,XFERTM
- ;
- AND 3FH ; 12 hour mode. Now things get messy.
- ;
- CP 12H ; 12 AM ?
- JR NZ,NO12AM
- ;
- XOR A ; YES: 12 AM = 00 HOURS
- JR XFERTM
- ;
- NO12AM: BIT 5,A ; If it is 01-11 AM then it is ok
- JR Z,XFERTM ; as it is.
- ;
- CP 32H ; 12 PM ?
- JR NZ,NO12PM
- ;
- AND 1FH ; YES: 12 PM = 12 HOURS
- JR XFERTM
- ;
- NO12PM: AND 1FH ; We now know it is PM.
- ADD A,12 ; Convert to 13-23
- DAA ; Back to BCD.
- AND 3FH
- ;
- XFERTM: CALL BCD2BIN ; Transfer the time from
- ; ; the SmartWatch to
- LD (WHOUR),A ; the BIOS clock.
- ;
- LD A,(MIN) ; The SmartWatch time is in
- CALL BCD2BIN ; BCD, the BIOS clock wants
- LD (WMIN),A ; the time in binary.
- LD A,(SEC)
- CALL BCD2BIN
- LD (WSEC),A
- CALL WRWALL ; Write the date to the BIOS clock.
- JP TELTIM ; Confirm that it was done.
- ;
- ; #############################################################
- ;
- ; NOTE: This section of code (appearing between the
- ; '###' lines) is taken from the file 'TIME.Z80', by Joe
- ; Wright, as supplied with the SB180. It is used by permission.
- ; 'TIME.Z80' is copyrighted by Joe Wright, 1985.
- ;
- ;
- CLRETM:
- XOR A
- LD (EHOURS),A
- LD (EMINS),A
- LD (ESECS),A
- CALL WRREAL
- ;
- DISETM:
- CALL RDREAL
- ;
- CALL PRINT
- DB CR,' RTC: ',0
- LD HL,EHOURS
- ;
- TIMEOUT:
- LD A,(HL)
- DEC HL
- CALL BIN2BCD
- CALL PA2HC
- ;
- LD A,':' ; I (RLP) added these two
- CALL COUT ; lines. Comment, or NOP them
- ; ; to be 100% compatible with
- ; ; 'TIME.Z80'.
- LD A,(HL)
- DEC HL
- CALL BIN2BCD
- CALL PA2HC
- LD A,':'
- CALL COUT
- LD A,(HL)
- CALL BIN2BCD
- CALL PA2HC
- ;
- JP EXIT
- ;
- TIME:
- LD HL,(BIOS+1)
- LD L,36H ; Offset to the BIOS clock.
- JP (HL)
-
- RDREAL:
- OR 255 ; Read flag.
- PUSH AF
- LD BC,3
- PUSH BC
- LD DE,1
- JR CLOCK
- WRREAL:
- XOR A ; Write flag.
- PUSH AF
- LD BC,3
- PUSH BC
- LD DE,1
- JR CLOCK
- RDWALL:
- OR 255 ; Read flag.
- PUSH AF
- LD BC,3 ; Three bytes.
- PUSH BC
- LD DE,4 ; Offset to wallclock.
- JR CLOCK
- WRWALL:
- XOR A ; Write flag.
- PUSH AF
- LD BC,3 ; Three bytes.
- PUSH BC
- LD DE,4 ; Offset to wallclock.
- CLOCK:
- LD HL,ETENTHS
- ADD HL,DE ; Add offset.
- PUSH HL
- CALL TIME ; Point HL to timer string
- ADD HL,DE ; add offset.
- POP DE
- POP BC ; Get byte count,
- POP AF ; get direction.
- JR NZ,CLOCK0
- EX DE,HL
- CLOCK0:
- DI
- LDIR ; Move it.
- EI
- RET
- ;
- ;
- ; BIN2BCD will convert a 0-99 binary number to 0-99 BCD number.
- ; call with (A)=binary number 0-99. (A)=0-99 BCD on exit.
- ;
- BIN2BCD:OR A ; BCD 0 = Binary 0,
- RET Z ; so return.
- LD B,A ; Conversion counter.
- XOR A ; Clear 'A'.
- ;
- BINLOP: INC A ; Add one.
- DAA ; Binary to BCD.
- DJNZ BINLOP ; All converted?
- ;
- RET
- ;
- ; #############################################################
- ;
- ;
- ; BCD to binary converter
- ; [from BYE504]
- ;
- ; This routine will convert an 8 bit BCD number (0-99) to binary.
- ; the routine returns with the binary number in the 'A' register.
- ;
- BCD2BIN:
- LD E,A ; Save original byte.
- AND 0FH
- LD D,A ; Save low nibble.
- LD A,E
- AND 0F0H ; Mask LSN.
- RRCA ; x2
- LD E,A
- RRCA ; x4
- RRCA ; x8
- ADD A,E ; x10
- ADD A,D ; Low nibble.
- RET
- ;
- ;
- ; -------------------------------------------------------------
- ;
- ENDIF ; SB180 OR SB180FX
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- ; Convert SmartWatch BCD info to ASCII text.
- ;
- ASCTIM: LD HL,TIMSTR ; Point to the ASCII time.
- ;
- ;
- LD A,(HRS)
- BIT 7,A ; 12 or 24 time?
- JR Z,MILTIM ; Jump if using 24 time.
- ;
- AND 1FH ; Strip unneeded bits, 12 hr mode.
- ;
- MILTIM: AND 3FH ; Strip unneeded bits, 24 hr mode.
- CALL BCDASC
- LD (HL),':'
- INC HL
- LD A,(MIN)
- CALL BCDASC
- LD (HL),':'
- INC HL
- LD A,(SEC)
- CALL BCDASC
- LD (HL),' '
- INC HL
- ;
- LD A,(HRS) ; If in 24 mode
- BIT 7,A ; then don't print
- JR Z,NOAMPM ; 'AM' or 'PM'.
- ;
- LD (HL),'A' ; Assume its AM.
- BIT 5,A ; Find out if it is really
- JR Z,WASAM ; AM.
- LD (HL),'P' ; No, its PM.
- ;
- WASAM: INC HL
- LD (HL),'M'
- INC HL
- LD (HL),' '
- INC HL
- ;
- NOAMPM:
- IF EDATE
- ;
- LD A,(DATE) ; dd/mm
- CALL BCDASC
- LD (HL),'/'
- INC HL
- LD A,(MON)
- CALL BCDASC
- ;
- ELSE
- ;
- LD A,(MON) ; mm/dd
- CALL BCDASC
- LD (HL),'/'
- INC HL
- LD A,(DATE)
- CALL BCDASC
- ;
- ENDIF ; EDATE
- ;
- ;
- LD (HL),'/' ; /yy
- INC HL
- LD A,(YEAR)
- CALL BCDASC
- ;
- ;
- IF WEKDAY ; Print the day of the week 'Sun, Mon...'
- LD (HL),' '
- INC HL
- PUSH HL
- LD A,(DAYS)
- AND 7
- DEC A ; Adjust for 0-6.
- LD E,A
- LD D,0 ; Clear top.
- LD HL,DAYTAB ; Get address of table,
- ADD HL,DE ; table + 3 * (HL) = name.
- ADD HL,DE
- ADD HL,DE
- LD BC,3 ; Move name into buffer.
- POP DE
- LDIR
- EX DE,HL
- ENDIF ; WEKDAY
- ;
- LD (HL),0 ; End marker for string print.
- ;
- LD HL,TIMSTR ; Send the start of the string
- RET ; then back to the caller.
- ;
- ; -------------------------------------------------------------
- ;
- ; Convert a BCD number to ASCII.
- ;
- BCDASC: PUSH AF
- ;
- SWAP ; Do the upper nibble first
- AND 0FH
- OR '0' ; Add in the ASCII bias.
- LD (HL),A
- INC HL
- ;
- POP AF ; Now the lower nibble
- AND 0FH
- OR '0'
- LD (HL),A
- INC HL
- ;
- RET
- ;
- ; -------------------------------------------------------------
- ;
- Z80MSG: DB CR,LF,CR,LF
- DB '*** SWTIME, will not work on the 8080 or the 8085'
- DB ', sorry... ***'
- DB CR,LF,CR,LF,0
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- IF SB180 OR SB180FX
- Z180MSG:DB CR,LF,CR,LF
- DB '*** This version of SWTIME is configured for '
- DB 'the HD64180/Z180.',CR,LF
- DB ' Reassemble to use on the Z80. ***'
- DB CR,LF,CR,LF,0
- ENDIF ; SB180 OR SB180FX
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- SWSOFF: DB CR,LF,CR,LF
- DB '*** The SmartWatch is now turned off. ***'
- DB CR,LF,CR,LF,0
- ;
- ; -------------------------------------------------------------
- ;
- NOSWPR: DB CR,LF,CR,LF
- DB '*** No SmartWatch is present. ***'
- ;
- ; Fall trough to the "Not Set" message. If there is no
- ; SmartWatch present then by default it won't be set.
- ;
- ;
- SWNSET: DB CR,LF
- DB '*** The SmartWatch is not set. ***'
- DB CR,LF
- ;
- ; If the SmartWatch is "Not Set" then fall trough to the
- ; "Help" screen, so that we can get instructions on how to set the
- ; SmartWatch.
- ;
- HLPMSG: DB CR,LF
- DB ' SWTIME VER:'
- ;
- DB MAIN +'0', '.'
- DB VERS /10+'0', VERS MOD 10+'0', ' - '
- DB VMONTH /10+'0', VMONTH MOD 10+'0', '/'
- DB VDAY /10+'0', VDAY MOD 10+'0', '/'
- DB VYEAR /10+'0', VYEAR MOD 10+'0'
- ;
- DB CR,LF
- DB ' Copyright (C) 1986-1987 by Robert Paddock.'
- ;
- DB CR,LF,CR,LF
- DB ' This program allows setting and reading of the:'
- DB CR,LF
- DB ' Dallas Semiconductor "SmartWatch".'
- DB CR,LF,CR,LF
- ;
- DB ' Usage:',CR,LF,CR,LF
- ;
- DB ' SWTIME<CR> Will display the date and time of day.'
- ;
- DB CR,LF
- DB ' SWTIME R<CR> Displays the time & date repeatedly.'
- ;
- DB CR,LF
- DB ' SWTIME O<CR> Turn the SmartWatch off, for long term storage.'
- ;
- DB CR,LF
- DB ' SWTIME S hhmmssMMDDYYdm<CR> Will set the time, date and day.'
- DB CR,LF,CR,LF
- DB ' Where: hh=Hours (00-23/00-12), '
- DB 'mm=Minutes (00-59), '
- DB 'ss=Seconds (00-59), '
- DB CR,LF
- DB ' MM=Months (01-12), '
- DB 'DD=Day of month (01-31), '
- DB 'YY=Year (00-99),'
- DB CR,LF
- DB ' d=Day of week (1=Sunday, 7=Saturday),'
- DB CR,LF
- DB ' m=Mode: "A" = AM, "P" = PM, '
- DB 'omit for 24 hour format.'
- DB CR,LF,CR,LF
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- IF SB180 OR SB180FX
- DB ' SWTIME C<CR> Clear the elapsed time clock.'
- DB CR,LF
- DB ' SWTIME X<CR> Display the elapsed time clock.'
- DB CR,LF
- DB ' SWTIME T<CR> Transfer the time of day from the'
- DB CR,LF
- DB ' SmartWatch to the SB180 BIOS clock.'
- DB CR,LF
- ENDIF ; SB180 OR SB180FX
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- DB 0 ; end marker for string print
- ;
- ;
- ; -------------------------------------------------------------
- ;
- IF WEKDAY
- DAYTAB: DB 'SUN' ; Day of week table.
- DB 'MON'
- DB 'TUE'
- DB 'WED'
- DB 'THU'
- DB 'FRI'
- DB 'SAT'
- ENDIF ; WEKDAY
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- IF SB180FX
- LTCHIMG: DS 2 ; Image of SB180FX latch
- BIOSLATCH: DS 2 ; Address of BIOS LATCHVAL routine
- ENDIF ; SB180FX
- ;
- ; -------------------------------------------------------------
- ;
- IF SB180 OR SB180FX
- SVCBAR: DS 1 ; Save the MMU register CBAR.
- SVRCR: DS 1 ; Save the refresh register RCR.
- ;
- ETENTHS:DS 1 ; Elapsed time clock.
- ESECS: DS 1
- EMINS: DS 1
- EHOURS: DS 1
- ;
- WSEC: DS 1 ; 'Wall clock' (Real time of day).
- WMIN: DS 1
- WHOUR: DS 1
- ENDIF ; SB180 OR SB180FX
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- IF DS1216
- SVRAM: DS 1 ; Place to save the RAM byte at SWRDD0.
- ENDIF ; DS1216
- ;
- ;
- LSTSEC: DS 1 ; Place to save the 'Last Second'.
- ;
- FRACT: DS 1 ; Fractions of a second
- SEC: DS 1 ; Seconds
- MIN: DS 1 ; Minutes
- HRS: DS 1 ; Hours
- DAYS: DS 1 ; Days
- DATE: DS 1 ; Date
- MON: DS 1 ; Month
- YEAR: DS 1 ; Years
- ;
- TIMSTR: DS 128 ; Place to store the ASCII time string,
- ; ; (and stack head room).
- STACK: DS 2 ; Place to save the operating systems
- ; ; stack pointer.
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- IF SB180 OR SB180FX
- .DEPHASE ; End of logical phase block.
- ENDIF ; SB180 OR SB180FX
- ;
- ; ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
- ;
- LSTADR EQU $ ; Last address of code that may
- ; ; need transferred.
- ;
- ;
- ; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- ; @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
- ; %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
- ;
- ;
- ; Here are some interesting things related to 'Time':
- ;
- ; Exactly what is this thing called 'Time' anyway?
- ;
- ; The following documents are available from the
- ; National Technical Information Service (NTIS), an agency of
- ; the U.S. Department of Commerce:
- ;
- ; 5285 Port Royal Road,
- ; Springfield, VA 22161:
- ; (703) 487-4650
- ;
- ; JPRS: 45238, 2 May 1968
- ;
- ; "The possibility of the Experimental Study of the Properties
- ; of Time; by N. Kozyrev"
- ;
- ; $9.95 + $3 Shipping
- ;
- ; -----------------------------------------------------------------
- ;
- ; Cesium atoms, which are used in Atomic-Clocks, have a
- ; resonant frequency of 9.192631770 GHz.
- ;
- ; -----------------------------------------------------------------
- ;
- ; The speed of light according to by Dr. Taylor of the National
- ; Bureau of Standards (USA) [on 11/14/85, at 8:35 AM] was:
- ;
- ; 299,792,458 Meters per Second
- ; [186,282.3971 Miles per second]
- ;
- ; These measurements were made in October of 1983.
- ;
- ;
- ; "The Meter has been redefined using this number
- ; [299,792,458]."
- ;
- ; From the Sixth Edition of "Modern College Physics" by
- ; Harvey E. White:
- ;
- ; The standard meter {1},is defined in terms of the
- ; wavelength of light from a source containing KRYPTON GAS
- ; (chemical element 36):
- ;
- ; 1 meter = 1,650,763.73 wavelengths
- ; (For orange light of krypton)
- ;
- ; {1}: Adopted as the International legal standard of
- ; length, October 14, 1960, by the General Conference on Weights
- ; and Measures in Paris, France.
- ;
- ; ----------------------------------------------------------------
- ;
- ; Light-year: The distance traveled by light in one year.
- ;
- ; There are 9.454254955 * 10^12 millimeters in one light-
- ; year.
- ;
- ; -----------------------------------------------------------------
- ;
- ; A large (6' by 4') multi-color map showing all 25 time
- ; zones of the planet Earth, is available from the U.S.
- ; Defense Mapping Agency, request:
- ;
- ; "Standard Time Zone Chart of the World"
- ; Chart #76; DMA Stock #WOBZC76
- ; $5.50
- ;
- ; Information on maps and charts produced by the Defense
- ; Mapping Agency, is available from:
- ;
- ;
- ; Defense Mapping Agency
- ; Office of Distribution Services, U.S. Department of Defense
- ; Attn: DDCP
- ; Washington, DC 20315-0020
- ; (202)-227-2816
- ;
- ; All orders must be pre-paid:
- ; Make checks payable to "Treasurer of the United States"
- ;
- ; [ The quality of this map, is well worth the price. It
- ; takes about ten weeks to get it. The DMA is cheep, not fast. ]
- ;
- ; -------------------------------------------------------------
- ;
- ; 00:00:00 and 24:00:00 are interchangeable. 24:00:00 is
- ; associated with the date of the day ending, 00:00:00 with the
- ; day just starting.
- ;
- ;
- ; -------------------------------------------------------------
- ;
- ; One Side Real Day = 23:56:04
- ;
- ; -------------------------------------------------------------
- ;
- ; At a Horological Exhibit you could see examples of clocks
- ; and watches representing America, England, France, Austria,
- ; Japan, Holland and others during the 18th, 19th, and 20th
- ; Century.
- ;
- ; You might see the work of: Ely Terry, Abel Chandler, Aron
- ; Crane, Livi and Able Hutchins, Joseph Ives, Chauncy Jerome, Asa
- ; Munger, Chas Kirk, Henri Robert, Antide Janvier, Seth Thomas,
- ; Abner Jones, Geo. Solliday, David Wood, Simon Willard Jr, The
- ; Howards.
- ;
- ; -------------------------------------------------------------
- ;
- ; Julian Dates: Julian dates as used by astronomers take
- ; noon, 1 January 4713 B.C. as the base date (astronomers count
- ; days from noon to noon). CP/M-3 uses a base data of 1 January
- ; 1978.
- ;
- ; Julian Dates, can be usefully applied in computer programs.
- ; Particularly for real-time control of processes that need to
- ; handle long term event scheduling.
- ;
- ;
- ; See "Julian Dates For Microcomputers" by Gordon King; Dr
- ; Dobb's Journal, Number 80, June 1983, for code on how to use
- ; Julian Dates.
- ;
- ; -------------------------------------------------------------
- ;
- ; Ephemeris Time:
- ;
- ; "Ephemeris Time is based on idealized motions of the Sun and
- ; Moon and was introduced into the astronomical tables on January
- ; 1, 1960 to free astronomical calculations from the effect of
- ; irregularities of the Earth's rotation. The irregularities
- ; apparently show up in GMT(UT) but not UTC which is based on
- ; atomic clocks and broadcast by WWV. Not to worry - all these
- ; times differ from each other by less than a second."
- ;
- ; -- 03/11/87 SYSOP [ of NOAA]
- ;
- ; -------------------------------------------------------------
- ;
- ; The
- END