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 / B5R4-1.IQS / B5R4-1.INS
Text File  |  2000-06-30  |  3KB  |  149 lines

  1.  
  2. ; B5R4-1.INS - BYE5 insert for TRS-80 Model IV - 07/17/85
  3. ;
  4. ;         TR1865 I/O and BR1943 baudrate generator
  5. ;
  6. ;          Note:  This is an insert not an overlay
  7. ;
  8. ;
  9. ; This BYE5 insert is for the TRS-80 model IV and Model IV Gate Array
  10. ; computers using the Montezuma Micro CP/M 2.2.
  11. ;
  12. ; NOTE:  The MDCARCK routine contains a "XRI" statement other similar
  13. ;     inserts do not have.  The TRS-Model IV seems to invert the
  14. ;     DCD line from the modem.  If having problems installing this
  15. ;     insert, you might try nulling out the XRI instruction.
  16. ;
  17. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  18. ;
  19. ; 07/17/85  Written to work with BYE5            - Irv Hoff
  20. ; 06/15/85  Modified from my previous B31865 insert    - Tom Brady
  21. ;
  22. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  23. ;
  24. ;
  25. ; Modem port equates
  26. ;
  27. PORT    EQU    0EBH        ; Modem port
  28. MDCTL1    EQU    PORT-1        ; Status port
  29. MDCTL2    EQU    PORT-2        ; Baud rate port
  30. MDCTL3    EQU    PORT-3        ; Reset port
  31. ;
  32. MDRCV    EQU    80H        ; Data available
  33. MDSND    EQU    40H        ; Xmit buffer empty
  34. MDDCD    EQU    20H        ; Data carrier detect
  35. ;
  36. ;
  37. B300    EQU    55H        ; 300 baud
  38. B1200    EQU    77H        ; 1200 bps
  39. B2400    EQU    0AAH        ; 2400 bps
  40. ;
  41. ;
  42. ;-----------------------------------------------------------------------
  43. ;
  44. ; See if we still have a carrier - if not, return with the zero flat set
  45. ;
  46. MDCARCK:IN    MDCTL3        ; Read port
  47.     ANI    MDDCD        ; Isolate the DCD response
  48.     XRI    MDDCD        ; Invert the signal
  49.     RET
  50. ;.....
  51. ;
  52. ;
  53. ; Disconnect and wait for an incoming call
  54. ;
  55. MDINIT:    MVI    A,0EBH        ; DTR, RTS off to hang up phone
  56.     OUT    MDCTL1
  57.     PUSH    B
  58.     MVI    B,20        ; 2 seconds to let modem settle down
  59.     CALL    DLP1
  60.     MVI    A,01        ; Reset UART, enable modem control
  61.     OUT    MDCTL3
  62.     MVI    A,0ECH        ; Turn DTR back on
  63.     OUT    MDCTL1
  64.     MVI    B,2        ; Slight additional delay
  65.     CALL    DLP1
  66.     POP    B
  67. ;
  68.      IF    IMODEM
  69.     CALL    IMINIT
  70.      ENDIF            ; IMODEM
  71. ;
  72.     RET
  73. ;.....
  74. ;
  75. ;
  76. ; Input a character from the modem port
  77. ;
  78. MDINP:    IN    PORT        ; Get character
  79.     RET
  80. ;.....
  81. ;
  82. ;
  83. ; Check the status to see if a character is available.    If not, return
  84. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  85. ;
  86. MDINST:    IN    MDCTL1        ; Read port
  87.     ANI    MDRCV        ; Mask crap
  88.     RZ            ; Nope, nothing there
  89.     ORI    0FFH        ; We got something...
  90.     RET
  91. ;.....
  92. ;
  93. ;
  94. ; Send a character to the modem
  95. ;
  96. MDOUTP:    OUT    PORT        ; Send it
  97.     RET
  98. ;.....
  99. ;
  100. ;
  101. ;
  102. ; See if the output is ready for another character
  103. ;
  104. MDOUTST:IN    MDCTL1        ; Read port
  105.     ANI    MDSND        ; Mask crap
  106.     RET
  107. ;.....
  108. ;
  109. ;
  110. ; Reinitialize the modem and hang up the phone by dropping DTR and
  111. ; leaving it inactive.
  112. ;
  113. MDQUIT:     IF    IMODEM
  114.     CALL    IMQUIT        ; Send ATZ and ATS0=0 (auto-answer off)
  115.      ENDIF            ; IMODEM
  116. ;
  117. ;
  118. ; Called by main program after caller types BYE
  119. ;
  120. MDSTOP:    MVI    A,0EBH        ; Turn off DTR so that modem will quit
  121.     OUT    MDCTL1
  122.     RET
  123. ;.....
  124. ;
  125. ;
  126. ; The following routine sets the baudrate.  BYE5 asks for the maximum
  127. ; speed you have available.
  128. ;
  129. SETINV:    ORI    0FFH        ; Make sure the zero flag is not set
  130.     RET
  131. ;.....
  132. ;
  133. ;
  134. SET300:    MVI    A,B300
  135.     JMP    SETBAUD
  136. ;
  137. SET1200:MVI    A,B1200
  138.     JMP    SETBAUD
  139. ;
  140. SET2400:MVI    A,B2400
  141. ;
  142. SETBAUD:OUT    MDCTL2
  143.     XRA    A
  144.     RET
  145. ;.....
  146. ;
  147. ;                   end
  148. ;-----------------------------------------------------------------------
  149.