From: nowhere@never.at   
      
   Kerr Mudd-John wrote:   
      
   >> now it's more than obvious that a direct 4:3 SMC gain at least   
   >> 25 bytes against all 2:1 variants:   
      
   >> all modifications can be done within the first two lines and   
   >> the string itself is halfed and now fits the third line !   
      
   > This was the realization for me; that the (eventual) B64 decoder was less   
   > than a line's width.   
      
   > I've been assuming that it must be the first line (bar a jmp past it, but   
   > even that can be fixed up!) with the fixup code afterwards;   
      
   > how do you otherwise deal with the crlf/cr/lf/nul possible line endings   
   > hitting the wrong fixup locations?   
      
   I put my 56byte decoder string at 0184 starting with four'36' nops,   
   so it wont contain any CRLF.   
      
   > the move code itself needs to be fixedup or written on the fly, so I leave it   
   > 'til after fixing in place.   
      
   >> we had ~016B as stringstart for 2:1.   
   >> now I made it 0184 (4 slide nops) to not have CRLF inbetween.   
   >> even this are 25 byte more it allow REP MOVS after start-scan.   
      
   >> further size reduction seems possible, I'll check.   
      
   >> btw: you posted something to the other 'too long' thread,   
   >> I see the header but can't open it.   
   > Not that exciting: saved a jmp, cost a lodsb:   
      
   > On Fri, 26 May 2017 08:24:38 +0100, Kerr Mudd-John   
   > wrote:   
      
   > ll63 bytes 252   
   > Saved a few more! (OK just 1 in the 2:1 stage2 decoder)   
   > ll64 bytes 249   
   > ZRPRhF0XPR5F1PRRjF4gPa5LU1GI1GKRX+G=1GdSVG8+r6238wat083t+RUZ=rY=   
   > 662202Zffffff0222F6====MJ=20=17===eeee+++slOBI9UnoAlpinMIupasbaA   
   > NE9E7jelperHQE9sAWKsuH8lpssMIG7asA9babaRKi8A99Wh8G7w7d8v7h8WKh8f   
   > 7I8sCoAlpadITw7YoH9f7=tAm6CAHNIcNIZWxsbyB3b3JsZCEk=   
      
   thanks.   
      
   > Here's the 47 byte b64 decoder (that I'm trying to fixup)   
      
   let me count:   
    3 Singles 100,114,118,(12e,+ 12f RET)   
    1 8x single 110, (80.. are only pairable if low byte with my way)   
   12 Pairs 108,10e,111,11b,11d,11f,121,123,125,127,129,12e   
      
   16 modifiers needed, shouldn't be a problem..   
      
   > ->u100 l2E   
   > 1622:0100 AC lodsb   
   > 1622:0101 3C 2B cmp al,2B   
   > 1622:0103 72 25 jb 012A   
   > 1622:0105 2C 41 sub al,41   
   > 1622:0107 73 0A jnb 0113   
   > 1622:0109 04 45 add al,45   
   > 1622:010B 3C 33 cmp al,33   
   > 1622:010D 77 0A ja 0119   
   > 1622:010F B0 86 mov al,86   
   > 1622:0111 1C 00 sbb al,00   
   > 1622:0113 3C 1A cmp al,1A   
   > 1622:0115 72 02 jb 0119   
   > 1622:0117 2C 06 sub al,06   
   > 1622:0119 41 inc cx   
   > 1622:011A 41 inc cx   
   > 1622:011B 83 E1 06 and cx,0006   
   > 1622:011E D2 EC shr ah,cl   
   > 1622:0120 C0 E0 02 shl al,02   
   > 1622:0123 D3 E0 shl ax,cl   
   > 1622:0125 86 E0 xchg ah,al   
   > 1622:0127 E3 01 jcxzw 012A   
   > 1622:0129 AA stosb   
   > 1622:012A AC lodsb   
   > 1622:012B 3C 3D cmp al,3D   
   > 1622:012D 75 D2 jnz 0101   
      
   why mov al,86 ?   
      
   I hope to not have inserted too many typos here:   
      
   my decoder is a bit larger (56 byte):   
   it needs: 5 singles| 1 paired 8x | 9 pairs (=15)   
      
   044 41 41 41 41 inc cx dup4 ;cx=0 from previous   
   048 55 55 push bp dup2   
   04a 66 8f 05 pop dword [DI] ;clr four (p)   
   04d AC lodsb ;(s)   
   04e 3c 2b cmp al,2b   
   050 72 fb jc 04d ;(s)   
   052 3c 3d cmp al,3d   
   054 75 01 jnz 057 ;   
   056 C3 ret ;c301 (p)   
   057 2c 47 sub al,47   
   059 73 10 jnc 06b ;0410 (p),06(s)   
   05b 04 06 add al,6 ;no gain with sub al,fa   
   05d 3c 1a cmp al,1a ;(s)   
   05f 72 0a jc 06b ;040a (p)   
   061 04 45 add al,45   
   063 3c 33 cmp al,33   
   065 77 04 ja 06b ;b004 (p)   
   067 b0 3f mov al,3f   
   069 1c 00 sbb al,00 ;(p)   
   06b 08 05 or [di],al ;(p)   
   06d 66 c1 05 46 ROR dword [di],6;(p)   
   071 e2 da loop 04d ;(p)   
   073 66 c1 2d 48 SHR dword [di],8;(s)   
   077 47 47 47 inc di dup 3   
   07a eb c8 jmp 044 ;(p)   
      
   but you might be more interested in how I modify:   
      
   100 pop cx   
   101 push cx   
   102 push cx ;ax=0   
   103 push byte 56 ;cx=0056   
   105 push 4130 ;dx=4130 to find my first byte with DH   
   108 pop ax   
   109 push ax   
   10a xor ax,4030   
   10d push ax ;bx=0100   
   10e push cx dup2 ;sp,bp=0   
   110 sub al,7e ;   
   112 push ax ;si=0182   
   113 push byte 044 ;di=0044   
   115 popa ;   
   116 push BX ;for ret   
   117 push DI ;for ret   
   118 sub ax,5c73 ;-> a38d   
   11b xor [bx+5b],ax ;make a back-branch to 0120   
   11e jnc 0142 ;=jmp always after xor (73 22)   
      
   120 cmp [si],dh ;search my first byte (41)   
   122 jnz 0158 ;skip   
   124 push bx   
   125 3636 REP MOVSB ;   
   127 pop di   
   128 sub [bp+7a],ax ;ax= 7761 [07a] was 404c   
   12b sub [bp+74],al ; [074] was 22   
   12e sub [bp+71],ax ; and so on...   
   131 sub [bb+6e],ax   
   134 sub [bp+6b],ax   
   137 sub [bp+69],ax   
   13a sub [bp+66],ax   
   13d jnz 0160 ;=jmp always 75 21   
   13f 3d ;unused can be any   
   140 0d 0a   
   142 36 36   
   144 push bp   
   145 pop ax   
   146 sub ax,6d3b ;92c5 xor 3636 = A4F3   
   149 xor [bx+25],ax ;create REP MOVS   
   14c sub al,21 ;c5-21=a4   
   14d inc ax dup2 ;a6 xor 65 = c3   
   14f xor [bx+7e],al ;create a RET in a field of 65 nops   
   152 36 ;just a forgotten byte   
   153 push 7761   
   156 pop ax   
   157 dec si   
   158 36 36   
   15a inc si   
   15b 6666 JMP 120   
   15d 6666   
   15f 36   
   160 sub [bp+5e],al   
   163 sub [bp+60],ax   
   166 sub [bp+5c],al   
   169 sub [bp+5a],ax   
   16c sub [bp+55],ax   
   16f sub [bb+51],al   
   172 sub [bp+4d],al   
   175 sub al,7a   
   178 sub [bp+4b],ax   
   17b 363636 ;free for one more   
   17e 65656565 ;the return goes there   
   182 0d0a   
   184 36363636   
   188 41414141 ... my raw string resides here   
   __   
   wolfgang   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   
|