wok diff linld/stuff/src/CRTL.ASM @ rev 23797

linld: fix argstr
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat May 23 18:02:24 2020 +0000 (2020-05-23)
parents 72e35f3c7aa1
children d70f7cc6e3ac
line diff
     1.1 --- a/linld/stuff/src/CRTL.ASM	Fri Jan 24 12:15:02 2020 +0100
     1.2 +++ b/linld/stuff/src/CRTL.ASM	Sat May 23 18:02:24 2020 +0000
     1.3 @@ -31,26 +31,7 @@
     1.4          segment _BSS byte public use16 'BSS'
     1.5  
     1.6  		ifdef EXTRA
     1.7 -;typedef unsigned dirsizetype;
     1.8 -struc		isostate		; struct isostate {
     1.9 -curpos		dw	?		; 0	unsigned curpos;
    1.10 -filename2open	dw	?		; 2	char *filename2open;
    1.11 -fd		dw	?		; 4	int fd;
    1.12 -filemod		dw	?		; 6	unsigned short filemod;
    1.13 -fileofs		dd	?		; 8	unsigned long fileofs;
    1.14 -filesize	dd	?		;12	unsigned long filesize;
    1.15 -filename	dw	?		;16	char *filename;
    1.16 -curdirsize	dw	?		;18	dirsizetype curdirsize;
    1.17 -dirsize		dw	?		;20	dirsizetype dirsize;
    1.18 -curdirofs	dd	?		;22	unsigned long curdirofs;
    1.19 -dirofs		dd	?		;26	unsigned long dirofs;
    1.20 -;overlap
    1.21 -entrysize	dw	?		;30	int entrysize;
    1.22 -tmp		dw	?		;32	const char *tmp;
    1.23 -c		db	?		;34	char c;
    1.24 -_64bits		db	?		;35	char _64bits;
    1.25 -buffer		db	?		;36	char buffer[2048+512];
    1.26 -ends		isostate		; } isostate;
    1.27 +		include	"isostate.inc"
    1.28  		public	_isostate
    1.29  _isostate	isostate	<?>
    1.30  		org	$-7
    1.31 @@ -59,7 +40,7 @@
    1.32  filecnt		db	?		; in fact 0 minus file count...
    1.33  nextfilename	dw	?
    1.34  	ifdef	EXTRA
    1.35 -ultoabuf	db	12	dup (?)
    1.36 +utoabuf		db	6	dup (?)
    1.37  	endif
    1.38  
    1.39          ends    _BSS
    1.40 @@ -111,6 +92,8 @@
    1.41  		xchg	ax,dx
    1.42  strend:
    1.43                  pop	si
    1.44 +	global	@ret:near
    1.45 +@ret:
    1.46  		ret
    1.47  
    1.48          endp	@strcatb$qpxzct1
    1.49 @@ -185,6 +168,10 @@
    1.50          proc    @open$qpxzc near
    1.51  
    1.52  open:						; open(bx)
    1.53 +	ifdef	ISOHOOK
    1.54 +		extrn	iso_open_hack:word
    1.55 +		call	[iso_open_hack]		; or ret
    1.56 +	endif
    1.57  	ifdef	LONG_FILENAME
    1.58  		mov	ax,716Ch
    1.59  		push	bx si
    1.60 @@ -221,6 +208,10 @@
    1.61  
    1.62          global  close:near			; close(ax)
    1.63  close:
    1.64 +	ifdef	ISOHOOK
    1.65 +		extrn	iso_close_hack:word
    1.66 +		call	[iso_close_hack]	; or ret
    1.67 +	endif
    1.68  		mov	bh,3Eh
    1.69  dosbx:
    1.70  		xchg	ax,bx
    1.71 @@ -263,6 +254,10 @@
    1.72  @read$cxdxbx:
    1.73                  mov	ah,3Fh
    1.74  		endif
    1.75 +	ifdef	ISOHOOK
    1.76 +		extrn	iso_read_hack:word
    1.77 +		call	[iso_read_hack]		; or ret
    1.78 +	endif
    1.79                  jcxz	fail
    1.80  dos:
    1.81                  int	21h
    1.82 @@ -302,6 +297,10 @@
    1.83  lseekword:
    1.84  		sbb	cx,cx
    1.85  lseekset:
    1.86 +	ifdef	ISOHOOK
    1.87 +		extrn	iso_lseek_hack:word
    1.88 +		call	[iso_lseek_hack]	; or ret
    1.89 +	endif
    1.90  		mov	bh,42h			; bx=fd cx:dx=offset al=whence
    1.91  		jmp	dosbx
    1.92  
    1.93 @@ -394,13 +393,8 @@
    1.94  		xchg	ax,di			; vars => di
    1.95  		dec	bx
    1.96  @@testalt:
    1.97 -		mov	al,-1
    1.98  		sub	di,dx
    1.99 -@@test:
   1.100 -		cmp	al,'='
   1.101 -		je	@@found
   1.102 -		cmp	al,0			; eos, si=next argv
   1.103 -		je	@@found
   1.104 +@@loop:
   1.105  		mov	si,cx			; s
   1.106  		add	di,dx
   1.107  @@match:
   1.108 @@ -416,15 +410,29 @@
   1.109  @@notopt:
   1.110  		ifdef	EXTRA
   1.111  		cmp	[byte bx],'/'
   1.112 -		je	@@testalt
   1.113 +		jne	@@notalt
   1.114 +		or	al,al			; 1st loop ?
   1.115 +		js	@@testalt
   1.116 +@@notalt:
   1.117  		endif
   1.118  		cmp	[byte bx],'|'
   1.119  		je	@@test
   1.120 +		cmp	[byte bx],0
   1.121 +		je	@@test
   1.122 +		mov	al,-1
   1.123  		inc	bx
   1.124 -		cmp	[byte bx-1],0
   1.125 -		jne	@@notopt
   1.126 +		jmp	@@notopt
   1.127 +@@test:
   1.128 +		or	al,al			; 1st loop ?
   1.129 +		jns	@@testal
   1.130 +		cmp	[byte bx],0
   1.131 +		jne	@@loop
   1.132 +@@testal:
   1.133 +		cmp	al,'='
   1.134 +		;je	@@found
   1.135 +		;cmp	al,0			; eos, si=next argv
   1.136  		stc
   1.137 -		jmp	@@nokeyword
   1.138 +		jne	@@nokeyword
   1.139  @@found:
   1.140  		mov	[di],si
   1.141  		dec	dx
   1.142 @@ -573,7 +581,7 @@
   1.143  		jz	@@eos
   1.144  		or	al,al
   1.145  		jnz	@@scan
   1.146 -		dec	cx
   1.147 +		dec	cx			; blocked to eos
   1.148  @@eos:
   1.149  		mov	[(image_himem di).state],cx
   1.150  		dec	si
   1.151 @@ -1300,34 +1308,25 @@
   1.152  		ifdef	EXTRA
   1.153                  p8086
   1.154  ;***************************************************************
   1.155 -;_fastcall char *ultoa(axdx:unsigned long n);
   1.156 +;_fastcall char *utoa(ax:unsigned n);
   1.157  ;***************************************************************
   1.158 -        global  @ultoa$qul:near
   1.159 -        proc    @ultoa$qul near
   1.160 +        global  @utoa$qui:near
   1.161 +        proc    @utoa$qui near
   1.162  
   1.163 -		xchg	ax,cx
   1.164 -		xchg	ax,dx		; AX:CX = n
   1.165 -		push	si
   1.166 -		mov	si,10
   1.167 -		mov	bx,offset ultoabuf+11
   1.168 +		mov	cx,10
   1.169 +		mov	bx,offset utoabuf+5
   1.170  @@loop:
   1.171  		dec	bx
   1.172  		xor	dx,dx
   1.173 -		div	si		; DX:AX = 0000:hi(n)
   1.174 -		xchg	ax,cx		; CX = hi(n)/10
   1.175 -		div	si		; DX:AX = hi(n)%10:lo(n)
   1.176 -		xchg	ax,cx		; CX = lo(n/10)
   1.177 -					; AX = hi(n)/10 = hi(n/10)
   1.178 +		div	cx		; DX:AX = n%10:n/10
   1.179  		mov	[byte bx],'0'
   1.180  		add	[bx],dl		; DL = n%10
   1.181 -		mov	dx,ax
   1.182 -		or	dx,cx
   1.183 +		or	ax,ax
   1.184  		jnz	@@loop
   1.185  		xchg	ax,bx
   1.186 -		pop	si
   1.187  		ret
   1.188  
   1.189 -        endp    @ultoa$qul
   1.190 +        endp    @utoa$qui
   1.191  
   1.192  
   1.193  ;***************************************************************