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
/
SIMTEL
/
CPMUG
/
CPMUG051.ARK
/
TERM.ALX
< prev
next >
Wrap
Text File
|
1984-04-29
|
8KB
|
380 lines
REV EQU 25H ; 03/19/81 R. CURTISS FOR NEW ALX STRUCTURES
;REV EQU 24H ; 06/17/79 R. CURTISS RFOPEN:
;REV EQU 23H ; 06/17/79 R. CURTISS FINISH RECEIVE FILE CODE
;REV EQU 22H ; 06/14/79 R. CURTISS SABORT, ETAB
;REV EQU 21H ; 06/14/79 R. CURTISS FINISH REWRITE
;REV EQU 20H ; 06/13/79 R. CURTISS ALX REWRITE FROM NORDATA1P
;REV EQU 14H ; 10/24/78 R. CURTISS CI & CISTAT DIRECT TO BIOS
;REV EQU 13H ; 10/23/78 R. CURTISS T,U,W BDOS AND BIOS CI
;REV EQU 12H ; 08/09/78 R. CURTISS FIX ERRORS
;REV EQU 11H ; 08/09/78 R. CURTISS MORE CODE
;REV EQU 10H ; 07/26/78 R. CURTISS INITIAL CODING
;
;
; NORDATA TERMINAL PROGRAM WITH FILE TRANSFER (SEND AND RECEIVE)
;
;
ORG 100H
JMP START
DB REV ; REVISION NUMBER IN CODE
EXIT: JMP 0000H ; RETURN TO CP/M
DB DREV ; REVISION NUMBER OF DISKIO PACKAGE
DB 0,0,0
DB SREV ; REVISION CODE FOR SUPPORT ROUTINES
;
; -----------------------
;
QUIT: DS 1 ; FLAG SET BY COMMAND TO STOP
SABORT: DS 1 ; FILE SENDING ABORT FLAG
ULTOG: DS 1 ; UPPER/LOWER CASE SWITCH FLAG
RFOPEN: DS 1 ; RECEIVE FILE OPEN FLAG
RLOG: DS 1 ; RECEIVE DATA SAVE FLAG
MSTART EQU 1000H ; START OF RLOG AREA
POINT: DS 2 ; TEMPORARY POINTER FOR WRITE TO DISK
MPOINT: DS 2 ; POINTER FOR RLOG STORAGE
MEMEND: DS 2 ; POINTER TO END OF RLOG AREA
BUFSIZ EQU 20 ; CONSOLE READ BUFFER SIZE
CBUFF: DB BUFSIZ ; BUFFER MAX SIZE
DB 0 ; CURRENT SIZE
DS BUFSIZ ; CONSOLE BUFFER
TAB: DB 0 ; TAB COLUMN COUNTER
XDATA: DS 1 ; TEMPORY STORAGE FOR READ/WRITE DATA
WACCE: DB 3 ; WRITE ACCESS CODE DELETE OLD FILE
ACCE: DB 1 ; READ ACCESS CODE
FTAB: DB 0,0,0,'R'
DS 33 ; FILE CONTROL BLOCK
DS 128 ; DATA BUFFER
DS 40 ; STACK SPACE
STACK:
PROCEDURE START
LXI SP,STACK
LHLD BDOS+1
DCR H
SHLD MEMEND ; END OF RECEIVE FILE BUFFER
LXI H,MSTART ; START OF RECEIVE FILE BUFFER
SHLD MPOINT ; RECEIVE FILE POINTER
CALL SMODE ; INITIALIZE MODEM INTERFACE
XRA A
STA QUIT ; QUIT = FALSE
STA RLOG ; SAVE = FALSE
CMA
STA ULTOG ; UPPER/LOWER SWITCH = TRUE
REPEAT
CALL RCVCHK ; CHECK FOR RECEIVE DATA
CALL CONCHK ; CHECK FOR CONSOLE DATA
LDA QUIT
ORA A
UNTIL ( NOT ZERO ) ; QUIT = TRUE
JMP EXIT ; RETURN TO CP/M
PROCEDURE RCVCHK
CALL MISTAT ; GET RECEIVE STATUS
IF ( NOT ZERO ) ; DATA READY
CALL MI ; GET DATA
MOV E,A
PUSH D
CALL CO ; OUTPUT TO CONSOLE
POP D
LDA RLOG
ORA A
IF ( NOT ZERO ) ; RLOG = TRUE
LHLD MPOINT
CALL MEND ; CHECK FOR POINTER AT END OF MEMORY
WHEN ( NO CARRY ) ; NOT AT END
MOV M,E
INX H
SHLD MPOINT
FIN
ELSE
MVI E,'@'
MOV M,E
CALL CO ; WARNING FULL
FIN
FIN
FIN
RET
PROCEDURE MEND
LDA MEMEND+1
SUB H
RC ; RETURN IF FULL
RNZ ; RETURN IF NOT FULL CY=0
LDA MEMEND
SUB L ; CY=1 IF FULL
RET
PROCEDURE CONCHK
CALL CISTAT ; GET CONSOLE STATUS
IF ( NOT ZERO ) ; DATA READY
CALL CI ; GET DATA
CPI 'E'-40H ; CONTROL E FOR COMMAND MODE
WHEN ( ZERO ) CALL CCP
ELSE
MOV E,A
CALL MO ; SEND CHARACTER
FIN
FIN
RET
PROCEDURE CCP
CALL CRLF ; NEW LINE
MVI E,':'
CALL CO ; PROMPT TO CONSOLE
CALL CIE ; GET COMMAND CHARACTER FROM CONSOLE
PUSH PSW
CALL BLK ; SPACE TO CONSOLE
POP PSW
SELECT
( 'B' )
CALL BRK ; SEND BREAK TONE
MVI A,10
CALL DELAY ; DELAY FOR 1 SEC
CALL SMODE ; INITIALIZE MODEM INTERFACE
FIN
( 'E' | 'E'-40H )
MVI E,5
CALL MO ; SEND CONTROL E
FIN
( 'H' )
LXI H,HELP
CALL MSG ; DISPLAY COMMAND LIST
FIN
( 'Q' )
MVI A,0FFH
STA QUIT ; QUIT = TRUE
FIN
( 'O' ) CALL ROPEN
( 'L' )
LDA RFOPEN
ORA A
IF ( NOT ZERO ) ; RECEIVE FILE OPEN
MVI A,0FFH
STA RLOG ; RLOG = TRUE
FIN
FIN
( 'N' )
XRA A
STA RLOG ; RLOG = FALSE
FIN
( 'C' ) CALL RCLOSE
( 'S' ) CALL SEND
( 'U' )
LDA ULTOG
CMA
STA ULTOG
FIN
( OTHERWISE )
MVI E,'?'
CALL CO
FIN
FIN
CALL CRLF
RET
;
; -------------------------------------------- HELP
;
HELP: DB 0DH,0AH,9,'B',9,'SEND BREAK TONE'
DB 0DH,0AH,9,'E',9,'SEND CONTROL E'
DB 0DH,0AH,9,'H',9,'HELP - LIST COMMANDS'
DB 0DH,0AH,9,'Q',9,'QUIT - RETURN TO CP/M'
DB 0DH,0AH,9,'O',9,'OPEN RECEIVE FILE'
DB 0DH,0AH,9,'L',9,'LOG RECEIVE DATA'
DB 0DH,0AH,9,'N',9,'NO LOG RECEIVE DATA'
DB 0DH,0AH,9,'C',9,'CLOSE RECEIVE FILE'
DB 0DH,0AH,9,'S',9,'SEND FILE'
DB 0DH,0AH,9,'U',9,'UPPER/LOWER CASE SWITCH'
DB 0 ; END OF MESSAGE
PROCEDURE SEND
LXI B,ACCE
CALL OPENF ; OPEN FILE FOR READ
IF ( ZERO ) ; NO OPEN ERROR
XRA A
STA SABORT ; SEND ABORT = FALSE
STA TAB ; INIT TAB COLUMN COUNTER
CALL SREAD ; READ FIRST CHARACTER FROM FILE
WHILE ( ZERO ) ; NO ERROR OR EOF
LDA XDATA ; GET CHARACTER
ANI 7FH
MOV E,A
SELECT
( 9 ) CALL ETAB ; EXPAND TAB
( 0DH ) ; CARRIAGE RETURN
CALL MOUT ; SEND CARRIAGE RETURN
XRA A
STA TAB ; INITIAL TAB COLUMN COUNTER
FIN
( 0 | 0AH | 7FH ) NOP ; IGNORE NULL, LF, DELETE
( OTHERWISE )
CPI 20H
IF ( CARRY ) ; CONTROL CHARACTER
PUSH PSW
MVI E,'^'
CALL MOUT ; SEND UP ARROW
POP PSW
ADI 40H ; CHANGE TO NON CONTROL
MOV E,A
FIN
CALL MOUT ; SEND CHARACTER
CALL CTAB ; TAKE CARE OF COUNTER FOR TAB EXPANSION
FIN
FIN
CALL SREAD ; READ NEXT CHARACTER FROM FILE
FIN
MVI A,10
CALL DELAY ; DELAY FOR 1 SECOND
LXI H,FTAB
CALL DCLOSE ; CLOSE FILE
MVI E,1AH
CALL MOUT ; SEND CONTROL Z
FIN
RET
PROCEDURE ETAB
LDA TAB
DCR A
ANI 7
INR A
MOV D,A
MVI E,' '
REPEAT
PUSH D
CALL MOUT ; SEND SPACE
POP D
DCR D
UNTIL ( ZERO )
XRA A
STA TAB
RET
PROCEDURE CTAB
LDA TAB
DCR A
ANI 7
STA TAB
RET
PROCEDURE SREAD
LDA SABORT
ORA A
IF ( ZERO ) ; NOT ABORT
LXI H,FTAB
LXI D,XDATA
CALL BREAD ; READ NEXT BYTE
ORA A
IF ( ZERO ) ; NO ERROR OR EOF
LDA XDATA
SUI 'Z'-40H ; CONTROL Z
SUI 1
SBB A
FIN
FIN
RET
PROCEDURE MOUT
PUSH D
REPEAT
CALL KCHECK ; CHECK KEYBOARD FOR ABORT OR LOCAL PAUSE
CALL HCHECK ; CHECK HOST FOR DATA OR PAUSE (X-OFF)
CALL MOSTAT ; CHECK MODEM OUT STATUS
UNTIL ( NOT ZERO ) ; SEND READY
POP D
CALL MO ; SEND THE CHARACTER
RET
PROCEDURE KCHECK
CALL CISTAT ; CHECK CONSOLE STATUS
IF ( NOT ZERO ) ; DATA READY
CALL CI ; GET KEYBOARD CHARACTER
SELECT
( 1AH )
MVI A,0FFH
STA SABORT ; SEND ABORT = TRUE
FIN
( 'S'-40H )
REPEAT
CALL HCHECK ; CHECK FOR INCOMING DATA
CALL CISTAT ; CHECK CONSOLE STATUS
UNTIL ( NOT ZERO ) ; ANY KEY TO CONTINUE
CALL CI ; GET CHARACTER AND IGNORE
FIN
FIN
FIN
RET
PROCEDURE HCHECK
CALL MISTAT ; CHECK RECEIVE STATUS
IF ( NOT ZERO ) ; DATA READY
CALL MI ; GET CHARACTER
CPI 'S'-40H ; X-OFF
WHEN ( ZERO )
CALL MI ; WAIT FOR ANOTHER RECEIVE CHARACTER
CPI 'Q'-40H ; X-ON
WHILE ( NOT ZERO ) ; NOT X-ON
MOV E,A
CALL CO ; DISPLAY CHARACTER
CALL MI ; WAIT FOR NEXT CHARACTER
CPI 'Q'-40H ; X-ON
FIN
FIN
ELSE
MOV E,A
CALL CO ; DISPLAY CHARACTER
FIN
FIN
RET
PROCEDURE ROPEN
LXI B,WACCE
CALL OPENF ; OPEN FILE FOR WRITE
RNZ ; RETURN IF ERROR
MVI A,0FFH
STA RFOPEN ; RECEIVE FILE OPEN = TRUE
STA RLOG ; RLOG = TRUE
LXI H,MSTART ; START OF RECEIVE FILE BUFFER
SHLD MPOINT ; RECEIVE FILE BUFFER POINTER
RET
PROCEDURE RCLOSE
LXI H,MSTART
SHLD POINT
LDA RFOPEN
ORA A
RZ ; RETURN IF RECEIVE FILE NOT OPEN
LOOP
LHLD MPOINT
XCHG ; DE = MPOINT end of received data storage
LHLD POINT ; HL = POINT temp pointer for writing to disk
MOV A,L
SUB E
MOV A,H
SBB D
BREAK IF ( NO CARRY ) ; POINT >= MPOINT done
MOV A,M
STA XDATA
INX H
SHLD POINT
LXI H,FTAB
LXI D,XDATA
CALL BWRITE ; WRITE NEXT BYTE TO DISK
ORA A
BREAK IF ( NOT ZERO ) ; WRITE ERROR
FIN
LXI H,FTAB
CALL DCLOSE
XRA A
STA RFOPEN ; RECEIVE FILE OPEN = FALSE
STA RLOG ; RLOG = FALSE
RET
;
;
END-OF-FILE