Module: D:\SOURCE\WORK\XX\xx.cpp Group: 'DGROUP' CONST,CONST2,_DATA,_BSS Segment: _TEXT PARA 000001b0 bytes static const char xx_chars[65] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz()"; void bin2xx(const void *src, unsigned srcbytes, void *dst, unsigned *dstbytes) { 0000 void near bin2xx( void const near *, int unsigned, void near *, int unsigned near * ): 0000 56 push si 0001 57 push di 0002 55 push bp 0003 89 e5 mov bp,sp 0005 83 ec 06 sub sp,0006H 0008 52 push dx 0009 51 push cx const unsigned char *srcp=(const unsigned char*)src; unsigned char *dstp=(unsigned char*)dst; 000a 89 c6 mov si,ax unsigned sb=srcbytes; while(srcbytes>0) { #ifdef NEEDALIGN unsigned long b24 = ((unsigned long)(srcp[0]) ) | ((unsigned long)(srcp[1])<< 8) | ((unsigned long)(srcp[2])<<16); #else 000c 89 56 fc mov -4H[bp],dx 000f 85 d2 test dx,dx 0011 76 78 jbe L2 unsigned long b24 = *((unsigned long*)srcp); #endif 0013 8b 04 L1 mov ax,[si] 0015 89 46 fe mov -2H[bp],ax dstp[0] = xx_chars[ b24 & 0x3f]; 0018 8b 7e fe mov di,-2H[bp] 001b 8b 44 02 mov ax,+2H[si] 001e 83 e7 3f and di,003fH 0021 89 46 fa mov -6H[bp],ax 0024 8a 85 00 00 mov al,char const near xx_chars[][di] 0028 8b 56 fa mov dx,-6H[bp] 002b 88 07 mov [bx],al dstp[1] = xx_chars[(b24>>6) & 0x3f]; 002d 8b 46 fe mov ax,-2H[bp] 0030 b1 06 mov cl,06H 0032 d3 e8 shr ax,cl 0034 d3 ca ror dx,cl 0036 31 d0 xor ax,dx 0038 81 e2 ff 03 and dx,03ffH 003c 31 d0 xor ax,dx 003e 89 c7 mov di,ax 0040 83 e7 3f and di,003fH 0043 8a 85 00 00 mov al,char const near xx_chars[][di] 0047 8b 56 fa mov dx,-6H[bp] 004a 88 47 01 mov +1H[bx],al dstp[2] = xx_chars[(b24>>12) & 0x3f]; 004d 8b 46 fe mov ax,-2H[bp] 0050 b1 0c mov cl,0cH 0052 d3 e8 shr ax,cl 0054 d3 ca ror dx,cl 0056 31 d0 xor ax,dx 0058 81 e2 0f 00 and dx,000fH 005c 31 d0 xor ax,dx 005e 89 c7 mov di,ax 0060 83 e7 3f and di,003fH 0063 8a 85 00 00 mov al,char const near xx_chars[][di] dstp[3] = xx_chars[(b24>>18) & 0x3f]; dstp+=4; 0067 8b 7e fa mov di,-6H[bp] 006a 83 6e f8 03 sub word ptr -8H[bp],0003H 006e d1 ef shr di,1 srcbytes-=3; 0070 83 c3 04 add bx,0004H 0073 d1 ef shr di,1 0075 88 47 fe mov -2H[bx],al 0078 83 e7 3f and di,003fH 007b 8a 85 00 00 mov al,char const near xx_chars[][di] srcp+=3; } 007f 83 c6 03 add si,0003H 0082 88 47 ff mov -1H[bx],al 0085 83 7e f8 00 cmp word ptr -8H[bp],0000H 0089 77 88 ja L1 *dstbytes = sb + ((sb+2)/3); 008b 8b 46 fc L2 mov ax,-4H[bp] 008e bb 03 00 mov bx,0003H 0091 31 d2 xor dx,dx 0093 05 02 00 add ax,0002H 0096 f7 f3 div bx 0098 8b 56 fc mov dx,-4H[bp] 009b 8b 5e f6 mov bx,-0aH[bp] 009e 01 c2 add dx,ax 00a0 89 17 mov [bx],dx } #ifdef __WATCOMC__ unsigned char xxindex(unsigned char c); #pragma aux xxindex = \ " cmp al,'(' " \ " jne testRP " \ " mov al,62 " \ " jmp theEnd " \ "testRP: cmp al,')' " \ " jne testD " \ " mov al,63 " \ " jmp theEnd " \ "testD: cmp al,'9' " \ " ja testUC " \ " sub al,'0' " \ " jmp theEnd " \ "testUC: cmp al,'Z' " \ " ja testLC " \ " sub al,'A' " \ " jmp theEnd " \ "testLC: sub al,'a' " \ " ret " \ "theEnd: " \ parm [al] \ value [al] \ modify [] unsigned long pack4x6to3x8(unsigned char b0, unsigned char b1, unsigned b2, unsigned b3); #pragma aux pack4x6to3x8 = \ ".386p " \ " xor ecx,ecx " \ " or cl,dh " \ " shl ecx,6 " \ " or cl,dl " \ " shl ecx,6 " \ " or cl,ah " \ " shl ecx,6 " \ " or cl,al " \ " mov ax,cx " \ " shr ecx,16 " \ " mov dx,cx " \ parm [al] [ah] [dl] [dh] \ value [ax dx] \ modify [cx] #else #define xxindex(c) (unsigned char)(strchr(xx_chars,c)-xx_chars) #endif 00a2 89 ec mov sp,bp 00a4 5d pop bp 00a5 5f pop di 00a6 5e pop si 00a7 c3 ret void xx2bin(const void *src, unsigned srcbytes, void *dst, unsigned *dstbytes) { 00a8 void near xx2bin( void const near *, int unsigned, void near *, int unsigned near * ): 00a8 56 push si 00a9 57 push di 00aa 55 push bp 00ab 89 e5 mov bp,sp 00ad 83 ec 04 sub sp,0004H 00b0 89 d7 mov di,dx 00b2 89 de mov si,bx 00b4 89 4e fc mov -4H[bp],cx const unsigned char *srcp=(const unsigned char*)src; unsigned char *dstp=(unsigned char*)dst; 00b7 89 c3 mov bx,ax unsigned sb=srcbytes; while(srcbytes>0) { 00b9 89 56 fe mov -2H[bp],dx 00bc 85 d2 test dx,dx 00be 77 03 ja L3 00c0 e9 d8 00 jmp L24 unsigned char b0= xxindex(srcp[0]); 00c3 8a 07 L3 mov al,[bx] 00c5 3c 28 cmp al,28H 00c7 75 04 jne L4 00c9 b0 3e mov al,3eH 00cb eb 1b jmp L8 00cd 3c 29 L4 cmp al,29H 00cf 75 04 jne L5 00d1 b0 3f mov al,3fH 00d3 eb 13 jmp L8 00d5 3c 39 L5 cmp al,39H 00d7 77 04 ja L6 00d9 2c 30 sub al,30H 00db eb 0b jmp L8 00dd 3c 5a L6 cmp al,5aH 00df 77 04 ja L7 00e1 2c 41 sub al,41H 00e3 eb 03 jmp L8 00e5 2c 61 L7 sub al,61H 00e7 c3 ret 00e8 88 c1 L8 mov cl,al unsigned char b1= xxindex(srcp[1]); 00ea 8a 47 01 mov al,+1H[bx] 00ed 3c 28 cmp al,28H 00ef 75 04 jne L9 00f1 b0 3e mov al,3eH 00f3 eb 1b jmp L13 00f5 3c 29 L9 cmp al,29H 00f7 75 04 jne L10 00f9 b0 3f mov al,3fH 00fb eb 13 jmp L13 00fd 3c 39 L10 cmp al,39H 00ff 77 04 ja L11 0101 2c 30 sub al,30H 0103 eb 0b jmp L13 0105 3c 5a L11 cmp al,5aH 0107 77 04 ja L12 0109 2c 41 sub al,41H 010b eb 03 jmp L13 010d 2c 61 L12 sub al,61H 010f c3 ret 0110 88 c5 L13 mov ch,al unsigned char b2= xxindex(srcp[2]); 0112 8a 47 02 mov al,+2H[bx] 0115 3c 28 cmp al,28H 0117 75 04 jne L14 0119 b0 3e mov al,3eH 011b eb 1b jmp L18 011d 3c 29 L14 cmp al,29H 011f 75 04 jne L15 0121 b0 3f mov al,3fH 0123 eb 13 jmp L18 0125 3c 39 L15 cmp al,39H 0127 77 04 ja L16 0129 2c 30 sub al,30H 012b eb 0b jmp L18 012d 3c 5a L16 cmp al,5aH 012f 77 04 ja L17 0131 2c 41 sub al,41H 0133 eb 03 jmp L18 0135 2c 61 L17 sub al,61H 0137 c3 ret 0138 88 c2 L18 mov dl,al unsigned char b3= xxindex(srcp[3]); 013a 8a 47 03 mov al,+3H[bx] 013d 3c 28 cmp al,28H 013f 75 04 jne L19 0141 b0 3e mov al,3eH 0143 eb 1b jmp L23 0145 3c 29 L19 cmp al,29H 0147 75 04 jne L20 0149 b0 3f mov al,3fH 014b eb 13 jmp L23 014d 3c 39 L20 cmp al,39H 014f 77 04 ja L21 0151 2c 30 sub al,30H 0153 eb 0b jmp L23 0155 3c 5a L21 cmp al,5aH 0157 77 04 ja L22 0159 2c 41 sub al,41H 015b eb 03 jmp L23 015d 2c 61 L22 sub al,61H 015f c3 ret unsigned long b24 = pack4x6to3x8(b0,b1,b2,b3); #ifdef NEEDALIGN dstp[0] = (unsigned char)((b24 ) & 0xff); dstp[1] = (unsigned char)((b24>> 8) & 0xff); dstp[2] = (unsigned char)((b24>>16) & 0xff); #else *((unsigned long*)dstp) = b24; #endif srcp += 4; srcbytes -= 4; 0160 88 c6 L23 mov dh,al 0162 88 ec mov ah,ch 0164 83 c6 03 add si,0003H 0167 88 c8 mov al,cl 0169 83 c3 04 add bx,0004H 016c 66 31 c9 xor ecx,ecx 016f 08 f1 or cl,dh 0171 66 c1 e1 06 shl ecx,06H 0175 08 d1 or cl,dl 0177 66 c1 e1 06 shl ecx,06H 017b 08 e1 or cl,ah 017d 66 c1 e1 06 shl ecx,06H 0181 08 c1 or cl,al 0183 89 c8 mov ax,cx 0185 66 c1 e9 10 shr ecx,10H 0189 89 ca mov dx,cx 018b 89 44 fd mov -3H[si],ax dstp += 3; } 018e 83 ef 04 sub di,0004H 0191 89 54 ff mov -1H[si],dx 0194 85 ff test di,di 0196 76 03 jbe L24 0198 e9 28 ff jmp L3 *dstbytes = sb/3; 019b 8b 46 fe L24 mov ax,-2H[bp] 019e bb 03 00 mov bx,0003H 01a1 31 d2 xor dx,dx 01a3 f7 f3 div bx 01a5 8b 5e fc mov bx,-4H[bp] 01a8 89 07 mov [bx],ax } 01aa 89 ec mov sp,bp 01ac 5d pop bp 01ad 5f pop di 01ae 5e pop si 01af c3 ret No disassembly errors ------------------------------------------------------------ Segment: _DATA WORD 00000041 bytes 0000 char const near xx_chars[] LABEL BYTE 0000 30 31 32 33 34 35 36 37 - 01234567 0008 38 39 41 42 43 44 45 46 - 89ABCDEF 0010 47 48 49 4a 4b 4c 4d 4e - GHIJKLMN 0018 4f 50 51 52 53 54 55 56 - OPQRSTUV 0020 57 58 59 5a 61 62 63 64 - WXYZabcd 0028 65 66 67 68 69 6a 6b 6c - efghijkl 0030 6d 6e 6f 70 71 72 73 74 - mnopqrst 0038 75 76 77 78 79 7a 28 29 - uvwxyz() 0040 00 - . No disassembly errors ------------------------------------------------------------