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 / XMEX-1.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  8KB  |  225 lines

  1.  
  2. ; XMEX-1.ASM - XMODEMxx PATCH FILE FOR EXTERNAL MODEM  11/17/83
  3. ;
  4. ; This file adapts XMODEMxx to an external modem.  This particular setup
  5. ; uses a 8251 I/O chip.  To use, first edit any options desired into
  6. ; XMODEMxx.ASM, then assemble (can use ASM.COM) and load which supplies
  7. ; XMODEMxx.COM.  Then edit this file as needed (check the CONOUT routine
  8. ; if you want to locally see file transfer time and the record count
  9. ; while programs are being sent).  Then assemble (can use ASM.COM) and
  10. ; merge via DDT or SID:
  11. ;
  12. ;    B>DDT XMODEMxx.COM
  13. ;    DDT VERS 2.2
  14. ;    NEXT  PC
  15. ;    1180 0100
  16. ;    -IXMEX-1.HEX        (note the 'I' command)
  17. ;    -R            ('R' loads in the .HEX file)
  18. ;    NEXT  PC
  19. ;    1180 0000
  20. ;    -G0            (return to CP/M)
  21. ;    B>SAVE 16 XMODEMxx.COM  (now have a modified .COM file)
  22. ;
  23. ; NOTE: Save 21 (rather than 16) if LOGCAL is YES
  24. ;
  25. ;=======================================================================
  26. ;
  27. ; 11/17/83 - Renamed to XMEX-1.ASM    - Irv Hoff
  28. ; 10/22/83 - Updated to XMODEM77    - Irv Hoff
  29. ; 04/04/83 - Updated to XMODEM74    - Irv Hoff
  30. ; 03/27/83 - Updated to XMODEM73    - Irv Hoff
  31. ; 03/17/83 - Updated to XMODEM72    - Irv Hoff
  32. ; 03/15/83 - Updated to XMODEM71    - Irv Hoff
  33. ;
  34. ; 03/07/83  Added instructions on how to adapt this file to XMODEM70.COM.
  35. ;        Standardized the format.  Added automatic MSPEED from "BYE"
  36. ;        program.  Added CONOUT information.  Adapted from XM70PMMI.
  37. ;                    - Irv Hoff
  38. ;
  39. ;=======================================================================
  40. YES:    EQU    0FFH
  41. NO:    EQU    0
  42. ;
  43. ;=======================================================================
  44. ;
  45. MODDATP: EQU    28H        ;data in port
  46. MODDATO: EQU    MODDATP        ;data out port
  47. MODCTLP: EQU    MODDATP+1    ;control/status port
  48. MODSNDB: EQU    1        ;bit to test for send
  49. MODSNDR: EQU    1        ;value when ready
  50. MODRCVB: EQU    2        ;bit to test for receive
  51. MODRCVR: EQU    2        ;value when ready
  52. MODDCDB: EQU    4        ;carrier detect bit
  53. MODDCDA: EQU    0        ;value when active
  54. MODPARE: EQU    08H        ;value for parity error
  55. MODOVRE: EQU    10H        ;value for overrun error
  56. MODFRME: EQU    20H        ;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 Z = carrier on
  144. ;
  145. CAROK:    IN    MODCTLP        ;get status
  146.     ANI    MODDCDB        ;get carrier detect bit
  147.     CPI    MODDCDA        ;test bit
  148.     RET
  149. ;
  150. ;=======================================================================
  151. ;
  152. EXTRA1:    RET            ;for later use
  153. EXTRA2:    RET            ;for later use
  154. EXTRA3:    RET            ;for later use
  155. ;
  156. ;=======================================================================
  157. ;
  158. ; ---> GETCHR - get a character, same as MDIN
  159. ; ---> MDIN - - get a character, same as GETCHR
  160. ;
  161. GETCHR:
  162. MDIN:    IN    MODDATP        ;get character from data in port
  163.     RET
  164. ;
  165. ;=======================================================================
  166. ;
  167. MINIT:    RET            ;no initialization required
  168. ;
  169. ;=======================================================================
  170. ;
  171. ; ---> RCVRDY - check receive ready.  RET with Z = character available.
  172. ;            Return with error code in A-reg.
  173. ;
  174. RCVRDY:    IN    MODCTLP        ;get modem status
  175.     PUSH    B        ;save scratch register
  176.     PUSH    PSW        ;check error status
  177.     ANI    MODFRME+MODOVRE+MODPARE
  178.     MOV    B,A        ;save it for a moment
  179.     POP    PSW
  180.     ANI    MODRCVB        ;isolate ready bit
  181.     CPI    MODRCVR        ;test it
  182.     MOV    A,B        ;get the error code char. back
  183.     POP    B
  184.     RET
  185. ;
  186. ;=======================================================================
  187. ;
  188. ; ---> SENDR - send character
  189. ;
  190. SENDR:    POP    PSW        ;get the character back
  191.     OUT    MODDATO        ;send it to the modem output
  192.     RET
  193. ;
  194. ;=======================================================================
  195. ;
  196. ; ---> SNDRDY - check if ready to send.
  197. ;
  198. SNDRDY:    IN    MODCTLP        ;get status byte
  199.     ANI    MODSNDB        ;isolate ready bit
  200.     CPI    MODSNDR        ;ready to send?
  201.     RET
  202. ;
  203. ;=======================================================================
  204. ;
  205. ; ---> SPEED - sets the time shown for program transfer.
  206. ;
  207. SPEED:     IF    LSPEED
  208.     LDA    MSPEED        ;get index for baud rate from 'BYE'
  209.      ENDIF
  210. ;
  211.      IF     NOT LSPEED
  212.     MVI    A,XSPEED    ;get index for baud rate from 'XSPEED'
  213.      ENDIF
  214. ;
  215.     RET
  216. ;
  217. ;=======================================================================
  218. ;
  219. UNINIT:    RET            ;not initialized, so no 'UN-INITIALIZE'
  220. ;
  221. ;=======================================================================
  222. ;
  223. ;
  224.     END