home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / mbbs / mbkmdovl.lbr / KMOS-1.AZM / KMOS-1.ASM
Encoding:
Assembly Source File  |  1987-02-21  |  10.1 KB  |  323 lines

  1. ;
  2. ; =================================================
  3. ;  KMOS-1.ASM - MB-KMD patch file for the OSBORNE I
  4. ; =================================================
  5. ;
  6. ;
  7. ; >>>>>>>IMPORTANT   This overlay will require you to set LARGEIO to YES
  8. ;             in the main MB-KMD program.  The size allowance
  9. ;             needed is 100H bytes.
  10. ;
  11. ; =============
  12. ; Introduction:
  13. ; =============
  14. ;
  15. ; This file adapts any version of MB-KMD to run with the OSBORNE I.
  16. ;
  17. ; To use, first edit any options desired into the mainline source code of
  18. ; the transfer program, then assemble with ASM or MAC to produce a HEX file.
  19. ;
  20. ; Then edit this file as needed (check the CONOUT routine if you want to 
  21. ; locally see file transfer time and the record count while programs are 
  22. ; being sent).  Then assemble this overlay with ASM or MAC.
  23. ;
  24. ; Now merge the two .HEX files using MLOAD.COM (available on most RCP/M
  25. ; systems using the command:
  26. ;
  27. ;       MLOAD KMD=MB-KMD,KMOS-1
  28. ;
  29. ; Then place the resulting .COM file on your system where it is accessible
  30. ; from any drive/user area (usually A0:)
  31. ;
  32. ;
  33. ; ===============
  34. ; Update History:
  35. ; ===============
  36. ;
  37. ; 08/21/86 - Edited for inclusion in MBKMDOVL.LBR    - Bob Kramer
  38. ; 08/09/86 - Inspected for MB-KMD compatibility        - Michael Conley
  39. ; 04/15/83 - Adapted XM74EXT.ASM to XM74OS.ASM to
  40. ;         install patches for the Osborne I. The MINIT
  41. ;         routine is executed from the standard patch
  42. ;         area and moves (a la BYE) the rest of the
  43. ;         routines up to the memory address defined by
  44. ;         tag DEST.  Note that these patches total more
  45. ;          than the 128 bytes allotted in XMODEM74.ASM,
  46. ;         so be sure to set LARGEIO to YES and IOSIZE
  47. ;         to at least the length of the code (100H is
  48. ;         safe).  Remember to increase the number of
  49. ;         sectors you SAVE out of DDT.        - George Peace
  50. ; 04/04/83 - Updated to XMODEM74            - Irv Hoff
  51. ; 03/27/83 - Updated to XMODEM73            - Irv Hoff
  52. ; 03/17/83 - Updated to XMODEM72            - Irv Hoff
  53. ; 03/15/83 - Updated to XMODEM71            - Irv Hoff
  54. ;
  55. ; 03/07/83  Added instructions on how to adapt this file to XMODEM70.COM.
  56. ;        Standardized the format.  Added automatic MSPEED from "BYE"
  57. ;        program.  Added CONOUT information.  Adapted from XM70PMMI.
  58. ;                            - Irv Hoff
  59. ;
  60. ;
  61. ; ==============
  62. ;
  63. NO:      EQU    0
  64. YES:      EQU    NOT NO
  65. ;
  66. DEST:      EQU    0A000H        ; Base address for modem routines. Must be
  67.                 ; at least 1 page lower than DEST in BYE.
  68. MODCTLP:  EQU    02A00H        ; Control/Status port
  69. MODDATP:  EQU    02A01H        ; Data In/Out port
  70. ;
  71. MODRCVB:  EQU    01H        ; Bit to test for receive
  72. MODRCVR:  EQU    01H        ; Value when ready
  73. MODSNDB:  EQU    02H        ; Bit to test for send
  74. MODSNDR:  EQU    02H        ; Value when ready
  75. MODDCDB:  EQU    04H        ; Carrier detect bit
  76. MODDCDA:  EQU    04H        ; Value when active
  77. MODCTSB:  EQU    08H        ; Clear to send bit
  78. MODCTSA:  EQU    08H        ; Value when active
  79. MODFRME:  EQU    10H        ; Value for framing error
  80. MODOVRE:  EQU    20H        ; Value for overrun error
  81. MODPARE:  EQU    40H        ; Value for parity error
  82. ;
  83. LSEED:      EQU    YES        ; Yes,  using 'BYE' with speed selection
  84.                 ; No,  using 'SPEED' manual selection
  85. MSPEED:      EQU    3CH        ; Location of baud rate factor (Set by
  86.                 ; 'BYE')  Set location in 'BYE' to agree
  87.                 ; 3DH and 3EH often used by newer versions
  88.                 ; of 'ZCPR'.
  89. XSPEED:      EQU    1        ; Speed for file time transfer without
  90.                 ; auto-set.  Use one of the following:
  91.                 ; 0=110 1=300 2=450 3=600 4=710 5=1200
  92. BASE:      EQU    100H        ; Start of CP/M normal program area
  93. ;
  94. ;
  95. ; ===========
  96. ; Jump table:
  97. ; ===========
  98. ;
  99. ; The jump table must be in exactly the same sequence as the one in MB-KMD.
  100. ; Note the ORG of 103H - This jump table has no jump to 'BEGIN'.
  101. ;
  102.       ORG    BASE+3        ; Start after 'JMP BEGIN'
  103. ;
  104. CONOUT:   JMP    00000H        ; Must be 0E738H if used,  see below
  105. PMINIT:      JMP    MINIT        ; Initialization routine (If needed)
  106. PUNINIT:  JMP    UNINIT        ; Undo whatever 'MINIT' did (or return)
  107. PSENDR:      JMP    SENDR        ; Send character (via POP PSW)
  108. PCAROK:      JMP    CAROK        ; Test for carrier
  109. PMDIN:      JMP    MDIN        ; Receive data byte
  110. PGETCHR:  JMP    GETCHR        ; Get character from modem
  111. PRCVRDY:  JMP    RCVRDY        ; Check receive ready
  112. PSNDRDY:  JMP    SNDRDY        ; Check send ready
  113. PSPEED:      JMP    SPEED        ; Get speed value for file transfer time
  114. PEXTRA1:  JMP    EXTRA1        ; Extra for custom routine
  115. PEXTRA2:  JMP    EXTRA2        ; Extra for custom routine 
  116. PEXTRA3:  JMP    EXTRA3        ; Extra for custom routine
  117. ;
  118. ;
  119. ; ================================================================
  120. ; To Display the Record Count on the CRT During Program Transfers:
  121. ; ================================================================
  122. ;    
  123. ;    This one addition requires some work on the part of the user.  When
  124. ; "BYE" is added,  CP/M is normally moved lower to accomodate the new
  125. ; program above CP/M.  Whenever BYE is called to enable the RCPM capability,
  126. ; it steals some of the addresses contained in the BIOS jump vector table.
  127. ; In order to display on the CRT during program transfers you need to get
  128. ; into the BIOS console output routine directly,  else what is being
  129. ; displayed also tries to go out the modem.  This is a big NO-NO at that
  130. ; time.  (This cannot be done automatically by MB-KMD,  since BYE has
  131. ; already taken the address we need to find,  by the time MB-KMD is auto-
  132. ; matically activated by the remote station.)
  133. ;
  134. ;    So,  with the disk containing BYE, but prior to activating BYE, do
  135. ; this:
  136. ;    1) Cold reboot to move CP/M (and BIOS) to the new area needed
  137. ;            when BYE is activated on the same disk.
  138. ;    2) Use DDT and dump the area from 0000H to 0002H.  This gives
  139. ;         the warm reboot address in BIOS.
  140. ;    3) Add 9 Bytes to that address to get your console output jump
  141. ;         vector.
  142. ;    4) Pick off the address contained in the jump vector and install
  143. ;         that in "CONOUT", below.  Example of one system in use:
  144. ;
  145. ;  FIRST, COLD REBOOT WITH DISK CONTAINING "BYE"
  146. ;
  147. ;      0000  C3 03 E0    (location of warm reboot on disk with BYE
  148. ;
  149. ;  PRIOR TO ACTIVATING BYE BUT ON SAME DISK
  150. ;
  151. ;      E003  C3 E9 E0    (BIOS warm reboot jump vector on this disk)
  152. ;      E006  C3 00 E9    (BIOS get console status routine)
  153. ;      E009  C3 B7 E1    (BIOS console input routine)
  154. ;      E00C  C3 D4 E1    (BIOS console output routine)
  155. ;
  156. ;        The address we need is thus E1D4.  Put that below, in
  157. ;        our example it would be:    CONOUT   JMP   0E1D4H
  158. ;
  159. ;
  160. ;CONOUT:  JMP    00000H        ; If you wish to show the record count
  161. ;                ; during program transfer, fill in this
  162. ;                ; address at 'CONOUT' above.
  163. ;
  164. ;                        - Irv Hoff
  165. ;
  166. ;
  167. ; ==============
  168. ;
  169. MINIT:
  170.     LXI    B,PEND-START+1        ; Number of bytes to move
  171.     LXI    H,DEST+PEND-START+1    ; End of moved code
  172.     LXI    D,SOURCE+PEND-START    ; End of source code
  173. ;
  174. MVLP:    LDAX    D        ; Get byte
  175.     DCX    H        ; Bump pointers
  176.     MOV    M,A        ; New home
  177.     DCX    D
  178.     DCX    B        ; Bump byte count
  179.     MOV    A,B        ; Check if zero
  180.     ORA    C
  181.     JNZ    MVLP        ; If not, do some more
  182.     RET
  183. ;
  184. ;
  185. ; ==============
  186. ;
  187. UNINIT:    RET            ; No 'UN-INITIALIZE' routine
  188. ;
  189. ;
  190. ;===============
  191. ;
  192. SOURCE:    EQU    $        ; Boundary memory amount
  193. OFFSET:    EQU    DEST-SOURCE    ; Relocation amount
  194. START:    EQU    $+OFFSET
  195. ;
  196. ;
  197. ; =========================================
  198. ; --> CAROK - check for presence of carrier
  199. ; =========================================
  200. ;
  201. ; RET with Z = carrier on
  202. ;
  203. CAROK:    EQU    $+OFFSET
  204. ;
  205. ; The following code should be activated and TESTED if the MODEM port is
  206. ; used since that port is supposed to be able to report carrier detect.
  207. ;
  208. ;    DI            ; Disable interrupts
  209. ;    OUT    0        ; Switch to shadow in memory
  210. ;    LDA    MODCTLP        ; Get status
  211. ;    OUT    1        ; Switch back to normal memory
  212. ;    EI            ; Enable interrupts
  213. ;    ANI    MODDCDB        ; Get carrier detect bit
  214. ;    CPI    MODDCDA        ; Test bit
  215. ;
  216. ; The following code is a fudge to allow the routine to pass the Zero
  217. ; flag clear value back to the caller until the carrier lead can be read.
  218. ;
  219.     XRA    A        ; Clear accumulator to zeros
  220.     CPI    0        ; Clear the zero flag
  221.     RET
  222. ;
  223. ;
  224. ; ==============
  225. ;
  226. EXTRA1:    EQU    $+OFFSET
  227. EXTRA2:    EQU    $+OFFSET
  228. EXTRA3:    EQU    $+OFFSET
  229.     RET            ; For later use
  230. ;
  231. ;
  232. ; ==========================================
  233. ; --> GETCHR - get a character, same as MDIN
  234. ; --> MDIN - get a character, same as GETCHR
  235. ; ==========================================
  236. ;
  237. GETCHR:    EQU    $+OFFSET
  238. MDIN:    EQU    $+OFFSET
  239.     DI            ; Disable interrupts
  240.     OUT    0        ; Switch to shadow memory
  241.     LDA    MODDATP        ; Send a data byte
  242.     OUT    1        ; Switch back to normal memory
  243.     EI            ; Enable interrupts
  244.     RET
  245. ;
  246. ;
  247. ; ================================
  248. ; --> RCVRDY - check receive ready
  249. ; ================================
  250. ;
  251. ; RET with Z = character available.  Return with error code in A-reg.
  252. ;
  253. RCVRDY:    EQU    $+OFFSET
  254.     DI            ; Disable interrupts
  255.     OUT    0        ; Switch to shadow memory
  256.     LDA    MODCTLP        ; Get modem status
  257.     OUT    1        ; Switch back to normal memory
  258.     EI            ; Enable interrupts
  259.     PUSH    B        ; Save scratch register
  260.     PUSH    PSW        ; Check error status
  261.     ANI    MODFRME+MODOVRE+MODPARE
  262.     MOV    B,A        ; Save it for a moment
  263.     POP    PSW
  264.     ANI    MODRCVB        ; Isolate ready bit
  265.     CPI    MODRCVR        ; Test it
  266.     MOV    A,B        ; Get the error code character back
  267.     POP    B
  268.     RET
  269. ;
  270. ;
  271. ; ==========================
  272. ; --> SENDR - send character
  273. ; ==========================
  274. ;
  275. SENDR:    EQU    $+OFFSET
  276.     POP    PSW        ; Get the character back
  277.     DI            ; Disable interrupts
  278.     OUT    0        ; Switch to shadow memory
  279.     STA    MODDATP        ; Send a data byte
  280.     OUT    1        ; Switch back to normal memory
  281.     EI            ; Enable interrupts
  282.     RET
  283. ;
  284. ;
  285. ; ===================================
  286. ; --> SNDRDY - check if ready to send
  287. ; ===================================
  288. ;
  289. SNDRDY:    EQU    $+OFFSET
  290.     DI            ; Disable interrupts
  291.     OUT    0        ; Switch to shadow memory
  292.     LDA    MODCTLP        ; Get status byte
  293.     OUT    1        ; Switch back to normal memory
  294.     EI            ; Enable interrupts
  295.     ANI    MODSNDB        ; Isolate ready bit
  296.     CPI    MODSNDR        ; Ready to send?
  297.     RET
  298. ;
  299. ;
  300. ; ====================================================
  301. ; --> SPEED - sets the time shown for program transfer
  302. ; ====================================================
  303. ;
  304. SPEED:    EQU    $+OFFSET
  305.      IF    LSPEED
  306.     LDA    MSPEED        ; Get index for baud rate from 'BYE'
  307.      ENDIF
  308. ;
  309.      IF     NOT LSPEED
  310.     MVI    A,XSPEED    ; Get index to baud rate from 'XSPEED'
  311.      ENDIF
  312. ;
  313.     RET
  314. ;
  315. ;
  316. ; ==============
  317. ;
  318. PEND:    EQU    $+OFFSET    ; End of relocated code
  319. ;
  320. ; ==============
  321. ;
  322. ;
  323.     END