]>
wirehaze git hosting - MS-DOS.git/blob - v4.0/src/CMD/MORE/MORE.ASM
1 ;******************************************************************************
5 ; Modification History:
7 ; Version Author date comment
8 ; ------- ------ ---- -------
9 ; V4.0 RussW ;AN000; initial extended attr. support
11 ; V4.0 Bill L 9/17/87 ;AN001; DCR 201 - extended attr. enhancement
13 ; ;AN003; PTM 3860 - add CR-LF to make DOS3.3 compat.
14 ;******************************************************************************
24 ;------------------------------
25 ; EXTENDED ATTRIBUTE Equates
26 ;------------------------------
27 GetExtAttr equ
05702h ;AN000; ;Int 021h function call
28 SetExtAttr equ
05704h ;AN000; ;Int 021h function call
29 GetCPSW equ
03303h ;AN001;
31 EAISBINARY equ
02h ;AN001; ;ea_type
32 EASYSTEM equ 8000h
;AN001; ;ea_flags
41 INCLUDE MORE
.INC ;AN000; ;MORE strucs and equates
43 INCLUDE STRUC.INC ;AN000; ;Structured macros
44 INCLUDE SYSMSG
.INC ;AN000; ;Message retriever code
47 MSG_UTILNAME
<MORE
> ;AN000;
51 ASSUME
CS:CODE,DS:CODE,ES:CODE,SS:CODE
54 START: JMP START1
;AC000;
55 ;;; DB " The DOS 4.0 MORE Filter" ;AC003;
58 ;----------------------------------------
59 ;- STRUCTURE TO QUERY EXTENDED ATTRIBUTES
60 ;----------------------------------------
61 querylist
struc ;AN001; ;query general list
63 qea_type db EAISBINARY
;AN001;
64 qea_flags dw EASYSTEM
;AN001;
65 qea_namelen db ?
;AN001;
66 qea_name db " " ;AN001;
67 querylist ends
;AN001;
69 cp_qlist querylist
<1,EAISBINARY
,EASYSTEM
,2,"CP"> ;AN001; ;query code page attr.
71 cp_list
label word ;AN001; ;code page attr. get/set list
72 dw 1 ;AN001; ; # of list entries
73 db EAISBINARY
;AN001; ; ea type
74 dw EASYSTEM
;AN001; ; ea flags
75 db ?
;AN001; ; ea return code
76 db 2 ;AN001; ; ea name length
77 dw 2 ;AN001; ; ea value length
78 db "CP" ;AN001; ; ea name
79 cp dw ?
;AN001; ; ea value (code page)
80 cp_len equ
($ - cp_list
) ;AN001;
84 CALL SYSLOADMSG
;AN000;
86 CALL SYSDISPMSG
;AN000;
91 MOV AX,ANSI_GET
;AN000; ;prepare for device characteristics..
92 MOV BX,STDERR
;AN000; ;request.
93 MOV CX,GET_SUBFUNC
;AN000; ;get subfucntion..
94 LEA DX,ANSI_BUF
;AN000; ;point to buffer.
96 .IF NC
;AN000; ;if ANSI returns a no carry then..
97 LEA DI,ANSI_BUF
;AN000;
98 .IF <[DI].D_MODE
EQ TEXT_MODE
> ;AN000; ;if we are in a text mode then..
99 MOV AX,[DI].SCR_ROWS
;AN000; ;store the screen length...else..
100 MOV MAXROW
,AL ;AN000; ;default (25) is assumed.
107 XOR BX,BX ; DUP FILE HANDLE 0
110 MOV BP,AX ; Place new handle in BP
112 MOV AH,CLOSE
; CLOSE STANDARD IN
115 MOV BX,2 ; DUP STD ERR TO STANDARD IN
119 mov ax,GetCPSW
;AN001;
120 int 21h
;AN001; ;DL =0 (Not supported)
121 jc sloop
;AN001; ;no CPSW, skip cp setting
122 cmp dl,0 ;AN001; ;Is CPSW active ?
123 je sloop
;AN001; ;no, skip cp setting
125 mov ax,GetExtAttr
;AN000; ;Get Codepage of source
126 mov bx,bp ;AN000; ;Standard Input
127 mov si,offset cp_qlist
;AN001; ;code page query list
128 mov cx,cp_len
;AN001; ;length of code page list
129 mov di,offset cp_list
;AC001; ;Input buffer address
130 int 021h ;AN000; ;Pow !
131 jc SLOOP
;AN000; ;Do nothing if error
132 ;Ok, we got CP of source. Set tgt to match...
133 mov ax,SetExtAttr
;AN000; ;Set target codepage to that of source
134 mov bx,1 ;AN000; ;Standard Output
135 mov di,offset cp_list
;AC001; ;Input buffer address
136 int 021h ;AN000; ;Blam !
137 ;-------------------------------
139 MOV CX,CRLF_LEN
;AN003; ;display a newline
140 MOV DX,OFFSET CRLF
;AN003;
141 MOV BX,STDOUT
;AN003;
163 MOV BYTE PTR CURCOL
,1
173 CMP BYTE PTR CURCOL
,1
188 IF MSVER
; IBM CONTROL CHARACTER PRINT
194 CMP AL,7 ; ALL CHARACTERS PRINT BUT BELL
203 MOV BYTE PTR CURCOL
,1
207 MOV AH,STD_CON_OUTPUT
214 PUSH BP ;AN000; ;save file handle
215 PUSH SI ;AN000; ;save pointer
216 PUSH CX ;AN000; ;save count
217 MOV AX,MORE_MSG
;AN000; ;use message retriever..
218 MOV BX,STDERR
;AN000; ;to issue..
219 XOR CX,CX ;AN000; ;-- More --
220 MOV DL,NO_INPUT
;AN000;
221 MOV DH,UTILITY_MSG_CLASS
;AN000;
222 CALL SYSDISPMSG
;AN000;
224 MOV AH,STD_CON_INPUT_FLUSH
;WAIT FOR A KEY, NO ECHO
225 MOV AL,STD_CON_INPUT_NO_ECHO
;AC000; ;no echo
228 CMP AL,EXTENDED
;AN000; ;Check for extended key?
229 JNE NOT_EXTENDED
;AN000; ;continue
230 MOV AH,STD_CON_INPUT_NO_ECHO
;AN000; ;clear extended key
234 MOV CX,CRLF2_LEN
;AC003; ;place cursor..
235 MOV DX,OFFSET CRLF2
;AC003; ;..on new line.
236 MOV BX,STDERR
;AN000;
239 POP CX ;AN000; ;restore count
240 POP SI ;AN000; ;restore pointer
241 POP BP ;AN000; ;restore file handle
243 MOV BYTE PTR CURCOL
,1
244 MOV BYTE PTR CURROW
,1
257 ANSI_BUF ANSI_STR
<> ;AN000; ;buffer for IOCTL call
260 MSG_SERVICES
<MSGDATA
> ;AN000; ;message retriever code
261 MSG_SERVICES
<LOADmsg
,DISPLAYmsg
,NOCHECKSTDIN
> ;AN002;
262 MSG_SERVICES
<MORE
.CL1
> ;AN000;
263 MSG_SERVICES
<MORE
.CL2
> ;AN000;
264 MSG_SERVICES
<MORE
.CLA
> ;AN000;
267 CRLF
DB 13,10 ;AC000;
268 CRLF_LEN
DW $ - CRLF
;AC000;
269 CRLF2
DB 13,10,13,10 ;AN003;
270 CRLF2_LEN
DW $ - CRLF2
;AN003;