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 / NUOS-2.IQS / nuos-2.ins
Text File  |  1986-04-26  |  10KB  |  323 lines

  1. ; NUOS-1.INS - Osborne OS-1 insert for NUBYE - 04/21/86
  2. ;
  3. ; 6850 ACIA
  4. ;
  5. ; Note:  This is an insert, not an overlay.
  6. ;
  7. ; If your OS-1 does not have have the hardware mod to support DTR,
  8. ; (shown below) then set the NODTR option in NUBYE to "YES".
  9. ; Also set:
  10. ;            IMODEM   EQU   YES
  11. ;            NORING   EQU   YES
  12. ;
  13. ; ========
  14. ;
  15. ; 04/21/86  Modified for NUBYE
  16. ; 08/07/85  Program now runs properly with BYE5 program.  Renamed several
  17. ;         labels to more closely match BYE5 conventions.  Changed MDOUTP
  18. ;        routine with addition of PUSH PSW and POP PSW statements.
  19. ;        MDOUTP routine for Osborne 1 clobbers accumulator register when
  20. ;        called.  Changed MDQUIT routine, program now calls RTSNBL and
  21. ;        IMQUIT if IMODEM equate is set true.  Changed MDINIT routine,
  22. ;        program now calls IMINIT if IMODEM equate is set true.  Changed
  23. ;        MDCARCK routine.                 - Roy Robinson
  24. ; 07/17/85  Revised for use with BYE5            - Kevin Murphy
  25. ;
  26. ; =========
  27. ;
  28. ; NOTE:
  29. ;    IF YOU USE THE HARWARE MODIFICATION TO THE OZZIE 1.
  30. ;    When the Sysop terminates the NUBYE program with a control C fol-
  31. ;    lowed by any other key except 'E' or 'R' from the local console
  32. ;    keyboard to go off-line, the Sysop must press the RESET button
  33. ;    at the front of the Ozzie and reboot the computer before running
  34. ;    the NUBYE program again. This is due to the nature of the 6821
  35. ;    PIA input, CB2, which is used for carrier detect in the hardware
  36. ;    mod.  Pushing the RESET button triggers the CB2 input for proper
  37. ;    use with NUBYE.    This reboot should be a minor inconvenience as
  38. ;    it is initiated only when the computer is off-line.
  39. ;
  40. ;                        - Roy Robinson
  41. ;
  42. ; The following hardware (your OCC-1) configuration is assumed:
  43. ;
  44. ;    DTR (pin 20) is supported
  45. ;    DCD (pin 8) is supported
  46. ;    RI  (pin 22) is not supported
  47. ;
  48. ; MAIN LOGIC BOARD TRACE CUTS:
  49. ; --------------------------
  50. ; Solder Side:
  51. ;
  52. ;     Cut trace running from pin 5 to pin 6 on inner row of pads
  53. ;     used in mounting the RS-232 female serial connector at the
  54. ;    front  of main logic board.  Pin 1 is pad with wide ground
  55. ;    trace.
  56. ;
  57. ; Component side:
  58. ;
  59. ;     Cut trace from pin 5 of UC4 (6850) to R20 (10K ohm).
  60. ;     Cut trace that runs between pins 3 and 4 of UC4 (6850).
  61. ;
  62. ; PART ADDITIONS:
  63. ; --------------
  64. ; Solder side:
  65. ;
  66. ;     Add jumper from pin 1 of UE3 (MC1458) to pin 5 of inner row of
  67. ;             RS-232 serial port pads.  Pin 1 has wide ground trace.
  68. ;     Add jumper from pin 3 to pin 5 of UE3 (MC1458).
  69. ;     Add jumper from pin 10 of UD4 (LM3400) to pin 5 of UC1 (74LS08).
  70. ;     Add jumper from pin 4 of UC1 (74LS08) to pin 1 of UE20 (74LS04).
  71. ;     Add jumper from pin 6 of UC1 (74LS08) to pin 5 of UA11 (74S04).
  72. ;     Add jumper from pin 6 of UA11 (74S04) to pin 19 of UC15 (6821).
  73. ;
  74. ;     Component side or solder side (whichever side you feel more
  75. ;     comfortable using for mounting components):
  76. ;
  77. ;    Add 10K ohm resistor from Vcc (+5 volts) to pin 2 of UE3 (MC1458).
  78. ;     Add 220 ohm resistor from pin 5 of UC4 (6850) to pin 2 of UE3 (MC1458).
  79. ;     Add 1k ohm resistor from pin 19 of UC15 (6821) to Vcc (+5 volts).
  80. ;
  81. ; NEW RS-232 MODEM CABLE:
  82. ; ----------------------
  83. ;
  84. ;      OCC-1                MODEM
  85. ;
  86. ;     2    RXD              3    RXD
  87. ;     3    TXD              2    TXD
  88. ;     4    DCD (new function)      8    DCD
  89. ;     5    DTR (new function)     20    DTR
  90. ;     7    GND              7    GND
  91. ;
  92. ; ----------
  93. ;
  94. WRKBAUD:DB    16H    ; [*] OCC1 ++
  95. SSTAT:    DB    0    ; RAM location serves as a secondary status reg-
  96.             ;   ister for the 6850 ACIA status register.
  97.             ;   This secondary RAM register is used because
  98.             ;   the  6850 ACIA clobbers its own status reg-
  99.             ;   ister (with regard to TBE and RDA status
  100.             ;   bits) when data is traveling in both direc-
  101.             ;   tions via the serial port.    This is illus-
  102.             ;   trated with data being output during a dis-
  103.             ;   play listing to the remote user, and the re-
  104.             ;   mote user wishes to suspend or abort the
  105.             ;   screen display by typing a ^S, ^C,    or ^K.
  106. HARDMOD    EQU    YES    ; YES, if hardware mods have been installed in
  107.             ;   Osborne O-1 to support DTR and modified DCD.
  108.             ;   (see installation procedure above)
  109.             ; NO,  if the O-1 is standard (no mods).  If NO,
  110.             ;   you must set NODTR equate to YES in the main
  111.             ;   body of the NUBYE program.
  112. STATM    EQU    2A00H
  113. DATA    EQU    2A01H
  114. CDATA    EQU    2C02H
  115. CSTAT    EQU    2C03H
  116. ;
  117.      IF    HARDMOD
  118. MDDCD    EQU    40H
  119.      ENDIF
  120. ;
  121.      IF    NOT HARDMOD
  122. MDDCD    EQU    4
  123.      ENDIF
  124. ;
  125. RRDA    EQU    0FEH
  126. MRDA    EQU    1
  127. RTBE    EQU    0FDH
  128. MTBE    EQU    2
  129. BD300    EQU    22
  130. BD1200    EQU    21
  131. ;
  132. ; See if we still have a carrier - if not, return with the zero flag set
  133. ;
  134. MDCARCK:
  135.      IF    HARDMOD
  136.     DI        ; Disable interrupts
  137.     OUT    0
  138.     LDA    CSTAT    ; Read video PIA status register
  139.     OUT    1
  140.     EI
  141.      ENDIF        ; HARDMOD
  142. ;
  143.      IF    NOT HARDMOD
  144.     CALL    BNKINS    ; Get modem status
  145.      ENDIF        ; NOT HARDMOD
  146. ;
  147.     CMA        ; Complement register, DCD bit set with LOSS of carrier
  148.             ; This is opposite of most I/O devices.
  149.     ANI    MDDCD    ; Mask out everything but carrier LOSS bit
  150.             ; Z=1 Lost carrier
  151.             ; Z=0 Carrier present
  152.     RET
  153. ;
  154. ; Disconnect and wait for an incoming call
  155. ;
  156. MDINIT:    CALL    RTSDIS    ; Clear RTS causing hangup
  157.     CALL    RTSNBL    ; Turn on DTR so modem can answer phone
  158.     CALL    OFFTIM    ; Wait 2 seconds
  159. ;
  160.      IF     IMODEM
  161.     CALL    IMINIT    ; Initialize smartmodem
  162.      ENDIF        ; IMODEM
  163. ;
  164.      IF    HARDMOD
  165.     CALL    INITCAR    ; Reset carrier detect input on 6821 video PIA
  166.      ENDIF        ; HARDMOD
  167. ;
  168.     RET
  169. ;
  170. ; Input a character from the modem port
  171. ;
  172. MDINP:    CALL    BNKIND    ; Input data from RS-232 serial port
  173.     PUSH    PSW    ; Save the character
  174.     LDA    SSTAT    ; Load secondary ACIA status register from RAM
  175.     ANI    RRDA    ; Mask the RDA bit (reset RDA bit in secondary register)
  176.     STA    SSTAT    ; Save our updated status register in RAM
  177.     POP    PSW    ; Recover the character
  178.     RET        ; Return to sender
  179. ;
  180. ; Check the status to see if a character is available.    If not, return
  181. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  182. ;
  183. MDINST:    PUSH    B    ; Save BC registers
  184.     LDA    SSTAT    ; Load secondary ACIA status register
  185.             ;   (contains status of ACIA from last ACIA operation)
  186.     MOV    B,A    ; Save it in register B
  187.     CALL    BNKINS    ; Input current ACIA status register
  188.     ORA    B    ; Perform an OR operation on both former
  189.             ;   as well as present ACIA register states.
  190.     STA    SSTAT    ; Save updated ACIA register state in secondary ACIA
  191.             ;   register
  192.     ANI    MRDA    ; Mask RDA bit
  193.     POP    B    ; Recover former BC registers
  194.     RZ        ; Nothing?  Return to sender with Z-flag set
  195.     ORI    0FFH    ; We got something....
  196.     RET        ; Return to sender with Z-flag not set
  197. ;
  198. ; Send a character to the modem
  199. ;
  200. MDOUTP:    PUSH    PSW
  201.     CALL    BNKOUTD    ; Output data to RS-232 serial port
  202.     LDA    SSTAT    ; Load secondary ACIA register
  203.     ANI    RTBE    ; Mask the TBE bit
  204.     STA    SSTAT    ; Save secondary ACIA register (now updated)
  205.     POP    PSW
  206.     RET        ; Return to sender
  207. ;
  208. ; Check the status to see if ACIA can output a character.  If not, return
  209. ; with the zero flag set.  If yes, use 0FFH to clear the flag.
  210. ;
  211. MDOUTST:PUSH    B    ; Save BC registers
  212.     CALL    BNKINS    ; Get present ACIA status register
  213.     MOV    B,A    ; Move it to 'B' register
  214.     LDA    SSTAT    ; Get secondary ACIA status register
  215.     ORA    B    ; Perform an OR operation on present and former
  216.             ;   ACIA status register states
  217.     STA    SSTAT    ; Save updated ACIA status register in secondary
  218.             ;   ACIA status register
  219.     ANI    MTBE    ; Mask the TBE bit
  220.     POP    B    ; Recover the former BC registers
  221.     RZ        ; Transmit buffer not empty so return
  222.             ;   to sender with Z-flag set
  223.     ORI    0FFH    ; If empty...
  224.     RET        ; Ready to send character
  225. ;
  226. ; Reinitialize the modem and hang up the phone by dropping RTS and
  227. ; leaving it inactive
  228. ;
  229. MDQUIT:    CALL    RTSDIS    ; Disable RTS output which forces modem to hang-up
  230. ;
  231.      IF    IMODEM
  232.     CALL    RTSNBL    ; Turn on RTS so modem can be
  233.     CALL    IMQUIT    ; If a smartmodem, tell it to shut down
  234.      ENDIF        ; IMODEM
  235. ;
  236. ; Called by the main program after caller types BYE
  237. ;
  238. MDSTOP:    CALL    RTSDIS    ; Clear RTS causing shutdown
  239. ;
  240.     RET
  241. ;
  242. ; Initialize the 6850 ACIA and disable RTS line which serves as DTR
  243. ; control for the modem
  244. ;
  245. RTSDIS:    MVI    A,57H     ; IRQ disabled, RTS disabled, 8bits/1stop, MRESET
  246.     CALL    BNKOUTS
  247. ;
  248. OFFTIM:    PUSH    B    ;2 second delay after dropping the ACIA RTS line
  249.     MVI    B,20    ;(which is DTR to the modem)
  250. ;
  251. OFFTI:
  252.     CALL    DELAY
  253.     DCR    B
  254.     JNZ    OFFTI
  255.     POP    B
  256.     RET
  257. ;
  258. ; Reset video 6820 PIA register for future detection of lost carrier
  259. ;
  260. INITCAR:
  261.     DI
  262.     OUT    0
  263.     LDA    CDATA    ; Read video pia data register to reset cb2 bit
  264.     OUT    1
  265.     EI
  266.     RET
  267. ;
  268. RTSNBL:    LDA    WRKBAUD    ; ACIA reset and enable RTS
  269.     ANI    0BFH    ;
  270.     CALL    BNKOUTS
  271.     RET
  272. ;
  273. BNKINS:    DI        ; Disable interrupts
  274.     OUT    0    ; Switch banks to shadow memory bank
  275.     LDA    STATM    ; Read ACIA status register (memory mapped)
  276.     OUT    1    ; Switch banks back to program memory bank
  277.     EI        ; Re-enable interrupts
  278.     RET        ; Go home
  279. ;
  280. BNKIND:    DI        ; Disable interrupts
  281.     OUT    0    ; Switch banks to shadow memory bank
  282.     LDA    DATA    ; Read ACIA data register (memory mapped)
  283.     OUT    1    ; Switch banks back to program memory bank
  284.     EI        ; Reenable interrupts
  285.     RET        ; Go home
  286. ;
  287. BNKOUTS:DI        ; Disable interrupts
  288.     OUT    0    ; Switch banks to shadow memory bank
  289.     STA    STATM    ; Write data to ACIA control register (memory mapped)
  290.     OUT    1    ; Switch banks to program memory bank
  291.     EI        ; Reenable interrupts
  292.     RET        ; Go home
  293. ;
  294. BNKOUTD:DI        ; Disable interrupts
  295.     OUT    0    ; Switch banks to shadow memory bank
  296.     STA    DATA    ; Write data to ACIA data register (memory mapped)
  297.     OUT    1    ; Switch banks to program memory bank
  298.     EI        ; Reenable interrupts
  299.     RET        ; Go home
  300. ;
  301. ; The following routine sets the baudrate.  NUBYE would like the maximum
  302. ; speed you have available for controlling your modem.
  303. ;
  304. SET300:    MVI    A,BD300    ; IRQ disable, RTS disable
  305.             ; 8 data bits, 1 stop bit, 64X clock
  306.     JMP    SETBAUD
  307. ;
  308. SET1200:MVI    A,BD1200
  309. ;
  310. SETBAUD:CALL    BNKOUTS
  311.     STA    WRKBAUD    ; Save incoming baud rate
  312.     XRA    A    ; Show baudrate was ok
  313.     RET
  314. ;
  315. SET2400    EQU    $    ; The OS-1 doesn't like 2400 -- yet
  316. ;
  317. SETINV:    MVI    A,0FFH    ; Return bad
  318.     ORA    A    ; Show baudrate was unacceptable
  319.     RET
  320. ;
  321. ; end of insert
  322. ; -------------
  323.