我已经将一个旧的 DOS 程序反汇编成汇编,我正在尝试找出一个函数调用。这是 ASM:
seg000:373C ; ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦ S U B R O U T I N E ¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦¦
seg000:373C
seg000:373C
seg000:373C sub_373C proc far ; CODE XREF: sub_72C6+16BP
seg000:373C ; sub_72C6+18FP ...
seg000:373C push si ; Temp. store si on stack so we can restore it later
seg000:373D xchg ax, si
seg000:373E xchg ax, dx
seg000:373F test ax, ax
seg000:3741 jz short loc_3745
seg000:3743 mul bx ; Multiply b by a IIF a is non-zero
seg000:3745
seg000:3745 loc_3745: ; CODE XREF: sub_373C+5j
seg000:3745 jcxz short loc_374C
seg000:3747 xchg ax, cx
seg000:3748 mul si
seg000:374A add ax, cx
seg000:374C
seg000:374C loc_374C: ; CODE XREF: sub_373C:loc_3745j
seg000:374C xchg ax, si
seg000:374D mul bx
seg000:374F add dx, si
seg000:3751 pop si ; Restore old si
seg000:3752 retf
seg000:3752 sub_373C endp
坦率地说,它似乎让我周围的寄存器乱七八糟。我最好的猜测是它是某种原始的伪随机数生成器。任何人都可以确认这一点,如果没有,请告诉我它的实际用途是什么?
编辑:
我试过干运行代码,据我所知,以下是寄存器的最终结果(谁能确认我做对了,并告诉我它可能在做什么有用的数学函数?):
ax: ( ax * bx )
bx: bx
cx: cx
dx: ax + ( (bx * dx) + (ax * cx) )