wok rev 25594

Update some web_site/wget_url
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Jul 11 10:40:23 2023 +0000 (10 months ago)
parents 7114a8f12ebc
children 9c2fdce844ea
files electricsheep/receipt enchant-dev/receipt enchant/receipt enchant2/receipt hatari/receipt memtest/stuff/unlz4.S memtest/stuff/unlzsa1.S memtest/stuff/unlzsa2.S memtest64/stuff/unlz4.S memtest64/stuff/unlzsa1.S memtest64/stuff/unlzsa2.S ntk/receipt plop/stuff/unlz4.S plop/stuff/unlzsa1.S plop/stuff/unlzsa2.S transcode/receipt wv/receipt yaws/receipt
line diff
     1.1 --- a/electricsheep/receipt	Sat Jun 24 08:24:26 2023 +0000
     1.2 +++ b/electricsheep/receipt	Tue Jul 11 10:40:23 2023 +0000
     1.3 @@ -8,7 +8,7 @@
     1.4  LICENSE="GPL2"
     1.5  TARBALL="$PACKAGE-$VERSION.tar.bz2"
     1.6  WEB_SITE="http://community.electricsheep.org/"
     1.7 -WGET_URL="https://sources.archlinux.org/other/community/$PACKAGE/$TARBALL"
     1.8 +WGET_URL="https://download.tuxfamily.org/slitaz/sources/packages-cooking/${TARBALL:0:1}/$TARBALL"
     1.9  
    1.10  DEPENDS="curl expat flam3 ffmpeg mplayer libglade gtk+"
    1.11  BUILD_DEPENDS="curl-dev expat-dev ffmpeg-dev libglade-dev gtk+-dev flam3-dev \
     2.1 --- a/enchant-dev/receipt	Sat Jun 24 08:24:26 2023 +0000
     2.2 +++ b/enchant-dev/receipt	Tue Jul 11 10:40:23 2023 +0000
     2.3 @@ -7,7 +7,7 @@
     2.4  MAINTAINER="pankso@slitaz.org"
     2.5  LICENSE="LGPL2.1"
     2.6  WANTED="enchant"
     2.7 -WEB_SITE="http://www.abisource.com/projects/enchant/"
     2.8 +WEB_SITE="https://github.com/AbiWord/enchant"
     2.9  HOST_ARCH="i486 arm"
    2.10  
    2.11  DEPENDS="enchant pkg-config"
     3.1 --- a/enchant/receipt	Sat Jun 24 08:24:26 2023 +0000
     3.2 +++ b/enchant/receipt	Tue Jul 11 10:40:23 2023 +0000
     3.3 @@ -8,18 +8,19 @@
     3.4  LICENSE="LGPL2.1"
     3.5  SUGGESTED="aspell"
     3.6  TARBALL="$PACKAGE-$VERSION.tar.gz"
     3.7 -WEB_SITE="http://www.abisource.com/projects/enchant/"
     3.8 -WGET_URL="http://www.abisource.com/downloads/enchant/$VERSION/$TARBALL"
     3.9 +WEB_SITE="https://github.com/AbiWord/enchant"
    3.10 +WGET_URL="https://web.archive.org/web/20230331215737if_/http://www.abisource.com/downloads/enchant/$VERSION/$TARBALL"
    3.11  TAGS="spell check"
    3.12  HOST_ARCH="i486 arm"
    3.13  
    3.14  DEPENDS="dbus dbus-glib glib gcc-lib-base"
    3.15  BUILD_DEPENDS="pkg-config glib glib-dev aspell-dev"
    3.16  
    3.17 +# What is the latest version available today?
    3.18  current_version()
    3.19  {
    3.20 -	wget -O - $WEB_SITE 2>/dev/null | \
    3.21 -	sed '/released/!d;s|.*Enchant ||;s| released.*||;q'
    3.22 +	wget -O - https://github.com/AbiWord/enchant/releases/ 2>/dev/null | \
    3.23 +	sed '/archive.*tar/!d;s|.*/v\(.*\).tar.*|\1|;q'
    3.24  }
    3.25  
    3.26  # Rules to configure and make the package.
     4.1 --- a/enchant2/receipt	Sat Jun 24 08:24:26 2023 +0000
     4.2 +++ b/enchant2/receipt	Tue Jul 11 10:40:23 2023 +0000
     4.3 @@ -19,6 +19,7 @@
     4.4  
     4.5  HOST_ARCH="i486 arm"
     4.6  
     4.7 +# What is the latest version available today?
     4.8  current_version()
     4.9  {
    4.10  	wget -O - ${WGET_URL%/down*} 2>/dev/null | \
     5.1 --- a/hatari/receipt	Sat Jun 24 08:24:26 2023 +0000
     5.2 +++ b/hatari/receipt	Tue Jul 11 10:40:23 2023 +0000
     5.3 @@ -6,7 +6,7 @@
     5.4  SHORT_DESC="An Atari ST/STE/TT/Falcon emulator."
     5.5  MAINTAINER="pascal.bellard@slitaz.org"
     5.6  LICENSE="GPL2"
     5.7 -WEB_SITE="https://hatari.tuxfamily.org/"
     5.8 +WEB_SITE="https://github.com/hatari/hatari"
     5.9  
    5.10  TARBALL="$PACKAGE-$VERSION.tar.bz2"
    5.11  WGET_URL="https://download.tuxfamily.org/$PACKAGE/$VERSION/$TARBALL"
     6.1 --- a/memtest/stuff/unlz4.S	Sat Jun 24 08:24:26 2023 +0000
     6.2 +++ b/memtest/stuff/unlz4.S	Tue Jul 11 10:40:23 2023 +0000
     6.3 @@ -19,6 +19,16 @@
     6.4  #define DI	%edi
     6.5  #endif
     6.6   
     6.7 +#if defined(FLAT16OUT) || defined(ONLY8086)
     6.8 +#define cAX	%ax
     6.9 +#define cCX	%cx
    6.10 +#define cDX	%dx
    6.11 +#else
    6.12 +#define cAX	%eax
    6.13 +#define cCX	%ecx
    6.14 +#define cDX	%edx
    6.15 +#endif
    6.16 +
    6.17  #define ARCHIVE_MAGICNUMBER 0x184C2102
    6.18  
    6.19  //#define PARANOIA			// cover rare cases, optional
    6.20 @@ -31,28 +41,72 @@
    6.21  	call	lz4mov
    6.22  # endif
    6.23  #endif
    6.24 +#if defined(FLAT16OUT) || defined(ONLY8086)
    6.25 +	lodsw			// get chunkSize
    6.26 +# ifndef NO_LZ4_HEADER
    6.27 +	cmpw	$ARCHIVE_MAGICNUMBER&0xFFFF, %ax
    6.28 +# endif
    6.29 +	xchg	%ax, %dx
    6.30 +	lodsw
    6.31 +# ifndef NO_LZ4_HEADER
    6.32 +	jne	chkeof
    6.33 +	cmpw	$ARCHIVE_MAGICNUMBER>>16, %ax
    6.34 +	je	lz4main
    6.35 +chkeof:	
    6.36 +# endif
    6.37 +# ifdef PARANOIA
    6.38 +	orw	%ax, %dx	// end of file ?
    6.39 +	je	lz4quit
    6.40 +# endif
    6.41 +# ifndef FLAT16OUT
    6.42 +	xchgw	%ax, %bp
    6.43 +	subw	$1, %dx
    6.44 +	sbbw	$0, %bp
    6.45 +# endif
    6.46 +#else
    6.47  	lodsl			// get chunkSize
    6.48 -#ifndef NO_LZ4_HEADER
    6.49 +# ifndef NO_LZ4_HEADER
    6.50  	cmpl	$ARCHIVE_MAGICNUMBER, %eax
    6.51  	je	lz4main
    6.52 -#endif
    6.53 +# endif
    6.54 +# ifdef PARANOIA
    6.55  	orl	%eax, %eax	// end of file ?
    6.56  	je	lz4quit
    6.57 +# endif
    6.58  	xchgl	%eax, %edx
    6.59 +#endif
    6.60  lz4chunk:			// uncompress chunk
    6.61  	lodsb			// get token
    6.62 -	movb	%al, %bl
    6.63 +	pushw	%ax
    6.64 +#ifdef ONLY8086
    6.65 +	movb	$4, %cl
    6.66 +	shrb	%cl, %al
    6.67 +#else
    6.68  	shrb	$4, %al
    6.69 +#endif
    6.70  	call	lz4len		// get literal length
    6.71 -	subl	%ecx, %edx	// count literal
    6.72 +#if !defined(FLAT16OUT) && defined(ONLY8086)
    6.73 +	subw	%cx, %dx	// count literal
    6.74 +	sbbw	$0, %bp
    6.75 +#else
    6.76 +	sub	cCX, cDX	// count literal
    6.77 +#endif
    6.78  #if !defined(FLAT32) && !defined(FLAT16OUT) && (!defined(FLAT16) || !defined(PARANOIA))
    6.79  #define NeedLz4mov
    6.80  	call	lz4mov		// copy literals
    6.81  #else
    6.82  	rep movsb
    6.83  #endif
    6.84 -	subl	$1+2, %edx	// count token & string address
    6.85 -	jle	lz4main
    6.86 +	popw	%bx
    6.87 +#if !defined(FLAT16OUT) && defined(ONLY8086)
    6.88 +	subw	$1+2, %dx	// count token & string address
    6.89 +	sbbw	$0, %bp
    6.90 +	jb	lz4quit
    6.91 +lz4cont:
    6.92 +#else
    6.93 +	sub	$1+2, cDX	// count token & string address
    6.94 +	jbe	lz4quit
    6.95 +#endif
    6.96  	lodsw			// get string address
    6.97  	xchg	AX, BX
    6.98  	call	lz4len		// get string length
    6.99 @@ -69,18 +123,29 @@
   6.100  .macro norm	reg
   6.101  	movw	%si, \reg
   6.102  	andw	$0xF, %si
   6.103 +# ifdef ONLY8086
   6.104 +	pushw	%cx
   6.105 +	movb	$4, %cl
   6.106 +	shrw	%cl, \reg
   6.107 +# else
   6.108  	shrw	$4, \reg
   6.109 +# endif
   6.110  	addw	\reg, %ax
   6.111  	movw	%ax, %ds
   6.112  	movw	%di, \reg
   6.113  	andw	$0xF, %di
   6.114 +# ifdef ONLY8086
   6.115 +	shrw	%cl, \reg
   6.116 +	popw	%cx
   6.117 +# else
   6.118  	shrw	$4, \reg
   6.119 +# endif
   6.120  	movw	%es, %ax
   6.121  	addw	\reg, %ax
   6.122  	movw	%ax, %es
   6.123  .endm 
   6.124  # if !defined (NeedLz4mov)
   6.125 -	norm	%bp
   6.126 +	norm	%bx
   6.127  	rep movsb
   6.128  # else
   6.129  	call	lz4movStr	// copy string
   6.130 @@ -88,13 +153,35 @@
   6.131  	popw	%si
   6.132  	popw	%ds
   6.133  #else
   6.134 +# ifdef FASTFILL
   6.135 +	cmp	$FASTFILL,BX
   6.136 +	jbe	lz4fast
   6.137 +# endif
   6.138 +lz4notfast:
   6.139  	xchg	AX, SI
   6.140  	mov	DI, SI
   6.141  	sub	BX, SI
   6.142  	rep movsb %es:(SI), %es:(DI)
   6.143  	xchg	AX, SI
   6.144 +# ifdef FASTFILL
   6.145 +lz4fast:
   6.146 +#  if FASTFILL == 1
   6.147 +	movb	%es:-1(DI), %al
   6.148 +	rep stosb
   6.149 +#  endif
   6.150 +#  if FASTFILL >= 2
   6.151 +	movw	%es:-2(DI), %ax
   6.152 +	je	lz4fastword
   6.153 +	movb	%al, %ah
   6.154 +lz4fastword:
   6.155 +	shr	$1, CX
   6.156 +	rep stosw
   6.157 +	jnc	lz4chunk
   6.158 +	stosb
   6.159 +#  endif
   6.160 +# endif
   6.161 +	jmp	lz4chunk
   6.162  #endif
   6.163 -	jmp	lz4chunk
   6.164  
   6.165  #if defined(NeedLz4mov)
   6.166  # if defined(PARANOIA)
   6.167 @@ -108,7 +195,7 @@
   6.168  lz4mov:
   6.169  	movw	%ds, %ax
   6.170  lz4movStr:
   6.171 -	norm	%bp
   6.172 +	norm	%bx
   6.173  # if defined(PARANOIA)
   6.174  	cmp	$0xFF, %ch	// catch FFFX case
   6.175  	jz	lz4movlp
   6.176 @@ -118,14 +205,19 @@
   6.177  #endif
   6.178  
   6.179  lz4len:				// get length in %ecx
   6.180 -	andl	$0xF, %eax
   6.181 -	movl	%eax, %ecx
   6.182 +	and	$0xF, cAX
   6.183 +	mov	cAX, cCX
   6.184  	cmpb	$0xF, %al
   6.185  	jne	lz4quit
   6.186  lz4len2:
   6.187  	lodsb
   6.188 -	decl	%edx		// remaining chunk size
   6.189 -	addw	%ax, %cx
   6.190 +#if !defined(FLAT16OUT) && defined(ONLY8086)
   6.191 +	subw	$1, %dx		// remaining chunk size
   6.192 +	sbbw	$0, %bp
   6.193 +#else
   6.194 +	dec	cDX		// remaining chunk size
   6.195 +#endif
   6.196 +	add	AX, CX
   6.197  	cmpb	$0xFF, %al
   6.198  	je	lz4len2
   6.199  lz4quit:
     7.1 --- a/memtest/stuff/unlzsa1.S	Sat Jun 24 08:24:26 2023 +0000
     7.2 +++ b/memtest/stuff/unlzsa1.S	Tue Jul 11 10:40:23 2023 +0000
     7.3 @@ -25,173 +25,175 @@
     7.4  #define PACKED_ONLY			// assume no copy block, optional
     7.5  //#define PARANOIA			// cover rare cases, optional
     7.6   
     7.7 +.macro	shrclw cnt,obj
     7.8 +#ifdef ONLY8086
     7.9 +	movb	\cnt, %cl
    7.10 +	shrw	%cl, \obj
    7.11 +#else
    7.12 +	shrw	\cnt, \obj
    7.13 +#endif
    7.14 +.endm
    7.15 +
    7.16 +#ifdef FLAT16OUT
    7.17 +#define RAW_FORMAT
    7.18 +#endif
    7.19  lzsa1main:
    7.20  #ifdef PARANOIA
    7.21  	cld
    7.22  #endif
    7.23 -#ifdef FLAT16OUT
    7.24 -#define RAW_FORMAT
    7.25 -#endif
    7.26  #ifndef RAW_FORMAT
    7.27 -# if defined(PARANOIA) && !defined(FLAT32) && !defined(FLAT16)
    7.28 -	xorw	%cx, %cx
    7.29 -	call	normalize
    7.30 -# endif
    7.31  # ifndef NO_LZSA1_HEADER
    7.32  	lodsw
    7.33  	cmpw	$0x9E7B, %ax	// magic
    7.34  	jne	lzsa1main
    7.35  	lodsb
    7.36 -	cmpb	$0, %al		// lzsa1
    7.37 -	jne	lzsa1main
    7.38 +//	cmpb	$0, %al		// lzsa1
    7.39 +//	jne	lzsa1main
    7.40 +# endif
    7.41 +	xorw	%ax, %ax
    7.42 +	xchgw	%ax, %di
    7.43 +	shrclw	$4, %ax
    7.44 +	jmp	lzsa1blockz	// %di *MUST* be paragraph aligned
    7.45 +# ifndef PACKED_ONLY
    7.46 +lzsa1copy:
    7.47 +	movsb			// handle 64K case
    7.48 +	decw	%cx
    7.49 +	rep	movsb		// copy block
    7.50  # endif
    7.51  lzsa1block:			// uncompress chunk
    7.52 +	movw	$0x1000, %ax
    7.53 +lzsa1blockz:	
    7.54 +	movw	%es, %bx
    7.55 +	addw	%ax, %bx
    7.56 +	movw	%bx, %es
    7.57 +# ifndef FLAT16
    7.58 +	movw	%si, %ax
    7.59 +	andw	$0xf, %si
    7.60 +	shrclw	$4, %ax
    7.61 +	movw	%ds, %bx
    7.62 +	addw	%ax, %bx
    7.63 +	movw	%bx, %ds
    7.64 +# endif
    7.65  	lodsw			// block size
    7.66  	xchgw	%ax, %cx
    7.67 +	movw	%cx, %dx
    7.68  	lodsb
    7.69  # ifndef PACKED_ONLY
    7.70  	orb	%al, %al
    7.71 -	jns	lzsa1compressed
    7.72 -#  if !defined(FLAT32) && !defined(FLAT16OUT)
    7.73 -	movw	%cx, %dx
    7.74 -	movb	$0, %cl
    7.75 -	movb	$0, %dh
    7.76 -copytail:
    7.77 -	call	lzsa1movStr
    7.78 -	xchg	%dx, %cx
    7.79 -	incw	%cx
    7.80 -	loop	copytail
    7.81 -#  else
    7.82 -	movsb			// copy block
    7.83 -copylp:
    7.84 -	movsb			// copy block
    7.85 -	loop	copylp		// handle 64K case
    7.86 -#  endif
    7.87 -	jmp	lzsa1block	// end of block
    7.88 -lzsa1compressed:
    7.89 -	jne	lzsa1chunk	// 64Kb block
    7.90 +	js	lzsa1copy
    7.91 +	jne	lzsa1full	// 64Kb block
    7.92  # endif
    7.93  	jcxz	lzsa1quit	// bail if we hit EOD
    7.94 -	pushw	%cx
    7.95 -# if !defined(FLAT32) && !defined(FLAT16)
    7.96 -	xorw	%cx, %cx
    7.97 -	call	normalize
    7.98 -# define NeedNormalize
    7.99 -# endif
   7.100 -	popw	%dx
   7.101 +lzsa1full:
   7.102  	addw	%si, %dx
   7.103  #endif
   7.104  lzsa1chunk:			// uncompress chunk
   7.105  	lodsb			// get token O|LLL|MMMM
   7.106  	movb	%al, %bl	// keep token in bl
   7.107 -	shrb	$4, %al		// shift literals length into place
   7.108 -	movw	$LITERALS_RUN_LEN*256+MIN_LITERALS_SIZE, %cx
   7.109 +	shrclw	$4, %ax		// shift literals length into place
   7.110 +	movw	$LITERALS_RUN_LEN+256*MIN_LITERALS_SIZE, %cx
   7.111  	call	lzsa1len	// %ch = LITERALS_RUN_LEN
   7.112 -#if defined(NeedNormalize)
   7.113 -	call	lzsa1movLit	// copy %cx literals from %ds:%si to %es:%di
   7.114 -#else
   7.115  	rep	movsb		// copy %cx literals from %ds:%si to %es:%di
   7.116 -#endif
   7.117  #ifndef RAW_FORMAT
   7.118  	cmpw	%dx, %si
   7.119 -	jae	lzsa1block	// bail if we hit EOD
   7.120 +	je	lzsa1block	// bail if we hit EOD
   7.121  #endif
   7.122  #ifdef FLAT32
   7.123  	orl	$-1, %eax
   7.124 -#else
   7.125 -	movb	$-1, %ah
   7.126  #endif
   7.127  	testb	%bl, %bl	// check match offset size in token (O bit)
   7.128 -	jns	lzsa1ShortOfs
   7.129 +	js	lzsa1LongOfs
   7.130 +#ifndef FLAT32
   7.131 +	movb	$-1, %ah	// set offset bits 15-8 to 1
   7.132 +#endif
   7.133 +	lodsb
   7.134 +	.byte	0x3C		// mask lodsw with cmpb $0xAD, %al
   7.135 +lzsa1LongOfs:
   7.136  	lodsw
   7.137 -	.byte	0x3C		// mask lodsb with cmpb $0xAC, %al
   7.138 -lzsa1ShortOfs:
   7.139 -	lodsb
   7.140  	xchg	AX, BX		// %bx: match offset  %ax: original token
   7.141 -	movw	$MATCH_RUN_LEN*256+MIN_MATCH_SIZE, %cx
   7.142 +	movw	$MATCH_RUN_LEN+256*MIN_MATCH_SIZE, %cx
   7.143  	call	lzsa1len
   7.144  #ifdef RAW_FORMAT
   7.145  	jcxz	lzsa1quit	// bail if we hit EOD
   7.146  #endif
   7.147 -#if !defined(FLAT32) && !defined(FLAT16OUT)
   7.148 +
   7.149 +#if !defined(FLAT16OUT) && !defined(FLAT32)
   7.150 +	xchg	AX, SI		// save %si	
   7.151 +	lea	(BX,DI), SI
   7.152  	pushw	%ds
   7.153 +	movw	%es, %bp
   7.154 +	cmpw	%si, %di
   7.155 +	jnc	lzsa1sameSeg
   7.156  	pushw	%si
   7.157 -	movw	%di, %si
   7.158 -	addw	%bx, %si
   7.159 -	movw	%es, %ax
   7.160 -	jc	axok
   7.161 -	subb	$0x10, %ah
   7.162 -axok:
   7.163 -.macro norm	reg
   7.164 -	movw	%si, \reg
   7.165 -	subw	%si, %dx
   7.166 +	shrclw	$4, %si
   7.167 +	lea	-4096(%bp,%si), %bp
   7.168 +	popw	%si
   7.169  	andw	$0xF, %si
   7.170 -	addw	%si, %dx
   7.171 -	shrw	$4, \reg
   7.172 -	addw	\reg, %ax
   7.173 -	movw	%ax, %ds
   7.174 -	movw	%di, \reg
   7.175 -	andw	$0xF, %di
   7.176 -	shrw	$4, \reg
   7.177 -	movw	%es, %ax
   7.178 -	addw	\reg, %ax
   7.179 -	movw	%ax, %es
   7.180 -.endm 
   7.181 -	pushw	%dx
   7.182 -# if defined(NeedNormalize) || defined(PARANOIA)
   7.183 -	call	lzsa1movStr	// copy string
   7.184 -# else
   7.185 -	norm	%bp
   7.186 +lzsa1sameSeg:
   7.187 +	movw	%bp, %ds
   7.188 +# ifdef FASTFILL
   7.189 +	cmp	$-FASTFILL,BX
   7.190 +	jae	lzsa1fast
   7.191 +# endif
   7.192  	rep movsb
   7.193 -# endif
   7.194 -	popw	%dx
   7.195 -	popw	%si
   7.196 +lzsa1chunkz:
   7.197  	popw	%ds
   7.198  #else
   7.199 +# ifdef FASTFILL
   7.200 +	cmp	$-FASTFILL,BX
   7.201 +	jae	lzsa1fast
   7.202 +# endif
   7.203  	xchg	AX, SI		// save %si	
   7.204  	lea	(BX,DI), SI
   7.205  	rep movsb	%es:(SI), %es:(DI)
   7.206 +#define lzsa1chunkz lzsa1chunk
   7.207 +#endif
   7.208  	xchg	AX, SI		// restore %si	
   7.209 +	jmp	lzsa1chunk
   7.210 +#ifdef FASTFILL
   7.211 +lzsa1fast:
   7.212 +# if FASTFILL == 1
   7.213 +#  if !defined(FLAT16OUT) && !defined(FLAT32)
   7.214 +	lodsb
   7.215 +#  else
   7.216 +	movb	%es:(BX,DI), %al
   7.217 +#  endif
   7.218 +	rep stosb
   7.219 +# endif
   7.220 +# if FASTFILL == 2
   7.221 +#  if !defined(FLAT16OUT) && !defined(FLAT32)
   7.222 +	lodsw
   7.223 +#  else
   7.224 +	movw	%es:(BX,DI), %ax
   7.225 +#  endif
   7.226 +	je	lzsa1fastword
   7.227 +	movb	%ah, %al
   7.228 +lzsa1fastword:
   7.229 +	shr	$1, CX
   7.230 +	rep stosw
   7.231 +	jnc	lzsa1chunkz
   7.232 +	stosb
   7.233 +# endif
   7.234 +	jmp	lzsa1chunkz
   7.235  #endif
   7.236 -	jmp	lzsa1chunk
   7.237  
   7.238  lzsa1len:			// get length in %ecx
   7.239 -	andb	%ch, %al
   7.240 +	andb	%cl, %al
   7.241  	cbw			// clear %ah
   7.242 -	cmpb	%ch, %al
   7.243 -	jne	lzsa1minNumber	// S=0-6, L=0-14
   7.244 +	cmpb	%al, %cl
   7.245 +	jne	lzsa1minNumber	// S=0-6, L=0-14		%cx = %ch + %al   if (%al & %cl != %cl)
   7.246 +	addb	%al, %ch
   7.247  	lodsb
   7.248 -	addb	%ch, %cl
   7.249  lzsa1minNumber:
   7.250 -	addb	%cl, %al
   7.251 -	jnc	lzsa1gotNumber  // 0-255
   7.252 -	movb	%al, %ah	// S=256-1791, L=256-3839 or S=256-511, L=256-511
   7.253 +	addb	%ch, %al
   7.254 +	jnc	lzsa1gotNumber  // 0-255			%cx = %ch + %cl + byte   if (%al & %cl == %cl && %ch + %cl + byte < 0x100)
   7.255 +	movb	%al, %ah	// S=256-1791, L=256-4607 or S=256-511, L=256-511
   7.256  	jne	lzsa1midNumber
   7.257 -	lodsw			// 0-65535
   7.258 +	lodsw			// 0-65535			%cx = word   if (%al & %cl == %cl && %ch + %cl + byte == 0x100)
   7.259  	.byte	0x3C		// mask lodsb with cmpb $0xAC, %al
   7.260  lzsa1midNumber:
   7.261 -	lodsb
   7.262 +	lodsb			//				%cx = (%ch + %cl + byte)*256 + byte2   if (%al & %cl == %cl && %ch + %cl + byte > 0x100)
   7.263  lzsa1gotNumber:
   7.264  	xchgw	%ax, %cx
   7.265  lzsa1quit:
   7.266  	ret
   7.267 -
   7.268 -#if defined(NeedNormalize) || defined(PARANOIA)
   7.269 -# if defined(PARANOIA)
   7.270 -lzsa1movlp:
   7.271 -	decw	%ch
   7.272 -	rep movsb
   7.273 -	incw	%ch
   7.274 -# endif
   7.275 -normalize:
   7.276 -lzsa1movLit:
   7.277 -	movw	%ds, %ax
   7.278 -lzsa1movStr:
   7.279 -	norm	%bp
   7.280 -# if defined(PARANOIA)
   7.281 -	cmpb	$0xFF, %ch	// catch FFFX case
   7.282 -	je	lzsa1movlp
   7.283 -# endif
   7.284 -	rep movsb
   7.285 -	ret
   7.286 -#endif
     8.1 --- a/memtest/stuff/unlzsa2.S	Sat Jun 24 08:24:26 2023 +0000
     8.2 +++ b/memtest/stuff/unlzsa2.S	Tue Jul 11 10:40:23 2023 +0000
     8.3 @@ -5,7 +5,6 @@
     8.4  	.code16
     8.5  #define AX	%ax
     8.6  #define BX	%bx
     8.7 -#define BP	%bp
     8.8  #define SI	%si
     8.9  #define DI	%di
    8.10  #else
    8.11 @@ -14,7 +13,6 @@
    8.12  	.code32
    8.13  #define AX	%eax
    8.14  #define BX	%ebx
    8.15 -#define BP	%ebp
    8.16  #define SI	%esi
    8.17  #define DI	%edi
    8.18  #endif
    8.19 @@ -27,248 +25,243 @@
    8.20  #define PACKED_ONLY			// assume no copy block, optional
    8.21  //#define PARANOIA			// cover rare cases, optional
    8.22   
    8.23 +.macro	shrcl cnt,obj
    8.24 +#ifdef ONLY8086
    8.25 +	movb	\cnt, %cl
    8.26 +	shr	%cl, \obj
    8.27 +#else
    8.28 +	shr	\cnt, \obj
    8.29 +#endif
    8.30 +.endm
    8.31 +
    8.32 +#ifdef FLAT16OUT
    8.33 +#define RAW_FORMAT
    8.34 +#endif
    8.35  lzsa2main:
    8.36  #ifdef PARANOIA
    8.37  	cld
    8.38  #endif
    8.39 -#ifdef FLAT16OUT
    8.40 -#define RAW_FORMAT
    8.41 -#endif
    8.42  #ifndef RAW_FORMAT
    8.43 -# if defined(PARANOIA) && !defined(FLAT32) && !defined(FLAT16)
    8.44 -	xorw	%cx, %cx
    8.45 -	call	normalize
    8.46 -# endif
    8.47  # ifndef NO_LZSA2_HEADER
    8.48  	lodsw
    8.49  	cmpw	$0x9E7B, %ax	// magic
    8.50  	jne	lzsa2main
    8.51  	lodsb
    8.52 -	testb	$0x20, %al	// lzsa2
    8.53 -	je	lzsa2main
    8.54 +//	testb	$0x20, %al	// lzsa2
    8.55 +//	je	lzsa2main
    8.56 +# endif
    8.57 +	xorw	%ax, %ax
    8.58 +	cwd			// no nibble stored
    8.59 +	xchgw	%ax, %di
    8.60 +	shrcl	$4, %ax
    8.61 +	jmp	lzsa2blockz	// %di *MUST* be paragraph aligned
    8.62 +# ifndef PACKED_ONLY
    8.63 +lzsa2copy:
    8.64 +	movsb			// handle 64K case
    8.65 +	decw	%cx
    8.66 +	rep	movsb		// copy block
    8.67  # endif
    8.68  lzsa2block:			// uncompress chunk
    8.69 -# if !defined(FLAT32) && !defined(FLAT16)
    8.70 -	xorw	%cx, %cx
    8.71 -	call	normalize
    8.72 +	movw	$0x1000, %ax
    8.73 +lzsa2blockz:	
    8.74 +	movw	%es, %bx
    8.75 +	addw	%ax, %bx
    8.76 +	movw	%bx, %es
    8.77 +# ifndef FLAT16
    8.78 +	movw	%si, %ax
    8.79 +	andw	$0xf, %si
    8.80 +	shrcl	$4, %ax
    8.81 +	movw	%ds, %bx
    8.82 +	addw	%ax, %bx
    8.83 +	movw	%bx, %ds
    8.84  # endif
    8.85  	lodsw			// block size
    8.86  	xchgw	%ax, %cx
    8.87 +	movw	%cx, %bp
    8.88  	lodsb
    8.89  # ifndef PACKED_ONLY
    8.90  	orb	%al, %al
    8.91 -	jns	lzsa2compressed
    8.92 -#  if !defined(FLAT32) && !defined(FLAT16OUT)
    8.93 -	movw	%cx, %dx
    8.94 -	movb	$0, %cl
    8.95 -	movb	$0, %dh
    8.96 -copytail:
    8.97 -	call	lzsa1movStr
    8.98 -	xchg	%dx, %cx
    8.99 -	incw	%cx
   8.100 -	loop	copytail
   8.101 -#  else
   8.102 -	movsb			// copy block
   8.103 -copylp:
   8.104 -	movsb			// copy block
   8.105 -	loop	copylp		// handle 64K case
   8.106 -#  endif
   8.107 -	jmp	lzsa2block	// end of block
   8.108 -lzsa2compressed:
   8.109 -	jne	lzsa2chunk	// 64Kb block
   8.110 +	js	lzsa2copy
   8.111 +	jne	lzsa2full	// 64Kb block
   8.112  # endif
   8.113  	jcxz	lzsa2quit	// bail if we hit EOD
   8.114 -# if !defined(FLAT16)
   8.115 -	pushw	%cx
   8.116 -	xorw	%cx, %cx
   8.117 -	call	normalize
   8.118 -# define NeedNormalize
   8.119 -	popw	%dx
   8.120 -	addw	%si, %dx
   8.121 -# else
   8.122 -	movw	%si, %dx
   8.123 -	addw	%cx, %dx
   8.124 -# endif
   8.125 +lzsa2full:
   8.126 +	addw	%si, %bp
   8.127  #else
   8.128 -# if !defined(FLAT16)
   8.129 -	xorw	%cx, %cx
   8.130 -	call	normalize
   8.131 -# define NeedNormalize
   8.132 -# endif
   8.133 +	movb	$0, %dh		// no nibble stored
   8.134  #endif
   8.135 -	movb	$0, %bh		// no nibble stored
   8.136 +#ifdef FLAT32
   8.137 +	orl	$-1, %ebx	// set offset bits 31-16 to 1
   8.138 +#endif
   8.139  lzsa2chunk:			// uncompress chunk
   8.140  	lodsb			// get token XYZ|LL|MMM
   8.141 -	movb	%al, %bl	// keep token in bl
   8.142 +	pushw	%ax		// keep token
   8.143  	movw	$LITERALS_RUN_LEN+256*MIN_LITERALS_SIZE, %cx
   8.144  	shrb	%cl, %al	// shift literals length into place
   8.145  	call	lzsa2len	// %cl = LITERALS_RUN_LEN
   8.146 -#if defined(NeedNormalize)
   8.147 -	pushw	%bp
   8.148 -	call	lzsa2movLit	// copy %cx literals from %ds:%si to %es:%di
   8.149 -	popw	%bp
   8.150 -#else
   8.151  	rep	movsb		// copy %cx literals from %ds:%si to %es:%di
   8.152 +	popw	%ax		// restore token
   8.153 +#ifndef RAW_FORMAT
   8.154 +	cmpw	%bp, %si
   8.155 +	je	lzsa2block	// bail if we hit EOD
   8.156  #endif
   8.157 -#ifndef RAW_FORMAT
   8.158 -maxsi:
   8.159 -	cmpw	%dx, %si
   8.160 -	jae	lzsa2block	// bail if we hit EOD
   8.161 -#endif
   8.162 -#ifdef FLAT32
   8.163 -	orl	$-1, %eax	// set offset bits 31-8 to 1
   8.164 -#else
   8.165 -	movb	$-1, %ah	// set offset bits 15-8 to 1
   8.166 -#endif
   8.167 -// XYZ
   8.168 -	testb	$0xC0, %bl	// check match offset mode in token (X bit)
   8.169 -	bt	$5, %bx		// move bit 5 to carry
   8.170 -	js	rep_match_or_large_offset
   8.171 -	jne	offset_9_bit
   8.172 +	pushw	%ax		// save token
   8.173 +// Decode XYZ bits to SZC flags
   8.174 +	andb	$0xE0, %al	// filter XYZ
   8.175 +	movb	%al, %ah
   8.176 +	orb	$0xDF, %al
   8.177 +	incw	%ax
   8.178 +	sahf			// ah=SZ.A.P.C
   8.179 +	je	no_nibble_in_offset	// Y=1
   8.180 +
   8.181 +	call	getNibble       // get nibble for offset bits 0-3, kill %cl
   8.182 +	sahf
   8.183 +	rclb	$1, %al
   8.184 +	xorb	$0xE1, %al	// set offset bits 7-5 to 1
   8.185 +	sahf
   8.186 +	cbw			// set offset bits 15-8 to 1
   8.187  // 00Z 5-bit offset: read a nibble for offset bits 1-4 and use the inverted bit Z of the token as bit 0 of the offset.
   8.188  //                   set bits 5-15 of the offset to 1.
   8.189 -	call	getByteFromNibbleAndC
   8.190 -	jmp	get_match_length
   8.191 -offset_9_bit:
   8.192 -// 01Z 9-bit offset: read a byte for offset bits 0-7 and use the inverted bit Z for bit 8 of the offset.
   8.193 -//                   set bits 9-15 of the offset to 1.
   8.194 -	sbbb	%cl, %ah	// clear bit 8 if Z bit is clear
   8.195 -	jmp	get_match_length_0
   8.196 +	jns	get_match_length	// 5-bit offset
   8.197 +//10Z 13-bit offset: read a nibble for offset bits 9-12 and use the inverted bit Z for bit 8 of the offset,
   8.198 +//                   then read a byte for offset bits 0-7. set bits 13-15 of the offset to 1.
   8.199 +//                   substract 512 from the offset to get the final value.
   8.200 +	subb	$2, %al		// substract 512, clear C
   8.201 +	jmp	get_match_length_1
   8.202  
   8.203  getNibble:
   8.204 -	xorb	$0xF0, %bh	// toggle nibble stored flags
   8.205 -	movb	%bh, %al
   8.206 +	xorb	$0xF0, %dh	// toggle nibble stored flags
   8.207 +	movb	%dh, %al
   8.208  	jns	gotnibble
   8.209  	lodsb
   8.210 -	movb	$0xF0, %bh
   8.211 -	orb	%al, %bh
   8.212 -	shrb	$4, %al
   8.213 +	movb	$0xF0, %dh
   8.214 +	orb	%al, %dh
   8.215 +	shrcl	$4, %al
   8.216  gotnibble:
   8.217  lzsa2quit:
   8.218  	ret
   8.219  
   8.220 -rep_match_or_large_offset:
   8.221 -	jpe	rep_match_or_16_bit
   8.222 -//10Z 13-bit offset: read a nibble for offset bits 9-12 and use the inverted bit Z for bit 8 of the offset,
   8.223 -//                   then read a byte for offset bits 0-7. set bits 13-15 of the offset to 1.
   8.224 -//                   substract 512 from the offset to get the final value.
   8.225 -	call	getByteFromNibbleAndC
   8.226 -	subb	$2, %al		// substract 512
   8.227 -	jmp	get_match_length_1
   8.228 -rep_match_or_16_bit:
   8.229 -	jc	repeat_match	// rep-match
   8.230 +no_nibble_in_offset:
   8.231 +	movb	$-1, %ah	// set offset bits 15-8 to 1
   8.232 +	jns	offset_9_bit	// X=0 Y=1
   8.233 +	jc	repeat_match	// rep-match X=1 Y=1 Z=1
   8.234  //110 16-bit offset: read a byte for offset bits 8-15, then another byte for offset bits 0-7.
   8.235  	lodsb			// Get 2-byte match offset
   8.236  get_match_length_1:
   8.237  	xchgb	%al, %ah
   8.238 -get_match_length_0:
   8.239 +
   8.240 +offset_9_bit:	// Z=C
   8.241 +// 01Z 9-bit offset: read a byte for offset bits 0-7 and use the inverted bit Z for bit 8 of the offset.
   8.242 +//                   set bits 9-15 of the offset to 1.
   8.243 +	sbbb	%ch, %ah	// clear bit 8 if Z bit is clear (%ch == 0)
   8.244  	lodsb			// load match offset bits 0-7
   8.245  get_match_length:
   8.246 -	xchgw	%ax, %bp	// bp: offset
   8.247 +	xchgw	%ax, %bx	// bx: offset
   8.248  repeat_match:
   8.249  //111 repeat offset: reuse the offset value of the previous match command.
   8.250  
   8.251 -	movb	%bl, %al	// %al: original token
   8.252 +	popw	%ax		// restore original token in %al
   8.253  	movw	$MATCH_RUN_LEN+256*MIN_MATCH_SIZE, %cx
   8.254  	call	lzsa2len
   8.255 -#ifdef RAW_FORMAT
   8.256 -	jcxz	lzsa2quit	// bail if we hit EOD
   8.257 +#if !defined(ENHANCED_FORMAT) && defined(RAW_FORMAT)
   8.258 +	je	lzsa2quit	// bail if we hit EOD in (%si-2)
   8.259  #endif
   8.260 -#if !defined(FLAT32) && !defined(FLAT16OUT)
   8.261 +
   8.262 +#if !defined(FLAT16OUT) && !defined(FLAT32)
   8.263 +	xchg	AX, SI		// save %si	
   8.264 +	lea	(BX,DI), SI
   8.265  	pushw	%ds
   8.266 +# ifndef RAW_FORMAT
   8.267 +	pushw	%bp		// save end
   8.268 +# endif
   8.269 +	movw	%es, %bp
   8.270 +	cmpw	%si, %di
   8.271 +	jnc	lzsa2sameSeg
   8.272  	pushw	%si
   8.273 -	movw	%di, %si
   8.274 -	addw	%bp, %si
   8.275 -	movw	%es, %ax
   8.276 -	jc	axok
   8.277 -	subb	$0x10, %ah
   8.278 -axok:
   8.279 -.macro norm	reg
   8.280 -	movw	%si, \reg
   8.281 -	subw	%si, %dx
   8.282 +	shrcl	$4, %si
   8.283 +	lea	-4096(%bp,%si), %bp
   8.284 +	popw	%si
   8.285  	andw	$0xF, %si
   8.286 -	addw	%si, %dx
   8.287 -	shrw	$4, \reg
   8.288 -	addw	\reg, %ax
   8.289 -	movw	%ax, %ds
   8.290 -	movw	%di, \reg
   8.291 -	andw	$0xF, %di
   8.292 -	shrw	$4, \reg
   8.293 -	movw	%es, %ax
   8.294 -	addw	\reg, %ax
   8.295 -	movw	%ax, %es
   8.296 -.endm 
   8.297 -	pushw	%bp
   8.298 -	pushw	%dx
   8.299 -# if defined(NeedNormalize) || defined(PARANOIA)
   8.300 -	call	lzsa2movStr	// copy string
   8.301 -# else
   8.302 -	norm	%bp
   8.303 +lzsa2sameSeg:
   8.304 +	movw	%bp, %ds
   8.305 +# ifdef FASTFILL
   8.306 +	cmp	$-FASTFILL,BX
   8.307 +	jae	lzsa2fast
   8.308 +# endif
   8.309  	rep movsb
   8.310 +lzsa2chunkz:
   8.311 +# ifndef RAW_FORMAT
   8.312 +	popw	%bp		// restore end
   8.313  # endif
   8.314 -	popw	%dx
   8.315 -	popw	%bp
   8.316 -	popw	%si
   8.317  	popw	%ds
   8.318  #else
   8.319 +# ifdef FASTFILL
   8.320 +	cmp	$-FASTFILL,BX
   8.321 +	jae	lzsa2fast
   8.322 +# endif
   8.323  	xchg	AX, SI		// save %si	
   8.324 -	lea	(BP,DI), SI
   8.325 +	lea	(BX,DI), SI
   8.326  	rep movsb	%es:(SI), %es:(DI)
   8.327 +#define lzsa2chunkz lzsa2chunk
   8.328 +#endif
   8.329  	xchg	AX, SI		// restore %si	
   8.330 +	jmp	lzsa2chunk
   8.331 +#ifdef FASTFILL
   8.332 +lzsa2fast:
   8.333 +# if FASTFILL == 1
   8.334 +#  if !defined(FLAT16OUT) && !defined(FLAT32)
   8.335 +	lodsb
   8.336 +#  else
   8.337 +	movb	%es:(BX,DI), %al
   8.338 +#  endif
   8.339 +	rep stosb
   8.340 +# endif
   8.341 +# if FASTFILL == 2
   8.342 +#  if !defined(FLAT16OUT) && !defined(FLAT32)
   8.343 +	lodsw
   8.344 +#  else
   8.345 +	movw	%es:(BX,DI), %ax
   8.346 +#  endif
   8.347 +	je	lzsa2fastword
   8.348 +	movb	%ah, %al
   8.349 +lzsa2fastword:
   8.350 +	shr	$1, CX
   8.351 +	rep stosw
   8.352 +	jnc	lzsa2chunkz
   8.353 +	stosb
   8.354 +# endif
   8.355 +	jmp	lzsa2chunkz
   8.356  #endif
   8.357 -	jmp	lzsa2chunk
   8.358 -
   8.359 -getByteFromNibbleAndC:
   8.360 -	pushfw
   8.361 -	call	getNibble	// get nibble for offset bits 0-3
   8.362 -	popfw
   8.363 -	rclb	$1, %al
   8.364 -	xorb	$0xE1, %al	// set offset bits 7-5 to 1
   8.365 -	ret
   8.366  
   8.367  lzsa2len:			// get length in %cx
   8.368  	andb	%cl, %al
   8.369  	cbw			// clear %ah
   8.370  	cmpb	%al, %cl
   8.371 -	jne	lzsa2minNumber	// S=0-2, L=0-6
   8.372 -	call	getNibble
   8.373 +	jne	lzsa2minNumber	// S=0-2, L=0-6			%cx = %ch + %al   if (%al & %cl != %cl)
   8.374 +	addb	%al, %ch
   8.375 +	call	getNibble	// kill %cl
   8.376  	cmp	$0xF, %al
   8.377 -	jne	lzsa2noExtraByte
   8.378 +	jne	lzsa2minNumber	//				%cx = %ch + %cl + nibble   if (%al & %cl == %cl && nibble != 0xF)
   8.379  	addb	%al, %ch
   8.380  	lodsb
   8.381 -lzsa2noExtraByte:
   8.382 -	addb	%cl, %ch
   8.383  lzsa2minNumber:
   8.384  	addb	%ch, %al
   8.385 -	jnc	lzsa2gotNumber  // 0-255
   8.386 -#if 0
   8.387 -	je	lzsa2BigNumber
   8.388 -	movb	%al, %ah	// S=256-767, L=256-1791
   8.389 -	lodsb	
   8.390 +	jnc	lzsa2gotNumber  // 0-255			%cx = %ch + %cl + 0xF + byte   if (%al & %cl == %cl && nibble == 0xF && %ch + %cl + 0xF + byte < 0x100)
   8.391 +#ifdef ENHANCED_FORMAT
   8.392 +	decw	%ax
   8.393 +	je	lzsa2maxNumber
   8.394 +# ifdef RAW_FORMAT
   8.395 +	jns	lzsa2midNumber
   8.396 +	popw	%ax
   8.397 +	ret			// bail if we hit EOD
   8.398 +lzsa2midNumber:
   8.399 +# endif
   8.400 +	xchgb	%al, %ah	// S=256-4351, L=256-5887
   8.401 +	lodsb			//				%cx = (%ch + %cl + 0xE + byte)*256 + byte2   if (%al & %cl == %cl && nibble == 0xF && %ch + %cl + 0xF + byte > 0x100)
   8.402  	.byte	0xB1		// mask lodsw with movb $0xAD, %cl
   8.403 -lzsa2BigNumber:
   8.404 +lzsa2maxNumber:
   8.405  #endif
   8.406 -	lodsw			// 0-65535
   8.407 +	lodsw			// 0-65535			%cx = word   if (%al & %cl == %cl && nibble == 0xF && %ch + %cl + 0xF + byte == 0x100)
   8.408  lzsa2gotNumber:
   8.409  	xchgw	%ax, %cx
   8.410  	ret
   8.411 -
   8.412 -#if defined(NeedNormalize) || defined(PARANOIA)
   8.413 -# if defined(PARANOIA)
   8.414 -lzsa2movlp:
   8.415 -	decw	%ch
   8.416 -	rep movsb
   8.417 -	incw	%ch
   8.418 -# endif
   8.419 -normalize:
   8.420 -lzsa2movLit:
   8.421 -	movw	%ds, %ax
   8.422 -lzsa2movStr:
   8.423 -	norm	%bp
   8.424 -# if defined(PARANOIA)
   8.425 -	cmpb	$0xFF, %ch	// catch FFFX case
   8.426 -	je	lzsa2movlp
   8.427 -# endif
   8.428 -	rep movsb
   8.429 -	ret
   8.430 -#endif
     9.1 --- a/memtest64/stuff/unlz4.S	Sat Jun 24 08:24:26 2023 +0000
     9.2 +++ b/memtest64/stuff/unlz4.S	Tue Jul 11 10:40:23 2023 +0000
     9.3 @@ -19,6 +19,16 @@
     9.4  #define DI	%edi
     9.5  #endif
     9.6   
     9.7 +#if defined(FLAT16OUT) || defined(ONLY8086)
     9.8 +#define cAX	%ax
     9.9 +#define cCX	%cx
    9.10 +#define cDX	%dx
    9.11 +#else
    9.12 +#define cAX	%eax
    9.13 +#define cCX	%ecx
    9.14 +#define cDX	%edx
    9.15 +#endif
    9.16 +
    9.17  #define ARCHIVE_MAGICNUMBER 0x184C2102
    9.18  
    9.19  //#define PARANOIA			// cover rare cases, optional
    9.20 @@ -31,28 +41,72 @@
    9.21  	call	lz4mov
    9.22  # endif
    9.23  #endif
    9.24 +#if defined(FLAT16OUT) || defined(ONLY8086)
    9.25 +	lodsw			// get chunkSize
    9.26 +# ifndef NO_LZ4_HEADER
    9.27 +	cmpw	$ARCHIVE_MAGICNUMBER&0xFFFF, %ax
    9.28 +# endif
    9.29 +	xchg	%ax, %dx
    9.30 +	lodsw
    9.31 +# ifndef NO_LZ4_HEADER
    9.32 +	jne	chkeof
    9.33 +	cmpw	$ARCHIVE_MAGICNUMBER>>16, %ax
    9.34 +	je	lz4main
    9.35 +chkeof:	
    9.36 +# endif
    9.37 +# ifdef PARANOIA
    9.38 +	orw	%ax, %dx	// end of file ?
    9.39 +	je	lz4quit
    9.40 +# endif
    9.41 +# ifndef FLAT16OUT
    9.42 +	xchgw	%ax, %bp
    9.43 +	subw	$1, %dx
    9.44 +	sbbw	$0, %bp
    9.45 +# endif
    9.46 +#else
    9.47  	lodsl			// get chunkSize
    9.48 -#ifndef NO_LZ4_HEADER
    9.49 +# ifndef NO_LZ4_HEADER
    9.50  	cmpl	$ARCHIVE_MAGICNUMBER, %eax
    9.51  	je	lz4main
    9.52 -#endif
    9.53 +# endif
    9.54 +# ifdef PARANOIA
    9.55  	orl	%eax, %eax	// end of file ?
    9.56  	je	lz4quit
    9.57 +# endif
    9.58  	xchgl	%eax, %edx
    9.59 +#endif
    9.60  lz4chunk:			// uncompress chunk
    9.61  	lodsb			// get token
    9.62 -	movb	%al, %bl
    9.63 +	pushw	%ax
    9.64 +#ifdef ONLY8086
    9.65 +	movb	$4, %cl
    9.66 +	shrb	%cl, %al
    9.67 +#else
    9.68  	shrb	$4, %al
    9.69 +#endif
    9.70  	call	lz4len		// get literal length
    9.71 -	subl	%ecx, %edx	// count literal
    9.72 +#if !defined(FLAT16OUT) && defined(ONLY8086)
    9.73 +	subw	%cx, %dx	// count literal
    9.74 +	sbbw	$0, %bp
    9.75 +#else
    9.76 +	sub	cCX, cDX	// count literal
    9.77 +#endif
    9.78  #if !defined(FLAT32) && !defined(FLAT16OUT) && (!defined(FLAT16) || !defined(PARANOIA))
    9.79  #define NeedLz4mov
    9.80  	call	lz4mov		// copy literals
    9.81  #else
    9.82  	rep movsb
    9.83  #endif
    9.84 -	subl	$1+2, %edx	// count token & string address
    9.85 -	jle	lz4main
    9.86 +	popw	%bx
    9.87 +#if !defined(FLAT16OUT) && defined(ONLY8086)
    9.88 +	subw	$1+2, %dx	// count token & string address
    9.89 +	sbbw	$0, %bp
    9.90 +	jb	lz4quit
    9.91 +lz4cont:
    9.92 +#else
    9.93 +	sub	$1+2, cDX	// count token & string address
    9.94 +	jbe	lz4quit
    9.95 +#endif
    9.96  	lodsw			// get string address
    9.97  	xchg	AX, BX
    9.98  	call	lz4len		// get string length
    9.99 @@ -69,18 +123,29 @@
   9.100  .macro norm	reg
   9.101  	movw	%si, \reg
   9.102  	andw	$0xF, %si
   9.103 +# ifdef ONLY8086
   9.104 +	pushw	%cx
   9.105 +	movb	$4, %cl
   9.106 +	shrw	%cl, \reg
   9.107 +# else
   9.108  	shrw	$4, \reg
   9.109 +# endif
   9.110  	addw	\reg, %ax
   9.111  	movw	%ax, %ds
   9.112  	movw	%di, \reg
   9.113  	andw	$0xF, %di
   9.114 +# ifdef ONLY8086
   9.115 +	shrw	%cl, \reg
   9.116 +	popw	%cx
   9.117 +# else
   9.118  	shrw	$4, \reg
   9.119 +# endif
   9.120  	movw	%es, %ax
   9.121  	addw	\reg, %ax
   9.122  	movw	%ax, %es
   9.123  .endm 
   9.124  # if !defined (NeedLz4mov)
   9.125 -	norm	%bp
   9.126 +	norm	%bx
   9.127  	rep movsb
   9.128  # else
   9.129  	call	lz4movStr	// copy string
   9.130 @@ -88,13 +153,35 @@
   9.131  	popw	%si
   9.132  	popw	%ds
   9.133  #else
   9.134 +# ifdef FASTFILL
   9.135 +	cmp	$FASTFILL,BX
   9.136 +	jbe	lz4fast
   9.137 +# endif
   9.138 +lz4notfast:
   9.139  	xchg	AX, SI
   9.140  	mov	DI, SI
   9.141  	sub	BX, SI
   9.142  	rep movsb %es:(SI), %es:(DI)
   9.143  	xchg	AX, SI
   9.144 +# ifdef FASTFILL
   9.145 +lz4fast:
   9.146 +#  if FASTFILL == 1
   9.147 +	movb	%es:-1(DI), %al
   9.148 +	rep stosb
   9.149 +#  endif
   9.150 +#  if FASTFILL >= 2
   9.151 +	movw	%es:-2(DI), %ax
   9.152 +	je	lz4fastword
   9.153 +	movb	%al, %ah
   9.154 +lz4fastword:
   9.155 +	shr	$1, CX
   9.156 +	rep stosw
   9.157 +	jnc	lz4chunk
   9.158 +	stosb
   9.159 +#  endif
   9.160 +# endif
   9.161 +	jmp	lz4chunk
   9.162  #endif
   9.163 -	jmp	lz4chunk
   9.164  
   9.165  #if defined(NeedLz4mov)
   9.166  # if defined(PARANOIA)
   9.167 @@ -108,7 +195,7 @@
   9.168  lz4mov:
   9.169  	movw	%ds, %ax
   9.170  lz4movStr:
   9.171 -	norm	%bp
   9.172 +	norm	%bx
   9.173  # if defined(PARANOIA)
   9.174  	cmp	$0xFF, %ch	// catch FFFX case
   9.175  	jz	lz4movlp
   9.176 @@ -118,14 +205,19 @@
   9.177  #endif
   9.178  
   9.179  lz4len:				// get length in %ecx
   9.180 -	andl	$0xF, %eax
   9.181 -	movl	%eax, %ecx
   9.182 +	and	$0xF, cAX
   9.183 +	mov	cAX, cCX
   9.184  	cmpb	$0xF, %al
   9.185  	jne	lz4quit
   9.186  lz4len2:
   9.187  	lodsb
   9.188 -	decl	%edx		// remaining chunk size
   9.189 -	addw	%ax, %cx
   9.190 +#if !defined(FLAT16OUT) && defined(ONLY8086)
   9.191 +	subw	$1, %dx		// remaining chunk size
   9.192 +	sbbw	$0, %bp
   9.193 +#else
   9.194 +	dec	cDX		// remaining chunk size
   9.195 +#endif
   9.196 +	add	AX, CX
   9.197  	cmpb	$0xFF, %al
   9.198  	je	lz4len2
   9.199  lz4quit:
    10.1 --- a/memtest64/stuff/unlzsa1.S	Sat Jun 24 08:24:26 2023 +0000
    10.2 +++ b/memtest64/stuff/unlzsa1.S	Tue Jul 11 10:40:23 2023 +0000
    10.3 @@ -25,173 +25,175 @@
    10.4  #define PACKED_ONLY			// assume no copy block, optional
    10.5  //#define PARANOIA			// cover rare cases, optional
    10.6   
    10.7 +.macro	shrclw cnt,obj
    10.8 +#ifdef ONLY8086
    10.9 +	movb	\cnt, %cl
   10.10 +	shrw	%cl, \obj
   10.11 +#else
   10.12 +	shrw	\cnt, \obj
   10.13 +#endif
   10.14 +.endm
   10.15 +
   10.16 +#ifdef FLAT16OUT
   10.17 +#define RAW_FORMAT
   10.18 +#endif
   10.19  lzsa1main:
   10.20  #ifdef PARANOIA
   10.21  	cld
   10.22  #endif
   10.23 -#ifdef FLAT16OUT
   10.24 -#define RAW_FORMAT
   10.25 -#endif
   10.26  #ifndef RAW_FORMAT
   10.27 -# if defined(PARANOIA) && !defined(FLAT32) && !defined(FLAT16)
   10.28 -	xorw	%cx, %cx
   10.29 -	call	normalize
   10.30 -# endif
   10.31  # ifndef NO_LZSA1_HEADER
   10.32  	lodsw
   10.33  	cmpw	$0x9E7B, %ax	// magic
   10.34  	jne	lzsa1main
   10.35  	lodsb
   10.36 -	cmpb	$0, %al		// lzsa1
   10.37 -	jne	lzsa1main
   10.38 +//	cmpb	$0, %al		// lzsa1
   10.39 +//	jne	lzsa1main
   10.40 +# endif
   10.41 +	xorw	%ax, %ax
   10.42 +	xchgw	%ax, %di
   10.43 +	shrclw	$4, %ax
   10.44 +	jmp	lzsa1blockz	// %di *MUST* be paragraph aligned
   10.45 +# ifndef PACKED_ONLY
   10.46 +lzsa1copy:
   10.47 +	movsb			// handle 64K case
   10.48 +	decw	%cx
   10.49 +	rep	movsb		// copy block
   10.50  # endif
   10.51  lzsa1block:			// uncompress chunk
   10.52 +	movw	$0x1000, %ax
   10.53 +lzsa1blockz:	
   10.54 +	movw	%es, %bx
   10.55 +	addw	%ax, %bx
   10.56 +	movw	%bx, %es
   10.57 +# ifndef FLAT16
   10.58 +	movw	%si, %ax
   10.59 +	andw	$0xf, %si
   10.60 +	shrclw	$4, %ax
   10.61 +	movw	%ds, %bx
   10.62 +	addw	%ax, %bx
   10.63 +	movw	%bx, %ds
   10.64 +# endif
   10.65  	lodsw			// block size
   10.66  	xchgw	%ax, %cx
   10.67 +	movw	%cx, %dx
   10.68  	lodsb
   10.69  # ifndef PACKED_ONLY
   10.70  	orb	%al, %al
   10.71 -	jns	lzsa1compressed
   10.72 -#  if !defined(FLAT32) && !defined(FLAT16OUT)
   10.73 -	movw	%cx, %dx
   10.74 -	movb	$0, %cl
   10.75 -	movb	$0, %dh
   10.76 -copytail:
   10.77 -	call	lzsa1movStr
   10.78 -	xchg	%dx, %cx
   10.79 -	incw	%cx
   10.80 -	loop	copytail
   10.81 -#  else
   10.82 -	movsb			// copy block
   10.83 -copylp:
   10.84 -	movsb			// copy block
   10.85 -	loop	copylp		// handle 64K case
   10.86 -#  endif
   10.87 -	jmp	lzsa1block	// end of block
   10.88 -lzsa1compressed:
   10.89 -	jne	lzsa1chunk	// 64Kb block
   10.90 +	js	lzsa1copy
   10.91 +	jne	lzsa1full	// 64Kb block
   10.92  # endif
   10.93  	jcxz	lzsa1quit	// bail if we hit EOD
   10.94 -	pushw	%cx
   10.95 -# if !defined(FLAT32) && !defined(FLAT16)
   10.96 -	xorw	%cx, %cx
   10.97 -	call	normalize
   10.98 -# define NeedNormalize
   10.99 -# endif
  10.100 -	popw	%dx
  10.101 +lzsa1full:
  10.102  	addw	%si, %dx
  10.103  #endif
  10.104  lzsa1chunk:			// uncompress chunk
  10.105  	lodsb			// get token O|LLL|MMMM
  10.106  	movb	%al, %bl	// keep token in bl
  10.107 -	shrb	$4, %al		// shift literals length into place
  10.108 -	movw	$LITERALS_RUN_LEN*256+MIN_LITERALS_SIZE, %cx
  10.109 +	shrclw	$4, %ax		// shift literals length into place
  10.110 +	movw	$LITERALS_RUN_LEN+256*MIN_LITERALS_SIZE, %cx
  10.111  	call	lzsa1len	// %ch = LITERALS_RUN_LEN
  10.112 -#if defined(NeedNormalize)
  10.113 -	call	lzsa1movLit	// copy %cx literals from %ds:%si to %es:%di
  10.114 -#else
  10.115  	rep	movsb		// copy %cx literals from %ds:%si to %es:%di
  10.116 -#endif
  10.117  #ifndef RAW_FORMAT
  10.118  	cmpw	%dx, %si
  10.119 -	jae	lzsa1block	// bail if we hit EOD
  10.120 +	je	lzsa1block	// bail if we hit EOD
  10.121  #endif
  10.122  #ifdef FLAT32
  10.123  	orl	$-1, %eax
  10.124 -#else
  10.125 -	movb	$-1, %ah
  10.126  #endif
  10.127  	testb	%bl, %bl	// check match offset size in token (O bit)
  10.128 -	jns	lzsa1ShortOfs
  10.129 +	js	lzsa1LongOfs
  10.130 +#ifndef FLAT32
  10.131 +	movb	$-1, %ah	// set offset bits 15-8 to 1
  10.132 +#endif
  10.133 +	lodsb
  10.134 +	.byte	0x3C		// mask lodsw with cmpb $0xAD, %al
  10.135 +lzsa1LongOfs:
  10.136  	lodsw
  10.137 -	.byte	0x3C		// mask lodsb with cmpb $0xAC, %al
  10.138 -lzsa1ShortOfs:
  10.139 -	lodsb
  10.140  	xchg	AX, BX		// %bx: match offset  %ax: original token
  10.141 -	movw	$MATCH_RUN_LEN*256+MIN_MATCH_SIZE, %cx
  10.142 +	movw	$MATCH_RUN_LEN+256*MIN_MATCH_SIZE, %cx
  10.143  	call	lzsa1len
  10.144  #ifdef RAW_FORMAT
  10.145  	jcxz	lzsa1quit	// bail if we hit EOD
  10.146  #endif
  10.147 -#if !defined(FLAT32) && !defined(FLAT16OUT)
  10.148 +
  10.149 +#if !defined(FLAT16OUT) && !defined(FLAT32)
  10.150 +	xchg	AX, SI		// save %si	
  10.151 +	lea	(BX,DI), SI
  10.152  	pushw	%ds
  10.153 +	movw	%es, %bp
  10.154 +	cmpw	%si, %di
  10.155 +	jnc	lzsa1sameSeg
  10.156  	pushw	%si
  10.157 -	movw	%di, %si
  10.158 -	addw	%bx, %si
  10.159 -	movw	%es, %ax
  10.160 -	jc	axok
  10.161 -	subb	$0x10, %ah
  10.162 -axok:
  10.163 -.macro norm	reg
  10.164 -	movw	%si, \reg
  10.165 -	subw	%si, %dx
  10.166 +	shrclw	$4, %si
  10.167 +	lea	-4096(%bp,%si), %bp
  10.168 +	popw	%si
  10.169  	andw	$0xF, %si
  10.170 -	addw	%si, %dx
  10.171 -	shrw	$4, \reg
  10.172 -	addw	\reg, %ax
  10.173 -	movw	%ax, %ds
  10.174 -	movw	%di, \reg
  10.175 -	andw	$0xF, %di
  10.176 -	shrw	$4, \reg
  10.177 -	movw	%es, %ax
  10.178 -	addw	\reg, %ax
  10.179 -	movw	%ax, %es
  10.180 -.endm 
  10.181 -	pushw	%dx
  10.182 -# if defined(NeedNormalize) || defined(PARANOIA)
  10.183 -	call	lzsa1movStr	// copy string
  10.184 -# else
  10.185 -	norm	%bp
  10.186 +lzsa1sameSeg:
  10.187 +	movw	%bp, %ds
  10.188 +# ifdef FASTFILL
  10.189 +	cmp	$-FASTFILL,BX
  10.190 +	jae	lzsa1fast
  10.191 +# endif
  10.192  	rep movsb
  10.193 -# endif
  10.194 -	popw	%dx
  10.195 -	popw	%si
  10.196 +lzsa1chunkz:
  10.197  	popw	%ds
  10.198  #else
  10.199 +# ifdef FASTFILL
  10.200 +	cmp	$-FASTFILL,BX
  10.201 +	jae	lzsa1fast
  10.202 +# endif
  10.203  	xchg	AX, SI		// save %si	
  10.204  	lea	(BX,DI), SI
  10.205  	rep movsb	%es:(SI), %es:(DI)
  10.206 +#define lzsa1chunkz lzsa1chunk
  10.207 +#endif
  10.208  	xchg	AX, SI		// restore %si	
  10.209 +	jmp	lzsa1chunk
  10.210 +#ifdef FASTFILL
  10.211 +lzsa1fast:
  10.212 +# if FASTFILL == 1
  10.213 +#  if !defined(FLAT16OUT) && !defined(FLAT32)
  10.214 +	lodsb
  10.215 +#  else
  10.216 +	movb	%es:(BX,DI), %al
  10.217 +#  endif
  10.218 +	rep stosb
  10.219 +# endif
  10.220 +# if FASTFILL == 2
  10.221 +#  if !defined(FLAT16OUT) && !defined(FLAT32)
  10.222 +	lodsw
  10.223 +#  else
  10.224 +	movw	%es:(BX,DI), %ax
  10.225 +#  endif
  10.226 +	je	lzsa1fastword
  10.227 +	movb	%ah, %al
  10.228 +lzsa1fastword:
  10.229 +	shr	$1, CX
  10.230 +	rep stosw
  10.231 +	jnc	lzsa1chunkz
  10.232 +	stosb
  10.233 +# endif
  10.234 +	jmp	lzsa1chunkz
  10.235  #endif
  10.236 -	jmp	lzsa1chunk
  10.237  
  10.238  lzsa1len:			// get length in %ecx
  10.239 -	andb	%ch, %al
  10.240 +	andb	%cl, %al
  10.241  	cbw			// clear %ah
  10.242 -	cmpb	%ch, %al
  10.243 -	jne	lzsa1minNumber	// S=0-6, L=0-14
  10.244 +	cmpb	%al, %cl
  10.245 +	jne	lzsa1minNumber	// S=0-6, L=0-14		%cx = %ch + %al   if (%al & %cl != %cl)
  10.246 +	addb	%al, %ch
  10.247  	lodsb
  10.248 -	addb	%ch, %cl
  10.249  lzsa1minNumber:
  10.250 -	addb	%cl, %al
  10.251 -	jnc	lzsa1gotNumber  // 0-255
  10.252 -	movb	%al, %ah	// S=256-1791, L=256-3839 or S=256-511, L=256-511
  10.253 +	addb	%ch, %al
  10.254 +	jnc	lzsa1gotNumber  // 0-255			%cx = %ch + %cl + byte   if (%al & %cl == %cl && %ch + %cl + byte < 0x100)
  10.255 +	movb	%al, %ah	// S=256-1791, L=256-4607 or S=256-511, L=256-511
  10.256  	jne	lzsa1midNumber
  10.257 -	lodsw			// 0-65535
  10.258 +	lodsw			// 0-65535			%cx = word   if (%al & %cl == %cl && %ch + %cl + byte == 0x100)
  10.259  	.byte	0x3C		// mask lodsb with cmpb $0xAC, %al
  10.260  lzsa1midNumber:
  10.261 -	lodsb
  10.262 +	lodsb			//				%cx = (%ch + %cl + byte)*256 + byte2   if (%al & %cl == %cl && %ch + %cl + byte > 0x100)
  10.263  lzsa1gotNumber:
  10.264  	xchgw	%ax, %cx
  10.265  lzsa1quit:
  10.266  	ret
  10.267 -
  10.268 -#if defined(NeedNormalize) || defined(PARANOIA)
  10.269 -# if defined(PARANOIA)
  10.270 -lzsa1movlp:
  10.271 -	decw	%ch
  10.272 -	rep movsb
  10.273 -	incw	%ch
  10.274 -# endif
  10.275 -normalize:
  10.276 -lzsa1movLit:
  10.277 -	movw	%ds, %ax
  10.278 -lzsa1movStr:
  10.279 -	norm	%bp
  10.280 -# if defined(PARANOIA)
  10.281 -	cmpb	$0xFF, %ch	// catch FFFX case
  10.282 -	je	lzsa1movlp
  10.283 -# endif
  10.284 -	rep movsb
  10.285 -	ret
  10.286 -#endif
    11.1 --- a/memtest64/stuff/unlzsa2.S	Sat Jun 24 08:24:26 2023 +0000
    11.2 +++ b/memtest64/stuff/unlzsa2.S	Tue Jul 11 10:40:23 2023 +0000
    11.3 @@ -5,7 +5,6 @@
    11.4  	.code16
    11.5  #define AX	%ax
    11.6  #define BX	%bx
    11.7 -#define BP	%bp
    11.8  #define SI	%si
    11.9  #define DI	%di
   11.10  #else
   11.11 @@ -14,7 +13,6 @@
   11.12  	.code32
   11.13  #define AX	%eax
   11.14  #define BX	%ebx
   11.15 -#define BP	%ebp
   11.16  #define SI	%esi
   11.17  #define DI	%edi
   11.18  #endif
   11.19 @@ -27,248 +25,243 @@
   11.20  #define PACKED_ONLY			// assume no copy block, optional
   11.21  //#define PARANOIA			// cover rare cases, optional
   11.22   
   11.23 +.macro	shrcl cnt,obj
   11.24 +#ifdef ONLY8086
   11.25 +	movb	\cnt, %cl
   11.26 +	shr	%cl, \obj
   11.27 +#else
   11.28 +	shr	\cnt, \obj
   11.29 +#endif
   11.30 +.endm
   11.31 +
   11.32 +#ifdef FLAT16OUT
   11.33 +#define RAW_FORMAT
   11.34 +#endif
   11.35  lzsa2main:
   11.36  #ifdef PARANOIA
   11.37  	cld
   11.38  #endif
   11.39 -#ifdef FLAT16OUT
   11.40 -#define RAW_FORMAT
   11.41 -#endif
   11.42  #ifndef RAW_FORMAT
   11.43 -# if defined(PARANOIA) && !defined(FLAT32) && !defined(FLAT16)
   11.44 -	xorw	%cx, %cx
   11.45 -	call	normalize
   11.46 -# endif
   11.47  # ifndef NO_LZSA2_HEADER
   11.48  	lodsw
   11.49  	cmpw	$0x9E7B, %ax	// magic
   11.50  	jne	lzsa2main
   11.51  	lodsb
   11.52 -	testb	$0x20, %al	// lzsa2
   11.53 -	je	lzsa2main
   11.54 +//	testb	$0x20, %al	// lzsa2
   11.55 +//	je	lzsa2main
   11.56 +# endif
   11.57 +	xorw	%ax, %ax
   11.58 +	cwd			// no nibble stored
   11.59 +	xchgw	%ax, %di
   11.60 +	shrcl	$4, %ax
   11.61 +	jmp	lzsa2blockz	// %di *MUST* be paragraph aligned
   11.62 +# ifndef PACKED_ONLY
   11.63 +lzsa2copy:
   11.64 +	movsb			// handle 64K case
   11.65 +	decw	%cx
   11.66 +	rep	movsb		// copy block
   11.67  # endif
   11.68  lzsa2block:			// uncompress chunk
   11.69 -# if !defined(FLAT32) && !defined(FLAT16)
   11.70 -	xorw	%cx, %cx
   11.71 -	call	normalize
   11.72 +	movw	$0x1000, %ax
   11.73 +lzsa2blockz:	
   11.74 +	movw	%es, %bx
   11.75 +	addw	%ax, %bx
   11.76 +	movw	%bx, %es
   11.77 +# ifndef FLAT16
   11.78 +	movw	%si, %ax
   11.79 +	andw	$0xf, %si
   11.80 +	shrcl	$4, %ax
   11.81 +	movw	%ds, %bx
   11.82 +	addw	%ax, %bx
   11.83 +	movw	%bx, %ds
   11.84  # endif
   11.85  	lodsw			// block size
   11.86  	xchgw	%ax, %cx
   11.87 +	movw	%cx, %bp
   11.88  	lodsb
   11.89  # ifndef PACKED_ONLY
   11.90  	orb	%al, %al
   11.91 -	jns	lzsa2compressed
   11.92 -#  if !defined(FLAT32) && !defined(FLAT16OUT)
   11.93 -	movw	%cx, %dx
   11.94 -	movb	$0, %cl
   11.95 -	movb	$0, %dh
   11.96 -copytail:
   11.97 -	call	lzsa1movStr
   11.98 -	xchg	%dx, %cx
   11.99 -	incw	%cx
  11.100 -	loop	copytail
  11.101 -#  else
  11.102 -	movsb			// copy block
  11.103 -copylp:
  11.104 -	movsb			// copy block
  11.105 -	loop	copylp		// handle 64K case
  11.106 -#  endif
  11.107 -	jmp	lzsa2block	// end of block
  11.108 -lzsa2compressed:
  11.109 -	jne	lzsa2chunk	// 64Kb block
  11.110 +	js	lzsa2copy
  11.111 +	jne	lzsa2full	// 64Kb block
  11.112  # endif
  11.113  	jcxz	lzsa2quit	// bail if we hit EOD
  11.114 -# if !defined(FLAT16)
  11.115 -	pushw	%cx
  11.116 -	xorw	%cx, %cx
  11.117 -	call	normalize
  11.118 -# define NeedNormalize
  11.119 -	popw	%dx
  11.120 -	addw	%si, %dx
  11.121 -# else
  11.122 -	movw	%si, %dx
  11.123 -	addw	%cx, %dx
  11.124 -# endif
  11.125 +lzsa2full:
  11.126 +	addw	%si, %bp
  11.127  #else
  11.128 -# if !defined(FLAT16)
  11.129 -	xorw	%cx, %cx
  11.130 -	call	normalize
  11.131 -# define NeedNormalize
  11.132 -# endif
  11.133 +	movb	$0, %dh		// no nibble stored
  11.134  #endif
  11.135 -	movb	$0, %bh		// no nibble stored
  11.136 +#ifdef FLAT32
  11.137 +	orl	$-1, %ebx	// set offset bits 31-16 to 1
  11.138 +#endif
  11.139  lzsa2chunk:			// uncompress chunk
  11.140  	lodsb			// get token XYZ|LL|MMM
  11.141 -	movb	%al, %bl	// keep token in bl
  11.142 +	pushw	%ax		// keep token
  11.143  	movw	$LITERALS_RUN_LEN+256*MIN_LITERALS_SIZE, %cx
  11.144  	shrb	%cl, %al	// shift literals length into place
  11.145  	call	lzsa2len	// %cl = LITERALS_RUN_LEN
  11.146 -#if defined(NeedNormalize)
  11.147 -	pushw	%bp
  11.148 -	call	lzsa2movLit	// copy %cx literals from %ds:%si to %es:%di
  11.149 -	popw	%bp
  11.150 -#else
  11.151  	rep	movsb		// copy %cx literals from %ds:%si to %es:%di
  11.152 +	popw	%ax		// restore token
  11.153 +#ifndef RAW_FORMAT
  11.154 +	cmpw	%bp, %si
  11.155 +	je	lzsa2block	// bail if we hit EOD
  11.156  #endif
  11.157 -#ifndef RAW_FORMAT
  11.158 -maxsi:
  11.159 -	cmpw	%dx, %si
  11.160 -	jae	lzsa2block	// bail if we hit EOD
  11.161 -#endif
  11.162 -#ifdef FLAT32
  11.163 -	orl	$-1, %eax	// set offset bits 31-8 to 1
  11.164 -#else
  11.165 -	movb	$-1, %ah	// set offset bits 15-8 to 1
  11.166 -#endif
  11.167 -// XYZ
  11.168 -	testb	$0xC0, %bl	// check match offset mode in token (X bit)
  11.169 -	bt	$5, %bx		// move bit 5 to carry
  11.170 -	js	rep_match_or_large_offset
  11.171 -	jne	offset_9_bit
  11.172 +	pushw	%ax		// save token
  11.173 +// Decode XYZ bits to SZC flags
  11.174 +	andb	$0xE0, %al	// filter XYZ
  11.175 +	movb	%al, %ah
  11.176 +	orb	$0xDF, %al
  11.177 +	incw	%ax
  11.178 +	sahf			// ah=SZ.A.P.C
  11.179 +	je	no_nibble_in_offset	// Y=1
  11.180 +
  11.181 +	call	getNibble       // get nibble for offset bits 0-3, kill %cl
  11.182 +	sahf
  11.183 +	rclb	$1, %al
  11.184 +	xorb	$0xE1, %al	// set offset bits 7-5 to 1
  11.185 +	sahf
  11.186 +	cbw			// set offset bits 15-8 to 1
  11.187  // 00Z 5-bit offset: read a nibble for offset bits 1-4 and use the inverted bit Z of the token as bit 0 of the offset.
  11.188  //                   set bits 5-15 of the offset to 1.
  11.189 -	call	getByteFromNibbleAndC
  11.190 -	jmp	get_match_length
  11.191 -offset_9_bit:
  11.192 -// 01Z 9-bit offset: read a byte for offset bits 0-7 and use the inverted bit Z for bit 8 of the offset.
  11.193 -//                   set bits 9-15 of the offset to 1.
  11.194 -	sbbb	%cl, %ah	// clear bit 8 if Z bit is clear
  11.195 -	jmp	get_match_length_0
  11.196 +	jns	get_match_length	// 5-bit offset
  11.197 +//10Z 13-bit offset: read a nibble for offset bits 9-12 and use the inverted bit Z for bit 8 of the offset,
  11.198 +//                   then read a byte for offset bits 0-7. set bits 13-15 of the offset to 1.
  11.199 +//                   substract 512 from the offset to get the final value.
  11.200 +	subb	$2, %al		// substract 512, clear C
  11.201 +	jmp	get_match_length_1
  11.202  
  11.203  getNibble:
  11.204 -	xorb	$0xF0, %bh	// toggle nibble stored flags
  11.205 -	movb	%bh, %al
  11.206 +	xorb	$0xF0, %dh	// toggle nibble stored flags
  11.207 +	movb	%dh, %al
  11.208  	jns	gotnibble
  11.209  	lodsb
  11.210 -	movb	$0xF0, %bh
  11.211 -	orb	%al, %bh
  11.212 -	shrb	$4, %al
  11.213 +	movb	$0xF0, %dh
  11.214 +	orb	%al, %dh
  11.215 +	shrcl	$4, %al
  11.216  gotnibble:
  11.217  lzsa2quit:
  11.218  	ret
  11.219  
  11.220 -rep_match_or_large_offset:
  11.221 -	jpe	rep_match_or_16_bit
  11.222 -//10Z 13-bit offset: read a nibble for offset bits 9-12 and use the inverted bit Z for bit 8 of the offset,
  11.223 -//                   then read a byte for offset bits 0-7. set bits 13-15 of the offset to 1.
  11.224 -//                   substract 512 from the offset to get the final value.
  11.225 -	call	getByteFromNibbleAndC
  11.226 -	subb	$2, %al		// substract 512
  11.227 -	jmp	get_match_length_1
  11.228 -rep_match_or_16_bit:
  11.229 -	jc	repeat_match	// rep-match
  11.230 +no_nibble_in_offset:
  11.231 +	movb	$-1, %ah	// set offset bits 15-8 to 1
  11.232 +	jns	offset_9_bit	// X=0 Y=1
  11.233 +	jc	repeat_match	// rep-match X=1 Y=1 Z=1
  11.234  //110 16-bit offset: read a byte for offset bits 8-15, then another byte for offset bits 0-7.
  11.235  	lodsb			// Get 2-byte match offset
  11.236  get_match_length_1:
  11.237  	xchgb	%al, %ah
  11.238 -get_match_length_0:
  11.239 +
  11.240 +offset_9_bit:	// Z=C
  11.241 +// 01Z 9-bit offset: read a byte for offset bits 0-7 and use the inverted bit Z for bit 8 of the offset.
  11.242 +//                   set bits 9-15 of the offset to 1.
  11.243 +	sbbb	%ch, %ah	// clear bit 8 if Z bit is clear (%ch == 0)
  11.244  	lodsb			// load match offset bits 0-7
  11.245  get_match_length:
  11.246 -	xchgw	%ax, %bp	// bp: offset
  11.247 +	xchgw	%ax, %bx	// bx: offset
  11.248  repeat_match:
  11.249  //111 repeat offset: reuse the offset value of the previous match command.
  11.250  
  11.251 -	movb	%bl, %al	// %al: original token
  11.252 +	popw	%ax		// restore original token in %al
  11.253  	movw	$MATCH_RUN_LEN+256*MIN_MATCH_SIZE, %cx
  11.254  	call	lzsa2len
  11.255 -#ifdef RAW_FORMAT
  11.256 -	jcxz	lzsa2quit	// bail if we hit EOD
  11.257 +#if !defined(ENHANCED_FORMAT) && defined(RAW_FORMAT)
  11.258 +	je	lzsa2quit	// bail if we hit EOD in (%si-2)
  11.259  #endif
  11.260 -#if !defined(FLAT32) && !defined(FLAT16OUT)
  11.261 +
  11.262 +#if !defined(FLAT16OUT) && !defined(FLAT32)
  11.263 +	xchg	AX, SI		// save %si	
  11.264 +	lea	(BX,DI), SI
  11.265  	pushw	%ds
  11.266 +# ifndef RAW_FORMAT
  11.267 +	pushw	%bp		// save end
  11.268 +# endif
  11.269 +	movw	%es, %bp
  11.270 +	cmpw	%si, %di
  11.271 +	jnc	lzsa2sameSeg
  11.272  	pushw	%si
  11.273 -	movw	%di, %si
  11.274 -	addw	%bp, %si
  11.275 -	movw	%es, %ax
  11.276 -	jc	axok
  11.277 -	subb	$0x10, %ah
  11.278 -axok:
  11.279 -.macro norm	reg
  11.280 -	movw	%si, \reg
  11.281 -	subw	%si, %dx
  11.282 +	shrcl	$4, %si
  11.283 +	lea	-4096(%bp,%si), %bp
  11.284 +	popw	%si
  11.285  	andw	$0xF, %si
  11.286 -	addw	%si, %dx
  11.287 -	shrw	$4, \reg
  11.288 -	addw	\reg, %ax
  11.289 -	movw	%ax, %ds
  11.290 -	movw	%di, \reg
  11.291 -	andw	$0xF, %di
  11.292 -	shrw	$4, \reg
  11.293 -	movw	%es, %ax
  11.294 -	addw	\reg, %ax
  11.295 -	movw	%ax, %es
  11.296 -.endm 
  11.297 -	pushw	%bp
  11.298 -	pushw	%dx
  11.299 -# if defined(NeedNormalize) || defined(PARANOIA)
  11.300 -	call	lzsa2movStr	// copy string
  11.301 -# else
  11.302 -	norm	%bp
  11.303 +lzsa2sameSeg:
  11.304 +	movw	%bp, %ds
  11.305 +# ifdef FASTFILL
  11.306 +	cmp	$-FASTFILL,BX
  11.307 +	jae	lzsa2fast
  11.308 +# endif
  11.309  	rep movsb
  11.310 +lzsa2chunkz:
  11.311 +# ifndef RAW_FORMAT
  11.312 +	popw	%bp		// restore end
  11.313  # endif
  11.314 -	popw	%dx
  11.315 -	popw	%bp
  11.316 -	popw	%si
  11.317  	popw	%ds
  11.318  #else
  11.319 +# ifdef FASTFILL
  11.320 +	cmp	$-FASTFILL,BX
  11.321 +	jae	lzsa2fast
  11.322 +# endif
  11.323  	xchg	AX, SI		// save %si	
  11.324 -	lea	(BP,DI), SI
  11.325 +	lea	(BX,DI), SI
  11.326  	rep movsb	%es:(SI), %es:(DI)
  11.327 +#define lzsa2chunkz lzsa2chunk
  11.328 +#endif
  11.329  	xchg	AX, SI		// restore %si	
  11.330 +	jmp	lzsa2chunk
  11.331 +#ifdef FASTFILL
  11.332 +lzsa2fast:
  11.333 +# if FASTFILL == 1
  11.334 +#  if !defined(FLAT16OUT) && !defined(FLAT32)
  11.335 +	lodsb
  11.336 +#  else
  11.337 +	movb	%es:(BX,DI), %al
  11.338 +#  endif
  11.339 +	rep stosb
  11.340 +# endif
  11.341 +# if FASTFILL == 2
  11.342 +#  if !defined(FLAT16OUT) && !defined(FLAT32)
  11.343 +	lodsw
  11.344 +#  else
  11.345 +	movw	%es:(BX,DI), %ax
  11.346 +#  endif
  11.347 +	je	lzsa2fastword
  11.348 +	movb	%ah, %al
  11.349 +lzsa2fastword:
  11.350 +	shr	$1, CX
  11.351 +	rep stosw
  11.352 +	jnc	lzsa2chunkz
  11.353 +	stosb
  11.354 +# endif
  11.355 +	jmp	lzsa2chunkz
  11.356  #endif
  11.357 -	jmp	lzsa2chunk
  11.358 -
  11.359 -getByteFromNibbleAndC:
  11.360 -	pushfw
  11.361 -	call	getNibble	// get nibble for offset bits 0-3
  11.362 -	popfw
  11.363 -	rclb	$1, %al
  11.364 -	xorb	$0xE1, %al	// set offset bits 7-5 to 1
  11.365 -	ret
  11.366  
  11.367  lzsa2len:			// get length in %cx
  11.368  	andb	%cl, %al
  11.369  	cbw			// clear %ah
  11.370  	cmpb	%al, %cl
  11.371 -	jne	lzsa2minNumber	// S=0-2, L=0-6
  11.372 -	call	getNibble
  11.373 +	jne	lzsa2minNumber	// S=0-2, L=0-6			%cx = %ch + %al   if (%al & %cl != %cl)
  11.374 +	addb	%al, %ch
  11.375 +	call	getNibble	// kill %cl
  11.376  	cmp	$0xF, %al
  11.377 -	jne	lzsa2noExtraByte
  11.378 +	jne	lzsa2minNumber	//				%cx = %ch + %cl + nibble   if (%al & %cl == %cl && nibble != 0xF)
  11.379  	addb	%al, %ch
  11.380  	lodsb
  11.381 -lzsa2noExtraByte:
  11.382 -	addb	%cl, %ch
  11.383  lzsa2minNumber:
  11.384  	addb	%ch, %al
  11.385 -	jnc	lzsa2gotNumber  // 0-255
  11.386 -#if 0
  11.387 -	je	lzsa2BigNumber
  11.388 -	movb	%al, %ah	// S=256-767, L=256-1791
  11.389 -	lodsb	
  11.390 +	jnc	lzsa2gotNumber  // 0-255			%cx = %ch + %cl + 0xF + byte   if (%al & %cl == %cl && nibble == 0xF && %ch + %cl + 0xF + byte < 0x100)
  11.391 +#ifdef ENHANCED_FORMAT
  11.392 +	decw	%ax
  11.393 +	je	lzsa2maxNumber
  11.394 +# ifdef RAW_FORMAT
  11.395 +	jns	lzsa2midNumber
  11.396 +	popw	%ax
  11.397 +	ret			// bail if we hit EOD
  11.398 +lzsa2midNumber:
  11.399 +# endif
  11.400 +	xchgb	%al, %ah	// S=256-4351, L=256-5887
  11.401 +	lodsb			//				%cx = (%ch + %cl + 0xE + byte)*256 + byte2   if (%al & %cl == %cl && nibble == 0xF && %ch + %cl + 0xF + byte > 0x100)
  11.402  	.byte	0xB1		// mask lodsw with movb $0xAD, %cl
  11.403 -lzsa2BigNumber:
  11.404 +lzsa2maxNumber:
  11.405  #endif
  11.406 -	lodsw			// 0-65535
  11.407 +	lodsw			// 0-65535			%cx = word   if (%al & %cl == %cl && nibble == 0xF && %ch + %cl + 0xF + byte == 0x100)
  11.408  lzsa2gotNumber:
  11.409  	xchgw	%ax, %cx
  11.410  	ret
  11.411 -
  11.412 -#if defined(NeedNormalize) || defined(PARANOIA)
  11.413 -# if defined(PARANOIA)
  11.414 -lzsa2movlp:
  11.415 -	decw	%ch
  11.416 -	rep movsb
  11.417 -	incw	%ch
  11.418 -# endif
  11.419 -normalize:
  11.420 -lzsa2movLit:
  11.421 -	movw	%ds, %ax
  11.422 -lzsa2movStr:
  11.423 -	norm	%bp
  11.424 -# if defined(PARANOIA)
  11.425 -	cmpb	$0xFF, %ch	// catch FFFX case
  11.426 -	je	lzsa2movlp
  11.427 -# endif
  11.428 -	rep movsb
  11.429 -	ret
  11.430 -#endif
    12.1 --- a/ntk/receipt	Sat Jun 24 08:24:26 2023 +0000
    12.2 +++ b/ntk/receipt	Tue Jul 11 10:40:23 2023 +0000
    12.3 @@ -7,7 +7,7 @@
    12.4  MAINTAINER="pankso@slitaz.org"
    12.5  LICENSE="LGPL"
    12.6  TARBALL="$PACKAGE-$VERSION.tar.gz"
    12.7 -WEB_SITE="http://non.tuxfamily.org/"
    12.8 +WEB_SITE="https://web.archive.org/web/20230627102029/http://non.tuxfamily.org/"
    12.9  WGET_URL="https://github.com/falkTX/ntk/archive/refs/tags/v$VERSION.tar.gz"
   12.10  #HOST_ARCH="i486 arm"
   12.11  
    13.1 --- a/plop/stuff/unlz4.S	Sat Jun 24 08:24:26 2023 +0000
    13.2 +++ b/plop/stuff/unlz4.S	Tue Jul 11 10:40:23 2023 +0000
    13.3 @@ -19,6 +19,16 @@
    13.4  #define DI	%edi
    13.5  #endif
    13.6   
    13.7 +#if defined(FLAT16OUT) || defined(ONLY8086)
    13.8 +#define cAX	%ax
    13.9 +#define cCX	%cx
   13.10 +#define cDX	%dx
   13.11 +#else
   13.12 +#define cAX	%eax
   13.13 +#define cCX	%ecx
   13.14 +#define cDX	%edx
   13.15 +#endif
   13.16 +
   13.17  #define ARCHIVE_MAGICNUMBER 0x184C2102
   13.18  
   13.19  //#define PARANOIA			// cover rare cases, optional
   13.20 @@ -31,28 +41,72 @@
   13.21  	call	lz4mov
   13.22  # endif
   13.23  #endif
   13.24 +#if defined(FLAT16OUT) || defined(ONLY8086)
   13.25 +	lodsw			// get chunkSize
   13.26 +# ifndef NO_LZ4_HEADER
   13.27 +	cmpw	$ARCHIVE_MAGICNUMBER&0xFFFF, %ax
   13.28 +# endif
   13.29 +	xchg	%ax, %dx
   13.30 +	lodsw
   13.31 +# ifndef NO_LZ4_HEADER
   13.32 +	jne	chkeof
   13.33 +	cmpw	$ARCHIVE_MAGICNUMBER>>16, %ax
   13.34 +	je	lz4main
   13.35 +chkeof:	
   13.36 +# endif
   13.37 +# ifdef PARANOIA
   13.38 +	orw	%ax, %dx	// end of file ?
   13.39 +	je	lz4quit
   13.40 +# endif
   13.41 +# ifndef FLAT16OUT
   13.42 +	xchgw	%ax, %bp
   13.43 +	subw	$1, %dx
   13.44 +	sbbw	$0, %bp
   13.45 +# endif
   13.46 +#else
   13.47  	lodsl			// get chunkSize
   13.48 -#ifndef NO_LZ4_HEADER
   13.49 +# ifndef NO_LZ4_HEADER
   13.50  	cmpl	$ARCHIVE_MAGICNUMBER, %eax
   13.51  	je	lz4main
   13.52 -#endif
   13.53 +# endif
   13.54 +# ifdef PARANOIA
   13.55  	orl	%eax, %eax	// end of file ?
   13.56  	je	lz4quit
   13.57 +# endif
   13.58  	xchgl	%eax, %edx
   13.59 +#endif
   13.60  lz4chunk:			// uncompress chunk
   13.61  	lodsb			// get token
   13.62 -	movb	%al, %bl
   13.63 +	pushw	%ax
   13.64 +#ifdef ONLY8086
   13.65 +	movb	$4, %cl
   13.66 +	shrb	%cl, %al
   13.67 +#else
   13.68  	shrb	$4, %al
   13.69 +#endif
   13.70  	call	lz4len		// get literal length
   13.71 -	subl	%ecx, %edx	// count literal
   13.72 +#if !defined(FLAT16OUT) && defined(ONLY8086)
   13.73 +	subw	%cx, %dx	// count literal
   13.74 +	sbbw	$0, %bp
   13.75 +#else
   13.76 +	sub	cCX, cDX	// count literal
   13.77 +#endif
   13.78  #if !defined(FLAT32) && !defined(FLAT16OUT) && (!defined(FLAT16) || !defined(PARANOIA))
   13.79  #define NeedLz4mov
   13.80  	call	lz4mov		// copy literals
   13.81  #else
   13.82  	rep movsb
   13.83  #endif
   13.84 -	subl	$1+2, %edx	// count token & string address
   13.85 -	jle	lz4main
   13.86 +	popw	%bx
   13.87 +#if !defined(FLAT16OUT) && defined(ONLY8086)
   13.88 +	subw	$1+2, %dx	// count token & string address
   13.89 +	sbbw	$0, %bp
   13.90 +	jb	lz4quit
   13.91 +lz4cont:
   13.92 +#else
   13.93 +	sub	$1+2, cDX	// count token & string address
   13.94 +	jbe	lz4quit
   13.95 +#endif
   13.96  	lodsw			// get string address
   13.97  	xchg	AX, BX
   13.98  	call	lz4len		// get string length
   13.99 @@ -69,18 +123,29 @@
  13.100  .macro norm	reg
  13.101  	movw	%si, \reg
  13.102  	andw	$0xF, %si
  13.103 +# ifdef ONLY8086
  13.104 +	pushw	%cx
  13.105 +	movb	$4, %cl
  13.106 +	shrw	%cl, \reg
  13.107 +# else
  13.108  	shrw	$4, \reg
  13.109 +# endif
  13.110  	addw	\reg, %ax
  13.111  	movw	%ax, %ds
  13.112  	movw	%di, \reg
  13.113  	andw	$0xF, %di
  13.114 +# ifdef ONLY8086
  13.115 +	shrw	%cl, \reg
  13.116 +	popw	%cx
  13.117 +# else
  13.118  	shrw	$4, \reg
  13.119 +# endif
  13.120  	movw	%es, %ax
  13.121  	addw	\reg, %ax
  13.122  	movw	%ax, %es
  13.123  .endm 
  13.124  # if !defined (NeedLz4mov)
  13.125 -	norm	%bp
  13.126 +	norm	%bx
  13.127  	rep movsb
  13.128  # else
  13.129  	call	lz4movStr	// copy string
  13.130 @@ -88,13 +153,35 @@
  13.131  	popw	%si
  13.132  	popw	%ds
  13.133  #else
  13.134 +# ifdef FASTFILL
  13.135 +	cmp	$FASTFILL,BX
  13.136 +	jbe	lz4fast
  13.137 +# endif
  13.138 +lz4notfast:
  13.139  	xchg	AX, SI
  13.140  	mov	DI, SI
  13.141  	sub	BX, SI
  13.142  	rep movsb %es:(SI), %es:(DI)
  13.143  	xchg	AX, SI
  13.144 +# ifdef FASTFILL
  13.145 +lz4fast:
  13.146 +#  if FASTFILL == 1
  13.147 +	movb	%es:-1(DI), %al
  13.148 +	rep stosb
  13.149 +#  endif
  13.150 +#  if FASTFILL >= 2
  13.151 +	movw	%es:-2(DI), %ax
  13.152 +	je	lz4fastword
  13.153 +	movb	%al, %ah
  13.154 +lz4fastword:
  13.155 +	shr	$1, CX
  13.156 +	rep stosw
  13.157 +	jnc	lz4chunk
  13.158 +	stosb
  13.159 +#  endif
  13.160 +# endif
  13.161 +	jmp	lz4chunk
  13.162  #endif
  13.163 -	jmp	lz4chunk
  13.164  
  13.165  #if defined(NeedLz4mov)
  13.166  # if defined(PARANOIA)
  13.167 @@ -108,7 +195,7 @@
  13.168  lz4mov:
  13.169  	movw	%ds, %ax
  13.170  lz4movStr:
  13.171 -	norm	%bp
  13.172 +	norm	%bx
  13.173  # if defined(PARANOIA)
  13.174  	cmp	$0xFF, %ch	// catch FFFX case
  13.175  	jz	lz4movlp
  13.176 @@ -118,14 +205,19 @@
  13.177  #endif
  13.178  
  13.179  lz4len:				// get length in %ecx
  13.180 -	andl	$0xF, %eax
  13.181 -	movl	%eax, %ecx
  13.182 +	and	$0xF, cAX
  13.183 +	mov	cAX, cCX
  13.184  	cmpb	$0xF, %al
  13.185  	jne	lz4quit
  13.186  lz4len2:
  13.187  	lodsb
  13.188 -	decl	%edx		// remaining chunk size
  13.189 -	addw	%ax, %cx
  13.190 +#if !defined(FLAT16OUT) && defined(ONLY8086)
  13.191 +	subw	$1, %dx		// remaining chunk size
  13.192 +	sbbw	$0, %bp
  13.193 +#else
  13.194 +	dec	cDX		// remaining chunk size
  13.195 +#endif
  13.196 +	add	AX, CX
  13.197  	cmpb	$0xFF, %al
  13.198  	je	lz4len2
  13.199  lz4quit:
    14.1 --- a/plop/stuff/unlzsa1.S	Sat Jun 24 08:24:26 2023 +0000
    14.2 +++ b/plop/stuff/unlzsa1.S	Tue Jul 11 10:40:23 2023 +0000
    14.3 @@ -25,173 +25,175 @@
    14.4  #define PACKED_ONLY			// assume no copy block, optional
    14.5  //#define PARANOIA			// cover rare cases, optional
    14.6   
    14.7 +.macro	shrclw cnt,obj
    14.8 +#ifdef ONLY8086
    14.9 +	movb	\cnt, %cl
   14.10 +	shrw	%cl, \obj
   14.11 +#else
   14.12 +	shrw	\cnt, \obj
   14.13 +#endif
   14.14 +.endm
   14.15 +
   14.16 +#ifdef FLAT16OUT
   14.17 +#define RAW_FORMAT
   14.18 +#endif
   14.19  lzsa1main:
   14.20  #ifdef PARANOIA
   14.21  	cld
   14.22  #endif
   14.23 -#ifdef FLAT16OUT
   14.24 -#define RAW_FORMAT
   14.25 -#endif
   14.26  #ifndef RAW_FORMAT
   14.27 -# if defined(PARANOIA) && !defined(FLAT32) && !defined(FLAT16)
   14.28 -	xorw	%cx, %cx
   14.29 -	call	normalize
   14.30 -# endif
   14.31  # ifndef NO_LZSA1_HEADER
   14.32  	lodsw
   14.33  	cmpw	$0x9E7B, %ax	// magic
   14.34  	jne	lzsa1main
   14.35  	lodsb
   14.36 -	cmpb	$0, %al		// lzsa1
   14.37 -	jne	lzsa1main
   14.38 +//	cmpb	$0, %al		// lzsa1
   14.39 +//	jne	lzsa1main
   14.40 +# endif
   14.41 +	xorw	%ax, %ax
   14.42 +	xchgw	%ax, %di
   14.43 +	shrclw	$4, %ax
   14.44 +	jmp	lzsa1blockz	// %di *MUST* be paragraph aligned
   14.45 +# ifndef PACKED_ONLY
   14.46 +lzsa1copy:
   14.47 +	movsb			// handle 64K case
   14.48 +	decw	%cx
   14.49 +	rep	movsb		// copy block
   14.50  # endif
   14.51  lzsa1block:			// uncompress chunk
   14.52 +	movw	$0x1000, %ax
   14.53 +lzsa1blockz:	
   14.54 +	movw	%es, %bx
   14.55 +	addw	%ax, %bx
   14.56 +	movw	%bx, %es
   14.57 +# ifndef FLAT16
   14.58 +	movw	%si, %ax
   14.59 +	andw	$0xf, %si
   14.60 +	shrclw	$4, %ax
   14.61 +	movw	%ds, %bx
   14.62 +	addw	%ax, %bx
   14.63 +	movw	%bx, %ds
   14.64 +# endif
   14.65  	lodsw			// block size
   14.66  	xchgw	%ax, %cx
   14.67 +	movw	%cx, %dx
   14.68  	lodsb
   14.69  # ifndef PACKED_ONLY
   14.70  	orb	%al, %al
   14.71 -	jns	lzsa1compressed
   14.72 -#  if !defined(FLAT32) && !defined(FLAT16OUT)
   14.73 -	movw	%cx, %dx
   14.74 -	movb	$0, %cl
   14.75 -	movb	$0, %dh
   14.76 -copytail:
   14.77 -	call	lzsa1movStr
   14.78 -	xchg	%dx, %cx
   14.79 -	incw	%cx
   14.80 -	loop	copytail
   14.81 -#  else
   14.82 -	movsb			// copy block
   14.83 -copylp:
   14.84 -	movsb			// copy block
   14.85 -	loop	copylp		// handle 64K case
   14.86 -#  endif
   14.87 -	jmp	lzsa1block	// end of block
   14.88 -lzsa1compressed:
   14.89 -	jne	lzsa1chunk	// 64Kb block
   14.90 +	js	lzsa1copy
   14.91 +	jne	lzsa1full	// 64Kb block
   14.92  # endif
   14.93  	jcxz	lzsa1quit	// bail if we hit EOD
   14.94 -	pushw	%cx
   14.95 -# if !defined(FLAT32) && !defined(FLAT16)
   14.96 -	xorw	%cx, %cx
   14.97 -	call	normalize
   14.98 -# define NeedNormalize
   14.99 -# endif
  14.100 -	popw	%dx
  14.101 +lzsa1full:
  14.102  	addw	%si, %dx
  14.103  #endif
  14.104  lzsa1chunk:			// uncompress chunk
  14.105  	lodsb			// get token O|LLL|MMMM
  14.106  	movb	%al, %bl	// keep token in bl
  14.107 -	shrb	$4, %al		// shift literals length into place
  14.108 -	movw	$LITERALS_RUN_LEN*256+MIN_LITERALS_SIZE, %cx
  14.109 +	shrclw	$4, %ax		// shift literals length into place
  14.110 +	movw	$LITERALS_RUN_LEN+256*MIN_LITERALS_SIZE, %cx
  14.111  	call	lzsa1len	// %ch = LITERALS_RUN_LEN
  14.112 -#if defined(NeedNormalize)
  14.113 -	call	lzsa1movLit	// copy %cx literals from %ds:%si to %es:%di
  14.114 -#else
  14.115  	rep	movsb		// copy %cx literals from %ds:%si to %es:%di
  14.116 -#endif
  14.117  #ifndef RAW_FORMAT
  14.118  	cmpw	%dx, %si
  14.119 -	jae	lzsa1block	// bail if we hit EOD
  14.120 +	je	lzsa1block	// bail if we hit EOD
  14.121  #endif
  14.122  #ifdef FLAT32
  14.123  	orl	$-1, %eax
  14.124 -#else
  14.125 -	movb	$-1, %ah
  14.126  #endif
  14.127  	testb	%bl, %bl	// check match offset size in token (O bit)
  14.128 -	jns	lzsa1ShortOfs
  14.129 +	js	lzsa1LongOfs
  14.130 +#ifndef FLAT32
  14.131 +	movb	$-1, %ah	// set offset bits 15-8 to 1
  14.132 +#endif
  14.133 +	lodsb
  14.134 +	.byte	0x3C		// mask lodsw with cmpb $0xAD, %al
  14.135 +lzsa1LongOfs:
  14.136  	lodsw
  14.137 -	.byte	0x3C		// mask lodsb with cmpb $0xAC, %al
  14.138 -lzsa1ShortOfs:
  14.139 -	lodsb
  14.140  	xchg	AX, BX		// %bx: match offset  %ax: original token
  14.141 -	movw	$MATCH_RUN_LEN*256+MIN_MATCH_SIZE, %cx
  14.142 +	movw	$MATCH_RUN_LEN+256*MIN_MATCH_SIZE, %cx
  14.143  	call	lzsa1len
  14.144  #ifdef RAW_FORMAT
  14.145  	jcxz	lzsa1quit	// bail if we hit EOD
  14.146  #endif
  14.147 -#if !defined(FLAT32) && !defined(FLAT16OUT)
  14.148 +
  14.149 +#if !defined(FLAT16OUT) && !defined(FLAT32)
  14.150 +	xchg	AX, SI		// save %si	
  14.151 +	lea	(BX,DI), SI
  14.152  	pushw	%ds
  14.153 +	movw	%es, %bp
  14.154 +	cmpw	%si, %di
  14.155 +	jnc	lzsa1sameSeg
  14.156  	pushw	%si
  14.157 -	movw	%di, %si
  14.158 -	addw	%bx, %si
  14.159 -	movw	%es, %ax
  14.160 -	jc	axok
  14.161 -	subb	$0x10, %ah
  14.162 -axok:
  14.163 -.macro norm	reg
  14.164 -	movw	%si, \reg
  14.165 -	subw	%si, %dx
  14.166 +	shrclw	$4, %si
  14.167 +	lea	-4096(%bp,%si), %bp
  14.168 +	popw	%si
  14.169  	andw	$0xF, %si
  14.170 -	addw	%si, %dx
  14.171 -	shrw	$4, \reg
  14.172 -	addw	\reg, %ax
  14.173 -	movw	%ax, %ds
  14.174 -	movw	%di, \reg
  14.175 -	andw	$0xF, %di
  14.176 -	shrw	$4, \reg
  14.177 -	movw	%es, %ax
  14.178 -	addw	\reg, %ax
  14.179 -	movw	%ax, %es
  14.180 -.endm 
  14.181 -	pushw	%dx
  14.182 -# if defined(NeedNormalize) || defined(PARANOIA)
  14.183 -	call	lzsa1movStr	// copy string
  14.184 -# else
  14.185 -	norm	%bp
  14.186 +lzsa1sameSeg:
  14.187 +	movw	%bp, %ds
  14.188 +# ifdef FASTFILL
  14.189 +	cmp	$-FASTFILL,BX
  14.190 +	jae	lzsa1fast
  14.191 +# endif
  14.192  	rep movsb
  14.193 -# endif
  14.194 -	popw	%dx
  14.195 -	popw	%si
  14.196 +lzsa1chunkz:
  14.197  	popw	%ds
  14.198  #else
  14.199 +# ifdef FASTFILL
  14.200 +	cmp	$-FASTFILL,BX
  14.201 +	jae	lzsa1fast
  14.202 +# endif
  14.203  	xchg	AX, SI		// save %si	
  14.204  	lea	(BX,DI), SI
  14.205  	rep movsb	%es:(SI), %es:(DI)
  14.206 +#define lzsa1chunkz lzsa1chunk
  14.207 +#endif
  14.208  	xchg	AX, SI		// restore %si	
  14.209 +	jmp	lzsa1chunk
  14.210 +#ifdef FASTFILL
  14.211 +lzsa1fast:
  14.212 +# if FASTFILL == 1
  14.213 +#  if !defined(FLAT16OUT) && !defined(FLAT32)
  14.214 +	lodsb
  14.215 +#  else
  14.216 +	movb	%es:(BX,DI), %al
  14.217 +#  endif
  14.218 +	rep stosb
  14.219 +# endif
  14.220 +# if FASTFILL == 2
  14.221 +#  if !defined(FLAT16OUT) && !defined(FLAT32)
  14.222 +	lodsw
  14.223 +#  else
  14.224 +	movw	%es:(BX,DI), %ax
  14.225 +#  endif
  14.226 +	je	lzsa1fastword
  14.227 +	movb	%ah, %al
  14.228 +lzsa1fastword:
  14.229 +	shr	$1, CX
  14.230 +	rep stosw
  14.231 +	jnc	lzsa1chunkz
  14.232 +	stosb
  14.233 +# endif
  14.234 +	jmp	lzsa1chunkz
  14.235  #endif
  14.236 -	jmp	lzsa1chunk
  14.237  
  14.238  lzsa1len:			// get length in %ecx
  14.239 -	andb	%ch, %al
  14.240 +	andb	%cl, %al
  14.241  	cbw			// clear %ah
  14.242 -	cmpb	%ch, %al
  14.243 -	jne	lzsa1minNumber	// S=0-6, L=0-14
  14.244 +	cmpb	%al, %cl
  14.245 +	jne	lzsa1minNumber	// S=0-6, L=0-14		%cx = %ch + %al   if (%al & %cl != %cl)
  14.246 +	addb	%al, %ch
  14.247  	lodsb
  14.248 -	addb	%ch, %cl
  14.249  lzsa1minNumber:
  14.250 -	addb	%cl, %al
  14.251 -	jnc	lzsa1gotNumber  // 0-255
  14.252 -	movb	%al, %ah	// S=256-1791, L=256-3839 or S=256-511, L=256-511
  14.253 +	addb	%ch, %al
  14.254 +	jnc	lzsa1gotNumber  // 0-255			%cx = %ch + %cl + byte   if (%al & %cl == %cl && %ch + %cl + byte < 0x100)
  14.255 +	movb	%al, %ah	// S=256-1791, L=256-4607 or S=256-511, L=256-511
  14.256  	jne	lzsa1midNumber
  14.257 -	lodsw			// 0-65535
  14.258 +	lodsw			// 0-65535			%cx = word   if (%al & %cl == %cl && %ch + %cl + byte == 0x100)
  14.259  	.byte	0x3C		// mask lodsb with cmpb $0xAC, %al
  14.260  lzsa1midNumber:
  14.261 -	lodsb
  14.262 +	lodsb			//				%cx = (%ch + %cl + byte)*256 + byte2   if (%al & %cl == %cl && %ch + %cl + byte > 0x100)
  14.263  lzsa1gotNumber:
  14.264  	xchgw	%ax, %cx
  14.265  lzsa1quit:
  14.266  	ret
  14.267 -
  14.268 -#if defined(NeedNormalize) || defined(PARANOIA)
  14.269 -# if defined(PARANOIA)
  14.270 -lzsa1movlp:
  14.271 -	decw	%ch
  14.272 -	rep movsb
  14.273 -	incw	%ch
  14.274 -# endif
  14.275 -normalize:
  14.276 -lzsa1movLit:
  14.277 -	movw	%ds, %ax
  14.278 -lzsa1movStr:
  14.279 -	norm	%bp
  14.280 -# if defined(PARANOIA)
  14.281 -	cmpb	$0xFF, %ch	// catch FFFX case
  14.282 -	je	lzsa1movlp
  14.283 -# endif
  14.284 -	rep movsb
  14.285 -	ret
  14.286 -#endif
    15.1 --- a/plop/stuff/unlzsa2.S	Sat Jun 24 08:24:26 2023 +0000
    15.2 +++ b/plop/stuff/unlzsa2.S	Tue Jul 11 10:40:23 2023 +0000
    15.3 @@ -5,7 +5,6 @@
    15.4  	.code16
    15.5  #define AX	%ax
    15.6  #define BX	%bx
    15.7 -#define BP	%bp
    15.8  #define SI	%si
    15.9  #define DI	%di
   15.10  #else
   15.11 @@ -14,7 +13,6 @@
   15.12  	.code32
   15.13  #define AX	%eax
   15.14  #define BX	%ebx
   15.15 -#define BP	%ebp
   15.16  #define SI	%esi
   15.17  #define DI	%edi
   15.18  #endif
   15.19 @@ -27,248 +25,243 @@
   15.20  #define PACKED_ONLY			// assume no copy block, optional
   15.21  //#define PARANOIA			// cover rare cases, optional
   15.22   
   15.23 +.macro	shrcl cnt,obj
   15.24 +#ifdef ONLY8086
   15.25 +	movb	\cnt, %cl
   15.26 +	shr	%cl, \obj
   15.27 +#else
   15.28 +	shr	\cnt, \obj
   15.29 +#endif
   15.30 +.endm
   15.31 +
   15.32 +#ifdef FLAT16OUT
   15.33 +#define RAW_FORMAT
   15.34 +#endif
   15.35  lzsa2main:
   15.36  #ifdef PARANOIA
   15.37  	cld
   15.38  #endif
   15.39 -#ifdef FLAT16OUT
   15.40 -#define RAW_FORMAT
   15.41 -#endif
   15.42  #ifndef RAW_FORMAT
   15.43 -# if defined(PARANOIA) && !defined(FLAT32) && !defined(FLAT16)
   15.44 -	xorw	%cx, %cx
   15.45 -	call	normalize
   15.46 -# endif
   15.47  # ifndef NO_LZSA2_HEADER
   15.48  	lodsw
   15.49  	cmpw	$0x9E7B, %ax	// magic
   15.50  	jne	lzsa2main
   15.51  	lodsb
   15.52 -	testb	$0x20, %al	// lzsa2
   15.53 -	je	lzsa2main
   15.54 +//	testb	$0x20, %al	// lzsa2
   15.55 +//	je	lzsa2main
   15.56 +# endif
   15.57 +	xorw	%ax, %ax
   15.58 +	cwd			// no nibble stored
   15.59 +	xchgw	%ax, %di
   15.60 +	shrcl	$4, %ax
   15.61 +	jmp	lzsa2blockz	// %di *MUST* be paragraph aligned
   15.62 +# ifndef PACKED_ONLY
   15.63 +lzsa2copy:
   15.64 +	movsb			// handle 64K case
   15.65 +	decw	%cx
   15.66 +	rep	movsb		// copy block
   15.67  # endif
   15.68  lzsa2block:			// uncompress chunk
   15.69 -# if !defined(FLAT32) && !defined(FLAT16)
   15.70 -	xorw	%cx, %cx
   15.71 -	call	normalize
   15.72 +	movw	$0x1000, %ax
   15.73 +lzsa2blockz:	
   15.74 +	movw	%es, %bx
   15.75 +	addw	%ax, %bx
   15.76 +	movw	%bx, %es
   15.77 +# ifndef FLAT16
   15.78 +	movw	%si, %ax
   15.79 +	andw	$0xf, %si
   15.80 +	shrcl	$4, %ax
   15.81 +	movw	%ds, %bx
   15.82 +	addw	%ax, %bx
   15.83 +	movw	%bx, %ds
   15.84  # endif
   15.85  	lodsw			// block size
   15.86  	xchgw	%ax, %cx
   15.87 +	movw	%cx, %bp
   15.88  	lodsb
   15.89  # ifndef PACKED_ONLY
   15.90  	orb	%al, %al
   15.91 -	jns	lzsa2compressed
   15.92 -#  if !defined(FLAT32) && !defined(FLAT16OUT)
   15.93 -	movw	%cx, %dx
   15.94 -	movb	$0, %cl
   15.95 -	movb	$0, %dh
   15.96 -copytail:
   15.97 -	call	lzsa1movStr
   15.98 -	xchg	%dx, %cx
   15.99 -	incw	%cx
  15.100 -	loop	copytail
  15.101 -#  else
  15.102 -	movsb			// copy block
  15.103 -copylp:
  15.104 -	movsb			// copy block
  15.105 -	loop	copylp		// handle 64K case
  15.106 -#  endif
  15.107 -	jmp	lzsa2block	// end of block
  15.108 -lzsa2compressed:
  15.109 -	jne	lzsa2chunk	// 64Kb block
  15.110 +	js	lzsa2copy
  15.111 +	jne	lzsa2full	// 64Kb block
  15.112  # endif
  15.113  	jcxz	lzsa2quit	// bail if we hit EOD
  15.114 -# if !defined(FLAT16)
  15.115 -	pushw	%cx
  15.116 -	xorw	%cx, %cx
  15.117 -	call	normalize
  15.118 -# define NeedNormalize
  15.119 -	popw	%dx
  15.120 -	addw	%si, %dx
  15.121 -# else
  15.122 -	movw	%si, %dx
  15.123 -	addw	%cx, %dx
  15.124 -# endif
  15.125 +lzsa2full:
  15.126 +	addw	%si, %bp
  15.127  #else
  15.128 -# if !defined(FLAT16)
  15.129 -	xorw	%cx, %cx
  15.130 -	call	normalize
  15.131 -# define NeedNormalize
  15.132 -# endif
  15.133 +	movb	$0, %dh		// no nibble stored
  15.134  #endif
  15.135 -	movb	$0, %bh		// no nibble stored
  15.136 +#ifdef FLAT32
  15.137 +	orl	$-1, %ebx	// set offset bits 31-16 to 1
  15.138 +#endif
  15.139  lzsa2chunk:			// uncompress chunk
  15.140  	lodsb			// get token XYZ|LL|MMM
  15.141 -	movb	%al, %bl	// keep token in bl
  15.142 +	pushw	%ax		// keep token
  15.143  	movw	$LITERALS_RUN_LEN+256*MIN_LITERALS_SIZE, %cx
  15.144  	shrb	%cl, %al	// shift literals length into place
  15.145  	call	lzsa2len	// %cl = LITERALS_RUN_LEN
  15.146 -#if defined(NeedNormalize)
  15.147 -	pushw	%bp
  15.148 -	call	lzsa2movLit	// copy %cx literals from %ds:%si to %es:%di
  15.149 -	popw	%bp
  15.150 -#else
  15.151  	rep	movsb		// copy %cx literals from %ds:%si to %es:%di
  15.152 +	popw	%ax		// restore token
  15.153 +#ifndef RAW_FORMAT
  15.154 +	cmpw	%bp, %si
  15.155 +	je	lzsa2block	// bail if we hit EOD
  15.156  #endif
  15.157 -#ifndef RAW_FORMAT
  15.158 -maxsi:
  15.159 -	cmpw	%dx, %si
  15.160 -	jae	lzsa2block	// bail if we hit EOD
  15.161 -#endif
  15.162 -#ifdef FLAT32
  15.163 -	orl	$-1, %eax	// set offset bits 31-8 to 1
  15.164 -#else
  15.165 -	movb	$-1, %ah	// set offset bits 15-8 to 1
  15.166 -#endif
  15.167 -// XYZ
  15.168 -	testb	$0xC0, %bl	// check match offset mode in token (X bit)
  15.169 -	bt	$5, %bx		// move bit 5 to carry
  15.170 -	js	rep_match_or_large_offset
  15.171 -	jne	offset_9_bit
  15.172 +	pushw	%ax		// save token
  15.173 +// Decode XYZ bits to SZC flags
  15.174 +	andb	$0xE0, %al	// filter XYZ
  15.175 +	movb	%al, %ah
  15.176 +	orb	$0xDF, %al
  15.177 +	incw	%ax
  15.178 +	sahf			// ah=SZ.A.P.C
  15.179 +	je	no_nibble_in_offset	// Y=1
  15.180 +
  15.181 +	call	getNibble       // get nibble for offset bits 0-3, kill %cl
  15.182 +	sahf
  15.183 +	rclb	$1, %al
  15.184 +	xorb	$0xE1, %al	// set offset bits 7-5 to 1
  15.185 +	sahf
  15.186 +	cbw			// set offset bits 15-8 to 1
  15.187  // 00Z 5-bit offset: read a nibble for offset bits 1-4 and use the inverted bit Z of the token as bit 0 of the offset.
  15.188  //                   set bits 5-15 of the offset to 1.
  15.189 -	call	getByteFromNibbleAndC
  15.190 -	jmp	get_match_length
  15.191 -offset_9_bit:
  15.192 -// 01Z 9-bit offset: read a byte for offset bits 0-7 and use the inverted bit Z for bit 8 of the offset.
  15.193 -//                   set bits 9-15 of the offset to 1.
  15.194 -	sbbb	%cl, %ah	// clear bit 8 if Z bit is clear
  15.195 -	jmp	get_match_length_0
  15.196 +	jns	get_match_length	// 5-bit offset
  15.197 +//10Z 13-bit offset: read a nibble for offset bits 9-12 and use the inverted bit Z for bit 8 of the offset,
  15.198 +//                   then read a byte for offset bits 0-7. set bits 13-15 of the offset to 1.
  15.199 +//                   substract 512 from the offset to get the final value.
  15.200 +	subb	$2, %al		// substract 512, clear C
  15.201 +	jmp	get_match_length_1
  15.202  
  15.203  getNibble:
  15.204 -	xorb	$0xF0, %bh	// toggle nibble stored flags
  15.205 -	movb	%bh, %al
  15.206 +	xorb	$0xF0, %dh	// toggle nibble stored flags
  15.207 +	movb	%dh, %al
  15.208  	jns	gotnibble
  15.209  	lodsb
  15.210 -	movb	$0xF0, %bh
  15.211 -	orb	%al, %bh
  15.212 -	shrb	$4, %al
  15.213 +	movb	$0xF0, %dh
  15.214 +	orb	%al, %dh
  15.215 +	shrcl	$4, %al
  15.216  gotnibble:
  15.217  lzsa2quit:
  15.218  	ret
  15.219  
  15.220 -rep_match_or_large_offset:
  15.221 -	jpe	rep_match_or_16_bit
  15.222 -//10Z 13-bit offset: read a nibble for offset bits 9-12 and use the inverted bit Z for bit 8 of the offset,
  15.223 -//                   then read a byte for offset bits 0-7. set bits 13-15 of the offset to 1.
  15.224 -//                   substract 512 from the offset to get the final value.
  15.225 -	call	getByteFromNibbleAndC
  15.226 -	subb	$2, %al		// substract 512
  15.227 -	jmp	get_match_length_1
  15.228 -rep_match_or_16_bit:
  15.229 -	jc	repeat_match	// rep-match
  15.230 +no_nibble_in_offset:
  15.231 +	movb	$-1, %ah	// set offset bits 15-8 to 1
  15.232 +	jns	offset_9_bit	// X=0 Y=1
  15.233 +	jc	repeat_match	// rep-match X=1 Y=1 Z=1
  15.234  //110 16-bit offset: read a byte for offset bits 8-15, then another byte for offset bits 0-7.
  15.235  	lodsb			// Get 2-byte match offset
  15.236  get_match_length_1:
  15.237  	xchgb	%al, %ah
  15.238 -get_match_length_0:
  15.239 +
  15.240 +offset_9_bit:	// Z=C
  15.241 +// 01Z 9-bit offset: read a byte for offset bits 0-7 and use the inverted bit Z for bit 8 of the offset.
  15.242 +//                   set bits 9-15 of the offset to 1.
  15.243 +	sbbb	%ch, %ah	// clear bit 8 if Z bit is clear (%ch == 0)
  15.244  	lodsb			// load match offset bits 0-7
  15.245  get_match_length:
  15.246 -	xchgw	%ax, %bp	// bp: offset
  15.247 +	xchgw	%ax, %bx	// bx: offset
  15.248  repeat_match:
  15.249  //111 repeat offset: reuse the offset value of the previous match command.
  15.250  
  15.251 -	movb	%bl, %al	// %al: original token
  15.252 +	popw	%ax		// restore original token in %al
  15.253  	movw	$MATCH_RUN_LEN+256*MIN_MATCH_SIZE, %cx
  15.254  	call	lzsa2len
  15.255 -#ifdef RAW_FORMAT
  15.256 -	jcxz	lzsa2quit	// bail if we hit EOD
  15.257 +#if !defined(ENHANCED_FORMAT) && defined(RAW_FORMAT)
  15.258 +	je	lzsa2quit	// bail if we hit EOD in (%si-2)
  15.259  #endif
  15.260 -#if !defined(FLAT32) && !defined(FLAT16OUT)
  15.261 +
  15.262 +#if !defined(FLAT16OUT) && !defined(FLAT32)
  15.263 +	xchg	AX, SI		// save %si	
  15.264 +	lea	(BX,DI), SI
  15.265  	pushw	%ds
  15.266 +# ifndef RAW_FORMAT
  15.267 +	pushw	%bp		// save end
  15.268 +# endif
  15.269 +	movw	%es, %bp
  15.270 +	cmpw	%si, %di
  15.271 +	jnc	lzsa2sameSeg
  15.272  	pushw	%si
  15.273 -	movw	%di, %si
  15.274 -	addw	%bp, %si
  15.275 -	movw	%es, %ax
  15.276 -	jc	axok
  15.277 -	subb	$0x10, %ah
  15.278 -axok:
  15.279 -.macro norm	reg
  15.280 -	movw	%si, \reg
  15.281 -	subw	%si, %dx
  15.282 +	shrcl	$4, %si
  15.283 +	lea	-4096(%bp,%si), %bp
  15.284 +	popw	%si
  15.285  	andw	$0xF, %si
  15.286 -	addw	%si, %dx
  15.287 -	shrw	$4, \reg
  15.288 -	addw	\reg, %ax
  15.289 -	movw	%ax, %ds
  15.290 -	movw	%di, \reg
  15.291 -	andw	$0xF, %di
  15.292 -	shrw	$4, \reg
  15.293 -	movw	%es, %ax
  15.294 -	addw	\reg, %ax
  15.295 -	movw	%ax, %es
  15.296 -.endm 
  15.297 -	pushw	%bp
  15.298 -	pushw	%dx
  15.299 -# if defined(NeedNormalize) || defined(PARANOIA)
  15.300 -	call	lzsa2movStr	// copy string
  15.301 -# else
  15.302 -	norm	%bp
  15.303 +lzsa2sameSeg:
  15.304 +	movw	%bp, %ds
  15.305 +# ifdef FASTFILL
  15.306 +	cmp	$-FASTFILL,BX
  15.307 +	jae	lzsa2fast
  15.308 +# endif
  15.309  	rep movsb
  15.310 +lzsa2chunkz:
  15.311 +# ifndef RAW_FORMAT
  15.312 +	popw	%bp		// restore end
  15.313  # endif
  15.314 -	popw	%dx
  15.315 -	popw	%bp
  15.316 -	popw	%si
  15.317  	popw	%ds
  15.318  #else
  15.319 +# ifdef FASTFILL
  15.320 +	cmp	$-FASTFILL,BX
  15.321 +	jae	lzsa2fast
  15.322 +# endif
  15.323  	xchg	AX, SI		// save %si	
  15.324 -	lea	(BP,DI), SI
  15.325 +	lea	(BX,DI), SI
  15.326  	rep movsb	%es:(SI), %es:(DI)
  15.327 +#define lzsa2chunkz lzsa2chunk
  15.328 +#endif
  15.329  	xchg	AX, SI		// restore %si	
  15.330 +	jmp	lzsa2chunk
  15.331 +#ifdef FASTFILL
  15.332 +lzsa2fast:
  15.333 +# if FASTFILL == 1
  15.334 +#  if !defined(FLAT16OUT) && !defined(FLAT32)
  15.335 +	lodsb
  15.336 +#  else
  15.337 +	movb	%es:(BX,DI), %al
  15.338 +#  endif
  15.339 +	rep stosb
  15.340 +# endif
  15.341 +# if FASTFILL == 2
  15.342 +#  if !defined(FLAT16OUT) && !defined(FLAT32)
  15.343 +	lodsw
  15.344 +#  else
  15.345 +	movw	%es:(BX,DI), %ax
  15.346 +#  endif
  15.347 +	je	lzsa2fastword
  15.348 +	movb	%ah, %al
  15.349 +lzsa2fastword:
  15.350 +	shr	$1, CX
  15.351 +	rep stosw
  15.352 +	jnc	lzsa2chunkz
  15.353 +	stosb
  15.354 +# endif
  15.355 +	jmp	lzsa2chunkz
  15.356  #endif
  15.357 -	jmp	lzsa2chunk
  15.358 -
  15.359 -getByteFromNibbleAndC:
  15.360 -	pushfw
  15.361 -	call	getNibble	// get nibble for offset bits 0-3
  15.362 -	popfw
  15.363 -	rclb	$1, %al
  15.364 -	xorb	$0xE1, %al	// set offset bits 7-5 to 1
  15.365 -	ret
  15.366  
  15.367  lzsa2len:			// get length in %cx
  15.368  	andb	%cl, %al
  15.369  	cbw			// clear %ah
  15.370  	cmpb	%al, %cl
  15.371 -	jne	lzsa2minNumber	// S=0-2, L=0-6
  15.372 -	call	getNibble
  15.373 +	jne	lzsa2minNumber	// S=0-2, L=0-6			%cx = %ch + %al   if (%al & %cl != %cl)
  15.374 +	addb	%al, %ch
  15.375 +	call	getNibble	// kill %cl
  15.376  	cmp	$0xF, %al
  15.377 -	jne	lzsa2noExtraByte
  15.378 +	jne	lzsa2minNumber	//				%cx = %ch + %cl + nibble   if (%al & %cl == %cl && nibble != 0xF)
  15.379  	addb	%al, %ch
  15.380  	lodsb
  15.381 -lzsa2noExtraByte:
  15.382 -	addb	%cl, %ch
  15.383  lzsa2minNumber:
  15.384  	addb	%ch, %al
  15.385 -	jnc	lzsa2gotNumber  // 0-255
  15.386 -#if 0
  15.387 -	je	lzsa2BigNumber
  15.388 -	movb	%al, %ah	// S=256-767, L=256-1791
  15.389 -	lodsb	
  15.390 +	jnc	lzsa2gotNumber  // 0-255			%cx = %ch + %cl + 0xF + byte   if (%al & %cl == %cl && nibble == 0xF && %ch + %cl + 0xF + byte < 0x100)
  15.391 +#ifdef ENHANCED_FORMAT
  15.392 +	decw	%ax
  15.393 +	je	lzsa2maxNumber
  15.394 +# ifdef RAW_FORMAT
  15.395 +	jns	lzsa2midNumber
  15.396 +	popw	%ax
  15.397 +	ret			// bail if we hit EOD
  15.398 +lzsa2midNumber:
  15.399 +# endif
  15.400 +	xchgb	%al, %ah	// S=256-4351, L=256-5887
  15.401 +	lodsb			//				%cx = (%ch + %cl + 0xE + byte)*256 + byte2   if (%al & %cl == %cl && nibble == 0xF && %ch + %cl + 0xF + byte > 0x100)
  15.402  	.byte	0xB1		// mask lodsw with movb $0xAD, %cl
  15.403 -lzsa2BigNumber:
  15.404 +lzsa2maxNumber:
  15.405  #endif
  15.406 -	lodsw			// 0-65535
  15.407 +	lodsw			// 0-65535			%cx = word   if (%al & %cl == %cl && nibble == 0xF && %ch + %cl + 0xF + byte == 0x100)
  15.408  lzsa2gotNumber:
  15.409  	xchgw	%ax, %cx
  15.410  	ret
  15.411 -
  15.412 -#if defined(NeedNormalize) || defined(PARANOIA)
  15.413 -# if defined(PARANOIA)
  15.414 -lzsa2movlp:
  15.415 -	decw	%ch
  15.416 -	rep movsb
  15.417 -	incw	%ch
  15.418 -# endif
  15.419 -normalize:
  15.420 -lzsa2movLit:
  15.421 -	movw	%ds, %ax
  15.422 -lzsa2movStr:
  15.423 -	norm	%bp
  15.424 -# if defined(PARANOIA)
  15.425 -	cmpb	$0xFF, %ch	// catch FFFX case
  15.426 -	je	lzsa2movlp
  15.427 -# endif
  15.428 -	rep movsb
  15.429 -	ret
  15.430 -#endif
    16.1 --- a/transcode/receipt	Sat Jun 24 08:24:26 2023 +0000
    16.2 +++ b/transcode/receipt	Tue Jul 11 10:40:23 2023 +0000
    16.3 @@ -8,7 +8,7 @@
    16.4  LICENSE="GPL2"
    16.5  TARBALL="$PACKAGE-$VERSION.tar.bz2"
    16.6  WEB_SITE="https://www.linuxtv.org/wiki/index.php/Transcode"
    16.7 -WGET_URL="https://sources.archlinux.org/other/community/transcode/$TARBALL"
    16.8 +WGET_URL="https://web.archive.org/web/20230219142817if_/https://sources.archlinux.org/other/community/transcode/$TARBALL"
    16.9  EXTRA_SOURCE_FILES="http://www.linuxfromscratch.org/patches/blfs/7.6/transcode-1.1.7-ffmpeg2-1.patch"
   16.10  
   16.11  DEPENDS="libav lame libdvdread jpeg libvorbis alsa-lib"
   16.12 @@ -18,7 +18,7 @@
   16.13  # What is the latest version available today?
   16.14  current_version()
   16.15  {
   16.16 -	wget -O - ${WGET_URL%/*}/ 2>/dev/null | \
   16.17 +	wget -O - https://sources.archlinux.org/other/community/transcode/ 2>/dev/null | \
   16.18  	sed '/transcode-/!d;s|.*transcode-||;s|.tar.*||'
   16.19  }
   16.20  
    17.1 --- a/wv/receipt	Sat Jun 24 08:24:26 2023 +0000
    17.2 +++ b/wv/receipt	Tue Jul 11 10:40:23 2023 +0000
    17.3 @@ -8,7 +8,7 @@
    17.4  LICENSE="GPL2"
    17.5  TARBALL="$PACKAGE-$VERSION.tar.gz"
    17.6  WEB_SITE="http://www.abisource.com/projects/"
    17.7 -WGET_URL="http://www.abisource.com/downloads/wv/$VERSION/$TARBALL"
    17.8 +WGET_URL="https://web.archive.org/web/20150709083957if_/http://www.abisource.com/downloads/wv/$VERSION/$TARBALL"
    17.9  
   17.10  DEPENDS="glib libgsf libpng libxml2 zlib"
   17.11  BUILD_DEPENDS="libgsf libgsf-dev glib-dev libxml2-dev libpng-dev"
   17.12 @@ -16,7 +16,7 @@
   17.13  # What is the latest version available today?
   17.14  current_version()
   17.15  {
   17.16 -	wget -O - ${WGET_URL%/*/*}/ 2>/dev/null | \
   17.17 +	wget -O - http://www.abisource.com/downloads/wv/ 2>/dev/null | \
   17.18  	sed '/\[DIR/!d;/arent/d;s|.*ref="||;s|/.*||' | sort -Vr | sed q
   17.19  }
   17.20  
    18.1 --- a/yaws/receipt	Sat Jun 24 08:24:26 2023 +0000
    18.2 +++ b/yaws/receipt	Tue Jul 11 10:40:23 2023 +0000
    18.3 @@ -7,7 +7,7 @@
    18.4  SHORT_DESC="Webserver for dynamic content written in Erlang."
    18.5  MAINTAINER="allan316@gmail.com"
    18.6  LICENSE="BSD"
    18.7 -WEB_SITE="http://yaws.hyber.org"
    18.8 +WEB_SITE="https://github.com/erlyaws/yaws"
    18.9  
   18.10  TARBALL="$PACKAGE-$VERSION.tar.gz"
   18.11  WGET_URL="https://github.com/erlyaws/$PACKAGE/archive/$TARBALL"
   18.12 @@ -15,6 +15,7 @@
   18.13  DEPENDS="erlang pam pkg-config"
   18.14  BUILD_DEPENDS="autoconf automake erlang gawk libtool pam-dev"
   18.15  
   18.16 +# What is the latest version available today?
   18.17  current_version()
   18.18  {
   18.19  	wget -O - ${WGET_URL%/arch*}/releases 2>/dev/null | \