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 / NUMT-1.IQS / numt-1.ins
Text File  |  1986-04-26  |  4KB  |  150 lines

  1. ; NUMT-1.INS - Memotech SDX-512 computer insert for NUBYE - 04/21/86
  2. ;
  3. ; DART I/O and CTC timer 4.000 MHz
  4. ;
  5. ; Note:  This is an insert, not an overlay.
  6. ;
  7. ; This version is for the Memotech SDX-512 using channel "B" of the Z80
  8. ; DART.  The Z80-CTC is used as the baud rate generator.
  9. ;
  10. ; NOTE:  The carrier detect input is checked for "Active low" which
  11. ;     is quite unusual, and requires a "CMA" in MDCARCK.
  12. ;
  13. ;       Make up an RS232 cable per the instructions below:
  14. ;
  15. ;            Modem       Ampro
  16. ;            -----       -----
  17. ;            pin 2    -  pin 2
  18. ;            pin 3    -  pin 3
  19. ;            pin 7    -  pin 7
  20. ;            pin 8    -  pin 8
  21. ;            pin 20    -  pin 20
  22. ;
  23. ; ========
  24. ;
  25. ; 04/21/86  Modified for NUBYE
  26. ; 02/11/86  Initial Memotech version        - Irv Hoff
  27. ;
  28. ; ========
  29. ;
  30. ; Values given are for port 'B'
  31. ;
  32. PORT    EQU    0DH        ; Data port
  33. MDCTL1    EQU    0FH        ; Status/control port
  34. BRPORT    EQU    0AH        ; Baud rate port
  35. ;
  36. ; See if we still have a carrier - if not, return with the zero flag set
  37. ;
  38. MDCARCK:MVI    A,10H        ; Reset status
  39.     OUT    MDCTL1
  40.     IN    MDCTL1        ; Get status
  41.     CMA            ; Invert for "active low" for Memotech
  42.     ANI    20H        ; Check for data carrier
  43.     RET
  44. ;
  45. ; Disconnect and wait for an incoming call
  46. ;
  47. MDINIT:    MVI    A,18H        ; Reset channel
  48.     OUT    MDCTL1
  49.     MVI    A,4        ; Setup to write register 4
  50.     OUT    MDCTL1
  51.     MVI    A,44H        ;*1 stop, 8 bits, no parity, 16x
  52.     OUT    MDCTL1
  53.     MVI    A,5        ; Setup to write register 5
  54.     OUT    MDCTL1
  55.     MVI    A,68H        ; Clear RTS causing hangup
  56.     OUT    MDCTL1
  57.     PUSH    B        ; Save in case it's being used elsewhere
  58.     MVI    B,20        ; 2 seconds delay to drop any carrier
  59. ;
  60. OFFTI:    CALL    DELAY        ; 0.1 second delay
  61.     DCR    B
  62.     JNZ    OFFTI        ; Keep looping until finished
  63.     POP    B        ; Restore bc
  64.     MVI    A,3        ; Setup to write register 3
  65.     OUT    MDCTL1
  66.     MVI    A,0C1H        ; Initialize receive register
  67.     OUT    MDCTL1
  68.     MVI    A,5        ; Setup to write register 5
  69.     OUT    MDCTL1
  70.     MVI    A,0EAH        ; Turn on RTS so modem can answer phone
  71.     OUT    MDCTL1
  72. ;
  73.      IF    IMODEM        ; If using intelligent modem
  74.     CALL    IMINIT        ; Go initialize
  75.      ENDIF            ; IMODEM
  76. ;
  77.     RET
  78. ;
  79. ; Input a character from the modem port
  80. ;
  81. MDINP:    IN    PORT        ; Get character
  82.     RET
  83. ;
  84. ; Check the status to see if a character is available.    If not, return
  85. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  86. ;
  87. MDINST:    IN    MDCTL1        ; Get status
  88.     ANI    1        ; Check receive ready bit
  89.     RZ            ; Return if none
  90.     ORI    0FFH        ; Otherwise, set the proper flag
  91.     RET
  92. ;
  93. ; Send a character to the modem
  94. ;
  95. MDOUTP:    OUT    PORT        ; Send it
  96.     RET
  97. ;
  98. ; See if the output is ready for another character
  99. ;
  100. MDOUTST:IN    MDCTL1
  101.     ANI    4        ; Check transmit ready bit
  102.     RET
  103. ;
  104. ; Reinitialize the modem and hang up the phone by dropping DTR and
  105. ; leaving it inactive.
  106. ;
  107. MDQUIT:     IF    IMODEM        ; If using a smartmodem
  108.     CALL    IMQUIT        ; Tell it to shut down
  109.      ENDIF            ; IMODEM
  110. ;
  111. ; Called by the main program after caller types BYE
  112. ;
  113. MDSTOP:    MVI    A,5        ; Setup to write register 5
  114.     OUT    MDCTL1
  115.     MVI    A,68H        ; Clear RTS causing shutdown
  116.     OUT    MDCTL1
  117.     RET
  118. ;
  119. ; The following routine sets the baudrate.  NUBYE asks for the maximum
  120. ; speed you have available.
  121. ;
  122. SETINV:    ORI    0FFH        ; Make sure zero flag is not set
  123.     RET            ; Return
  124. ;
  125. SET300:    MVI    B,BD300        ; Get 300 bps parameters in 'HL'
  126.     JMP    LOADBD        ; Go load them
  127. ;
  128. SET1200:MVI    B,BD1200
  129.     JMP    LOADBD
  130. ;
  131. SET2400:MVI    B,BD2400
  132.     JMP    LOADBD
  133. ;
  134. SET9600:MVI    B,BD9600
  135. ;
  136. LOADBD:    MVI    A,47H        ; CTC command word
  137.     OUT    BRPORT
  138.     MOV    A,B        ; Baudrate
  139.     OUT    BRPORT
  140.     XRA    A
  141.     RET
  142. ;
  143. BD300    EQU    64        ; 19200/300  (first half is CTC command)
  144. BD1200    EQU    16        ; 19200/1200
  145. BD2400    EQU    8        ; 19200/2400
  146. BD9600    EQU    2        ; 19200/9600
  147. ;
  148. ; end of insert
  149. ; -------------
  150.