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 / BYE5 / B5OV-1.IQS / B5OV-1.INS
Text File  |  2000-06-30  |  8KB  |  326 lines

  1. ; B5OV-1.INS - Osborne Vixen insert for BYE5 - 07/17/85
  2. ;
  3. ;         8251A with BIOS routines setting baud rate
  4. ;
  5. ;
  6. ; This version is for an 8251A I/O with extended BIOS jump for setting
  7. ; baudrate.  Note:  This is an insert, not an overlay.
  8. ;
  9. ; This version is for the Osborne Vixen which uses an extended BIOS
  10. ; function call to set the baudrate.  The normal serial input interrupt
  11. ; driver in BIOS is disabled while BYE5 is used.
  12. ;
  13. ;
  14. ;=   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  15. ;
  16. ;  06/15/85  Written for use with BYE5        - Roy Robinson
  17. ;                          FOG RCPM #4
  18. ;                          (415) 591-6259
  19. ;=   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  20. ;
  21. ;-----------------------------------------------------------------------
  22. ; PATCH #1 -------------------------------------------------------------
  23. ;-----------------------------------------------------------------------
  24. ;
  25. ; Listed below is a patch for disabling the serial input interrupt
  26. ; driver in the Vixen BIS.  This patch goes AFTER the label
  27. ;
  28. ;   START1:
  29. ;
  30. ; and immediately AFTER the line of code, CALL MDCARCK
  31. ;
  32. ; ---->  beginning of patch:
  33. ;
  34. ;
  35. ;    JNZ    BYPASS
  36. ;
  37. ;INITMOD:
  38. ;    PUSH    PSW
  39. ;    MVI    C,7    ; Use BDOS to obrain current IOBYTE
  40. ;    CALL    BDOS    ;
  41. ;    STA    OLDIOB    ; Save old IOBYTE
  42. ;    ANI    3fH    ;
  43. ;    ORI    80H    ; Make CEN: PORT new LST: DEVICE
  44. ;    MOV    E,A
  45. ;    MVI    C,8
  46. ;    CALL    BDOS    ; Use BDOS to place new IOBYTE in first page of memory
  47. ;
  48. ;    DI        ;
  49. ;    LHLD    INTVEC    ; Get serial port interrupt processor address
  50. ;    SHLD    OLDVEC    ; Save serial port interrupt processor address
  51. ;    DCX    H
  52. ;    DCX    H
  53. ;    DCX    H    ; HL has next interrupt processor address
  54. ;    SHLD    INTVEC    ; This is now first interrupt processor rather
  55. ;            ;   than second
  56. ;
  57. ;INITSIO:
  58. ;
  59. ;    LHLD    BIOS    ; Find start ofF BIOS
  60. ;    MVI    L,3CH    ; Displacement of baudrate byte from start of BIOS
  61. ;    MOV    A,M
  62. ;    STA    OLDBAUD ; Save original baudrate byte
  63. ;
  64. ;    MVI    L,3BH    ; Displacement of 8251 mode byte from start of BIOS
  65. ;    MOV    A,M    ; Old mode byte set by ROM is 2SB, NP, 8DB, X16 clock
  66. ;    STA    OLDMODE ; Save original 8251 mode byte
  67. ;
  68. ;    MOV    B,L
  69. ;    MVI    A,6EH    ; 1 SB, NP, 8 DB, X16 clock modem byte
  70. ;    CALL    IORESET ; Use extended BIOS jump to reset 8251
  71. ;
  72. ;    MVI    A,37H    ; 8251 command byte RTS/DTR active, TXD and RXD active
  73. ;    OUT    31H    ; Send it to 8251 control port
  74. ;
  75. ;    MVI    A,3    ; Select 8155 port C
  76. ;    OUT    21h    ;
  77. ;    IN    28h    ; Get miscellaneous byte
  78. ;    STA    OLDMSC    ; Save misdellaneous info byte
  79. ;    ORI    00001111B
  80. ;            ; Disable ring detect interrupt, RXD interrupt, XMIT
  81. ;            ;   interrupt, emab;e omterma; clock
  82. ;    MOV    E,A
  83. ;    MVI    A,3
  84. ;    OUT    21h    ; Select 8155 port C
  85. ;    MOV    A,E
  86. ;    OUT    28h    ; Send new control byte to 8155 port C
  87. ;    EI
  88. ;    POP    PSW
  89. ;    ORA    A
  90. ;
  91. ;BYPASS:
  92. ;
  93. ;--> Original code starts again with the following instruction:
  94. ;
  95. ;    JNZ    GOODBY
  96. ;
  97. ;
  98. ;=======================================================================
  99. ;
  100. ;-----------------------------------------------------------------------
  101. ; PATCH #2 -------------------------------------------------------------
  102. ;-----------------------------------------------------------------------
  103. ;
  104. ;
  105. ; Listed below is a patch for re-enabling the serial input interrupt
  106. ; driver in the Vixen.    Place this patch before the instruction line
  107. ; "JMP    0000H" in the EXCPM routine.
  108. ;
  109. ;--> Patch starts here
  110. ;
  111. ;RSTINT:LDA    OLDIOB    ; Get original IOBYTE
  112. ;    MVI    C,8
  113. ;    MOV    E,A    ; Use BDOS to restore original IOBYTE
  114. ;    CALL    BDOS
  115. ;
  116. ;    DI
  117. ;    XRA    A
  118. ;    OUT    STPORT    ; Disable 8251 DTR/RTS lines
  119. ;    LHLD    OLDVEC    ; Get original interrupt service address
  120. ;    SHLD    INTVEC    ; Restore original interrupt service address
  121. ;    MVI    A,3    ; Select 8155 port C
  122. ;    OUT    21H
  123. ;    IN    28H    ; Get misc. info byte for controlling interrupt lines
  124. ;    ANI    030H    ; Zero the least significant four bits, keep the
  125. ;            ;   remainining two most significant bits
  126. ;    MOV    E,A
  127. ;    LDA    OLDMSC    ; Get original misc. 8155 control byte
  128. ;    ANI    0FH    ; Keep least significant four bits
  129. ;    ORA    E    ; Combine everything
  130. ;    MOV    E,A
  131. ;    MVI    A,3
  132. ;    OUT    21H    ; Select 8155 port C
  133. ;    MOV    A,E
  134. ;    OUT    28H    ; Restore original 8155 control byte
  135. ;    EI
  136. ;
  137. ;    MVI    B,3CH
  138. ;    LDA    OLDBAUD ; Restore original baudrate byte
  139. ;    CALL    IORESET ; Do an 8251 reset
  140. ;
  141. ;    MVI    B,3BH
  142. ;    LDA    OLDMODE ; Restore original mode byte
  143. ;    CALL    IORESET ; Do an 8251 reset
  144. ;
  145. ;--> Original code starts again with the following instruction:
  146. ;
  147. ;    JMP    0000H
  148. ;
  149. ;-----------------------------------------------------------------------
  150. ;
  151. ;
  152. ; E Q U A T E S
  153. ;
  154. ;
  155. INTVEC    EQU    0EFFEH        ; Address of interrupt vector to first interrupt
  156.                 ; Service routine
  157. BDOS    EQU    0005H        ; Address of bdos entry point in first page of RAM
  158. BIOS    EQU    0001H        ; Address of pointer to CP/M warm boot jump in BIOS
  159. AJUMP    EQU    0C3H        ; JUMP instruction opcode
  160. ;
  161. ;
  162. PORT    EQU    030H
  163. DATPORT    EQU    PORT        ; Modem data port
  164. STPORT    EQU    PORT+1        ; Modem status port
  165. ;
  166. ;
  167. ;-----------------------------------------------------------------------
  168. ;
  169. ; Is there a carrier?  If not, return with the zero flag set.
  170. ;
  171. MDCARCK:MVI    A,17H        ; Reset status
  172.     OUT    STPORT
  173.     IN    STPORT        ; Get status
  174.     ANI    80H        ; Check for carrier detect
  175.     RET
  176. ;.....
  177. ;
  178. ;
  179. ; This routine will turn off the serial card and hang up the phone.
  180. ;
  181. MDINIT:    MVI    A,10H        ; Clear DTR
  182.     OUT    STPORT        ; Causing modem to hangup
  183.     PUSH    B        ; Preserve in case we need it
  184.     MVI    B,20        ; 2 seconds to drop DTR
  185.  
  186. OFFTI:    CALL    DELAY        ; 0.1 second delay
  187.     DCR    B
  188.     JNZ    OFFTI        ; Keep waiting until carrier drops
  189.     POP    B        ; Restore BC
  190.     MVI    A,17H        ; Raise DTR so that modem can answer the phone
  191.     OUT    STPORT
  192. ;
  193.      IF    IMODEM
  194.     CALL    IMINIT        ; Initialize smartmodem
  195.      ENDIF            ; IMODEM
  196. ;
  197.     RET
  198. ;.......
  199. ;
  200. ;
  201. ; Input a character from the modem.
  202. ;
  203. MDINP:    IN    DATPORT        ; Get character
  204.     RET
  205. ;.....
  206. ;
  207. ;
  208. ; Check the status to see if a character is available.  Return with zero
  209. ; flag set, if not.  If yes, use 0FFH to clear the flag.
  210. ;
  211. MDINST:    IN    STPORT        ; Get status
  212.     ANI    2        ; Got a character?
  213.     RZ            ; Return if none
  214.     IN    STPORT        ; Get status again
  215.     ANI    ERR        ; Check for framing and overrun
  216.     JZ    MDINST1        ; No errors
  217.     MVI    A,17H        ; Reset error flags
  218.     OUT    STPORT
  219.     XRA    A        ; Return false
  220.     RET
  221. ;.....
  222. ;
  223. ;
  224. MDINST1:ORI    0FFH        ; We have a character
  225.     RET            ; And return
  226. ;.....
  227. ;
  228. ;
  229. ; Send a character to the modem.
  230. ;
  231. MDOUTP:    OUT    DATPORT        ; Send it
  232.     RET
  233. ;.....
  234. ;
  235. ;
  236. ; See if the output is ready for another character.
  237. ;
  238. MDOUTST:IN    STPORT        ; Read port
  239.     ANI    4        ; Mask crap
  240.     RZ
  241.     ORI    0FFH
  242.     RET
  243. ;.....
  244. ;
  245. ;
  246. ; Re-initialize modem and hang up phone by dropping DTR and leaving
  247. ; modem inactive
  248. ;
  249. MDQUIT:     IF    IMODEM
  250.     CALL    IMQUIT
  251.      ENDIF            ; IMODEM
  252. ;
  253. ;
  254. ; Called by main BYE program after caller types BYE
  255. ;
  256. MDSTOP:    XRA    A        ; Turn off rts/dtr, rx/tx
  257.     OUT    STPORT        ; Command byte to 8251 control port
  258.     RET
  259. ;.....
  260. ;
  261. ;
  262. ; If you do not support a particular baud rate, put it here before
  263. ; SETINV:
  264. ;
  265. SETINV:    MVI    A,0FFH
  266.     ORI    A        ; Make sure the Zero flag is not set
  267.     RET
  268. ;.....
  269. ;
  270. ;
  271. SET300:    MVI    A,06H        ; Store baud rate parameter (300 baud)
  272.     MVI    B,3CH
  273.     JMP    SETBAUD
  274. ;
  275. SET1200:MVI    A,08H        ; Store baud rate parameter (1200 baud)
  276.     MVI    B,3CH
  277.     JMP    SETBAUD
  278. ;
  279. SET2400:MVI    A,0BH        ; Store baud rate parameter (2400 baud)
  280.     MVI    B,3CH
  281.  
  282. SETBAUD:CALL    IORESET        ; Use extended BIOS function to reset baudrate
  283.     XRA    A        ; Say baudrate change was satisfactory
  284.     RET
  285. ;.....
  286. ;
  287. ;
  288. IORESET:
  289. ;
  290. ; Subroutine which executes a master reset for 8251.  8251 reset is a
  291. ; BIOS function in VIXEN extended BIOS
  292. ;
  293. ;    ENTRY:
  294. ;    A    =    byte value to be replaced in BIOS
  295. ;            (mode byte or baudrate byte)
  296. ;
  297. ;    B    =    hex displacement from base of BIOS
  298. ;            for mode byte or baudrate byte
  299. ;            (mode byte = 3BH)
  300. ;            (baudrate byte = 3CH)
  301. ;
  302. ;    EXIT:
  303. ;    NONE
  304. ;
  305.     LHLD    BIOS        ; Find base of BIOS
  306.     MOV    L,B
  307.     MOV    M,A
  308.     MVI    L,36H        ; Displacement in BIOS for 8251 reset function
  309.     SHLD    EXTFUN
  310.     CALL    BIOSFUNC    ; Subroutine call of BIOS 8251 reset function
  311.     RET
  312. ;.....
  313. ;
  314. ;
  315. OLDIOB:    DS    1        ; Original  IOBYTE
  316. OLDMSC:    DS    1        ; Original misc. control byte for 8155 port C
  317. OLDVEC:    DS    2        ; Original interrupt service vector
  318. OLDMODE:DB    1        ; Original 8251 mode byte from BIOS
  319. OLDBAUD:DB    1        ; Original baudrate byte for 8251 from BIOS
  320. BIOSFUNC: DB    AJUMP        ; Absolute jump to the    following memory address
  321. EXTFUN:    DS    2        ; BIOS extended function address
  322. ;.....
  323. ;
  324. ;                   end
  325. ;-----------------------------------------------------------------------
  326.