0

Im having problem finding some information about the registers in x8086.
can any one tell me what opartions i can and cant use each of the registers ?

for example i know only bx,di and si registers can be used as adress pointers
([ax] for example just wont compile).

EDIT:
thank you for all the information so far, but my question probably wasnt understandble enough, the information im seeking for isnt only about addressing mods but the arithmetic opartions and other given oprations by the language, on each of them.

on which register i CAN and CANT use each of the given assembly operators ?
(mov,add,sub,[ ], mul, etc...)

Itay.V
  • 169
  • 1
  • 7
  • The [x86 tag wiki](http://stackoverflow.com/tags/x86/info) contains lots of useful links. – Cody Gray - on strike Dec 03 '16 at 08:16
  • @CodyGray checked that already, didnt find any thing useful. it says what each register is used to but no information about the limits of each register. – Itay.V Dec 03 '16 at 08:17
  • 2
    [This article](http://www.swansontec.com/sregisters.html) literally explains everything you could possibly want to know, but you do have to read it carefully. In addition to saying what each register is used for, it also notes: *"In 16-bit mode, the base register, EBX, acts as a general-purpose pointer. Besides the specialized ESI, EDI, and EBP registers, it is the only general-purpose register that can appear in a square-bracket memory access (For example, MOV [BX], AX). In the 32-bit world, however, any register may serve as a memory offset, so the base register is no longer special."* – Cody Gray - on strike Dec 03 '16 at 08:21
  • 1
    [This article](https://courses.engr.illinois.edu/ece390/books/artofasm/CH04/CH04-2.html) is pretty good with respects to the addressing modes on the 8086. The 17 possible combinations of registers and displacements that are supported are outlined in the section _4.6.2.7 An Easy Way to Remember the 8086 Memory Addressing Modes_ . – Michael Petch Dec 03 '16 at 08:37
  • I happened to answer [something similar](https://stackoverflow.com/questions/40927445/invalid-use-of-registers/40927614#40927614). There is a list of valid 16-bit addressing modes. – Margaret Bloom Dec 03 '16 at 10:06

1 Answers1

1

The x86 instruction set is an incredible hodgepodge of historically patched pieces, thoroughly documented but even then lacking cohesive structure. The particular information on which registers work as address pointers could be found in the reference manual section on addressing forms section 2.1.5, but I'm not quite sure that covers it; it certainly doesn't describe the stack push/pop family of operations, which use an implicit pointer. Just a few sections down (2.2.1.6) we find another addressing mode, RIP-relative.

Yann Vernier
  • 15,414
  • 2
  • 28
  • 26