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 / NUB2-1.IQS / nub2-1.ins
Text File  |  1986-04-26  |  3KB  |  139 lines

  1. ; NUB2-1.INS - Big Board II overlay file for NUBYE - 04/21/86
  2. ;
  3. ; Z80 SIO and 8430 CTC timer
  4. ;
  5. ; This overlay adapts NUBYE to the Big Board II computer with the SIO
  6. ; serial port "B" and the Z80 CTC baud rate generator.
  7. ;
  8. ;
  9. ; ========
  10. ;
  11. ; 04/21/86  Modified for NUBYE
  12. ; 10/27/85  Written for use with BYE5    - Irv Hoff
  13. ;
  14. ; ========
  15. ;
  16. ; SIO Port B, Data = 82H, CTC = 88H
  17. ;
  18. PORT    EQU    82H    ; Your Z80 SIO base port (data or status)
  19. MDCTL1    EQU    PORT+1    ; Modem control port
  20. BRPORT    EQU    88H    ; CTC port for baud rate
  21. ;
  22. ; Table of baud rate parameters
  23. ;
  24. BD300    EQU    128        ; 38400/300
  25. BD1200    EQU    32        ; 38400/1200
  26. BD2400    EQU    16        ; 38400/9600
  27. BD9600    EQU    4        ; 38400/9600
  28. ;
  29. ; See if we still have a carrier - if not, return with the zero flag set
  30. ;
  31. MDCARCK:MVI    A,10H        ; Reset status
  32.     OUT    MDCTL1
  33.     IN    MDCTL1        ; Get status
  34.     ANI    8        ; Check for data carrier
  35.     RET
  36. ;
  37. ; Disconnect and wait for an incoming call
  38. ;
  39. MDINIT:    MVI    A,18H        ; Reset channel
  40.     OUT    MDCTL1
  41.     MVI    A,4        ; Setup to write register 4
  42.     OUT    MDCTL1
  43.     MVI    A,84H        ;*1 stop, 8 bits, no parity, 32x
  44.     OUT    MDCTL1
  45.     MVI    A,5        ; Setup to write register 5
  46.     OUT    MDCTL1
  47.     MVI    A,68H        ; Clear RTS causing hangup
  48.     OUT    MDCTL1
  49.     PUSH    B        ; Save in case it's being used elsewhere
  50.     MVI    B,20        ; 2 seconds delay to drop any carrier
  51. ;
  52. OFFTI:    CALL    DELAY        ; 0.1 second delay
  53.     DCR    B
  54.     JNZ    OFFTI        ; Keep looping until finished
  55.     POP    B        ; Restore bc
  56.     MVI    A,3        ; Setup to write register 3
  57.     OUT    MDCTL1
  58.     MVI    A,0C1H        ; Initialize receive register
  59.     OUT    MDCTL1
  60.     MVI    A,5        ; Setup to write register 5
  61.     OUT    MDCTL1
  62.     MVI    A,0EAH        ; Turn on RTS so modem can answer phone
  63.     OUT    MDCTL1
  64. ;
  65.      IF    IMODEM        ; If using intelligent modem
  66.     CALL    IMINIT        ; Go initialize
  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    1        ; Check receive ready bit
  81.     RZ            ; Return if none
  82.     ORI    0FFH        ; Otherwise, set the proper flag
  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    4        ; Check 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        ; If using a smartmodem
  100.     CALL    IMQUIT        ; Tell it to shut down
  101.      ENDIF            ; IMODEM
  102. ;
  103. ; Called by the main program after caller types BYE
  104. ;
  105. MDSTOP:    MVI    A,5        ; Setup to write register 5
  106.     OUT    MDCTL1
  107.     MVI    A,68H        ; Clear RTS causing shutdown
  108.     OUT    MDCTL1
  109.     RET
  110. ;
  111. ; The following routine sets the baudrate.  NUBYE asks for the maximum
  112. ; speed you have available.
  113. ;
  114. SETINV:    ORI    0FFH        ; Make sure zero flag is not set
  115.     RET            ; Return
  116. ;
  117. SET300:    MVI    B,BD300        ; Get 300 bps parameters in 'HL'
  118.     JMP    LOADBD        ; Go load them
  119. ;
  120. SET1200:MVI    B,BD1200
  121.     JMP    LOADBD
  122. ;
  123. SET2400:MVI    B,BD2400
  124.     JMP    LOADBD
  125. ;
  126. SET9600:MVI    B,BD9600
  127. ;
  128. LOADBD:    MVI    A,47H        ; CTC command word
  129.     OUT    BRPORT
  130.     XTHL            ; Short delay
  131.     XTHL            ; Additional short delay
  132.     MOV    A,B        ; Baudrate
  133.     OUT    BRPORT        ; Reset CTC to new baudrate
  134.     XRA    A        ; Say baudrate was ok
  135.     RET
  136. ;
  137. ; end of insert
  138. ; -------------
  139.