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

  1.  
  2. ; XMKP-1.ASM - XMODEMxx overlay file for Kaypro computers  01/01/83
  3. ;
  4. ; This file adapts XMODEMxx to the Kaypro computer.  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
  7. ; the CONOUT routine if you want to locally see file transfer time and
  8. ; the record count while programs are being sent or insure that USECON
  9. ; on ByeII or BYE3 is set YES.)  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. ;    1100 0100
  16. ;    -IXKP-1.HEX        (note the 'I' command)
  17. ;    -R            ('R' loads in the .HEX file)
  18. ;    NEXT  PC
  19. ;    1100 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. ; 01/01/84  Updated to XMODEM84        - 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. ; Define True and False
  40. ;
  41. YES:      EQU    0FFH
  42. NO:      EQU    0
  43. ;
  44. ;=======================================================================
  45. ;
  46. ; Modem & Data Equates
  47. ;
  48. MODDATP:  EQU    04H        ;data in port for kaypro computers
  49. MODCTLP:  EQU    MODDATP+2    ;control/status port
  50. MODSNDB:  EQU    04H        ;bit to test for send
  51. MODSNDR:  EQU    04H        ;value when ready
  52. MODRCVB:  EQU    01H        ;bit to test for receive
  53. MODRCVR:  EQU    01H        ;value when ready
  54. MODDCDB:  EQU    08H        ;carrier detect bit
  55. MODDCDA:  EQU    08H        ;value when active
  56. MODPARE:  EQU    10H        ;value for parity error
  57. MODOVRE:  EQU    20H        ;value for overrun error
  58. MODFRME:  EQU    40H        ;value for framing error
  59. MODRESI:  EQU   10H        ;reset external status/interrupts
  60. MODERES:  EQU   30H        ;error reset
  61. ;
  62. ;
  63. LSPEED:      EQU    YES        ;true if using by2-17ks or any bye2-xx
  64.                 ;false if using 'SPEED' manual selection
  65. MSPEED:      EQU    3CH        ;location of baud rate factor (set by
  66. ;                ;'BYE')  SET LOCATION IN 'BYE' TO AGREE.
  67. ;                ;3DH AND 3EH OFTEN USED BY NEWER VER-
  68. ;                ;SIONS OF 'ZCPR'.
  69. XSPEED:      EQU    1        ;speed for file time transfer without
  70. ;                ;AUTO-SET.  USE ONE OF THE FOLLOWING:
  71. ;                ;0=110 1=300 2=450 3=600 4=710 5=1200
  72. BASE:      EQU    100H        ;start of cp/m normal program area
  73. ;
  74. ;=======================================================================
  75. ;
  76. ; Jump table: The jump table must be in exactly the same sequence as the
  77. ; one in XMODEM.
  78. ;
  79.       ORG    BASE+3        ;start after 'JMP BEGIN'
  80. ;
  81. CONOUT:   JMP    0EBFDH        ;must be 00000h if not used, see below
  82.                 ;shown for kaypro-10 with cp/m 2.2d
  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. ;    The CRTOUT routine below may be used if you know the ports used
  101. ; by your CRT for status and data.  (Cannot be used with memory mapped
  102. ; displays.)  If using the CRTOUT routine, skip rest of this discussion.
  103. ;
  104. ;    This one addition requires some work on the part of the user.
  105. ; When "BYE" is added, CP/M is normally moved lower to accomodate the
  106. ; new program above CP/M.  Whenever BYE is called to enable the RCPM
  107. ; capability, it steals some of the addresses contained in the BIOS jump
  108. ; vector table.  In order to display on the CRT during program transfers
  109. ; you need to get into the BIOS console output routine directly, else
  110. ; what is being displayed also tries to go out the modem.  This is a big
  111. ; NO-NO at that time.  (This cannot be done automatically by XMODEM,
  112. ; since BYE has already taken the address we need to find, by the time
  113. ; XMODEM is automatically activated by the remote station.)
  114. ;
  115. ;    So with the disk containing BYE, but prior to activating BYE, do
  116. ; this:
  117. ;        1) Cold reboot to move CP/M (and BIOS) to the new area
  118. ;            needed when BYE is activated on the same disk.
  119. ;        2) Use DDT and dump the area from 0000H to 0002H.  This
  120. ;                   gives the warm reboot address in BIOS.
  121. ;        3) Add 9 Bytes to that address to get your console out-
  122. ;             put jump vector.
  123. ;        4) Pick off the address contained in the jump vector and
  124. ;             install that in "CONOUT", below.  Example of one
  125. ;             system in use:
  126. ;
  127. ;            FIRST, COLD REBOOT WITH DISK CONTAINING "BYE"
  128. ;
  129. ;      0000  C3 03 E0    (location of warm reboot on disk with BYE
  130. ;
  131. ;            PRIOR TO ACTIVATING BYE BUT ON SAME DISK
  132. ;
  133. ;      E003  C3 E9 E0    (BIOS warm reboot jump vector on this disk)
  134. ;      E006  C3 00 E9    (BIOS get console status routine)
  135. ;      E009  C3 B7 E1    (BIOS console input routine)
  136. ;      E00C  C3 D4 E1    (BIOS console output routine)
  137. ;
  138. ;        The address we need is thus E1D4.  Put that below, in
  139. ;        our example it would be:    CONOUT   JMP   0E1D4H
  140. ;
  141. ;
  142. ;    CONOUT:      JMP    00000H    ;If you wish to show the record count
  143. ;                ;during program transfer, fill in this
  144. ;                ;address at 'CONOUT' above.
  145. ;
  146. ;                    - Irv Hoff
  147. ;
  148. ;=======================================================================
  149. ;
  150. ; ---> CAROK - check for presence of carrier.  RET with Z = carrier on
  151. ;
  152. CAROK:
  153.     MVI    A,MODRESI    ;reset external status/interrupts
  154.     OUT    MODCTLP
  155.     IN    MODCTLP        ;get status
  156.     ANI    MODDCDB        ;get carrier detect bit
  157.     CPI    MODDCDA        ;test bit
  158.     RET
  159. ;
  160. ;=======================================================================
  161. ;
  162. EXTRA1:    RET            ;for later use
  163. EXTRA2:    RET            ;for later use
  164. EXTRA3:    RET            ;for later use
  165. ;
  166. ;=======================================================================
  167. ;
  168. ; ---> GETCHR - get a character, same as MDIN
  169. ; ---> MDIN - - get a character, same as GETCHR
  170. ;
  171. GETCHR:
  172. MDIN:    IN    MODDATP        ;get character from data in port
  173.     RET
  174. ;
  175. ;=======================================================================
  176. ;
  177. MINIT:    RET            ;no initialization required
  178. ;
  179. ;=======================================================================
  180. ;
  181. ; ---> RCVRDY - check receive ready.  RET with Z = character available.
  182. ;            Return with error code in A-reg.
  183. ;
  184. RCVRDY:    IN    MODCTLP        ;get modem status
  185.     PUSH    B        ;save scratch register
  186.     PUSH    PSW
  187.     MVI    A,1+MODRESI    ;select read register 1
  188.     OUT    MODCTLP
  189.     IN    MODCTLP        ;read the error status
  190.     ANI    MODFRME+MODOVRE+MODPARE
  191.     MOV    B,A        ;save it for a moment
  192.     MVI    A,MODERES
  193.     OUT    MODCTLP        ;do an error reset command
  194.     POP    PSW        ;now get modem status back
  195.     ANI    MODRCVB        ;isolate ready bit
  196.     CPI    MODRCVR        ;test it
  197.     MOV    A,B        ;get the error code char. back
  198.     POP    B
  199.     RET
  200. ;
  201. ;=======================================================================
  202. ;
  203. ; ---> SENDR - send character
  204. ;
  205. SENDR:    POP    PSW        ;get the character back
  206.     OUT    MODDATP        ;send it to the modem output
  207.     RET
  208. ;
  209. ;=======================================================================
  210. ;
  211. ; ---> SNDRDY - check if ready to send.
  212. ;
  213. SNDRDY:    IN    MODCTLP        ;get status byte
  214.     ANI    MODSNDB        ;isolate ready bit
  215.     CPI    MODSNDR        ;ready to send?
  216.     RET
  217. ;
  218. ;=======================================================================
  219. ;
  220. ; ---> SPEED - sets the time shown for program transfer.
  221. ;
  222. SPEED:    EQU    $
  223. ;
  224.      IF    LSPEED
  225.     LDA    MSPEED        ;get index for baud rate from 'BYE'
  226.      ENDIF
  227. ;
  228.      IF     NOT LSPEED
  229.     MVI    A,XSPEED    ;get index for baud rate from 'XSPEED'
  230.      ENDIF
  231. ;
  232.     RET
  233. ;
  234. ;=======================================================================
  235. ;
  236. UNINIT:    RET            ;not initialized, so no 'UN-INITIALIZE'
  237. ;
  238. ;=======================================================================
  239. ;
  240.     END
  241.