浮点数以16位汇编 [英] float numbers in 16 bit asembly

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

问题描述

hi
我想在汇编16位中编写一个模拟小时,所以我需要使用浮点数
但是如何在汇编16位中使用浮点数? (在16位环境中,我仅使用Intel 8086/8088/80x86,它们仅对协处理器80x87进行浮点运算,后者后来集成在同一芯片上,但在逻辑上是分开的,需要同步.)您的处理器可以做什么?首先在其指令集中找到引用的地址.

—SA


假设使用x86/FPU,则可以使用它们.

同样,大多数操作码都有2个不同的变体.这是8位版本和16/32位版本.使用操作码中的一位完成选择. 16/32位意味着它取决于您使用该操作码时所处的模式.因此,您处于16位模式,这意味着默认情况下16位操作码与16位操作数大小一起使用.但是,可以通过使用特殊前缀来更改它.

操作数改写,66h.更改指令默认模式下预期的数据大小,例如16位到32位,反之亦然.

地址覆盖67小时.更改指令期望的地址大小. 32位地址可以切换到16位,反之亦然.

这意味着当您需要使用32位操作码,操作数或同时使用两者时,可以使用这些前缀.对于NASM,请使用BITS 16,并且必要的前缀将自动添加.

祝你好运!


hi
i want to write a analogue hour in assembly 16 bit,so i need to use float numbers
but how can i use float numbers in assembly 16 bit?

解决方案

It totally depends on hardware (processor) and its instruction set. (In 16-bit world, I only worked with Intel 8086/8088/80x86, they did floating point only with co-processor 80x87 which later was integrated on the same chip but was logically separate, requiring synchronization.) What your processor can do? Address to the reference in its instruction set first.

—SA


Assuming x86/FPU, you can just use them.

Also, most of the opcodes have 2 different variants. This is the 8-bit version and the 16/32-bit version. The selection is done using a bit in the opcode. The 16/32-bit means that it depends on the mode you are in when using that opcode. So, you are in 16-bit mode, meaning that by default the 16-bit opcode is used with 16-bit operand sizes. It is however possible to change that by using special prefixes.

Operand override, 66h. Changes size of data expected by default mode of the instruction e.g. 16-bit to 32-bit and vice versa.

Address override, 67h. Changes size of address expected by the instruction. 32-bit address could switch to 16-bit and vice versa.

This means that when you would need to use a 32-bit opcode, operand or both you can use those prefixes. For NASM you use BITS 16 and necessary prefixes will be added automatically.

Good luck!


这篇关于浮点数以16位汇编的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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