home *** CD-ROM | disk | FTP | other *** search
/ Oakland CPM Archive / oakcpm.iso / cpm / bye3 / b3r4-2.iqs / B3R4-2.INS
Text File  |  1985-11-17  |  3KB  |  132 lines

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