]>
wirehaze git hosting - MS-DOS.git/blob - v2.0/source/EDLPROC.ASM
8 roprot equ FALSE
;set to TRUE if protection to r/o files
12 Comand_Line_Length equ
128
13 quote_char equ 16h
;quote character = ^V
23 SUBTTL Contants
and Data areas
32 CONST
SEGMENT PUBLIC WORD
34 EXTRN TXT1
:BYTE,TXT2
:BYTE,FUDGE
:BYTE,HARDCH
:DWORD,USERDIR
:BYTE
38 DATA SEGMENT PUBLIC WORD
40 EXTRN OLDLEN
:WORD,OLDDAT
:BYTE,SRCHFLG
:BYTE,COMLINE
:WORD
41 EXTRN PARAM1
:WORD,PARAM2
:WORD,NEWLEN
:WORD,SRCHMOD
:BYTE
42 EXTRN CURRENT
:WORD,POINTER
:WORD,START
:BYTE,ENDTXT
:WORD
43 EXTRN USER_DRIVE
:BYTE,LSTNUM
:WORD,NUMPOS
:WORD,LSTFND
:WORD
48 DG GROUP
CODE,CONST
,DATA
52 ASSUME
CS:DG
,DS:DG
,SS:DG
,ES:DG
54 PUBLIC REST_DIR
,KILL_BL
,INT_24
,SCANLN
,FINDLIN
,SHOWNUM
55 PUBLIC FNDFIRST
,FNDNEXT
,CRLF
,LF
,OUT,UNQUOTE
68 MOV DI,1+OFFSET DG
:TXT1
69 mov byte ptr[olddat
],1 ;replace with old value if none new
71 OR AL,AL ;Reset zero flag in case CX is zero
73 cmp al,1
ah ;terminated with a ^Z ?
75 mov byte ptr[olddat
],0 ;do not replace with old value
81 CMP BYTE PTR [SRCHFLG
],0
87 MOV DI,1+OFFSET DG
:TXT2
89 CMP BYTE PTR [SRCHFLG
],0
101 cmp byte ptr[srchmod
],0
103 mov bx,1 ;start from line number 1
107 INC BX ;Default search and replace to current+1
117 SBB BX,-1 ;Decrement everything except zero
132 ; [TXT1+1] has string to search for
133 ; [OLDLEN] has length of the string
134 ; [LSTFND] has starting position of search in text buffer
135 ; [LSTNUM] has line number which has [LSTFND]
136 ; [SRCHCNT] has length to be searched
137 ; [NUMPOS] has beginning of line which has [LSTFND]
139 ; Zero flag set if match found
140 ; [LSTFND],[LSTNUM],[SRCHCNT] updated for continuing the search
141 ; [NUMPOS] has beginning of line in which match was made
147 OR DI,DI ;Clear zero flag in case CX=0
151 MOV BX,DI ;Save search position
154 MOV SI,2 + OFFSET DG
:TXT1
155 CMP AL,AL ;Set zero flag in case CX=0
157 dec si ;Want to look at the first character again
191 ;Determine line number of match
207 ; SI points into command line buffer
208 ; DI points to result buffer
210 ; Moves [SI] to [DI] until ctrl-Z (1AH) or
211 ; RETURN (0DH) is found. Termination char not moved.
213 ; AL = Termination character
214 ; CX = No of characters moved.
215 ; SI points one past termination character
216 ; DI points to next free location
222 ;-----------------------------------------------------------------------
223 cmp al,quote_char
;a quote character?
224 jne sj101
;no, skip....
225 lodsb ;yes, get quoted character
228 ;-----------------------------------------------------------------------
244 MOV BYTE PTR [DI-1],cl
249 cmp byte ptr[olddat
],1 ;replace with old text?
251 mov byte ptr[di-1],cl ;zero text buffer char count
255 MOV CL,BYTE PTR [DI-1]
263 ; BX = Line number to be located in buffer (0 means last line)
265 ; DX = Actual line found
266 ; DI = Pointer to start of line DX
267 ; Zero set if BX = DX
268 ; AL,CX destroyed. No other registers affected.
278 MOV DI,OFFSET DG
:START
286 OR AL,AL ;Clear zero flag
299 ; BX = Line number to be displayed
301 ; Displays line number on terminal in 8-character
302 ; format, suppressing leading zeros.
303 ; AX, CX, DX destroyed. No other registers affected.
323 ; BX = Binary number to be displayed
325 ; Ouputs binary number. Five digits with leading
326 ; zero suppression. Zero prints 5 blanks.
375 MOV AH,STD_CON_OUTPUT
382 ;-----------------------------------------------------------------------;
383 ; Will scan buffer given pointed to by SI and get rid of quote
384 ;characters, compressing the line and adjusting the length at the
385 ;begining of the line.
386 ; Preserves al registers except flags and AX .
393 mov cl,[si-1] ;length of buffer
398 jcxz unq_done
;no more chars in the buffer, exit
399 repnz scasb ;search for quote character
400 jnz unq_done
;none found, exit
401 push cx ;save chars left in buffer
402 push di ;save pointer to quoted character
403 push ax ;save quote character
404 mov al,byte ptr[di] ;get quoted character
407 pop ax ;restore quote character
409 dec di ;points to the quote character
410 inc cx ;include the carriage return also
411 rep movsb ;compact line
412 pop di ;now points to after quoted character
414 jcxz sj13
;if quote char was last of line do not adjust
415 dec cx ;one less char left in the buffer
417 dec byte ptr[si-1] ;one less character in total buffer count also
428 ;-----------------------------------------------------------------------;
429 ; Convert the character in AL to the corresponding control
430 ; character. AL has to be between @ and _ to be converted. That is,
431 ; it has to be a capital letter. All other letters are left unchanged.
444 ;---- Kill spaces in buffer --------------------------------------------;
446 lodsb ;get rid of blanks
452 ;----- Restore INT 24 vector and old current directory -----------------;
457 mov ax,(set_interrupt_vector
shl 8) or 24h
463 mov dx,offset dg
:userdir
;restore directory
466 mov dl,[user_drive
] ;restore old current drive
467 mov ah,set_default_drive
473 ;----- INT 24 Processing -----------------------------------------------;
475 int_24_retaddr dw offset dg
:int_24_back
478 assume
ds:nothing
,es:nothing
,ss:nothing
482 push [int_24_retaddr
]
483 push word ptr [hardch
+2]
484 push word ptr [hardch
]
525 ;-----------------------------------------------------------------------;