home *** CD-ROM | disk | FTP | other *** search
/ ftp.barnyard.co.uk / 2015.02.ftp.barnyard.co.uk.tar / ftp.barnyard.co.uk / cpm / walnut-creek-CDROM / CPM / BBSING / MBBS / MBKMDOVL.LBR / KMHZ-1.AZM / KMHZ-1.ASM
Assembly Source File  |  2000-06-30  |  8KB  |  246 lines

  1.  
  2. ;
  3. ; =========================================================
  4. ;  KMHZ-1.ASM - MB-KMD patch file for the HEATH/ZENITH Z100
  5. ; =========================================================
  6. ;
  7. ;
  8. ; =============
  9. ; Introduction:
  10. ; =============
  11. ;
  12. ; This file adapts any version of MB-KMD to run with the HEATH/ZENITH Z100.
  13. ;
  14. ; To use, first edit any options desired into the mainline source code of
  15. ; the transfer program, then assemble with ASM or MAC to produce a HEX file.
  16. ;
  17. ; Then edit this file as needed (check the CONOUT routine if you want to 
  18. ; locally see file transfer time and the record count while programs are 
  19. ; being sent).  Then assemble this overlay with ASM or MAC.
  20. ;
  21. ; Now merge the two .HEX files using MLOAD.COM (available on most RCP/M
  22. ; systems using the command:
  23. ;
  24. ;       MLOAD KMD=MB-KMD,KMHZ-1
  25. ;
  26. ; Then place the resulting .COM file on your system where it is accessible
  27. ; from any drive/user area (usually A0:)
  28. ;
  29. ;
  30. ; ===============
  31. ; Update History:
  32. ; ===============
  33. ;
  34. ; 10/26/86 - Edited for inclusion in MBKMDOVL.LBR    - Bob Kramer
  35. ; 08/09/86 - Inspected for MB-KMD compatibility.    - Michael Conley
  36. ; 11/17/83 - Renamed to XMHZ-1.ASM            - Irv Hoff
  37. ; 10/22/83 - Updated to XMODEM77            - Irv Hoff
  38. ; 09/27/83 - Modified for Zenith Z100            - Paul Matlin
  39. ;
  40. ; 03/07/83  Added instructions on how to adapt this file to XMODEM70.COM.
  41. ;        Standardized the format.  Added automatic MSPEED from "BYE"
  42. ;        program.  Added CONOUT information.  Adapted from XM70PMMI.
  43. ;                            - Irv Hoff
  44. ;
  45. ;
  46. ; ==============
  47. YES:     EQU    0FFH
  48. NO:     EQU    0
  49. ;
  50. ; Values shown are for the 2661-2 serial I/O
  51. ;
  52. MODDATP: EQU    0ECH        ; Data in port
  53. MODDATO: EQU    MODDATP        ; Data out port
  54. MODCTLP: EQU    MODDATP+1    ; Line status register
  55. MODCTL2: EQU    MODDATP+1    ; Modem status register
  56. MODSNDB: EQU    01H        ; Bit to test for send
  57. MODSNDR: EQU    01H        ; Value when ready
  58. MODRCVB: EQU    02        ; Bit to test for receive
  59. MODRCVR: EQU    02        ; Value when ready
  60. MODDCDA: EQU    40H        ; Value when active
  61. MODDCDB: EQU    40H        ; Carrier detect bit
  62. MODPARE: EQU    08H        ; Value for parity error
  63. MODOVRE: EQU    10H        ; Value for overrun error
  64. MODFRME: EQU    20H        ; Value for framing error
  65. ;
  66. LSPEED:     EQU    YES        ; Yes,  using 'BYE' with speed selection
  67.                 ; No,  using 'SPEED' manual selection
  68. MSPEED:     EQU    3CH        ; Location of baud rate factor (set by
  69.                 ; 'BYE')  set location in 'BYE' to agree.
  70.                 ; 3DH and 3EH often used by newer versions
  71.                 ; of 'ZCPR'.
  72. XSPEED:     EQU    1        ; Speed for file time transfer without
  73.                 ; auto-set.  Use one of the following:
  74.                 ; 0=110 1=300 2=450 3=600 4=710 5=1200
  75. BASE:     EQU    100H        ; Start of CP/M normal program area
  76. ;
  77. ;
  78. ; ===========
  79. ; Jump table:
  80. ; ===========
  81. ;
  82. ; The jump table must be in exactly the same sequence as the one in MB-KMD.
  83. ; Note the ORG of 103H - This jump table has no jump to 'BEGIN'.
  84. ;
  85.      ORG    BASE+3        ; Start after 'JMP BEGIN'
  86. ;
  87. ; NOTE:    For the Zenith Z100 the CONOUT address is 0F9FFH
  88. ;
  89. CONOUT:     JMP    0F9FFH        ; Must be 00000h if not used, see below
  90. PMINIT:     JMP    MINIT        ; Initialization routine (if needed)
  91. PUNINIT: JMP    UNINIT        ; Undo whatever 'MINIT' did (or return)
  92. PSENDR:     JMP    SENDR        ; Send character (via pop psw)
  93. PCAROK:     JMP    CAROK        ; Test for carrier
  94. PMDIN:     JMP    MDIN        ; Receive data byte
  95. PGETCHR: JMP    GETCHR        ; Get character from modem
  96. PRCVRDY: JMP    RCVRDY        ; Check receive ready
  97. PSNDRDY: JMP    SNDRDY        ; Check send ready
  98. PSPEED:     JMP    SPEED        ; Get speed value for file transfer time
  99. PEXTRA1: JMP    EXTRA1        ; Extra for custom routine
  100. PEXTRA2: JMP    EXTRA2        ; Extra for custom routine
  101. PEXTRA3: JMP    EXTRA3        ; Extra for custom routine
  102. ;
  103. ;
  104. ; ================================================================
  105. ; To Display the Record Count on the CRT During Program Transfers:
  106. ; ================================================================
  107. ;    
  108. ;    This one addition requires some work on the part of the user.  When
  109. ; "BYE" is added,  CP/M is normally moved lower to accomodate the new
  110. ; program above CP/M.  Whenever BYE is called to enable the RCPM capability,
  111. ; it steals some of the addresses contained in the BIOS jump vector table.
  112. ; In order to display on the CRT during program transfers you need to get
  113. ; into the BIOS console output routine directly,  else what is being
  114. ; displayed also tries to go out the modem.  This is a big NO-NO at that
  115. ; time.  (This cannot be done automatically by MB-KMD,  since BYE has
  116. ; already taken the address we need to find,  by the time MB-KMD is auto-
  117. ; matically activated by the remote station.)
  118. ;
  119. ;    So,  with the disk containing BYE, but prior to activating BYE, do
  120. ; this:
  121. ;    1) Cold reboot to move CP/M (and BIOS) to the new area needed
  122. ;            when BYE is activated on the same disk.
  123. ;    2) Use DDT and dump the area from 0000H to 0002H.  This gives
  124. ;         the warm reboot address in BIOS.
  125. ;    3) Add 9 Bytes to that address to get your console output jump
  126. ;         vector.
  127. ;    4) Pick off the address contained in the jump vector and install
  128. ;         that in "CONOUT", below.  Example of one system in use:
  129. ;
  130. ;  FIRST, COLD REBOOT WITH DISK CONTAINING "BYE"
  131. ;
  132. ;      0000  C3 03 E0    (location of warm reboot on disk with BYE
  133. ;
  134. ;  PRIOR TO ACTIVATING BYE BUT ON SAME DISK
  135. ;
  136. ;      E003  C3 E9 E0    (BIOS warm reboot jump vector on this disk)
  137. ;      E006  C3 00 E9    (BIOS get console status routine)
  138. ;      E009  C3 B7 E1    (BIOS console input routine)
  139. ;      E00C  C3 D4 E1    (BIOS console output routine)
  140. ;
  141. ;        The address we need is thus E1D4.  Put that below, in
  142. ;        our example it would be:    CONOUT   JMP   0E1D4H
  143. ;
  144. ;
  145. ;CONOUT:  JMP    00000H        ; If you wish to show the record count
  146. ;                ; during program transfer, fill in this
  147. ;                ; address at 'CONOUT' above.
  148. ;
  149. ;                        - Irv Hoff
  150. ;
  151. ; =========================================
  152. ; --> CAROK - check for presence of carrier
  153. ; =========================================
  154. ;
  155. ; Return with Z = carrier on
  156. ;
  157. CAROK:    IN    MODCTL2        ; Read modem status
  158.     ANI    MODDCDB        ; Get carrier detect bit
  159.     CPI    MODDCDA        ; Test bit
  160.     RET
  161. ;
  162. ;
  163. ; ==============
  164. ;
  165. EXTRA1:    RET            ; For later use
  166. EXTRA2:    RET            ; For later use
  167. EXTRA3:    RET            ; For later use
  168. ;
  169. ;
  170. ; ==========================================
  171. ; --> GETCHR - get a character, same as MDIN
  172. ; --> MDIN - get a character, same as GETCHR
  173. ; ==========================================
  174. ;
  175. GETCHR:
  176. MDIN:    IN    MODDATP        ; Get character from data in port
  177.     RET
  178. ;
  179. ;
  180. ; ==============
  181. ;
  182. MINIT:    RET            ; No initialization required
  183. ;
  184. ;
  185. ; ================================
  186. ; --> RCVRDY - check receive ready
  187. ; ================================
  188. ; RET with Z = character available.  Return with error code in A-reg.
  189. ;
  190. RCVRDY:    IN    MODCTLP        ; Get modem status
  191.     PUSH    B        ; Save scratch register
  192.     PUSH    PSW        ; Check error status
  193.     ANI    MODFRME+MODOVRE+MODPARE
  194.     MOV    B,A        ; Save it for a moment
  195.     POP    PSW
  196.     ANI    MODRCVB        ; Isolate ready bit
  197.     CPI    MODRCVR        ; Test it
  198.     MOV    A,B        ; Get the error code char. back
  199.     POP    B
  200.     RET
  201. ;
  202. ;
  203. ; ==========================
  204. ; --> SENDR - send character
  205. ; ==========================
  206. ;
  207. SENDR:    POP    PSW        ; Get the character back
  208.     OUT    MODDATO        ; Send it to the modem output
  209.     RET
  210. ;
  211. ;
  212. ; ===================================
  213. ; --> SNDRDY - check if ready to send
  214. ; ===================================
  215. ;
  216. SNDRDY:    IN    MODCTLP        ; Get status byte
  217.     ANI    MODSNDB        ; Isolate ready bit
  218.     CPI    MODSNDR        ; Ready to send?
  219.     RET
  220. ;
  221. ;
  222. ; ====================================================
  223. ; --> SPEED - sets the time shown for program transfer
  224. ; ====================================================
  225. ;
  226. SPEED:     IF    LSPEED
  227.     LDA    MSPEED        ; Get index for baud rate from 'BYE'
  228.      ENDIF
  229. ;
  230.      IF     NOT LSPEED
  231.     MVI    A,XSPEED    ; Get index for baud rate from 'XSPEED'
  232.      ENDIF
  233. ;
  234.     RET
  235. ;
  236. ;
  237. ; ==============
  238. ;
  239. UNINIT:    RET            ; Not initialized, so no 'UN-INITIALIZE'
  240. ;
  241. ; ==============
  242. ;
  243. ;
  244.     END