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

  1.  
  2. ; XMMM-1.ASM - XMODEMxx PATCH FILE FOR HAYES MM-II MODEM  11/17/83
  3. ;
  4. ; This file adapts XMODEMxx to the HAYES MM-II 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. ;    -IXMMM-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 XMMM-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. SLOT:     EQU    2        ;normal apple modem slot
  45. SLOTVAL: EQU    SLOT*16        ;allows relocating modem slot    
  46. MODCTLP: EQU    0E086H+SLOTVAL    ;hayes mm-ii status location
  47. MODCTL2: EQU    MODCTLP        ;second control/status port
  48. MODDATP: EQU    MODCTLP+1    ;data in port
  49. MODDATO: EQU    MODCTLP+1    ;data out port
  50. MODSNDB: EQU    2        ;bit to test for send
  51. MODSNDR: EQU    2        ;value when ready
  52. MODRCVB: EQU    1        ;bit to test for receive
  53. MODRCVR: EQU    1        ;value when ready
  54. MODDCDB: EQU    4        ;carrier detect bit
  55. MODDCDA: EQU    0        ;value when active
  56. MODPARE: EQU    40H        ;value for parity error
  57. MODOVRE: EQU    20H        ;value for overrun error
  58. MODFRME: EQU    10H        ;value for framing error
  59.                 ;receive reg. full status when sta catclr
  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.  Note the ORG of 103H - This jump table has no jump to
  77. ; 'BEGIN'.
  78.  
  79. ;
  80.      ORG    BASE+3        ;start after 'JMP BEGIN'
  81. ;
  82. CONOUT:     JMP    00000H        ;must be 00000h if not used, see below
  83. PMINIT:     JMP    MINIT        ;initialization routine (if needed)
  84. PUNINIT: JMP    UNINIT        ;undo whatever 'MINIT' did (or return)
  85. PSENDR:     JMP    SENDR        ;send character (via pop psw)
  86. PCAROK:     JMP    CAROK        ;test for carrier
  87. PMDIN:     JMP    MDIN        ;receive data byte
  88. PGETCHR: JMP    GETCHR        ;get character from modem
  89. PRCVRDY: JMP    RCVRDY        ;check receive ready
  90. PSNDRDY: JMP    SNDRDY        ;check send ready
  91. PSPEED:     JMP    SPEED        ;get speed value for file transfer time
  92. PEXTRA1: JMP    EXTRA1        ;extra for custom routine
  93. PEXTRA2: JMP    EXTRA2        ;extra for custom routine
  94. PEXTRA3: JMP    EXTRA3        ;extra for custom routine
  95. ;
  96. ;=======================================================================
  97. ;
  98. ; -- To Display the Record Count on the CRT During Program Transfers --
  99. ;    
  100. ;    This one addition requires some work on the part of the user.
  101. ; When "BYE" is added, CP/M is normally moved lower to accomodate the
  102. ; new program above CP/M.  Whenever BYE is called to enable the RCPM
  103. ; capability, it steals some of the addresses contained in the BIOS jump
  104. ; vector table.  In order to display on the CRT during program transfers
  105. ; you need to get into the BIOS console output routine directly, else
  106. ; what is being displayed also tries to go out the modem.  This is a big
  107. ; NO-NO at that time.  (This cannot be done automatically by XMODEM,
  108. ; since BYE has already taken the address we need to find, by the time
  109. ; XMODEM is automatically activated by the remote station.)
  110. ;
  111. ;    So with the disk containing BYE, but prior to activating BYE, do
  112. ; this:
  113. ;        1) Cold reboot to move CP/M (and BIOS) to the new area
  114. ;            needed when BYE is activated on the same disk.
  115. ;        2) Use DDT and dump the area from 0000H to 0002H.  This
  116. ;                   gives the warm reboot address in BIOS.
  117. ;        3) Add 9 Bytes to that address to get your console out-
  118. ;             put jump vector.
  119. ;        4) Pick off the address contained in the jump vector and
  120. ;             install that in "CONOUT", below.  Example of one
  121. ;             system in use:
  122. ;
  123. ;            FIRST, COLD REBOOT WITH DISK CONTAINING "BYE"
  124. ;
  125. ;      0000  C3 03 E0    (location of warm reboot on disk with BYE
  126. ;
  127. ;            PRIOR TO ACTIVATING BYE BUT ON SAME DISK
  128. ;
  129. ;      E003  C3 E9 E0    (BIOS warm reboot jump vector on this disk)
  130. ;      E006  C3 00 E9    (BIOS get console status routine)
  131. ;      E009  C3 B7 E1    (BIOS console input routine)
  132. ;      E00C  C3 D4 E1    (BIOS console output routine)
  133. ;
  134. ;        The address we need is thus E1D4.  Put that below, in
  135. ;        our example it would be:    CONOUT   JMP   0E1D4H
  136. ;
  137. ;
  138. ;    CONOUT:      JMP    00000H    ;If you wish to show the record count
  139. ;                ;during program transfer, fill in this
  140. ;                ;address at 'CONOUT' above.
  141. ;
  142. ;                    - Irv Hoff
  143. ;
  144. ;=======================================================================
  145. ;
  146. ; ---> CAROK - check for presence of carrier.  RET with Z = carrier on
  147. ;
  148. CAROK:    LDA    MODCTLP        ;check for carrier
  149.     ANI    MODDCDB        ;get carrier detect bit
  150.     CPI    MODDCDA        ;test bit
  151.     RET
  152. ;
  153. ;=======================================================================
  154. ;
  155. EXTRA1:    RET            ;for later use
  156. EXTRA2:    RET            ;for later use
  157. EXTRA3:    RET            ;for later use
  158. ;
  159. ;=======================================================================
  160. ;
  161. ; ---> GETCHR - get a character, same as MDIN
  162. ; ---> MDIN - - get a character, same as GETCHR
  163. ;
  164. GETCHR:
  165. MDIN:    LDA    MODDATP        ;get the char, if any
  166.     RET
  167. ;
  168. ;=======================================================================
  169. ;
  170. MINIT:    RET            ;no initialization required
  171. ;
  172. ;=======================================================================
  173. ;
  174. ; ---> RCVRDY - check receive ready.  RET with Z = character available.
  175. ;            Return with error code in A-reg.
  176. ;
  177. RCVRDY:    LDA    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.     STA    MODDATO        ;send it to the modem output
  195.     RET
  196. ;
  197. ;=======================================================================
  198. ;
  199. ; ---> SNDRDY - check if ready to send.
  200. ;
  201. SNDRDY:    LDA    MODCTL2        ;get status byte
  202.     ANI    MODSNDB        ;isolate ready bit
  203.     CPI    MODSNDR        ;ready to send?
  204.     RET
  205. ;
  206. ;=======================================================================
  207. ;
  208. ; ---> SPEED - sets the time shown for program transfer.
  209. ;
  210. SPEED:     IF    LSPEED
  211.     LDA    MSPEED        ;get index for baud rate from 'BYE'
  212.      ENDIF
  213. ;
  214.      IF     NOT LSPEED
  215.     MVI    A,XSPEED    ;get index for baud rate from 'XSPEED'
  216.      ENDIF
  217. ;
  218.     RET
  219. ;
  220. ;=======================================================================
  221. ;
  222. UNINIT:    RET            ;not initialized, so no 'UN-INITIALIZE'
  223. ;
  224. ;=======================================================================
  225. ;
  226. ;
  227.     END
  228.