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

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