wok rev 24162

Up lzsa (1.3.9)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Fri Dec 24 12:31:52 2021 +0000 (2021-12-24)
parents be11ceb31dcf
children 1523c0330556
files linld/stuff/src/CRTL.ASM linld/stuff/src/JUMP.ASM linld/stuff/src/_BEG.ASM lzsa/receipt
line diff
     1.1 --- a/linld/stuff/src/CRTL.ASM	Wed Dec 22 13:43:13 2021 +0100
     1.2 +++ b/linld/stuff/src/CRTL.ASM	Fri Dec 24 12:31:52 2021 +0000
     1.3 @@ -47,13 +47,11 @@
     1.4  
     1.5          segment _TEXT byte public use16 'CODE'
     1.6  
     1.7 -		ifdef	VCPI
     1.8 -                p386
     1.9  ;***************************************************************
    1.10  
    1.11  struc   data_himem			;struct data_himem {
    1.12  first		dd	?		;   0  u32 first;	*must* be the first one	assume zero'd in bss
    1.13 -cacheidx	dw	?		;   4  int cacheidx;	quad *			assume zero'd in bss
    1.14 +cacheidx	dw	?		;   4  int cacheidx;	byte *			assume zero'd in bss
    1.15  pageidx		dw	?		;   6  int pageidx;	byte *			assume zero'd in bss
    1.16  cache		dd	1024 dup(?)	;   8  int cache;
    1.17  page		dd	1024 dup(?)	;4104  int page;
    1.18 @@ -61,270 +59,6 @@
    1.19  
    1.20  		include	"himem.inc"
    1.21  
    1.22 -;***************************************************************
    1.23 -;_fastcall u32* malloc_bufv_or_die(si:struct image_himem *m);
    1.24 -;***************************************************************
    1.25 -        global  @malloc_bufv_or_die$qp11image_himem:near
    1.26 -        proc    @malloc_bufv_or_die$qp11image_himem near
    1.27 -
    1.28 -                p386
    1.29 -		;mov	ecx,[(image_himem si).size]
    1.30 -		;shr	ecx,20			; pages index size = size >> 20
    1.31 -		;mov	ax,cx
    1.32 -		;add	ax,size data_himem-4096
    1.33 -		mov	ax,size data_himem
    1.34 -		call	malloc_or_die
    1.35 -		;mov	cx,4096+4095		; cnt = 1+(m->size+PAGE_MASK)/PAGE_SIZE;
    1.36 -		mov	ecx,4096+4095		; cnt = 1+(m->size+PAGE_MASK)/PAGE_SIZE;
    1.37 -		add	ecx,[(image_himem si).size]
    1.38 -		shr	ecx,12
    1.39 -		mov	[(image_himem si).bufv],ax	; update m->bufv
    1.40 -		xchg	ax,di
    1.41 -@@vcpi_alloc:
    1.42 -                mov     ax,0DE04h		; allocate a 4K page => EDX
    1.43 -                int     67h
    1.44 -		or	ah,ah
    1.45 -		mov	bx,offset vcpi_alloc_err
    1.46 -		jnz	jmpdie
    1.47 -; for (i = cnt-1; i >= 0; i--)
    1.48 -; if (edx < pm.fallback+pm.size) again
    1.49 -		mov	bx,offset _imgs.fallback+size image_himem
    1.50 -		mov	eax,[bx-2+6-size image_himem]	; pm.size
    1.51 -		add	eax,[bx-2+2-size image_himem]
    1.52 -		cmp	eax,edx		; pm.fallback+pm.size <= edx ?
    1.53 -		ja	@@vcpi_alloc
    1.54 -		mov	eax,ecx
    1.55 -		dec	eax
    1.56 -		shl	eax,12		; i*_4k
    1.57 -; if (edx >= initrd.fallback+i*_4k && edx < initrd.fallback+initrd.size) again
    1.58 -		add	eax,[bx-2+2]	; +initrd.fallback
    1.59 -		cmp	eax,edx		; initrd.fallback+i*_4k > edx ?
    1.60 -		ja	@@initrdok
    1.61 -		mov	eax,[bx-2+6]	; initrd.size
    1.62 -		add	eax,[bx-2+2]	; +initrd.fallback
    1.63 -		cmp	eax,edx		; initrd.fallback+initrd.size > edx ?
    1.64 -@@ja_vcpi_alloc:
    1.65 -		ja	@@vcpi_alloc
    1.66 -@@initrdok:
    1.67 -		cmp	[(data_himem di).first],0	; zero'd in bss
    1.68 -		jne	@@notfirst
    1.69 -		mov	[(data_himem di).first],edx
    1.70 -@@notfirst:
    1.71 -		mov	bx,[(data_himem di).cacheidx]	; zero'd in bss
    1.72 -		cmp	bh,4
    1.73 -		jae	@@nextpage
    1.74 -		shl	bx,2
    1.75 -		inc	[(data_himem di).cacheidx]
    1.76 -		mov	[(data_himem bx+di).cache],edx	; cache[cacheidx++] = edx
    1.77 -		loopd	@@vcpi_alloc
    1.78 -		mov	[(data_himem bx+di).cache],ecx	; last is 0
    1.79 -@@nextpage:
    1.80 -		and	[(data_himem di).cacheidx],0
    1.81 -		mov	bx,[(data_himem di).pageidx]	; zero'd in bss
    1.82 -		mov	[(data_himem bx+di).page],edx
    1.83 -		add	[(data_himem di).pageidx],4
    1.84 -		push	cx
    1.85 -		lea	cx,[(data_himem di).cache]
    1.86 -		ifdef	NO386
    1.87 -		push	edx
    1.88 -		pop	ax			; to es:ax
    1.89 -		pop	es
    1.90 -		endif
    1.91 -		call	storepage		; storepage(edx/es:ax,cx)	
    1.92 -		pop	cx
    1.93 -		or	ecx,ecx			; clear C
    1.94 -		jnz	@@ja_vcpi_alloc
    1.95 -
    1.96 -        endp    @malloc_bufv_or_die$qp11image_himem
    1.97 -
    1.98 -;***************************************************************
    1.99 -;_fastcall void reset_bufv(di:u32 *p);
   1.100 -;***************************************************************
   1.101 -        global  @reset_bufv$qpul:near
   1.102 -        proc    @reset_bufv$qpul near
   1.103 -
   1.104 -		mov	[curdata],di
   1.105 -		and	[dword (data_himem di).cacheidx],0	; and pageidx=0
   1.106 -		ret
   1.107 -
   1.108 -        endp    @reset_bufv$qpul
   1.109 -
   1.110 -;***************************************************************
   1.111 -;u32* di=prev_bufv();
   1.112 -;u32* di=prev_bufv();
   1.113 -;***************************************************************
   1.114 -        global  _prev_bufv:near
   1.115 -        global  _next_bufv:near
   1.116 -        proc    _prev_bufv near
   1.117 -
   1.118 -		stc
   1.119 -		db	73h			; jnc
   1.120 -_next_bufv:
   1.121 -		clc
   1.122 -		push	si
   1.123 -		mov	bx,0
   1.124 -		org	$-2
   1.125 -curdata		dw	?
   1.126 -		sbb	ax,ax
   1.127 -		cmc
   1.128 -		adc	ax,[(data_himem bx).cacheidx]	; -1/+1
   1.129 -		mov	si,3ffh
   1.130 -		and	si,ax
   1.131 -		mov	[(data_himem bx).cacheidx],si
   1.132 -		shl	si,2
   1.133 -		xor	ecx,ecx
   1.134 -		test	ax,0fc00h
   1.135 -		jz	@@gotpage		; FFFF / 0400
   1.136 -		xchg	al,ah			; FFFC / 0004
   1.137 -		and	al,0fch
   1.138 -		add	[(data_himem bx).pageidx],ax
   1.139 -		mov	di,[(data_himem bx).pageidx]
   1.140 -		lea	di,[(data_himem bx+di).page]
   1.141 -		mov	edx,ds
   1.142 -		shl	edx,4
   1.143 -		lea	cx,[(data_himem bx).cache]		
   1.144 -		add	edx,ecx
   1.145 -		mov	eax,[di]
   1.146 -		or	eax,eax
   1.147 -		jz	@@ret
   1.148 -		mov	cx,4096			; get page
   1.149 -		call	memcpy_imagez		; memcpy_imagez(edx,eax,ecx)
   1.150 -@@gotpage:
   1.151 -		lea	ax,[(data_himem bx+si).cache]		
   1.152 -		or	si,[(data_himem bx).pageidx]	; !pageidx && !cacheidx
   1.153 -		jnz	@@notfirst2
   1.154 -		xchg	ax,bx				; &first
   1.155 -@@notfirst2:
   1.156 -		xchg	ax,di
   1.157 -@@ret:
   1.158 -		pop	si
   1.159 -		ret
   1.160 -
   1.161 -        endp    _prev_bufv
   1.162 -		endif
   1.163 -
   1.164 -		ifdef	NO386
   1.165 -                p8086
   1.166 -		endif
   1.167 -
   1.168 -;***************************************************************
   1.169 -;_fastcall void memcpy_image_initrd(si:struct image_himem *m);
   1.170 -;_fastcall void memcpy_image_kernel(si:struct image_himem *m);
   1.171 -;_fastcall void memcpy_image(bx:struct image_himem *m);
   1.172 -;***************************************************************
   1.173 -	global	@memcpy_image_initrd$qv:near
   1.174 -@memcpy_image_initrd$qv:
   1.175 -		lea	bx,[si+size image_himem]
   1.176 -		db	0A9h			; test	ax,imm
   1.177 -	global	@memcpy_image_kernel$qv:near
   1.178 -@memcpy_image_kernel$qv:
   1.179 -		mov	bx,si
   1.180 -        proc    @memcpy_image$qp11image_himem near
   1.181 -
   1.182 -		ifndef	NO386
   1.183 -		mov	edx,[(image_himem bx).fallback]
   1.184 -		mov	eax,[(image_himem bx).buf]
   1.185 -		cmp	eax,edx			; if (m->fallback != m->buf)
   1.186 -		jz	@@skip			;   memcpy32(m->fallback,0,m->buf,m->size)
   1.187 -		mov	ecx,[(image_himem bx).size]
   1.188 -		else
   1.189 -		les	cx,[((image_himem bx).buf)]
   1.190 -		mov	dx,es
   1.191 -		les	ax,[((image_himem bx).fallback)]
   1.192 -		cmp	ax,cx			; if (m->fallback != m->buf)
   1.193 -		jnz	@@do
   1.194 -		cmp	dx,[word ((image_himem bx).fallback)+2]
   1.195 -		jz	@@skip			;   memcpy32(m->fallback,0,m->buf,m->size)
   1.196 -@@do:
   1.197 -		push	[((image_himem bx).size)]
   1.198 -		xor	bx,bx
   1.199 -call_memcpy32:					; call_memcpy32(to=es:ax,fromseg=bx,fromofs=dx:cx,size)
   1.200 -		push	dx			; [word ((image_himem bx).buf)+2]
   1.201 -		push	cx			; [word ((image_himem bx).buf)]
   1.202 -		push	bx
   1.203 -		push	es			; push es:ax
   1.204 -		push	ax
   1.205 -		jmp	@@memcpy
   1.206 -		endif
   1.207 -memcpy_imagez:					; memcpy_imagez(edx,eax,ecx)
   1.208 -		p386
   1.209 -		push	ecx
   1.210 -		push	eax
   1.211 -		push	0
   1.212 -		ifndef	NO386
   1.213 -call_memcpy32:					; call_memcpy32(to=edx,fromseg,fromofs,size)
   1.214 -		endif
   1.215 -		push	edx
   1.216 -		ifdef	NO386
   1.217 -                p8086
   1.218 -		endif
   1.219 -@@memcpy:
   1.220 -		extrn	memcpy32:near
   1.221 -		call	near memcpy32
   1.222 -@@skip:
   1.223 -		ret
   1.224 -
   1.225 -		global	movedend:near
   1.226 -movedend:
   1.227 -
   1.228 -        endp    @memcpy_image$qp11image_himem
   1.229 -
   1.230 -;***************************************************************
   1.231 -;_fastcall void storepage(di:u32 *dst);
   1.232 -;***************************************************************
   1.233 -        global  @storepage$qpul:near
   1.234 -        proc    @storepage$qpul near
   1.235 -
   1.236 -		ifndef	NO386
   1.237 -		mov	edx,[di]
   1.238 -		else
   1.239 -		les	ax,[dword di]
   1.240 -		endif
   1.241 -		mov	cx,offset _buf4k
   1.242 -storepage:					; storepage(edx,cx)
   1.243 -		ifndef	NO386
   1.244 -		push	0
   1.245 -		push	4096
   1.246 -		push	0
   1.247 -		push	cx
   1.248 -		push	ds			; call_memcpy32(to=edx,fromseg,fromofs,size)
   1.249 -		else
   1.250 -		xor	dx,dx
   1.251 -		push	dx			; 0
   1.252 -		mov	bx,4096
   1.253 -		push	bx			; 4096
   1.254 -		mov	bx,ds			; call_memcpy32(to=es:ax,fromseg=bx,fromofs=dx:cx,size)
   1.255 -		endif
   1.256 -		jmp	call_memcpy32
   1.257 -
   1.258 -        endp    @storepage$qpul
   1.259 -
   1.260 -;***************************************************************
   1.261 -;_fastcall void strcatb(bx:const char* a, ax:const char* b);
   1.262 -;***************************************************************
   1.263 -        global  @strcatb$qpxzct1:near
   1.264 -        proc	@strcatb$qpxzct1 near
   1.265 -
   1.266 -                push	si
   1.267 -                xchg	ax,si			; b
   1.268 -		dec	bx
   1.269 -@@catlp:
   1.270 -                inc	bx
   1.271 -                cmp	[byte bx],0		; a=bx
   1.272 -                jne	@@catlp
   1.273 -		db	0b8h,20h		; mov	ax,??20h
   1.274 -@@cpylp:
   1.275 -		lodsb
   1.276 -                mov	[bx],al
   1.277 -                inc	bx
   1.278 -		or	al,al
   1.279 -                jne	@@cpylp
   1.280 -                pop	si
   1.281 -catret:
   1.282 -		ret
   1.283 -
   1.284 -        endp	@strcatb$qpxzct1
   1.285 -
   1.286  
   1.287  		ifdef	NO386
   1.288                  p8086
   1.289 @@ -332,8 +66,8 @@
   1.290  
   1.291  	ifndef ISO9660
   1.292  ;***************************************************************
   1.293 -;_fastcall int:C open(bx:const char* name, int flags=O_RDONLY);
   1.294 -;_fastcall int:C openargs(bx:const char* name, int flags=O_RDONLY);
   1.295 +;_fastcall int:C open(bx:const char* name, const flags=O_RDONLY);
   1.296 +;_fastcall int:C openargs(bx:const char* name, const flags=O_RDONLY);
   1.297  ;***************************************************************
   1.298          global  openargs:near			; openargs(bx)
   1.299  openargs:
   1.300 @@ -346,7 +80,6 @@
   1.301  	endif
   1.302  opendos:
   1.303  	ifdef	LONG_FILENAME
   1.304 -		;xchg	ax,cx			; attributes
   1.305  		mov	ax,716Ch
   1.306  		push	bx si
   1.307  		mov	si,bx
   1.308 @@ -355,17 +88,15 @@
   1.309  		stc
   1.310                  int	21h
   1.311  		pop	si dx
   1.312 -                jnc	openok
   1.313 -                mov	ax,3d00h		; read-only+compatibility
   1.314 +                jnc	@@openok
   1.315  	else
   1.316 -                mov	ah,3dh			; read-only+compatibility
   1.317                  mov	dx,bx			; open(DS:DX=filename,al=access,cl=attributes)
   1.318  	endif
   1.319 -		;mov	cl,0			; attribute mask
   1.320 +                mov	ax,3d00h		; read-only+compatibility
   1.321  		call	dos
   1.322  	ifdef ISO9660
   1.323 -		jc	catret
   1.324 -openok:
   1.325 +		jc	@@openret
   1.326 +@@openok:
   1.327  		xchg	ax,bx
   1.328  		mov	ax,4202h
   1.329  		cwd
   1.330 @@ -378,9 +109,10 @@
   1.331  		cwd
   1.332  		call	seeksetpos0		; filepos = 0
   1.333  	else
   1.334 -openok:
   1.335 +@@openok:
   1.336  	endif
   1.337  		xchg	ax,bx			; fd
   1.338 +@@openret:
   1.339  		ret
   1.340  
   1.341  	ifdef ISO9660
   1.342 @@ -389,8 +121,8 @@
   1.343  		extrn	_isostate:isostate
   1.344  
   1.345  ;***************************************************************
   1.346 -;_fastcall int:C open(bx:const char* name, int flags=O_RDONLY);
   1.347 -;_fastcall int:C openargs(bx:const char* name, int flags=O_RDONLY);
   1.348 +;_fastcall int:C open(bx:const char* name, const flags=O_RDONLY);
   1.349 +;_fastcall int:C openargs(bx:const char* name, const flags=O_RDONLY);
   1.350  ;***************************************************************
   1.351          global  openargs:near			; openargs(bx)
   1.352  openargs:
   1.353 @@ -400,15 +132,9 @@
   1.354  
   1.355          global  @open$qpxzc:near
   1.356  @open$qpxzc:
   1.357 -		ifdef	LONG_FILENAME
   1.358 -		mov	cx,[_isostate.fd]
   1.359 -		jcxz	opendos
   1.360 -		xchg	ax,cx
   1.361 -		else
   1.362  		mov	ax,[_isostate.fd]
   1.363  		or	ax,ax
   1.364 -		je	opendos
   1.365 -		endif
   1.366 +		jz	opendos
   1.367  		ifdef ISOHOOK
   1.368  		cmp	[byte bx],'!'
   1.369  		je	@readmenu$qv
   1.370 @@ -425,7 +151,7 @@
   1.371  	global	@fileexist$qpxzc:near
   1.372  @fileexist$qpxzc:
   1.373  		call	@open$qpxzc
   1.374 -		jc	fail
   1.375 +		jc	failifc
   1.376  
   1.377  ;***************************************************************
   1.378  ;_fastcall int close(ax:int fd);
   1.379 @@ -439,8 +165,10 @@
   1.380  	ifdef ISO9660
   1.381  		mov	cx,[_isostate.fd]
   1.382  		jcxz	dosbx
   1.383 +		ret
   1.384 +	else
   1.385 +		jmp	dosbx
   1.386  	endif
   1.387 -		jmp	fail
   1.388  
   1.389          endp    @close$qi
   1.390  
   1.391 @@ -455,26 +183,24 @@
   1.392  		mov	bx,[si-2]	; data
   1.393          proc    @read$qipvi near
   1.394  
   1.395 -@read$dxbxax:
   1.396 +@read$dxbxax:		; dx:size bx:data ax:fd
   1.397  		xchg	ax,bx			; fd
   1.398 -@read$dxaxbx:
   1.399 +@read$dxaxbx:		; dx:size ax:data bx:fd
   1.400  		xchg	ax,dx			; data
   1.401  		xchg	ax,cx			; sz
   1.402  	global	@read$cxdxbx:near
   1.403 -@read$cxdxbx:
   1.404 +@read$cxdxbx:		; cx:size dx:data bx:fd
   1.405  	ifdef ISO9660
   1.406  		push	bx
   1.407  		mov	bx,offset _isostate.filepos
   1.408  		push	cx
   1.409 -		mov	cx,[bx-4]		; filesize
   1.410 +		les	cx,[bx-4]		; filesize
   1.411  		sub	cx,[bx]			; filepos
   1.412 -		mov	ax,[bx-2]
   1.413 +		mov	ax,es
   1.414  		sbb	ax,[bx+2]
   1.415  		pop	ax
   1.416 -		ja	@@axok
   1.417 -		;je	@@rem
   1.418 -		;xor	ax,ax
   1.419 -@@rem:
   1.420 +		;jb	fail			; filepos > filesize ???
   1.421 +		jne	@@axok
   1.422  		cmp	cx,ax
   1.423  		jb	@@cxok
   1.424  @@axok:
   1.425 @@ -489,12 +215,12 @@
   1.426                  ;jcxz	fail
   1.427  dos:
   1.428                  int	21h
   1.429 -                jnc	doret
   1.430 +                jnc	@@doret
   1.431  fail:
   1.432  		stc
   1.433  failifc:
   1.434                  sbb	ax,ax			; ax=-1 CF
   1.435 -doret:
   1.436 +@@doret:
   1.437                  ret
   1.438  
   1.439          endp    @read$qipvi
   1.440 @@ -591,7 +317,7 @@
   1.441          proc    @isoreadsector$qpxul near
   1.442  
   1.443  		call	isolseek		; filepos = 0
   1.444 -		jc	fail
   1.445 +		jc	failifc
   1.446  		mov	cx,2048
   1.447  		mov	dx,offset _buf2k
   1.448  		jmp	readfd			; read(fd,buf2k,2048)
   1.449 @@ -630,8 +356,7 @@
   1.450          proc    @strcmp$qpxzct1 near
   1.451  
   1.452  		call	@strhead$qpxzct1
   1.453 -		jne	fail			; return -1
   1.454 -		xor	dh,[bx]			; clear C
   1.455 +		or	dh,[bx]			; clear C
   1.456  		jne	fail			; return -1
   1.457  		jmp	failifc			; return 0, dh=0
   1.458  
   1.459 @@ -667,34 +392,6 @@
   1.460  	endif
   1.461  
   1.462  ;***************************************************************
   1.463 -;_fastcall void puts(bx:const char* s):
   1.464 -;***************************************************************
   1.465 -        global  @puts$qpxzc:near
   1.466 -
   1.467 -;        global  puts:near			; puts(bx)
   1.468 -@putsz:
   1.469 -		call	@putc
   1.470 -@puts$qpxzc:
   1.471 -puts:
   1.472 -		mov	dl,[bx]
   1.473 -		inc	bx
   1.474 -		or	dl,dl
   1.475 -		jne	@putsz
   1.476 -		mov	dl,10
   1.477 -@putc:
   1.478 -		cmp	dl,10
   1.479 -		jne	@putcz
   1.480 -		call	@putcz2
   1.481 -@putcz2:
   1.482 -		xor	dl,7		; 10^13  1010^1101
   1.483 -@putcz:
   1.484 -		mov	ah,2
   1.485 -do_int21h:
   1.486 -		int	21h
   1.487 -		ret
   1.488 -
   1.489 -
   1.490 -;***************************************************************
   1.491  ;_fastcall char* malloc_or_die(ax:unsigned size);
   1.492  ;***************************************************************
   1.493  xchg_heap_top:
   1.494 @@ -742,34 +439,31 @@
   1.495  	endp	@die$qpxzc
   1.496  
   1.497  ;***************************************************************
   1.498 -;_fastcall void open_image(si:struct image_himem *m, ax:const char *name);
   1.499 +;_fastcall void puts(bx:const char* s):
   1.500  ;***************************************************************
   1.501 +        global  @puts$qpxzc:near
   1.502  
   1.503 -        global  @open_image$qp11image_himempxzc:near
   1.504 -        proc    @open_image$qp11image_himempxzc near
   1.505 -
   1.506 -                mov	[(image_himem si).state],ax
   1.507 -		push	ax
   1.508 -@@next:
   1.509 -		call	next_chunk
   1.510 -		ifndef	NO386
   1.511 -		add	eax,3
   1.512 -		and	al,0FCh
   1.513 -		add	[(image_himem si).size],eax	; m->size += m->chunk_size	size zero'd in bss
   1.514 -		or	eax,eax
   1.515 -		else
   1.516 -		add	ax,3
   1.517 -		adc	dx,0
   1.518 -		and	al,0FCh
   1.519 -		add	[word (image_himem si).size],ax	; m->size += m->chunk_size	size zero'd in bss
   1.520 -		adc	[word ((image_himem si).size)+2],dx
   1.521 -		or	ax,dx
   1.522 -		endif
   1.523 -		jnz	@@next
   1.524 -                pop	[(image_himem si).state]
   1.525 -
   1.526 -        endp    @open_image$qp11image_himempxzc
   1.527 -
   1.528 +;        global  puts:near			; puts(bx)
   1.529 +@putsz:
   1.530 +		call	@putc
   1.531 +@puts$qpxzc:
   1.532 +puts:
   1.533 +		mov	dl,[bx]
   1.534 +		inc	bx
   1.535 +		or	dl,dl
   1.536 +		jne	@putsz
   1.537 +		mov	dl,10
   1.538 +@putc:
   1.539 +		cmp	dl,10
   1.540 +		jne	@putcz
   1.541 +		call	@putcz2
   1.542 +@putcz2:
   1.543 +		xor	dl,7		; 10^13  1010^1101
   1.544 +@putcz:
   1.545 +		mov	ah,2
   1.546 +do_int21h:
   1.547 +		int	21h
   1.548 +		ret
   1.549  
   1.550  ;***************************************************************
   1.551  ;static long next_chunk(struct image_himem *si);
   1.552 @@ -790,17 +484,15 @@
   1.553  		mov	bx,[(image_himem si).state]
   1.554  		cmp	al,[bx]			; ""
   1.555  		jz	@@end
   1.556 -		dec	bx
   1.557  		push	di
   1.558  @@scan:
   1.559 -		inc	bx
   1.560  		mov	al,[bx]
   1.561  		mov	di,bx
   1.562  		or	al,al
   1.563  		jz	@@eos
   1.564 +		inc	bx
   1.565  		sub	al,','
   1.566  		jnz	@@scan
   1.567 -		inc	bx
   1.568  @@eos:
   1.569  		xchg	[(image_himem si).state],bx	; set start of string
   1.570  		mov	[current_file],bx
   1.571 @@ -863,6 +555,128 @@
   1.572  
   1.573          endp    next_chunk
   1.574  
   1.575 +		ifdef	VCPI
   1.576 +                p386
   1.577 +;***************************************************************
   1.578 +;_fastcall u32* malloc_bufv_or_die(si:struct image_himem *m);
   1.579 +;***************************************************************
   1.580 +        global  @malloc_bufv_or_die$qp11image_himem:near
   1.581 +        proc    @malloc_bufv_or_die$qp11image_himem near
   1.582 +
   1.583 +                p386
   1.584 +		;mov	ecx,[(image_himem si).size]
   1.585 +		;shr	ecx,20			; pages index size = size >> 20
   1.586 +		;mov	ax,cx
   1.587 +		;add	ax,size data_himem-4096
   1.588 +		mov	ax,size data_himem
   1.589 +		call	malloc_or_die
   1.590 +		;mov	cx,4096+4095		; cnt = 1+(m->size+PAGE_MASK)/PAGE_SIZE;
   1.591 +		mov	ecx,4096+4095		; cnt = 1+(m->size+PAGE_MASK)/PAGE_SIZE;
   1.592 +		add	ecx,[(image_himem si).size]
   1.593 +		shr	ecx,12
   1.594 +		mov	[(image_himem si).bufv],ax	; update m->bufv
   1.595 +		xchg	ax,di
   1.596 +@@vcpi_alloc:
   1.597 +                mov     ax,0DE04h		; allocate a 4K page => EDX
   1.598 +                int     67h
   1.599 +		or	ah,ah
   1.600 +		mov	bx,offset vcpi_alloc_err
   1.601 +		jnz	jmpdie
   1.602 +; for (i = cnt-1; i >= 0; i--)
   1.603 +; if (edx < pm.fallback+pm.size) again
   1.604 +		mov	bx,offset _imgs.fallback+size image_himem
   1.605 +		mov	eax,[bx-2+6-size image_himem]	; pm.size
   1.606 +		add	eax,[bx-2+2-size image_himem]
   1.607 +		cmp	eax,edx		; pm.fallback+pm.size <= edx ?
   1.608 +		ja	@@vcpi_alloc
   1.609 +		mov	eax,ecx
   1.610 +		dec	eax
   1.611 +		shl	eax,12		; i*_4k
   1.612 +; if (edx >= initrd.fallback+i*_4k && edx < initrd.fallback+initrd.size) again
   1.613 +		add	eax,[bx-2+2]	; +initrd.fallback
   1.614 +		cmp	eax,edx		; initrd.fallback+i*_4k > edx ?
   1.615 +		ja	@@initrdok
   1.616 +		mov	eax,[bx-2+6]	; initrd.size
   1.617 +		add	eax,[bx-2+2]	; +initrd.fallback
   1.618 +		cmp	eax,edx		; initrd.fallback+initrd.size > edx ?
   1.619 +		ja	@@vcpi_alloc
   1.620 +@@initrdok:
   1.621 +		cmp	[(data_himem di).first],0	; zero'd in bss
   1.622 +		jne	@@notfirst
   1.623 +		mov	[(data_himem di).first],edx
   1.624 +@@notfirst:
   1.625 +		mov	bx,[(data_himem di).cacheidx]	; zero'd in bss
   1.626 +		cmp	bh,10h
   1.627 +		jae	@@nextpage
   1.628 +		add	[(data_himem di).cacheidx],4
   1.629 +		mov	[(data_himem bx+di).cache],edx	; cache[cacheidx++] = edx
   1.630 +		loopd	@@vcpi_alloc
   1.631 +		mov	[(data_himem bx+di).cache],ecx	; last is 0
   1.632 +@@nextpage:
   1.633 +		and	[(data_himem di).cacheidx],0
   1.634 +		mov	bx,[(data_himem di).pageidx]	; zero'd in bss
   1.635 +		mov	[(data_himem bx+di).page],edx
   1.636 +		add	[(data_himem di).pageidx],4
   1.637 +		push	cx
   1.638 +		lea	cx,[(data_himem di).cache]
   1.639 +		ifdef	NO386
   1.640 +		push	edx
   1.641 +		pop	ax			; to es:ax
   1.642 +		pop	es
   1.643 +		endif
   1.644 +		call	storepage		; storepage(edx/es:ax,cx)	
   1.645 +		pop	cx
   1.646 +		or	ecx,ecx			; clear C
   1.647 +		jnz	@@vcpi_alloc
   1.648 +
   1.649 +        endp    @malloc_bufv_or_die$qp11image_himem
   1.650 +
   1.651 +;***************************************************************
   1.652 +;_fastcall void reset_bufv(di:u32 *p);
   1.653 +;***************************************************************
   1.654 +        global  @reset_bufv$qpul:near
   1.655 +        proc    @reset_bufv$qpul near
   1.656 +
   1.657 +		mov	[curdata],di
   1.658 +		and	[dword (data_himem di).cacheidx],0	; and pageidx=0
   1.659 +		ret
   1.660 +
   1.661 +        endp    @reset_bufv$qpul
   1.662 +                p8086
   1.663 +		endif
   1.664 +
   1.665 +;===============================================================
   1.666 +
   1.667 +;***************************************************************
   1.668 +;_fastcall void open_image(si:struct image_himem *m, ax:const char *name);
   1.669 +;***************************************************************
   1.670 +
   1.671 +        global  @open_image$qp11image_himempxzc:near
   1.672 +        proc    @open_image$qp11image_himempxzc near
   1.673 +
   1.674 +                mov	[(image_himem si).state],ax
   1.675 +		push	ax
   1.676 +@@next:
   1.677 +		call	next_chunk
   1.678 +		ifndef	NO386
   1.679 +		add	eax,3
   1.680 +		and	al,0FCh
   1.681 +		add	[(image_himem si).size],eax	; m->size += m->chunk_size	size zero'd in bss
   1.682 +		or	eax,eax
   1.683 +		else
   1.684 +		add	ax,3
   1.685 +		adc	dx,0
   1.686 +		and	al,0FCh
   1.687 +		add	[word (image_himem si).size],ax	; m->size += m->chunk_size	size zero'd in bss
   1.688 +		adc	[word ((image_himem si).size)+2],dx
   1.689 +		or	ax,dx
   1.690 +		endif
   1.691 +		jnz	@@next
   1.692 +                pop	[(image_himem si).state]
   1.693 +
   1.694 +        endp    @open_image$qp11image_himempxzc
   1.695 +
   1.696 +;===============================================================
   1.697  
   1.698  ;***************************************************************
   1.699  ;_fastcall int read_image(si:struct image_himem *m);
   1.700 @@ -891,11 +705,11 @@
   1.701  		endif
   1.702  		xchg	ax,cx
   1.703  @@szok:
   1.704 -		jcxz	image_done
   1.705 +		jcxz	@@image_done
   1.706  		lea	dx,[di+_buf4k]
   1.707  		mov	bx,[(image_himem si).fd]
   1.708  		call	@read$cxdxbx
   1.709 -		jb	image_done
   1.710 +		jb	@@image_done
   1.711  		add	di,ax
   1.712  		ifndef	NO386
   1.713  		cwde				; ax < 8000h
   1.714 @@ -927,13 +741,15 @@
   1.715  		call	next_chunk
   1.716  @@same_chunk:
   1.717  		jmp	@@loop
   1.718 -image_done:
   1.719 +@@image_done:
   1.720  		xchg	ax,di
   1.721                  pop	di
   1.722  		ret
   1.723  
   1.724          endp    @read_image$qp11image_himem
   1.725  
   1.726 +;===============================================================
   1.727 +
   1.728  ;***************************************************************
   1.729  ;_fastcall const char **argstr(bx:const char *s, ax:const char keywords[], dx:const char **var);
   1.730  ;_fastcall unsigned long *argnum(bx:char *s, ax:const char keywords[], dx:unsigned long *var);
   1.731 @@ -1109,6 +925,186 @@
   1.732  
   1.733  	endp	@argstr$qpxzcxt1ppxzc
   1.734  
   1.735 +;===============================================================
   1.736 +
   1.737 +		ifdef	VCPI
   1.738 +                p386
   1.739 +;***************************************************************
   1.740 +;u32* di=prev_bufv();
   1.741 +;u32* di=prev_bufv();
   1.742 +;***************************************************************
   1.743 +        global  _prev_bufv:near
   1.744 +        global  _next_bufv:near
   1.745 +        proc    _prev_bufv near
   1.746 +
   1.747 +		mov	al,-4
   1.748 +		db	0A9h			; test	ax,imm
   1.749 +_next_bufv:
   1.750 +		mov	al,4
   1.751 +		cbw
   1.752 +		push	si
   1.753 +		mov	bx,0
   1.754 +		org	$-2
   1.755 +curdata		dw	?
   1.756 +		add	ax,[(data_himem bx).cacheidx]	; -4/+4
   1.757 +		mov	si,0fffh
   1.758 +		and	si,ax
   1.759 +		mov	[(data_himem bx).cacheidx],si
   1.760 +		xor	ecx,ecx
   1.761 +		sar	ax,12-2
   1.762 +		test	al,3
   1.763 +		jz	@@gotpage		; neither -4 nor 4 ?
   1.764 +		add	[(data_himem bx).pageidx],ax
   1.765 +		mov	di,[(data_himem bx).pageidx]
   1.766 +		lea	di,[(data_himem bx+di).page]
   1.767 +		mov	edx,ds
   1.768 +		shl	edx,4
   1.769 +		lea	cx,[(data_himem bx).cache]		
   1.770 +		add	edx,ecx
   1.771 +		mov	eax,[di]
   1.772 +		or	eax,eax
   1.773 +		jz	@@ret
   1.774 +		mov	cx,4096			; get page
   1.775 +		call	memcpy_imagez		; memcpy_imagez(edx,eax,ecx)
   1.776 +@@gotpage:
   1.777 +		lea	ax,[(data_himem bx+si).cache]		
   1.778 +		or	si,[(data_himem bx).pageidx]	; !pageidx && !cacheidx
   1.779 +		jnz	@@notfirst2
   1.780 +		xchg	ax,bx				; &first
   1.781 +@@notfirst2:
   1.782 +		xchg	ax,di
   1.783 +@@ret:
   1.784 +		pop	si
   1.785 +		ret
   1.786 +
   1.787 +        endp    _prev_bufv
   1.788 +		endif
   1.789 +
   1.790 +;===============================================================
   1.791 +
   1.792 +		ifdef	NO386
   1.793 +                p8086
   1.794 +		endif
   1.795 +
   1.796 +;***************************************************************
   1.797 +;_fastcall void memcpy_image_initrd(si:struct image_himem *m);
   1.798 +;_fastcall void memcpy_image_kernel(si:struct image_himem *m);
   1.799 +;_fastcall void memcpy_image(bx:struct image_himem *m);
   1.800 +;***************************************************************
   1.801 +	global	@memcpy_image_initrd$qv:near
   1.802 +@memcpy_image_initrd$qv:
   1.803 +		lea	bx,[si+size image_himem]
   1.804 +		db	0A9h			; test	ax,imm
   1.805 +	global	@memcpy_image_kernel$qv:near
   1.806 +@memcpy_image_kernel$qv:
   1.807 +		mov	bx,si
   1.808 +        proc    @memcpy_image$qp11image_himem near
   1.809 +
   1.810 +		ifndef	NO386
   1.811 +		mov	edx,[(image_himem bx).fallback]
   1.812 +		mov	eax,[(image_himem bx).buf]
   1.813 +		cmp	eax,edx			; if (m->fallback != m->buf)
   1.814 +		jz	@@skip			;   memcpy32(m->fallback,0,m->buf,m->size)
   1.815 +		mov	ecx,[(image_himem bx).size]
   1.816 +		else
   1.817 +		les	cx,[((image_himem bx).buf)]
   1.818 +		mov	dx,es
   1.819 +		les	ax,[((image_himem bx).fallback)]
   1.820 +		;cmp	ax,cx			; if (m->fallback != m->buf)
   1.821 +		;jnz	@@do
   1.822 +		;cmp	dx,[word ((image_himem bx).fallback)+2]
   1.823 +		;jz	@@skip			;   memcpy32(m->fallback,0,m->buf,m->size)
   1.824 +@@do:
   1.825 +		push	[((image_himem bx).size)]
   1.826 +		xor	bx,bx
   1.827 +call_memcpy32:					; call_memcpy32(to=es:ax,fromseg=bx,fromofs=dx:cx,size)
   1.828 +		push	dx			; [word ((image_himem bx).buf)+2]
   1.829 +		push	cx			; [word ((image_himem bx).buf)]
   1.830 +		push	bx
   1.831 +		push	es			; push es:ax
   1.832 +		push	ax
   1.833 +		jmp	@@memcpy
   1.834 +		endif
   1.835 +memcpy_imagez:					; memcpy_imagez(edx,eax,ecx)
   1.836 +		p386
   1.837 +		push	ecx
   1.838 +		push	eax
   1.839 +		push	0
   1.840 +		ifndef	NO386
   1.841 +call_memcpy32:					; call_memcpy32(to=edx,fromseg,fromofs,size)
   1.842 +		endif
   1.843 +		push	edx
   1.844 +		ifdef	NO386
   1.845 +                p8086
   1.846 +		endif
   1.847 +@@memcpy:
   1.848 +		extrn	memcpy32:near
   1.849 +		call	near memcpy32
   1.850 +@@skip:
   1.851 +		ret
   1.852 +
   1.853 +		global	movedend:near
   1.854 +movedend:
   1.855 +
   1.856 +        endp    @memcpy_image$qp11image_himem
   1.857 +
   1.858 +;***************************************************************
   1.859 +;_fastcall void storepage(di:u32 *dst);
   1.860 +;***************************************************************
   1.861 +        global  @storepage$qpul:near
   1.862 +        proc    @storepage$qpul near
   1.863 +
   1.864 +		ifndef	NO386
   1.865 +		mov	edx,[di]
   1.866 +		else
   1.867 +		les	ax,[dword di]
   1.868 +		endif
   1.869 +		mov	cx,offset _buf4k
   1.870 +storepage:					; storepage(edx,cx)
   1.871 +		ifndef	NO386
   1.872 +		push	0
   1.873 +		push	4096
   1.874 +		push	0
   1.875 +		push	cx
   1.876 +		push	ds			; call_memcpy32(to=edx,fromseg,fromofs,size)
   1.877 +		else
   1.878 +		xor	dx,dx
   1.879 +		push	dx			; 0
   1.880 +		mov	bx,4096
   1.881 +		push	bx			; 4096
   1.882 +		mov	bx,ds			; call_memcpy32(to=es:ax,fromseg=bx,fromofs=dx:cx,size)
   1.883 +		endif
   1.884 +		jmp	call_memcpy32
   1.885 +
   1.886 +        endp    @storepage$qpul
   1.887 +
   1.888 +;===============================================================
   1.889 +
   1.890 +;***************************************************************
   1.891 +;_fastcall void strcatb(bx:const char* a, ax:const char* b);
   1.892 +;***************************************************************
   1.893 +        global  @strcatb$qpxzct1:near
   1.894 +        proc	@strcatb$qpxzct1 near
   1.895 +
   1.896 +                push	si
   1.897 +                xchg	ax,si			; b
   1.898 +		dec	bx
   1.899 +@@catlp:
   1.900 +                inc	bx
   1.901 +                cmp	[byte bx],0		; a=bx
   1.902 +                jne	@@catlp
   1.903 +		db	0b8h,20h		; mov	ax,??20h
   1.904 +@@cpylp:
   1.905 +		lodsb
   1.906 +                mov	[bx],al
   1.907 +                inc	bx
   1.908 +		or	al,al
   1.909 +                jne	@@cpylp
   1.910 +                pop	si
   1.911 +		ret
   1.912 +
   1.913 +        endp	@strcatb$qpxzct1
   1.914 +
   1.915  
   1.916          ends    _TEXT
   1.917  
     2.1 --- a/linld/stuff/src/JUMP.ASM	Wed Dec 22 13:43:13 2021 +0100
     2.2 +++ b/linld/stuff/src/JUMP.ASM	Fri Dec 24 12:31:52 2021 +0000
     2.3 @@ -235,8 +235,7 @@
     2.4  		mov	eax,[dword si+1E6h]
     2.5  		xor	eax,'SKLE'
     2.6  		else
     2.7 -		mov	ax,[si+1E6h]
     2.8 -		xor	ax,'LE'
     2.9 +		cmp	[word si+1E6h],'LE'
    2.10  		jne	@@notelks
    2.11  		mov	ax,[si+1E8h]
    2.12  		xor	ax,'SK'
     3.1 --- a/linld/stuff/src/_BEG.ASM	Wed Dec 22 13:43:13 2021 +0100
     3.2 +++ b/linld/stuff/src/_BEG.ASM	Fri Dec 24 12:31:52 2021 +0000
     3.3 @@ -281,16 +281,15 @@
     3.4  		mov	cx,0F04h
     3.5  		and	ah,ch
     3.6  		and	bh,ch
     3.7 -		ror	bx,cl		; extended FamilyID in bl, extended ModelID in bh[7-4]
     3.8 +		rol	bx,cl		; extended FamilyID in bh, extended ModelID in bl[7-4]
     3.9  		shr	al,cl		; set base ModelID
    3.10  		cmp	ah,ch
    3.11  		jz	SetModelID
    3.12  		cmp	ah,06h
    3.13  		jnz	ModelIDset
    3.14 -		db	3Dh		; cmp ax,0E302h
    3.15 +		mov	bh,0		; remove extended FamilyID
    3.16  SetModelID:
    3.17 -		add	ah,bl		; use extended FamilyID
    3.18 -		or	al,bh		; use extended ModelID
    3.19 +		add	ax,bx		; use extended FamilyID & extended ModelID
    3.20  ModelIDset:
    3.21  set_cputype:
    3.22  		endif
     4.1 --- a/lzsa/receipt	Wed Dec 22 13:43:13 2021 +0100
     4.2 +++ b/lzsa/receipt	Fri Dec 24 12:31:52 2021 +0000
     4.3 @@ -1,7 +1,7 @@
     4.4  # SliTaz package receipt.
     4.5  
     4.6  PACKAGE="lzsa"
     4.7 -VERSION="1.3.8"
     4.8 +VERSION="1.3.9"
     4.9  CATEGORY="system-tools"
    4.10  SHORT_DESC="Efficient packer optimized for fast decompression on 8-bit cpu."
    4.11  MAINTAINER="pascal.bellard@slitaz.org"