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 / XMTRS4.ASM < prev    next >
Assembly Source File  |  2000-06-30  |  8KB  |  224 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. ; 01/15/84 - Modified for TRS4 and renamed to XMTRS4.ASM
  27. ;                                       - Ed Richter 
  28. ; 11/17/83 - Renamed to XMEX-1.ASM    - Irv Hoff
  29. ; 10/22/83 - Updated to XMODEM77    - Irv Hoff
  30. ; 04/04/83 - Updated to XMODEM74    - Irv Hoff
  31. ; 03/27/83 - Updated to XMODEM73    - Irv Hoff
  32. ; 03/17/83 - Updated to XMODEM72    - Irv Hoff
  33. ; 03/15/83 - Updated to XMODEM71    - Irv Hoff
  34. ;
  35. ; 03/07/83  Added instructions on how to adapt this file to XMODEM70.COM.
  36. ;        Standardized the format.  Added automatic MSPEED from "BYE"
  37. ;        program.  Added CONOUT information.  Adapted from XM70PMMI.
  38. ;                    - Irv Hoff
  39. ;
  40. ;=======================================================================
  41. YES:    EQU    0FFH
  42. NO:    EQU    0
  43. ;
  44. ;=======================================================================
  45. ;
  46. MODDATP: EQU    0E8H        ;data in port
  47. MODDATO: EQU    MODDATP+3    ;data out port
  48. MODCTLP: EQU    MODDATP+2    ;control/status port
  49. MODSNDB: EQU    040H        ;bit to test for send
  50. MODSNDR: EQU    040H        ;value when ready
  51. MODRCVB: EQU    080H        ;bit to test for receive
  52. MODRCVR: EQU    080H        ;value when ready
  53. MODDCDB: EQU    020H        ;carrier detect bit
  54. MODDCDA: EQU    0        ;value when active
  55. MODPARE: EQU    08H        ;value for parity error
  56. MODOVRE: EQU    20H        ;value for overrun error
  57. MODFRME: EQU    10H        ;value for framing error
  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.       ORG    BASE+3        ;start after 'JMP BEGIN'
  77. ;
  78. CONOUT:     JMP    00000H        ;must be 00000h if not used, see below
  79. PMINIT:     JMP    MINIT        ;initialization routine (if needed)
  80. PUNINIT: JMP    UNINIT        ;undo whatever 'MINIT' did (or return)
  81. PSENDR:     JMP    SENDR        ;send character (via pop psw)
  82. PCAROK:     JMP    CAROK        ;test for carrier
  83. PMDIN:     JMP    MDIN        ;receive data byte
  84. PGETCHR: JMP    GETCHR        ;get character from modem
  85. PRCVRDY: JMP    RCVRDY        ;check receive ready
  86. PSNDRDY: JMP    SNDRDY        ;check send ready
  87. PSPEED:     JMP    SPEED        ;get speed value for file transfer time
  88. PEXTRA1: JMP    EXTRA1        ;extra for custom routine
  89. PEXTRA2: JMP    EXTRA2        ;extra for custom routine
  90. PEXTRA3: JMP    EXTRA3        ;extra for custom routine
  91. ;
  92. ;=======================================================================
  93. ;
  94. ; -- To Display the Record Count on the CRT During Program Transfers --
  95. ;    
  96. ;    This one addition requires some work on the part of the user.
  97. ; When "BYE" is added, CP/M is normally moved lower to accomodate the
  98. ; new program above CP/M.  Whenever BYE is called to enable the RCPM
  99. ; capability, it steals some of the addresses contained in the BIOS jump
  100. ; vector table.  In order to display on the CRT during program transfers
  101. ; you need to get into the BIOS console output routine directly, else
  102. ; what is being displayed also tries to go out the modem.  This is a big
  103. ; NO-NO at that time.  (This cannot be done automatically by XMODEM,
  104. ; since BYE has already taken the address we need to find, by the time
  105. ; XMODEM is automatically activated by the remote station.)
  106. ;
  107. ;    So with the disk containing BYE, but prior to activating BYE, do
  108. ; this:
  109. ;        1) Cold reboot to move CP/M (and BIOS) to the new area
  110. ;            needed when BYE is activated on the same disk.
  111. ;        2) Use DDT and dump the area from 0000H to 0002H.  This
  112. ;                   gives the warm reboot address in BIOS.
  113. ;        3) Add 9 Bytes to that address to get your console out-
  114. ;             put jump vector.
  115. ;        4) Pick off the address contained in the jump vector and
  116. ;             install that in "CONOUT", below.  Example of one
  117. ;             system in use:
  118. ;
  119. ;            FIRST, COLD REBOOT WITH DISK CONTAINING "BYE"
  120. ;
  121. ;      0000  C3 03 E0    (location of warm reboot on disk with BYE
  122. ;
  123. ;            PRIOR TO ACTIVATING BYE BUT ON SAME DISK
  124. ;
  125. ;      E003  C3 E9 E0    (BIOS warm reboot jump vector on this disk)
  126. ;      E006  C3 00 E9    (BIOS get console status routine)
  127. ;      E009  C3 B7 E1    (BIOS console input routine)
  128. ;      E00C  C3 D4 E1    (BIOS console output routine)
  129. ;
  130. ;        The address we need is thus E1D4.  Put that below, in
  131. ;        our example it would be:    CONOUT   JMP   0E1D4H
  132. ;
  133. ;
  134. ;    CONOUT:      JMP    00000H    ;If you wish to show the record count
  135. ;                ;during program transfer, fill in this
  136. ;                ;address at 'CONOUT' above.
  137. ;
  138. ;                    - Irv Hoff
  139. ;
  140. ;=======================================================================
  141. ;
  142. ; ---> CAROK - check for presence of carrier.  RET with Z = carrier on
  143. ;
  144. CAROK:    IN    MODDATP        ;get status
  145.     ANI    MODDCDB        ;get carrier detect bit
  146.     CPI    MODDCDA        ;test bit
  147.     RET
  148. ;
  149. ;=======================================================================
  150. ;
  151. EXTRA1:    RET            ;for later use
  152. EXTRA2:    RET            ;for later use
  153. EXTRA3:    RET            ;for later use
  154. ;
  155. ;=======================================================================
  156. ;
  157. ; ---> GETCHR - get a character, same as MDIN
  158. ; ---> MDIN - - get a character, same as GETCHR
  159. ;
  160. GETCHR:
  161. MDIN:    IN    MODDATO        ;get character from data in port
  162.     RET
  163. ;
  164. ;=======================================================================
  165. ;
  166. MINIT:    RET            ;no initialization required
  167. ;
  168. ;=======================================================================
  169. ;
  170. ; ---> RCVRDY - check receive ready.  RET with Z = character available.
  171. ;            Return with error code in A-reg.
  172. ;
  173. RCVRDY:    IN    MODCTLP        ;get modem status
  174.     PUSH    B        ;save scratch register
  175.     PUSH    PSW        ;check error status
  176.     ANI    MODFRME+MODOVRE+MODPARE
  177.     MOV    B,A        ;save it for a moment
  178.     POP    PSW
  179.     ANI    MODRCVB        ;isolate ready bit
  180.     CPI    MODRCVR        ;test it
  181.     MOV    A,B        ;get the error code char. back
  182.     POP    B
  183.     RET
  184. ;
  185. ;=======================================================================
  186. ;
  187. ; ---> SENDR - send character
  188. ;
  189. SENDR:    POP    PSW        ;get the character back
  190.     OUT    MODDATO        ;send it to the modem output
  191.     RET
  192. ;
  193. ;=======================================================================
  194. ;
  195. ; ---> SNDRDY - check if ready to send.
  196. ;
  197. SNDRDY:    IN    MODCTLP        ;get status byte
  198.     ANI    MODSNDB        ;isolate ready bit
  199.     CPI    MODSNDR        ;ready to send?
  200.     RET
  201. ;
  202. ;=======================================================================
  203. ;
  204. ; ---> SPEED - sets the time shown for program transfer.
  205. ;
  206. SPEED:     IF    LSPEED
  207.     LDA    MSPEED        ;get index for baud rate from 'BYE'
  208.      ENDIF
  209. ;
  210.      IF     NOT LSPEED
  211.     MVI    A,XSPEED    ;get index for baud rate from 'XSPEED'
  212.      ENDIF
  213. ;
  214.     RET
  215. ;
  216. ;=======================================================================
  217. ;
  218. UNINIT:    RET            ;not initialized, so no 'UN-INITIALIZE'
  219. ;
  220. ;=======================================================================
  221. ;
  222. ;
  223.