Forums before death by AOL, social media and spammers... "We can't have nice things"
|    comp.lang.asm.x86    |    Ahh, the lost art of x86 assembly    |    4,675 messages    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
|    Message 2,783 of 4,675    |
|    wolfgang kern to All    |
|    Re: B64 fixup version    |
|    03 Jul 17 13:16:27    |
      From: nowhere@never.at              > hope it's correct typed in yet:       what happend to my eyes recently ? I better ask for new glasses soon.       corrected: address 012c+3=012f =! 013f       I added more comments to make sure you detect any bugs easier :)              100 pop cx       101 push cx       102 push cx ;ax=0       103 push byte 038 ;cx=0038 (56 byte)       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,5873 ;-> a78d xor 6666 = EB C1       11b xor [bx+5D],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 015a ;skip       124 3636 REP MOVSB ;       126 sub [bp+7a],ax ;404c-7751=C8EB       129 sub [bp+74],al ;22-61=C1       12c sub [bp+71],ax ;5243-7761=DAE2       12f sub [bp+6e],ax ;7D22-7761=05C1       132 sub [bp+6b],ax ;7C69-7761-0508       135 sub [bp+69],ax ;777D-7761=001C       138 sub [bp+66],ax ;2765-7761=B004       13b sub [bp+60],ax ;7B6B-7761=040A       13e jnz 0161 ;=jmp always 75 21       140 0d 0a              142 36 36       144 push bp       145 pop ax       146 sub ax,6d3b ;92c5 xor 3636 = A4F3       149 xor [bx+24],ax ;create REP MOVS       14c sub al,21 ;c5-21=a4       14e inc ax dup2 ;a6 xor 65 = c3       150 xor [bx+7e],al ;create a RET in a field of 65 nops       153 push bx       154 pop di       155 push 7761       158 pop ax       159 dec si       15a 36 36 ;slide nops       15c inc si       15d 6666 JMP 120 ;become eb c1       15f 6666              161 sub [bp+5e],al ;7B-61=1A       164 sub [bp+5c],al ;67-61=06       167 sub [bp+5a],ax ;7B71-7761=0410       16a sub [bp+55],ax ;3A62-7761=C301       16d sub [bp+51],al ;5C-61=FB       170 sub [bp+4d],ah ;23-77=AC       173 363636 ;free for two more       176 363636 ;       179 sub al,7a ;make ax=77e7       17b sub [bp+4b],ax ;7D76-77e7=058F       17e 6565 ;the return goes here       180 6565 ;or there       182 0d0a       184 3636 ;two are enough with scan start at 0182       186 41414141 ... ;raw string starts here immediate followed by B64              just checked if this was all correct typed:              044 41 41 41 41 inc cx dup4 ;cx=0 from previous       can use MOV CL,04 to save two bytes by using a free SUB[bp+..]       048 55 55 push bp dup2       04a 66 8f 05 pop dword [DI] ;clr four, 058f(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)       07c ***       seems OK AFAICS ;)              I now try to mix with and modify Kerr's shorter variant:              044 B1 06 mov cl,06 ;06b1 (p) required after REP MOV       046 AC lodsb ;(s ah)       047 3c 2b cmp al,2b       049 72 fb jc 046 ;(s al)       04b 3c 3d cmp al,3d       04d 75 01 jnz 050 ;c301 (p)       05f C3 ret       50..63 same size but one modify need less than 0105..0118       050 2c 47 sub al,47       052 73 10 jnc 064 ;0410 (p)       054 04 06 add al,6 ;06 (s)       056 3c 1a cmp al,1a ;1a (s)       058 72 0a jc 064 ;040a (p)       05a 04 45 add al,45       05c 3c 33 cmp al,33       05e 77 04 ja 064 ;b004 (p)       060 b0 3f mov al,3f       062 1c 00 sbb al,00 ;001c (p)              064 41 41 inc cx dup2       066 83 E1 06 and cx,0006 ;(s 8x) [5e-61-7a=83]       069 D2 EC shr ah,cl ;06e1 (p) ecd2 (p)       06b C0 E0 42 shl al,02 ;e0c0 (p) tricky:42       06e D3 E0 shl ax,cl ;e0d3 (p)       070 86 E0 xchg ah,al ;e086 (p 8x)       072 E3 01 jcxzw 075 ;01e3 (p)       074 AA stosb ;aa (s ah)       075 EB CF jmp 046 ;cfeb (p)       077 ***              even shorter by 5byte it needs 13 pairs + 6 singles, 2 too much yet!       perhaps two three byte subs can be added by moving the return to the       third line with [BP+DI+..] an 3d0d0a and SI=0190, but this five bytes       are more than lost in the overall size then.       __       wolfgang              --- SoupGate-Win32 v1.05        * Origin: you cannot sedate... all the things you hate (1:229/2)    |
[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]
(c) 1994, bbs@darkrealms.ca