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
/
TERMSUP.ASM
< prev
next >
Wrap
Assembly Source File
|
1984-04-29
|
3KB
|
220 lines
SREV EQU 20H ; 06/14/79 R. CURTISS DERIVED FROM NORDATA1
;
;
; OPEN FILE FOR READ OR WRITE
;
OPENF: PUSH B ; SAVE ACCESS CODE
MVI C,10
LXI D,CBUFF
CALL BDOS ; GET FILE NAME FROM CONSOLE
POP B
LXI H,CBUFF+1 ; CHAR COUNT POINTER
MOV E,M
MVI D,0
DAD D
INX H
MVI M,0 ; MAKE SURE DELIMITER AT END OF NAME
LXI H,FTAB
LXI D,CBUFF+2
CALL DOPEN
RET
;
;
;
CRLF: MVI E,0DH
CALL CO
MVI E,0AH
CALL CO
RET
;
;
;
BLK: MVI E,' '
JMP CO
;
;
BDOS EQU 0005H ; BDOS ENTRY POINT
KBD EQU 02H ; KEYBOARD PORT
SIO EQU 50H ; 2SIO BOARD ORIGIN
;
;
; OUTPUT TO CONSOLE
;
CO: MVI C,2
CALL BDOS
RET
;
;
; OUTPUT (E) TO MODEM
;
MO: IN SIO
ANI 2 ; TRANSMIT READY BIT
JZ MO
MOV A,E
OUT SIO+1
RET
;
;
; CHECK RECEIVE STATUS 1=READY 0=NOT READY
;
MISTAT: IN SIO
ANI 1 ; RECEIVER READY STATUS BIT
RET
;
;
; CHECK SEND READY STATUS
;
MOSTAT: IN SIO
ANI 2
RET
;
;
; CHECK CONSOLE READY STATUS 1=READY 0=NOT READY
;
CISTAT: IN KBD
ANI 2
RZ
ORI 0FFH
RET
;
;
; GET DATA FROM MODEM
;
MI: IN SIO ; GET STATUS
ANI 1
JZ MI
IN SIO+1
RET
;
;
; GET DATA FROM CONSOLE
;
CIE: CALL CI
MOV E,A
PUSH PSW
CALL CO ; ECHO INPUT
POP PSW
RET
CI: CALL CISTAT ; GET KEYBOARD STATUS
JZ CI ; JUMP IF NO DATA READY
IN KBD+1 ; GET KBD DATA
ANI 7FH
PUSH PSW
LDA ULTOG ; UPPER/LOWER CASE TOGGLE
ORA A
JNZ CIX ; JUMP IF CASE SWITCH REQUIRED
POP PSW
RET
CIX: POP PSW
CPI 'A'
RC ; RETURN IF < 'A'
CPI 'Z'+1
JC KINV ; JUMP IF IN RANGE 'A'-'Z'
CPI 'A'+20H
RC ; RETURN IF < LOWER CASE 'A'
CPI 'Z'+21H
RNC ; RETURN IF > LOWER CASE 'Z'
KINV: XRI 20H ; FLIP CASE BIT
RET
;
;
; CONTROL BYTE FOR SIO
; X XX XXX XX
; 01 /16
; 11 MASTER RESET
; 100 8 BITS, 2 STOP, NO PARITY
; 00 /RTS LOW, XMIT INT. DISABLE
; 11 /RTS HIGH, BREAK LEVEL TRANSMIT
; 0 RCV. INTERRUPT DISABLE
;
;
; TRANSMIT BREAK LEVEL
;
BRK: MVI A,71H
OUT SIO
RET
;
;
; INITIALIZE SIO FOR NORMAL OPERATION
;
SMODE: MVI A,03H
OUT SIO ; RESET
MVI A,11H ; NORMAL OPERATION
OUT SIO
RET
;
;
; DELAY 100*(A) MILLESECONDS
;
DELAY: LXI B,29B4H ; Z80 VALUE
D1: DCX B
INR B
DCR B
JNZ D1
DCR A
JNZ DELAY
RET
;
;
; TYPE MESSAGE WITH TABS EXPANDED
;
MSG: MOV A,M ; GET NEXT CHARACTER OF MESSAGE
ORA A
RZ ; RETURN IF END OF MESSAGE (NULL)
PUSH H
MOV E,A
CALL MSG1
POP H
INX H
JMP MSG
MSG1: LDA TAB ; TAB COLUMN COUNTER
DCR A
ANI 7
STA TAB
MOV B,A
MOV A,E
CPI 'I'-40H
JZ MSG3 ; JUMP IF TAB
CPI 0DH
JNZ MSG2 ; JUMP IF NOT CARRIAGE RETURN
CALL CO ; OUTPUT CARRIAGE RETURN
JMP MSG5
MSG2: CALL CO ; OUTPUT CHARACTER
RET
MSG3: INR B ; TAB COUNT
MSG4: PUSH B
MVI E,' '
CALL CO
POP B
DCR B
JNZ MSG4
MSG5: XRA A
STA TAB ; RESET TAB COLUMN COUNT
RET
;
;