Discussion:
BASE64 again
(too old to reply)
Kerr Mudd-John
2017-07-05 09:08:05 UTC
Permalink
(may not thread)
WK wrote:

...
146 sub ax,6d3b ;92c5 xor 3636 = A4F3
149 xor [bx+24],ax ;create REP MOVS

I presume al=c5 here

; 14c sub al,21 ;c5-21=a4
; 14d inc ax dup2 ;a6 xor 65 = c3
shorter:
xor al,63 ; c5->a6

14f xor [bx+7e],al ;create a RET in a field of 65 nops
...


setting cx for my b64 decoder:
shorter to set dl earlier (where you set dh) (;it's not used elsewhere) to x6 where x is one of {3,4,5,6,7}
then push dx, pop cx before the entering; the "and cx,6" will scrap the other values.
--
Bah, and indeed, Humbug
wolfgang kern
2017-07-05 10:19:59 UTC
Permalink
Post by Kerr Mudd-John
...
146 sub ax,6d3b ;92c5 xor 3636 = A4F3
149 xor [bx+24],ax ;create REP MOVS
I presume al=c5 here
; 14c sub al,21 ;c5-21=a4
; 14d inc ax dup2 ;a6 xor 65 = c3
xor al,63 ; c5->a6
14f xor [bx+7e],al ;create a RET in a field of 65 nops
Yeah thanks, this saves two bytes. But because of the unmodified branch
to 0161 there isn't much we can do with it before REP MOVS took place,
except you can push dx there and pop cx at 044 (so save one byte).
Post by Kerr Mudd-John
shorter to set dl earlier (where you set dh) (;it's not used elsewhere)
to x6 where x is one of {3,4,5,6,7}
then push dx, pop cx before the entering; the "and cx,6" will scrap the other values.
Yes, this saves you on the MOV CL modifier, but I still count 18 modify
needs with your (shorter by only 3(4) bytes yet) SHR ah,cl version.
And for now I see only 17 available. My version need 16 incl. MOV CL.
__
wolfgang

Loading...