Do we also refer to the registers RAX, RBX etc as R1, R2 and so on?

前端 未结 2 890
有刺的猬
有刺的猬 2021-01-13 09:00

I am studying 8086/8080 microprocessors. The registers used in them have names,

  1. RAX
  2. RBX
  3. RCX
  4. RDX

and go on until R8 wh

2条回答
  •  日久生厌
    2021-01-13 09:44

    Standard practice is for the first 8 registers to keep their historical name. This convention is used in the documentation from Intel and AMD and in most assemblers.

    The reason for this is that these names are mnemonic for the function of the register. For example rsp sticks out as the stack pointer; r4 not so much. The new registers, by contrast, don't have any particular function.

    That being said you can always use macros to define r0-r7 as rax,rcx,rdx,rbx,rsp,rbp,rsi,rdi. For example you can get these definitions in nasm with

    %use altreg

    Again, this is non-standard and will make the code hard to read, both for you and others.

提交回复
热议问题