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 / B5H8-2.INS < prev    next >
Text File  |  2000-06-30  |  4KB  |  150 lines

  1. ; B5H8-2.INS - Heath H89 insert for BYE5 - 07/27/85
  2. ;
  3. ;         8250 I/O with built-in baudrate generator
  4. ;
  5. ;          Note:  This is an insert not an overlay
  6. ;
  7. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  8. ;
  9. ; 07/27/85  Fixed LOADBD code so it will work with BYE5.  Used stuff
  10. ;           from M7H8-7.                           - Bill Wood
  11. ; 06/16/85  Put in missing RET just before MDINP.       - Bill Wood    
  12. ; 06/10/85  Written for use with BYE335 or later    - Irv Hoff
  13. ;
  14. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  15. ;
  16. ;-----------------------------------------------------------------------
  17. ;
  18. ; The following define the port address to use.
  19. ;
  20. PORT    EQU    0D8H        ; Data port
  21. MDCTL3    EQU    PORT+3        ; Line control register
  22. MDCTL4    EQU    PORT+4        ; Modem control register
  23. MDCTL5    EQU    PORT+5        ; Line status register
  24. MDCTL6    EQU    PORT+6        ; Modem status register
  25. ;
  26. BD300:    DW    0180H        ; 300 baud
  27. BD1200:    DW    0060H        ; 1200 bps
  28. BD2400:    DW    0030H        ; 2400 bps
  29. ;
  30. ;
  31. ;-----------------------------------------------------------------------
  32. ;
  33. ; See if we still have a carrier - if not, return with the zero flag set
  34. ;
  35. MDCARCK:IN    MDCTL6        ; Get modem status
  36.     ANI    80H        ; Got a carrier?
  37.     RET
  38. ;.....
  39. ;
  40. ;
  41. ; Disconnect and wait for an incoming call
  42. ;
  43. MDINIT:    XRA    A        ; Shut off DTR & RTS
  44.     OUT    MDCTL4        ; Which turns off modem.
  45.     PUSH    B        ; Preserve since we need it
  46.     MVI    B,20        ; 2 seconds delay to drop any carrier
  47. ;
  48. OFFTI:    CALL    DELAY        ; .1 second delay
  49.     DCR    B
  50.     JNZ    OFFTI        ; Loop until done
  51.     POP    B        ; Restore BC
  52.     MVI    A,03H        ; 8-level, 1 stop bit, no parity
  53.     OUT    PORT+3        ; Line control register (03=1, 07=2)
  54.     MVI    A,03H        ; Turn on DTR and RTS & wait for call
  55.     OUT    MDCTL4
  56. ;
  57.      IF    IMODEM
  58.     CALL    IMINIT        ; Init smartmodem
  59.      ENDIF            ; IMODEM
  60. ;
  61.     RET
  62. ;.....
  63. ;
  64. ;
  65. ; Input a character from the modem port
  66. ;
  67. MDINP:    IN    PORT        ; Get character
  68.     RET
  69. ;.....
  70. ;
  71. ;
  72. ; Check the status to see if a character is available.    if not, return
  73. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  74. ;
  75. MDINST:    IN    MDCTL5        ; Get status
  76.     ANI    01H        ; Check receive ready bit
  77.     RZ            ; Return if not ready
  78.     ORI    0FFH        ; We have a character
  79.     RET
  80. ;.....
  81. ;
  82. ;
  83. ; Send a character to the modem
  84. ;
  85. MDOUTP:    OUT    PORT        ; Send it
  86.     RET
  87. ;.....
  88. ;
  89. ;
  90. ; See if the output is ready for another character
  91. ;
  92. MDOUTST:IN    MDCTL5
  93.     ANI    20H        ; Check transmit ready bit
  94.     RET
  95. ;.....
  96. ;
  97. ;
  98. ; Reinitialize the modem and hang up the phone by dropping DTR and
  99. ; leaving it inactive.
  100. ;
  101. MDQUIT:     IF    IMODEM
  102.     CALL    IMQUIT
  103.      ENDIF            ; IMODEM
  104. ;
  105. ;
  106. ; Called by the main program after caller types BYE
  107. ;
  108. MDSTOP:    XRA    A        ; Turn off DTR (in case NORING was on)
  109.     OUT    MDCTL4
  110.     RET
  111. ;.....
  112. ;
  113. ;
  114. ; The following routine sets the baudrate.  BYE3 asks for the maximum
  115. ; speed you have available.
  116. ;
  117. ;
  118. SETINV:    ORI    0FFH
  119.     RET
  120. ;.....
  121. ;
  122. ;
  123. SET300:    LHLD    BD300        ; Get 300 baud parameters in HL
  124.     JMP    LOADBD        ; Go load them
  125. ;
  126. SET1200:LHLD    BD1200
  127.     JMP    LOADBD
  128. ;
  129. SET2400:LHLD    BD2400
  130. ;
  131. LOADBD:    DI            ; Turn off interrupts for initialization
  132.     XRA    A
  133.     OUT    PORT+1        ; Interrupt enable register
  134.     MVI    A,80H        ; Insure out of mode to set baud rate
  135.     OUT    PORT+3        ; Line control register
  136.     MOV    A,L        ; Get least significant baud rate byte
  137.     OUT    PORT
  138.     MOV    A,H        ; Get most signifcant baud rate byte
  139.     OUT    PORT+1
  140.     MVI    A,03H        ; 8-level, 1 stop bit, no parity
  141.     OUT    PORT+3        ; Line control register (03=1, 07=2)
  142.     MVI    A,01H        ; Set 'DTR' nromal
  143.     OUT    PORT+4        ; Modem control register
  144.     EI            ; Restore interrupts to normal
  145.     RET
  146. ;.....
  147. ;
  148. ;                   end
  149. ;-----------------------------------------------------------------------
  150.