大会:为什么我们用寄存器困扰? [英] Assembly: Why are we bothering with registers?

查看:240
本文介绍了大会:为什么我们用寄存器困扰?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对装配的一个基本问题。

I have a basic question about assembly.

为什么我们何必只对寄存器做算术运算,如果他们能在内存中运行呢?

Why do we bother doing arithmetic operations only on registers if they can work on memory as well?

例如以下两个原因(基本)相同的值将作为一个答案计算:

For example both of the following cause (essentially) the same value to be calculated as an answer:

1片段

.data
    var dd 00000400h

.code

    Start:
        add var,0000000Bh
        mov eax,var
        ;breakpoint: var = 00000B04
    End Start

结果

2片段

.code

    Start:
        mov eax,00000400h
        add eax,0000000bh
        ;breakpoint: eax = 0000040B
    End Start

搜索结果
 从我所看到的大多数文章和教程做的大多寄存器算术运算。难道仅仅是更快地与登记工作?



From what I can see most texts and tutorials do arithmetic operations mostly on registers. Is it just faster to work with registers?

编辑:这是快:)

一些伟大的答案被给予;基于第一个很好的答案被选为最佳答案。

A few great answers were given; best answer was chosen based on the first good answer.

推荐答案

寄存器都更快,也可以在内存中直接执行的操作是更加有限的。

Registers are much faster and also the operations that you can perform directly on memory are far more limited.

这篇关于大会:为什么我们用寄存器困扰?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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