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
/
TERM
/
SPLTVIO.LBR
/
SPLTVIO.LQB
/
SPLTVIO.LIB
Wrap
Text File
|
2000-06-30
|
4KB
|
176 lines
; THIS ROUTINE IS A VIO DRIVER WHICH WILL ALLOW THE
; THE VIO SCREEN TO BE BROKEN UP INTO "SUB-SCREENS".
; A SUB-SCREEN CAN BE FROM 2 TO 24 LINES AND THERE
; CAN BE ANY NUMBER OF SUB-SCREENS UP TO A TOTAL OF
; OF 24 LINES. THIS ROUTINE OPERATES ON "PARAMETER
; PACKETS". THEY ARE CODED WITH THE INFORMATION RE-
; QUIRED BY THE ROUTINE TO OPERATE ON THE SUB-SCREENS.
; THE PACKET (10 BYTES) IS CODED AS FOLLOWS:
;
; DW (BEGINNING ADDR. OF MEM. FOR THIS SUB-SCREEN)
; DW (END ADDR. + 1 OF MEM. FOR THIS SUB-SCREEN)
; DW (NUMBER OF CHARS. IN THIS SUB-SCREEN)
; DB (NUMBER OF LINES IN THIS SUB-SCREEN)
; DB (L. S. BYTE ADDR. OF LAST LINE OF THIS S.C)
; DS 2 ;CURSOR POINTER STORAGE
;
VIO: PUSH PSW
PUSH H
PUSH D
PUSH B
SHLD PKTPTR ;SAVE POINTER TO PACKET
VIODVR: ANI 7FH ;GET RID OF HIGH BIT
CPI 7FH ;RUBOUT?
JZ DONE1 ;YES
; LOAD THE CURSOR POINTER
; H&L POINTS TO THE PARAMETER PACKET
LXI D,8 ;INDEX BY 8
DAD D
SHLD STR1 ;SAVE THE ADDR.
MOV E,M ;GET CURSOR POINTER
INX H
MOV D,M
XCHG ;POINTER TO H&L
CPI 0DH ;CARRIAGE RETURN?
JZ CRET ;YES
CPI 5FH ;BACKSPACE?
JZ BKSP ;YES
CPI 20H ;CONTROL CHAR.?
JC DONE1 ;YES
VIO1: MOV M,A ;PUT CHAR. ON SCREEN
INX H
PUSH H
LHLD STR1 ;GET PACKET POINTER
DCX H ;MAKE INDEX 7
MOV A,M ;GET BEGINNING OF LINE CONSTANT
ADI 80 ;MAKE END OF LINE
POP H
CMP L ;END OF LINE?
JZ SCROLL
JMP DONE
CRET: MVI M,' ' ;DELETE CARRIAGE RETURN
SCROLL: LXI H,0
DAD SP
SHLD SPSAV ;SAVE S. P.
; GET NUMBER OF LINES
LHLD PKTPTR ;GET PACKET POINTER
LXI D,6 ;INDEX BY 6
DAD D
MOV A,M ;NUMBER OF LINES TO A
STA VCNTR ;SAVE IT
; SET UP MEM. POINTERS FOR THE SCROLL
LHLD PKTPTR ;GET PACKET POINTER
MOV E,M ;LOAD MEM. POINTER
INX H
MOV D,M
XCHG ;MEM. POINTER TO H&L
SHLD STR2 ;SAVE IT
LXI D,80 ;BUMP BY 80
DAD D
SPHL ;LOAD INTO SP
LHLD STR2 ;RESTORE H
SCRL1: MVI A,40 ;SET UP FOR 40 MINOR LOOPS
SCRL2: POP B ;SOURCE 2 BYTES TO B&C
MOV M,C ;STORE FIRST BYTE
INX H
MOV M,B ;STORE SECOND BYTE
INX H
DCR A ;DONE 40 TIMES?
JNZ SCRL2 ;NO
LDA VCNTR
DCR A ;DONE MAJOR LOOP VCNTR TIMES?
STA VCNTR
JNZ SCRL1 ;NO
LHLD SPSAV
SPHL ;RESTORE S. P.
CALL LNER1
JMP DONE
LNER1: LHLD PKTPTR ;GET PACKET POINTER
LXI D,2 ;INDEX BY 2
DAD D
MOV E,M ;MEM. END POINTER TO D&E
INX H
MOV D,M
XCHG ;PUT INTO H&L
MVI B,80 ;80 CHARS PER LINE
LNER: DCX H
MVI M,' '
DCR B
JNZ LNER
RET
BKSP: PUSH H ;SAVE H
LHLD PKTPTR ;GET PACKET POINTER
LXI D,7 ;INDEX BY 7
DAD D
MOV A,M ;GET BEG. OF LINE POINTER
POP H ;RESTORE H&L
CMP L ; ARE WE AT BEGINNING OF LINE?
JZ DONE1 ;YES
MVI M,' ' ;KILL CURSOR
DCX H ;BACKSPACE
JMP DONE
DONE: MVI M,7FH ;DISPLAY CURSOR
PUSH H ;SAVE CURSOR POINTER
LHLD STR1 ;GET PACKET POINTER
POP D ;CUR. POINTER TO D
MOV M,E ;SAVE CURPTR IN PACKET
INX H
MOV M,D
DONE1: POP B ;RESTORE REGS
POP D
POP H
POP PSW
RET
; THIS ROUTINE WILL ERASE A SUB-SCREEN AND INITIALLY SET UP THE
; CURSOR POINTER. UPON ENTRY H&L CONTAIN THE ADDRESS OF THE
; PACKET FOR A PARTICULAR SUB-SCREEN.
ERASE: PUSH PSW
PUSH H
PUSH D
PUSH B
SHLD PKTPTR ;SAVE PACKET POINTER
; H&L HAVE PACKET POINTER
MOV E,M ;GET BEGINNING ADDR.
INX H
MOV D,M
PUSH D ;BEGINNING MEM. ADDR.
LHLD PKTPTR ;GET PACKET POINTER
LXI D,4 ;INDEX BY 4
DAD D
MOV C,M ;# OF CHARS. TO ERASE INTO B&C
INX H
MOV B,M
POP H ;RESTORE BEGINNING ADDR.
ERASE1: MVI M,' '
DCX B
INX H
MOV A,B
ORA C
JNZ ERASE1
; GET LAST LINE ADDRESS
ERASE2: LHLD PKTPTR ;GET PACKET POINTER
LXI D,2 ;INDEX BY 2
DAD D
MOV E,M ;GET ADDR. OF END
INX H
MOV D,M
XCHG
LXI D,-80
DAD D ;MAKE ADDR. OF LAST LINE
MVI M,7FH ;DISPLAY CURSOR
PUSH H
LHLD PKTPTR ;GET PACKET POINTER
LXI D,8 ;INDEX BY 8 MORE TO GET CUR. POINT.
DAD D
POP D ;GET VALUE BACK
MOV M,E ;PUT VALUE IN PACKET
INX H
MOV M,D
JMP DONE1 ;RETURN TO CALLER
PKTPTR: DS 2 ;STORAGE FOR PACKET POINTER
STR1: DS 2 ;TEMP. STORAGE
STR2: DS 2 ;TEMP. STORAGE
SPSAV: DS 2 ;STORE S. P. HERE
VCNTR: DS 1 ;TEMP. STORAGE
VIOMEM: EQU 0E800H