当前位置: 动力学知识库 > 问答 > 编程问答 >

fixed point - How to write 0.5 in assembly language code?

问题描述:

How can I convert the floating point "0.5" into a fixed point digit suitable for an assembly code?

Thank you for your answer,

Edit: I am trying to multiply the contents of AX by half, so I wrote IMUL AX,AX,0.5

The assembler refused this and told me "floating-points are not allowed".

All that I want is to divide the contents of AX by two.

网友答案:

Signed:

cwd
sub ax, dx
sar ax, 1

Unsigned:

shr ax, 1
分享给朋友:
您可能感兴趣的文章:
随机阅读: