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 / XMDC-1.AQM / XMDC-1.ASM
Assembly Source File  |  2000-06-30  |  8KB  |  229 lines

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