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 / B5R1-1.INS < prev    next >
Text File  |  2000-06-30  |  3KB  |  139 lines

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