home *** CD-ROM | disk | FTP | other *** search
/ CP/M / CPM_CDROM.iso / jsage / znode3 / uploads / tclock.lbr / TCLOCK.ZZ0 / TCLOCK.Z8°
Encoding:
Text File  |  1993-06-07  |  3.1 KB  |  104 lines

  1. ;  PROGRAM:  TCLOCK
  2. ;  AUTHOR: Al Hawley 
  3. ;  VERSION:  1.1
  4. ;  DATE:  12/29/89
  5. ;  Version Author: Al Hawley (aeh)
  6. ;  PREVIOUS VERSIONS:  12/30/88
  7.  
  8. ; This program determines which operating system is present and
  9. ; which clock drivers (if any) are available. It reads the 
  10. ; system clock and transfers the time to the WYSE-60 terminal
  11. ; clock whose time is displayed on the terminals status line.
  12. ; The program reads as standard clocks, the Date/Time services
  13. ; provided by ZSDOS, ZDDOS, CPM+(CP/M 3.0), DateStamper, and a
  14. ; user supplied RTC which meets certain interface standards.
  15. ; An example of such a clock interface is included in BIOCLK.
  16.  
  17. VERS    EQU    11
  18. ; Added the BIOCLK module by means of which a user can provide
  19. ; for use of a 'non-standard' Real-Time-Clock.
  20.  
  21. ;Externals, Entry Points, and definitions here
  22.  
  23.     .request gtosd
  24.     ext    gt_osd,rdclk,time,ascidt
  25.     .request bioclk
  26.     ext    rdbclk
  27.     .request z3lib,syslib
  28.     ext    z3init,epstr,cout
  29.  
  30.     include    sysdef
  31.  
  32. ; Start of Program
  33. module:    jp    start
  34.     db    'Z3ENV'        ;This is a ZCPR3 Utility
  35.     db    1        ;External Environment Descriptor
  36. z3eadr:    dw    0        ;gets filled in by Z33/4 or Z3INST
  37.     dw    module        ;reserved for type 3/4 env use
  38.  
  39. ;======================================================
  40.  
  41. ; Configuration Parameters for program defaults
  42.     db    'xxxxxxxx'    ;PROGRAM ID STRING for configuration data
  43.     ds    1,0        ;allow for up to 8 char plus null terminator
  44. ; Configuration Data here
  45.  
  46. ;======================================================
  47.  
  48. ;  Start of Program
  49. start:                ; Initialize ZCPR3 Environment
  50.     ld    hl,(z3eadr)    ;pt to ZCPR3 environment
  51.     call    z3init        ;initialize the ZCPR3 Env and the VLIB Env
  52.     ld    a,h
  53.     or    l
  54.     ld    (z3flag),a    ;if 0, not Z3. if NZ, then Z3 is present
  55.     ld    (stack),sp    ; save callers stack
  56.     ld    sp,stack    ; set local stack
  57.  
  58.     call    gt_osd        ;Check OS, get clock data structure addr.
  59.     jr    c,mainx        ;abort if unrecognized OS
  60.     jr    nz,dotime    ;nz=valid clock found
  61. ;A system clock is not defined. If a user supplied clock
  62. ;is provided, then its address and the byte to be passed
  63. ;in C or A must be installed at (HL)+5 and (HL)+4, respectively
  64. ;before a call to TIME or RDCLK.
  65.     call    rdbclk        ;read bios clock, ret HL->std DT buf
  66.     call    ascidt        ;convert BCD Date/Time to formatted ASCII
  67.                 ;ret hl-> yy/mm/dd_hh:mm:ss
  68.     xor    a        ;make Z to skip the TIME call
  69. dotime:    call    nz,time        ;read standard clocks
  70.                 ;ret hl-> yy/mm/dd_hh:mm:ss
  71.     ld    (dtstr),hl    ;save pointer to formatted Date/Time
  72.     ld    bc,9        ;offset to hh
  73.     add    hl,bc
  74.     ld    de,newtim
  75.     ldi
  76.     ldi
  77.     inc    hl        ;skip the colon
  78.     ldi
  79.     ldi
  80.  
  81. ;display the date/time on the screen.
  82.     ld    hl,(dtstr)    ;hl -> formatted Date/Time
  83.     call    epstr
  84. ;do this last, because it ties up the terminal for
  85. ;a second or so.
  86.     ld    hl,setterm
  87.     call    epstr        ;send setup string to terminal
  88. mainx:    ld    sp,(stack)
  89.     ret
  90.  
  91. ;------------------------------------------------
  92.  
  93. setterm:
  94.     db    esc,'c8'    ;Wyse60 lead in to set terminal clock
  95. newtim:    db    '1200'        ;hhmm
  96.     db    0        ;string terminator
  97. dtstr:    ds    2        ;->formatted asci d/t string
  98.  
  99. z3flag:    ds    1
  100.     ds    20
  101. stack:    ds    2
  102.  
  103.     end
  104.