home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / bye3 / b3r1-2.iqs / B3R1-2.INS
Encoding:
Text File  |  1985-11-17  |  2.6 KB  |  120 lines

  1.  
  2. ; B3R1-1.INS - TRS-80 Model I insert for BYE3 - 08/01/85
  3. ;
  4. ;      TR1602 I/O and BR19411 baudrate generator
  5. ;
  6. ;       Note:  This is an insert not an overlay
  7. ;
  8. ;----------------------------------------------------------------
  9. ;
  10. ; 08/01/85 Upgraded for v337        - pst
  11. ; 06/25/83 Originally written        - pst
  12. ;
  13. ;----------------------------------------------------------------
  14. ;
  15. ; Modem port equates
  16. ;
  17. DPORT    EQU    0EBH        ; Modem port
  18. SPORT    EQU    DPORT-1        ; Status port
  19. BPORT    EQU    DPORT-2        ; Baud rate port
  20. RPORT    EQU    DPORT-3        ; Reset port
  21. ;
  22. DAV    EQU    10000000B    ; Data available
  23. TBMT    EQU    01000000B    ; Xmit buffer empty
  24. DCD    EQU    00100000B    ; Data carrier detect
  25. ;
  26. B300    EQU    055H        ; 300 baud
  27. B1200    EQU    077H        ; 1200 bps
  28. B2400    EQU    0AAH        ; 2400 bps
  29. ;
  30. ;-----------------------------------------------------------------------
  31. ;
  32. ; See if we still have a carrier - if not, return with the zero flat set
  33. ;
  34. MDCARCK:IN    RPORT        ; Read port
  35.     ANI    DCD        ; Mask carrier detect
  36.     RZ
  37.     ORI    255
  38.     RET
  39. ;
  40. ; Disconnect and wait for an incoming call
  41. ;
  42. MDINIT:    MVI    A,01        ; Reset UART, enable modem control
  43.     OUT    RPORT
  44.     MVI    A,68H        ; DTR, RTS off to hang up phone
  45.     OUT    SPORT
  46. ;
  47.     PUSH    B
  48.     MVI    B,20        ; 2 seconds to let modem settle down
  49. OFFTI:    CALL    DELAY
  50.     DCR    B
  51.     JNZ    OFFTI
  52.     POP    B
  53. ;
  54.     MVI    A,6BH        ; Turn DTR back on
  55.     OUT    SPORT
  56. ;
  57.      IF    IMODEM
  58.     CALL    IMINIT
  59.      ENDIF            ; IMODEM
  60. ;
  61.     RET
  62. ;
  63. ; Input a character from the modem port
  64. ;
  65. MDINP:    IN    DPORT        ; Get character
  66.     RET
  67. ;
  68. ; Check the status to see if a character is available.    If not, return
  69. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  70. ;
  71. MDINST:    IN    SPORT        ; Read port
  72.     ANI    DAV        ; Mask crap
  73.     RZ            ; Nope, nothing there
  74.     ORI    255        ; We got something...
  75.     RET
  76. ;
  77. ; Send a character to the modem
  78. ;
  79. MDOUTP:    OUT    DPORT        ; Send it
  80.     RET
  81. ;
  82. ;
  83. ; See if the output is ready for another character
  84. ;
  85. MDOUTST:IN    SPORT        ; Read port
  86.     ANI    TBMT        ; Mask crap
  87.     RZ
  88.     ORI    255
  89.     RET
  90. ;
  91. ; Reinitialize the modem and hang up the phone by dropping DTR and
  92. ; leaving it inactive.
  93. ;
  94. MDQUIT:     IF    IMODEM
  95.     CALL    IMQUIT        ; Tell smartmodem to shut down
  96.      ENDIF            ; IMODEM
  97. ;
  98. ; Called by main program after caller has typed BYE
  99. ;
  100. MDSTOP:    MVI    A,68H        ; Turn off DTR so that modem will quit
  101.     OUT    SPORT
  102.     RET
  103. ;
  104. ; The following routine sets the baudrate.  BYE3 asks for the maximum
  105. ; speed you have available.
  106. ;
  107. SET300:    MVI    A,B300
  108.     JMP    SETBAUD
  109. ;
  110. SET1200:MVI    A,B1200
  111.     JMP    SETBAUD
  112. ;
  113. SET2400:MVI    A,B2400
  114. ;
  115. SETBAUD:OUT    BPORT
  116.     XRA    A
  117.     RET
  118. ;                   end
  119. ;-----------------------------------------------------------------------
  120.