首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 嵌入开发 > 汇编语言 >

请教怎么用C语言实现这样的汇编

2012-02-13 
请问如何用C语言实现这样的汇编我多次看到有这样的汇编代码.text:00010C09cmpecx,3.text:00010C0Cmov[eax+

请问如何用C语言实现这样的汇编
我多次看到有这样的汇编代码

.text:00010C09                                   cmp           ecx,   3
.text:00010C0C                                   mov           [eax+4Ch],   esi
.text:00010C0F                                   pop           esi
.text:00010C10                                   ja             short   loc_10C4B
.text:00010C12                                   jmp           ds:off_10CA0[ecx*4]   //   注意这里
.text:00010C19
.text:00010C19   loc_10C19:                                                             ;   DATA   XREF:   .text:00010CA4o
.text:00010C19                                   mov           cl,   [eax+30h]
.text:00010C1C                                   test         cl,   cl
.text:00010C1E                                   jnz           short   loc_10C4B
.text:00010C20                                   mov           cl,   [eax+18h]
.text:00010C23                                   test         cl,   cl
.text:00010C25                                   jz             short   loc_10C4B
.text:00010C27                                   mov           byte   ptr   [eax+31h],   4
.text:00010C2B                                   jmp           short   loc_10C4F
.text:00010C2D   ;   哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?
.text:00010C2D
.text:00010C2D   loc_10C2D:                                                             ;   CODE   XREF:   sub_10BC0+52j
.text:00010C2D                                                                                   ;   DATA   XREF:   .text:off_10CA0o   ...


.text:00010C2D                                   mov           cl,   [eax+18h]
.text:00010C30                                   test         cl,   cl
.text:00010C32                                   jz             short   loc_10C3A
.text:00010C34                                   mov           byte   ptr   [eax+31h],   4
.text:00010C38                                   jmp           short   loc_10C4F
.text:00010C3A   ;   哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?
.text:00010C3A
.text:00010C3A   loc_10C3A:                                                             ;   CODE   XREF:   sub_10BC0+52j
.text:00010C3A                                                                                   ;   sub_10BC0+72j
.text:00010C3A                                                                                   ;   DATA   XREF:   ...
.text:00010C3A                                   test         [eax+1Ch],   dl
.text:00010C3D                                   jz             short   loc_10C45
.text:00010C3F                                   mov           byte   ptr   [eax+31h],   7
.text:00010C43                                   jmp           short   loc_10C4F
.text:00010C9B   loc_10C9B:                                                             ;   CODE   XREF:   sub_10BC0+11j
.text:00010C9B                                                                                   ;   sub_10BC0+1Aj   ...
.text:00010C9B                                   xor           eax,   eax


.text:00010C9D
.text:00010C9D   locret_10C9D:                                                       ;   CODE   XREF:   sub_10BC0+97j
.text:00010C9D                                                                                   ;   sub_10BC0+9Ej
.text:00010C9D                                   retn         8
.text:00010C9D   sub_10BC0               endp
.text:00010C9D
.text:00010C9D   ;   哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪哪?
.text:00010CA0   off_10CA0               dd   offset   loc_10C2D           ;   DATA   XREF:   sub_10BC0+52r
.text:00010CA4                                   dd   offset   loc_10C19
.text:00010CA8                                   dd   offset   loc_10C3A
.text:00010CAC                                   dd   offset   loc_10C2D


大家可以看到
.text:00010C12                                   jmp           ds:off_10CA0[ecx*4]
这行是转跳到.text:00010CA0的off_10CA0数组里面去

我就是想不明白,C语言可以做到这样的转跳么?




[解决办法]
应该是反汇编错了
[解决办法]
可以,这是个switch 语句

switch(ecx)
{
case 0: goto loc_10C2D ;
case 1: goto loc_10C19;
....

default: goto short loc_10C4B;
}

热点排行