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 / MODEMS / XMODEM / XMH8-1.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  8KB  |  227 lines

  1.  
  2. ; XMH8-1.ASM - XMODEMxx PATCH FILE FOR HEATH/ZENITH COMPUTERS 11/17/83
  3. ;
  4. ; This file adapts XMODEMxx to the HEATH/ZENITH H89 computers with ex-
  5. ; ternal modem.  To use, first edit any options desired into XMODEMxx.ASM,
  6. ; then assemble (can use ASM.COM) and load to get XMODEMxx.COM.  Then
  7. ; edit this file as needed (check the CONOUT routine if you want to loc-
  8. ; ally see file transfer time and the record count while programs are
  9. ; being sent).  Then assemble (can use ASM.COM) and merge via DDT or SID:
  10. ;
  11. ;    B>DDT XMODEMxx.COM
  12. ;    DDT VERS 2.2
  13. ;    NEXT  PC
  14. ;    1180 0100
  15. ;    -IXMH8-1.HEX        (note the 'I' command)
  16. ;    -R            ('R' loads in the .HEX file)
  17. ;    NEXT  PC
  18. ;    1180 0000
  19. ;    -G0            (return to CP/M)
  20. ;    B>SAVE 16 XMODEMxx.COM  (now have a modified .COM file)
  21. ;
  22. ; NOTE: Save 21 (rather than 16) if LOGCAL is YES
  23. ;
  24. ;=======================================================================
  25. ;
  26. ; 11/17/83 - Renamed to XMH8-1.ASM    - Irv Hoff
  27. ; 10/22/83 - Updated to XMODEM77    - Irv Hoff
  28. ; 04/04/83 - Updated to XMODEM74    - Irv Hoff
  29. ; 03/27/83 - Updated to XMODEM73    - Irv Hoff
  30. ; 03/17/83 - Updated to XMODEM72    - Irv Hoff
  31. ; 03/15/83 - Updated to XMODEM71    - Irv Hoff
  32. ;
  33. ; 03/07/83  Added instructions on how to adapt this file to XMODEM70.COM.
  34. ;        Standardized the format.  Added automatic MSPEED from "BYE"
  35. ;        program.  Added CONOUT information.  Adapted from XM70PMMI.
  36. ;                    - Irv Hoff
  37. ;
  38. ;=======================================================================
  39. YES:    EQU    0FFH
  40. NO:    EQU    0
  41. ;
  42. ;=======================================================================
  43. ;
  44. ; Values shown are for the 8250 serial I/O
  45. ;
  46. MODDATP: EQU    0D8H        ;data in port
  47. MODDATO: EQU    MODDATP        ;data out port
  48. MODCTLP: EQU    MODDATP+5    ;line status register
  49. MODCTL2: EQU    MODDATP+6    ;modem status register
  50. MODSNDB: EQU    20H        ;bit to test for send
  51. MODSNDR: EQU    20H        ;value when ready
  52. MODRCVB: EQU    1        ;bit to test for receive
  53. MODRCVR: EQU    1        ;value when ready
  54. MODDCDA: EQU    10H        ;value when active
  55. MODDCDB: EQU    10H        ;carrier detect bit
  56. MODPARE: EQU    4        ;value for parity error
  57. MODOVRE: EQU    2        ;value for overrun error
  58. MODFRME: EQU    8        ;value for framing error
  59. ;
  60.  
  61. LSPEED    EQU    YES        ;yes if using 'BYE' with speed selection
  62.                 ;no if using 'SPEED' manual selection
  63. MSPEED    EQU    3CH        ;location of baud rate factor (set by
  64.                 ;'BYE')  set location in 'BYE' to agree.
  65.                 ;3dh and 3eh often used by newer ver-
  66.                 ;sions of 'ZCPR'.
  67. XSPEED    EQU    1        ;speed for file time transfer without
  68.                 ;auto-set.  use one of the following:
  69.                 ;0=110 1=300 2=450 3=600 4=710 5=1200
  70. BASE    EQU    100H        ;start of cp/m normal program area
  71. ;
  72. ;-------------------------------------------------------------------
  73. ;
  74. ; Jump table: The jump table must be in exactly the same sequence as the
  75. ; one in XMODEM.  Note the ORG of 103H - This jump table has no jump to
  76. ; 'BEGIN'.
  77.  
  78. ;
  79.      ORG    BASE+3        ;start after 'JMP BEGIN'
  80. ;
  81. CONOUT:     JMP    00000H        ;must be 00000h if not used, see below
  82. PMINIT:     JMP    MINIT        ;initialization routine (if needed)
  83. PUNINIT: JMP    UNINIT        ;undo whatever 'MINIT' did (or return)
  84. PSENDR:     JMP    SENDR        ;send character (via pop psw)
  85. PCAROK:     JMP    CAROK        ;test for carrier
  86. PMDIN:     JMP    MDIN        ;receive data byte
  87. PGETCHR: JMP    GETCHR        ;get character from modem
  88. PRCVRDY: JMP    RCVRDY        ;check receive ready
  89. PSNDRDY: JMP    SNDRDY        ;check send ready
  90. PSPEED:     JMP    SPEED        ;get speed value for file transfer time
  91. PEXTRA1: JMP    EXTRA1        ;extra for custom routine
  92. PEXTRA2: JMP    EXTRA2        ;extra for custom routine
  93. PEXTRA3: JMP    EXTRA3        ;extra for custom routine
  94. ;
  95. ;=======================================================================
  96. ;
  97. ; -- To Display the Record Count on the CRT During Program Transfers --
  98. ;    
  99. ;    This one addition requires some work on the part of the user.
  100. ; When "BYE" is added, CP/M is normally moved lower to accomodate the
  101. ; new program above CP/M.  Whenever BYE is called to enable the RCPM
  102. ; capability, it steals some of the addresses contained in the BIOS jump
  103. ; vector table.  In order to display on the CRT during program transfers
  104. ; you need to get into the BIOS console output routine directly, else
  105. ; what is being displayed also tries to go out the modem.  This is a big
  106. ; NO-NO at that time.  (This cannot be done automatically by XMODEM,
  107. ; since BYE has already taken the address we need to find, by the time
  108. ; XMODEM is automatically activated by the remote station.)
  109. ;
  110. ;    So with the disk containing BYE, but prior to activating BYE, do
  111. ; this:
  112. ;        1) Cold reboot to move CP/M (and BIOS) to the new area
  113. ;            needed when BYE is activated on the same disk.
  114. ;        2) Use DDT and dump the area from 0000H to 0002H.  This
  115. ;                   gives the warm reboot address in BIOS.
  116. ;        3) Add 9 Bytes to that address to get your console out-
  117. ;             put jump vector.
  118. ;        4) Pick off the address contained in the jump vector and
  119. ;             install that in "CONOUT", below.  Example of one
  120. ;             system in use:
  121. ;
  122. ;            FIRST, COLD REBOOT WITH DISK CONTAINING "BYE"
  123. ;
  124. ;      0000  C3 03 E0    (location of warm reboot on disk with BYE
  125. ;
  126. ;            PRIOR TO ACTIVATING BYE BUT ON SAME DISK
  127. ;
  128. ;      E003  C3 E9 E0    (BIOS warm reboot jump vector on this disk)
  129. ;      E006  C3 00 E9    (BIOS get console status routine)
  130. ;      E009  C3 B7 E1    (BIOS console input routine)
  131. ;      E00C  C3 D4 E1    (BIOS console output routine)
  132. ;
  133. ;        The address we need is thus E1D4.  Put that below, in
  134. ;        our example it would be:    CONOUT   JMP   0E1D4H
  135. ;
  136. ;
  137. ;    CONOUT:      JMP    00000H    ;If you wish to show the record count
  138. ;                ;during program transfer, fill in this
  139. ;                ;address at 'CONOUT' above.
  140. ;
  141. ;                    - Irv Hoff
  142. ;
  143. ;=======================================================================
  144. ;
  145. ; ---> CAROK - check for presence of carrier.  RET with Z = carrier on
  146. ;
  147. CAROK:    IN    MODCTL2        ;read modem status
  148.     ANI    MODDCDB        ;get carrier detect bit
  149.     CPI    MODDCDA        ;test bit
  150.     RET
  151. ;
  152. ;=======================================================================
  153. ;
  154. EXTRA1:    RET            ;for later use
  155. EXTRA2:    RET            ;for later use
  156. EXTRA3:    RET            ;for later use
  157. ;
  158. ;=======================================================================
  159. ;
  160. ; ---> GETCHR - get a character, same as MDIN
  161. ; ---> MDIN - - get a character, same as GETCHR
  162. ;
  163. GETCHR:
  164. MDIN:    IN    MODDATP        ;get character from data in port
  165.     RET
  166. ;
  167. ;=======================================================================
  168. ;
  169. MINIT:    RET            ;no initialization required
  170. ;
  171. ;=======================================================================
  172. ;
  173. ; ---> RCVRDY - check receive ready.  RET with Z = character available.
  174. ;            Return with error code in A-reg.
  175. ;
  176. RCVRDY:    IN    MODCTLP        ;get modem status
  177.     PUSH    B        ;save scratch register
  178.     PUSH    PSW        ;check error status
  179.     ANI    MODFRME+MODOVRE+MODPARE
  180.     MOV    B,A        ;save it for a moment
  181.     POP    PSW
  182.     ANI    MODRCVB        ;isolate ready bit
  183.     CPI    MODRCVR        ;test it
  184.     MOV    A,B        ;get the error code char. back
  185.     POP    B
  186.     RET
  187. ;
  188. ;=======================================================================
  189. ;
  190. ; ---> SENDR - send character
  191. ;
  192. SENDR:    POP    PSW        ;get the character back
  193.     OUT    MODDATO        ;send it to the modem output
  194.     RET
  195. ;
  196. ;=======================================================================
  197. ;
  198. ; ---> SNDRDY - check if ready to send.
  199. ;
  200. SNDRDY:    IN    MODCTLP        ;get status byte
  201.     ANI    MODSNDB        ;isolate ready bit
  202.     CPI    MODSNDR        ;ready to send?
  203.     RET
  204. ;
  205. ;=======================================================================
  206. ;
  207. ; ---> SPEED - sets the time shown for program transfer.
  208. ;
  209. SPEED:     IF    LSPEED
  210.     LDA    MSPEED        ;get index for baud rate from 'BYE'
  211.      ENDIF
  212. ;
  213.      IF     NOT LSPEED
  214.     MVI    A,XSPEED    ;get index for baud rate from 'XSPEED'
  215.      ENDIF
  216. ;
  217.     RET
  218. ;
  219. ;=======================================================================
  220. ;
  221. UNINIT:    RET            ;not initialized, so no 'UN-INITIALIZE'
  222. ;
  223. ;=======================================================================
  224. ;
  225. ;
  226.     END