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 / NUBYE / NUBY-INS.LBR / NUSY-1.IQS / nusy-1.ins
Text File  |  1986-04-26  |  3KB  |  146 lines

  1. ; NUSY-1.INS - NUBYE insert for Sanyo 1000/1100/1200/1250 - 04/21/86
  2. ;
  3. ; 8251A and no baudrate generator
  4. ;
  5. ; Pin 8 (DCD) from the modem must be connected to the USART's DSR input,
  6. ; usually Pin 6.
  7. ;
  8. ; Note:  This is an insert, not an overlay.
  9. ;
  10. ; ========
  11. ;
  12. ; 04/21/86  Modified for NUBYE
  13. ; 02/07/86  Added Sayno 1100 as an option    - Irv Hoff
  14. ; 09/29/85  Original version for BYE5        - Irv Hoff
  15. ;
  16. ; ========
  17. ;
  18. MBC1000    EQU    NO
  19. MBC1100 EQU    YES
  20. MBC1200 EQU    NO
  21. ;
  22.      IF    MBC1000
  23. PORT    EQU    0FEH        ; Data port
  24.      ENDIF
  25. ;
  26.      IF    MBC1100
  27. PORT    EQU    0DCH        ; Data port
  28.      ENDIF
  29. ;
  30.      IF    MBC1200
  31. PORT    EQU    0ECH        ; Data port
  32.      ENDIF
  33. ;
  34. ;The following define the port address to use
  35. ;
  36. MDCTL1    EQU    PORT+1        ; Status/control port
  37. ;
  38. ; NOTE: The DIP switches must be set for 1200 bps for this to work
  39. ; this to work.
  40. ;    
  41. BPORT    EQU    MDCTL1        ; Baud rate port=8251 control
  42. ;
  43. ; See if we still have a carrier - if not, return with the zero flag set
  44. ;
  45. MDCARCK:IN    MDCTL1        ; Get status
  46.     ANI    80H        ; Check DSR bit for a carrier
  47.     RET
  48. ;
  49. ; Disconnect and wait for an incoming call
  50. ;
  51. MDINIT:    MVI    A,10H        ; Clear DTR
  52.     OUT    MDCTL1        ; Causing hangup
  53.     PUSH    B        ; Preserve in case we need it
  54.     MVI    B,20        ; 2 second delay
  55. ;
  56. OFFTI:    CALL    DELAY        ; 0.1 second delay
  57.     DCR    B
  58.     JNZ    OFFTI        ; Keep looping until finnished
  59.     POP    B        ; Restore BC
  60.     MVI    A,17H        ; Assert DTR so that modem
  61.     OUT    MDCTL1        ; Can answer phone
  62.     XCHG            ; Small delay
  63.     XCHG            ; Small delay
  64. ;
  65.      IF    IMODEM
  66.     CALL    IMINIT
  67.      ENDIF            ; IMODEM
  68. ;
  69.     RET
  70. ;
  71. ; Input a character from the modem port
  72. ;
  73. MDINP:    IN    PORT        ; Get character
  74.     RET
  75. ;
  76. ; Check the status to see if a character is available.    If not, return
  77. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  78. ;
  79. MDINST:    IN    MDCTL1        ; Get status
  80.     ANI    2        ; Check the receive ready bit
  81.     RZ            ; Return if none
  82.     ORI    0FFH        ; We have a character
  83.     RET
  84. ;
  85. ; Send a character to the modem
  86. ;
  87. MDOUTP:    OUT    PORT        ; Send it
  88.     RET
  89. ;
  90. ; See if the output is ready for another character
  91. ;
  92. MDOUTST:IN    MDCTL1
  93.     ANI    1        ; Check the transmit ready bit
  94.     RET
  95. ;
  96. ; Reinitialize the modem and hang up the phone by dropping DTR and
  97. ; leaving it inactive.
  98. ;
  99. MDQUIT:     IF    IMODEM
  100.     CALL    IMQUIT        ; Tell smartmodem to quit
  101.      ENDIF            ; IMODEM
  102. ;
  103. ; Called by the main program after caller types BYE
  104. ;
  105. MDSTOP:    MVI    A,10H        ; Turn off DTR
  106.     OUT    MDCTL1
  107.     RET
  108. ;
  109. ; Start of rev 1.x speeds
  110. ;
  111. ; The following routine sets the baudrate.  NUBYE asks for the maximum
  112. ; speed you have available.
  113. ;
  114. SET2400    EQU    $        ; Only supports 300/1200
  115. ;
  116. SETINV:    ORI    0FFH        ; Make sure zero flag not set
  117.     RET
  118. ;
  119. SET300:    MVI    B,BD300
  120.     JMP    SETBAUD
  121. ;
  122. SET1200:MVI    B,BD1200
  123. ;
  124. SETBAUD:MVI    A,47H        ; Reset, enable Rx, DTR, Tx
  125.     OUT    MDCTL1        ; Rx,Tx enabled
  126.     XCHG            ; Small delay
  127.     XCHG            ; Small delay
  128.     MOV    A,B        ; Recover Baud Rate Word
  129.     OUT    BPORT
  130.     XCHG            ; Small delay
  131.     XCHG            ; Small delay
  132.     MVI    A,17H        ; ERR reset, DTR, Rx, Tx all on
  133.     OUT    MDCTL1
  134.     XCHG            ; Small delay
  135.     XCHG            ; Small delay
  136.     XRA    A        ; Say rate OK
  137.     RET
  138. ;
  139. ; Values to switch the 8251 between x16 and x64 for rev 1.x boards
  140. ;
  141. BD300    EQU    4FH        ; 300 baud
  142. BD1200    EQU    4EH        ; 1200 bps
  143. ;
  144. ; end of insert
  145. ; -------------
  146.