home *** CD-ROM | disk | FTP | other *** search
- ;
- ; B5SV-1.INS - BYE5 insert for Servo-8 Single board computer - 08/02/85
- ;
- ; Z80 DART and Z80 CTC baudrate generator
- ;
- ; This routine adapts the Servo-8 single board computer to BYE5. Baudrate is
- ; sent to the baudrate generator upon powerup, from default
- ; jumpers.
- ;
- ; **** Note: This is an insert, not an overlay. ****
- ;
- ; = = = = = = = = = = = = = = = = = =
- ; 08/02/85 Converted for the Servo-8 computer
- ; from B3AD-0.INS & changed name to
- ; B5SV-1.INS - Paul Leighly
- ; 06/10/85 Rewritten for BYE335 and later - Irv Hoff
- ; 05/15/85 First version of B3AD - John Sojak
- ;
- ; = = = = = = = = = = = = = = = = = =
- ;
- ;
- PORT EQU 06H ; Data port
- MDCTL1 EQU PORT+1 ; Modem control port
- BRPORT EQU 09H ; Set baud rate generator base port
- ;
- MDRCV EQU 1 ; Modem receive ready bit
- MDSND EQU 4 ; Modem send ready bit
- MDDCD EQU 8 ; Data carrier detect
- ;
- ;
- ; Divisors for the CTC baudrate geneator
- ;
- BD300 EQU 0 ; 300 baud
- BD1200 EQU 40H ; 1200 bps
- BD2400 EQU 10 ; 2400 bps
- ;
- ;
- ;-----------------------------------------------------------------------
- ;
- ; See if we still have a carrier - if not, return with the zero flag set
- ;
- MDCARCK:MVI A,10H ; Reset status
- OUT MDCTL1
- IN MDCTL1 ; Get status
- ANI MDDCD ; Check for carrier
- RET
- ;.....
- ;
- ;
- ; Disconnect and wait for an incoming call
- ;
- MDINIT: MVI A,0 ; Setup to write register 0
- OUT MDCTL1
- MVI A,18H ; Reset channel
- OUT MDCTL1
- MVI A,4 ; Setup to write register 4
- OUT MDCTL1
- MVI A,84H ; Set 32x, 1 stop bit, no parity
- OUT MDCTL1
- MVI A,3 ; Setup to write register 3
- OUT MDCTL1
- MVI A,0C1H ; 8 bits, Rx enable
- OUT MDCTL1
- MVI A,5 ; Setup to write register 5
- OUT MDCTL1
- MVI A,6AH ; DTR off
- OUT MDCTL1
- PUSH B ; Save in case it's being used elsewhere
- MVI B,20 ; 2 second delay to drop any carrier
- ;
- OFFTI: CALL DELAY ; 1 second delay
- DCR B
- JNZ OFFTI ; Keep looping until finished
- POP B ; Restore 'BC'
- MVI A,5 ; Setup to write register 5
- OUT MDCTL1
- MVI A,0EAH ; Turn DTR back on
- OUT MDCTL1
- ;
- IF IMODEM ; If using an intellegent modem
- CALL IMINIT ; Go initialize it now
- ENDIF ; IMODEM
- ;
- RET
- ;.....
- ;
- ;
- ; Input a character from the modem port
- ;
- MDINP: IN PORT ; Get character
- ANI 7FH ; Strip parity
- RET
- ;.....
- ;
- ;
- ; Check the status to see if a character is available. If not, return
- ; with the zero flage set. If yes, use 0FFH to clear the flag.
- ;
- MDINST: IN MDCTL1 ; Get status
- ANI MDRCV ; Got a character
- RZ ; Return if none
- ORI 0FFH ; Otherwise set the proper flag
- RET
- ;.....
- ;
- ;
- ; Send a character to the modem
- ;
- MDOUTP: OUT PORT ; Send it
- RET
- ;.....
- ;
- ;
- ; See if the output is ready for another character
- ;
- MDOUTST:IN MDCTL1 ; Get status
- ANI MDSND ; Ready for a character?
- RET
- ;.....
- ;
- ;
- ; Reinitialize the modem and hang up the phone by dropping DTR and
- ; leaving it inactive.
- ;
- MDQUIT: IF IMODEM
- CALL IMQUIT
- ENDIF ; IMODEM
- ;
- ;
- ; Called by the main program after caller types BYE
- ;
- MDSTOP: MVI A,5 ; Setup to write register 5
- OUT MDCTL1
- MVI A,6AH ; Turn off DTR until next time
- OUT MDCTL1
- RET
- ;.....
- ;
- ;
- ; The following routine sets the baudrate. BYE5 asks for the maximum
- ; speed you have available.
- ;
- SETINV: ORI 0FFH ; Make sure zero flag is not set
- RET
- ;.....
- ;
- ;
- SET300: MVI A,47H
- OUT BRPORT
- MVI A,BD300
- OUT BRPORT
- RET
- ;
- SET1200:MVI A,47H
- OUT BRPORT
- MVI A,BD1200
- OUT BRPORT
- RET
- ;
- SET2400:MVI A,47H
- OUT BRPORT
- MVI A,BD2400
- OUT BRPORT
- RET
- ;
- ;.....
- ;
- ; end
- ------------------------------------------------------------------------:
- 0
- OUT BRPORT
- RET
- ;
- ;.....
- ;
- ; en