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 / XMPM-1.AQM / XMPM-1.ASM
Assembly Source File  |  2000-06-30  |  9KB  |  250 lines

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