]>
wirehaze git hosting - MS-DOS.git/blob - v4.0/src/CMD/FC/GETL.ASM
2 ; blindingly fast assembly help for Z
27 ; getlpos returns current seek position in file
29 cProc getlpos
,<PUBLIC>
31 mov dx,word ptr bufpos
+2
32 mov ax,word ptr bufpos
36 ; getlinit (buf, len, fh) initializes the getl routine for buffer buf and fh fh
38 cProc getlinit
,<PUBLIC>
44 mov word ptr bufstart
,ax
46 mov word ptr bufstart
+2,ax
53 mov word ptr bufpos
+2,0
58 ; getl (dst, len) returns TRUE if a line was read.
60 cProc getl
,<PUBLIC>,<DS,SI,DI>
68 mov ds,word ptr bufstart
+2
74 dec dx ; room for NUL at end
77 movc: lodsb ; get a byte
78 cmp al,13 ; is it special?
79 jbe spec
; yes, go handle special case
80 stoc: stosb ; put character in buffer
81 dec dx ; one less space in buffer
82 endl: loopnz movc
; go back for more characters
83 jnz fill
; no more characters => go fill buffer
84 ; cx = 0, buflen = length moved
88 mov bufsrc
,si ; length moved = buflen - cx
91 add word ptr bufpos
,cx
92 adc word ptr bufpos
+2,0
97 mov cx, buflen
; add length moved to bufpos
98 add word ptr bufpos
,cx
99 adc word ptr bufpos
+2,0
101 mov dx,word ptr bufstart
112 ; if we've stored chars then terminate line else return with 0
118 mov fGetlCR
,-1 ; indicate we've seen a CR