home *** CD-ROM | disk | FTP | other *** search
/ norge.freeshell.org (192.94.73.8) / 192.94.73.8.tar / 192.94.73.8 / pub / computers / cpm / alphatronic / ZSDOS2.ZIP / USERCLOK.TEM < prev    next >
Text File  |  1988-10-23  |  7KB  |  185 lines

  1.     TITLE    "Clock module name - (REL clock name here)"
  2.     SUBTTL    "Description of Clock Module"
  3. ;================================================================
  4. ; Place brief description and machine clock I/O parameters here
  5. ; along with any version and date data
  6. ;================================================================
  7.  
  8. VERS    EQU    01
  9.     .Z80
  10.     NAME    CCLOK        ; Change this to no more than 6-char
  11.                 ; name for the REL driver module
  12.  
  13.     MACLIB    CLOCK.LIB    ; Some useful equates are here
  14.  
  15. ; This first section contains identification information for the driver
  16. ; The information is not placed in the clock driver code section, but are
  17. ; located in a different area located by the _CLKID Named Common directive.
  18.  
  19.     COMMON    /_CLKID/
  20.  
  21. DESCST:    DEFW    0000        ; Add label here if a static year byte
  22.                 ; is used by your clock driver.  The
  23.                 ; label should point to the year byte
  24.  
  25. CLKNAM:    DEFB    'Myclock                 '    ; Exactly 24 chars in name
  26.     DEFB    VERS/10+'0','.',VERS MOD 10 +'0',0
  27.  
  28. DESCR:    DEFB    '  This description may be longer than the brief',CR,LF
  29.     DEFB    '  name string above, and must be null-terminated',0
  30.  
  31.       IF  [$-DESCST] > 256
  32.     OVER2            ; This must be less than or equal to 256 bytes
  33.       ENDIF
  34.  
  35.     PAGE
  36.     SUBTTL    "Configurable Clock Hardware Parameters"
  37. ;---------------------------------------------------------------------
  38. ; This section contains any configurable parameters needed for the
  39. ; clock driver.  They must be structured in the manner shown in order
  40. ; for the loader to properly match and set the values.
  41. ; The values in this section are not loaded in the same code section
  42. ; as the actual driver code, but are located in another base referenced
  43. ; by the _PARM_ Named Common directive.
  44.  
  45.     COMMON    /_PARM_/
  46.  
  47. PARBAS:    DEFW    NPARAMS        ; # of parameters (Set to 00 if none)
  48.     DEFW    STRS        ; Pointer to STRS (Set to 00 if none)
  49. NP0:
  50. XYR    EQU    $+1
  51.     DEFB    BYTE        ; EXAMPLE! - This shows a byte value
  52.     DEFW    88H        ;    "     - ..and default value in Set
  53.  
  54. XPORT    EQU    $+1
  55.     DEFB    WORD        ; EXAMPLE! - This shows a 16-bit value
  56.     DEFW    0F013H        ;    "     - ..and default value in Set
  57.  
  58. NPARAMS    EQU    ($-NP0)/3
  59.  
  60. STRS:    DEFB    'Default Year',0    ; EXAMPLE! - Text prompt for XYR
  61.     DEFB    'Default Port',0    ; EXAMPLE! - Text prompt for XPORT
  62.  
  63.     PAGE
  64.     SUBTTL    "Clock Code - SB180 HeartBeat"
  65. ;------------------------------------------------------------------
  66. ; This section should contain the actual Clock Driver code, and all
  67. ; entries here are located in the CSEG, or Code Segment.
  68.  
  69.     CSEG
  70.  
  71. ; Add any needed equates here if they are not included in CLOCK.LIB
  72.  
  73. TIMOFF    EQU    36H        ; EXAMPLE! - Bios offset for clock ptr
  74.  
  75. ;-----------------------------------------------------------
  76. ;        Z S D O S    C L O C K    H E A D E R
  77. ;-----------------------------------------------------------
  78. ; Enter: HL points to a 6-byte buffer to Get/Set time
  79. ; Exit :  A=1 on Success, A=FFH if error
  80. ;     HL points to last char in buffer
  81. ; NOTE: If clock Set is not included, comment these two jumps
  82. ;    out to save a few bytes.  The loader, SETUPZST, uses
  83. ;    these two jumps to recognize a full ZSDOS clock and
  84. ;    modify the interface code.
  85.  
  86. PRGBAS:    JP    GETTIM        ; Jump to Read Clock
  87.     JP    WRCLK        ; Jump to Set Clock
  88.  
  89. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  90. ;        R e a d    T h e    C l o c k
  91. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  92. ; Clock READ code starts here.
  93.  
  94. GETTIM:                ; The work of reading the clock
  95.                 ; goes here.  Values needing to be set
  96.                 ; during installation are referenced as:
  97. ;YPORT1    EQU    $+1
  98. ;    LD    BC,0000        ; EXAMPLE! - this will set a 16-bit value
  99. ;                ;    in the configuration process
  100. ;YYR    EQU    $+1        ; EXAMPLE! - This will set an 8-bit value
  101. ;    LD    A,00        ;    in the configuration process
  102.  
  103. ; ... Place the meat of the driver in this section ...
  104.  
  105. OKRET:    LD    A,01        ; Set OK status return
  106.     RET
  107.  
  108. ERRET:    OR    0FFH        ; Set Error code if needed
  109.     RET
  110.  
  111. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  112. ;        S e t    T h e    C l o c k
  113. ;- - - - - - - - - - - - - - - - - - - - - - - - - - - - -
  114. ; Clock Set code placed here if needed.  If Clock Setting
  115. ; is not being added, comment out this section to save a
  116. ; byte of code.
  117.  
  118. WRCLK:
  119.     RET
  120.  
  121.     PAGE
  122.     SUBTTL    "Run-Time Configuration of Ports and Masks"
  123. ;-------------------------------------------------------------
  124. ; This code installs configurable items into the clock module
  125. ; Enter with DE pointing to the physical base address of the
  126. ;     relocatable module.  DE MUST BE USED TO SET VALUES IN
  127. ;     THE CSEG PORTION OF CODE!
  128. ; NOTE: Code in this section is not added to the actual clock
  129. ;    driver, but placed in a different area referenced to
  130. ;    the common base _POST_.
  131.  
  132.     COMMON    /_POST_/
  133.  
  134. ; Values in the _PARM_, _POST_ and _PRE_ sections may be loaded
  135. ; and saved directly, since their addresses are constant from
  136. ; linkage through execution.  Setting or reading values in the
  137. ; CSEG must be indirect based on the value in the DE register
  138. ; pair.  The following examples show how to access the various
  139. ; sections.
  140. ;
  141. ;    LD    A,(XYR)        ; EXAMPLE - Get byte from _PARM_ directly
  142. ;    LD    HL,YYR        ;    "    - Begin offset into CSEG indirectly
  143. ;    ADD    HL,DE        ;    "    - HL now addresses relocated loc'n
  144. ;    LD    (HL),A        ;    "    - ..so value can be stored
  145. ;
  146. ; Likewise, 16-bit values must be accessed indirectly, and may use
  147. ; the BC register pair as transfer storage.
  148. ;
  149. ;    LD    BC,(XPORT)    ; EXAMPLE - Get word from _PARM_ directly
  150. ;    LD    HL,YPORT1    ;    "    - Begin offset into CSEG indirectly
  151. ;    ADD    HL,DE        ;    "    - HL now addresses relocated loc'n
  152. ;    LD    (HL),C        ;    "    - ..so value can be saved..
  153. ;    INC    HL        ;    "    - ...a byte..
  154. ;    LD    (HL),B        ;    "    - ....at a time..
  155. ;
  156. ;    LD    (YPORT2),BC    ; EXAMPLE - Values can be stored directly into
  157. ;                     "    - other sections such as _PRE_
  158.  
  159.     RET        ; This RETURN MUST be present even if no other
  160.             ; code is included in this section
  161.  
  162.  
  163.     PAGE
  164.     SUBTTL    "Pre-Execution Clock Checks (Check for ticking)"
  165. ;----------------------------------------------------------------
  166. ; This module is executed just prior to installing the module to
  167. ;   insure that a valid clock is present
  168. ; Enter with DE pointing to base of relocated clock code segment
  169.  
  170.     COMMON    /_PRE_/
  171.  
  172. ; Optional final setup of the clock module may go here.  Examples of such
  173. ; code would be installation-dependant items such as physical RAM location
  174. ; for the driver module.  If any code is added here, the DE register pair
  175. ; MUST be preserved to properly inter PRECLOCK code (If included).
  176.  
  177. ;YPORT2    EQU    $+1        ; EXAMPLE - just to show accessing method
  178. ;    LD    BC,0000        ;    "    - ..from _POST_ code.
  179.  
  180.     INCLUDE    PRECLOCK.LIB    ; This section of code merely calls the
  181.                 ; clock and waits an arbitrary period of
  182.                 ; time (>> 1 second) to see if the time
  183.                 ; changes.  It returns an error if not.
  184.     END
  185.