组装8086;浮点数,加,减 [英] Assembly 8086; Floating Point Numbers, Add, Subtract

查看:62
本文介绍了组装8086;浮点数,加,减的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要一些资源来了解有关浮点数的更多信息,我需要在 emu8086 环境 ....

I need some resources to get to know more about numbers with floating point, I need to code add and subtract operations for that kind of numbers in emu8086 environment ....

非常感谢任何帮助

推荐答案

据我所知,emu8086模拟带有 8087 FPU 的机器.

As far as I can tell, emu8086 does not emulate a machine with an 8087 FPU.

您所做的任何浮点运算都必须是纯软件,不能使用 fld/fadd/fstp 或任何通常的遗留物1 x87 说明.

Any floating-point you do has to be pure software, not using fld / fadd / fstp or any of the usual legacy1 x87 instructions.

如果你想在实模式下使用 FP 指令,你最好的选择是像 DOSBox 或 BOCHS 这样的模拟器来模拟更新的 x86 + x87,而不是 emu8086.这样做的另一个好处是让您可以使用更方便的指令,例如 imul ax, 1234,而不必使用 1-operand mul.

If you want to use FP instructions in real mode, your best bet is an emulator like DOSBox or BOCHS that emulate a more recent x86 + x87, not emu8086. This also has the advantage of letting you use more convenient instructions like imul ax, 1234 instead of having to use 1-operand mul.

如果您坚持使用 emu8086(或真正的 8086 微控制器),大多数问题都可以通过 fixed-point,实际上不是浮点数:将固定位数视为小数部分.这在具有整数指令的软件中更容易做到.但它仍然可以让您表示像 1.25 这样的数字.

If you are stuck with emu8086 (or a real 8086 microcontroller), most problems can be solved with fixed-point, not actually floating point: treat a fixed number of bits as the fractional part. This is easier to do in software with integer instructions. But it still lets you represent numbers like 1.25.

脚注 1:在现代 x86 中,x87 FPU 已过时;我们现在将 SSE 和 SSE2 用于标量和 SIMD FP 数学,除非实际需要 80 位精度.emu8086当然也没有这个.现代 x86 CPU 当然仍然支持 x87​​ 指令;向后兼容现有二进制文件是 x86 仍然存在的主要原因.

Footnote 1: In modern x86, the x87 FPU is obsolete; we use SSE and SSE2 now for scalar and SIMD FP math, unless 80-bit precision is actually needed. emu8086 of course doesn't have this either. Modern x86 CPUs of course still support x87 instructions; being backwards compatible with existing binaries is x86's primary reason for still existing.

这篇关于组装8086;浮点数,加,减的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆