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

  1.  
  2. ; B5R3-1.INS - TRS-80 Model III insert for BYE5 - 07/17/85
  3. ;
  4. ;      TR1602 I/O and BR19411 baudrate generator
  5. ;
  6. ;       Note:  This is an insert not an overlay
  7. ;
  8. ; Some TRS-80 Model III units may differ from the ones that use this
  9. ; insert in which case get the one for the Model IV and try that.  The
  10. ; status on some of the boards such as the Montezuma Micro CP/M 2.2 are
  11. ; inverted and you may or may not have that problem.
  12. ;
  13. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  14. ;
  15. ; 07/17/85  Written to work with BYE5        - Irv Hoff
  16. ;
  17. ; =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =   =
  18. ;
  19. ;
  20. ; Modem port equates
  21. ;
  22. PORT    EQU    0EBH        ; Modem port
  23. MDCTL1    EQU    PORT-1        ; Status port
  24. MDCTL2    EQU    PORT-2        ; Baud rate port
  25. MDCTL3    EQU    PORT-3        ; Reset port
  26. ;
  27. MDRCV    EQU    80HB        ; Data available
  28. MDSND    EQU    40H        ; Xmit buffer empty
  29. MDDCD    EQU    20H        ; Data carrier detect
  30. ;
  31. ;
  32. B300    EQU    55H        ; 300 baud
  33. B1200    EQU    77H        ; 1200 bps
  34. B2400    EQU    0AAH        ; 2400 bps
  35. ;
  36. ;
  37. ;-----------------------------------------------------------------------
  38. ;
  39. ; See if we still have a carrier - if not, return with the zero flat set
  40. ;
  41. MDCARCK:IN    MDCTL3        ; Read port
  42.     ANI    MDDCD        ; Mask carrier detect
  43.     RET
  44. ;.....
  45. ;
  46. ;
  47. ; Disconnect and wait for an incoming call
  48. ;
  49. MDINIT:    MVI    A,01        ; Reset UART, enable modem control
  50.     OUT    MDCTL3
  51.     MVI    A,68H        ; DTR, RTS off to hang up phone
  52.     OUT    MDCTL1
  53.     PUSH    B
  54.     MVI    B,20        ; 2 seconds to let modem settle down
  55. ;
  56. MDINIT1:CALL    DELAY
  57.     DCR    B
  58.     JNZ    MDINIT1
  59.     POP    B
  60.     MVI    A,6BH        ; Turn DTR back on
  61.     OUT    MDCTL1
  62. ;
  63.      IF    IMODEM
  64.     CALL    IMINIT
  65.      ENDIF            ; IMODEM
  66. ;
  67.     RET
  68. ;.....
  69. ;
  70. ;
  71. ; Input a character from the modem port
  72. ;
  73. MDINP:    IN    PORT        ; Get character
  74.     RET
  75. ;.....
  76. ;
  77. ;
  78. ; Check the status to see if a character is available.    If not, return
  79. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  80. ;
  81. MDINST:    IN    MDCTL1        ; Read port
  82.     ANI    MDRCV        ; Mask crap
  83.     RZ            ; Nope, nothing there
  84.     ORI    0FFH        ; We got something...
  85.     RET
  86. ;.....
  87. ;
  88. ;
  89. ; Send a character to the modem
  90. ;
  91. MDOUTP:    OUT    PORT        ; Send it
  92.     RET
  93. ;.....
  94. ;
  95. ;
  96. ;
  97. ; See if the output is ready for another character
  98. ;
  99. MDOUTST:IN    MDCTL1        ; Read port
  100.     ANI    MDSND        ; Mask crap
  101.     RET
  102. ;.....
  103. ;
  104. ;
  105. ; Reinitialize the modem and hang up the phone by dropping DTR and
  106. ; leaving it inactive.
  107. ;
  108. MDQUIT:     IF    IMODEM
  109.     CALL    IMQUIT        ; Tell smartmodem to shut down
  110.      ENDIF            ; IMODEM
  111. ;
  112. ;
  113. ; Called by main program after caller has typed BYE
  114. ;
  115. MDSTOP:    MVI    A,68H        ; Turn off DTR so that modem will quit
  116.     OUT    MDCTL1
  117.     RET
  118. ;.....
  119. ;
  120. ;
  121. ; The following routine sets the baudrate.  BYE5 asks for the maximum
  122. ; speed you have available.
  123. ;
  124. SETINV:    ORI    0FFH        ; Make sure the zero flag is not set
  125.     RET
  126. ;.....
  127. ;
  128. ;
  129. SET300:    MVI    A,B300
  130.     JMP    SETBAUD
  131. ;
  132. SET1200:MVI    A,B1200
  133.     JMP    SETBAUD
  134. ;
  135. SET2400:MVI    A,B2400
  136. ;
  137. SETBAUD:OUT    MDCTL2
  138.     XRA    A
  139.     RET
  140. ;.....
  141. ;
  142. ;                   end
  143. ;-----------------------------------------------------------------------
  144.