Questions tagged [addressing-mode]

An addressing mode specifies how to calculate the effective memory address of an operand by using information held in registers and/or constants contained within a machine instruction or elsewhere.

From Wikipedia (Addressing mode):

Addressing modes are an aspect of the instruction set architecture in most central processing unit (CPU) designs. The various addressing modes that are defined in a given instruction set architecture define how machine language instructions in that architecture identify the operand (or operands) of each instruction. An addressing mode specifies how to calculate the effective memory address of an operand by using information held in registers and/or constants contained within a machine instruction or elsewhere.

296 questions
3
votes
3 answers

Differences between general purpose registers in 8086: [bx] works, [cx] doesn't?

In 8086 this structure is correct: mov bh,[bx] but this is not correct: mov bh,[cx] I don't know why. I think that the general purpose registers (AX, BX, CX, DX, SP, BP, SI and DI) are registers that we can use for any purpose and the statement…
jack.math
  • 77
  • 1
  • 6
3
votes
1 answer

How to print memory referenced by a complex addressing mode, using GDB?

I am new to assembly and I am trying to print a value stored in the following address. cmp %esi,0x10(%rsp,%rax,4) I think it is something like x/d $rsp+ 0x10 + 4*$rax
a_a_a
  • 283
  • 1
  • 11
3
votes
1 answer

Can I choose RIP-relative or absolute addressing for different variables with gcc in x86-64

I write my own link script to put different variables in two different data sections (A & B). A is linked to zero address; B is linked near to code, and in high address space (higher than 4G, which is not available for normal absolute addressing in…
xingchong
  • 31
  • 3
3
votes
1 answer

What addressing mode is used for a MOV AL, ' * ' instruction

I am studying for an exam and have found no examples yet similar to this one. I can see that mov al, '*' is moving a character into a register but I am uncertain as to what addressing mode is being used for this particular function.
Amy Krypto
  • 31
  • 3
3
votes
1 answer

6502 Addressing mode with labels

I'm looking at some code sample from this site: http://www.6502asm.com/ And looking at it i see they have some instructions that instead of using the memory location directly they use a label, for example, in the alive.asm: lda ypos,x And ypos…
Daniel Sega
  • 323
  • 2
  • 7
  • 19
3
votes
1 answer

Assembly: What is the purpose of movl data_items(,%edi,4), %eax in this program

This program (from Jonathan Bartlett's Programming From the Ground Up) cycles through all the numbers stored in memory with .long and puts the largest number in the EBX register for viewing when the program completes. .section .data data_items: …
3
votes
1 answer

Direct addressing without segment in x86?

The encoding of memory operands with the SIB-byte allows a ›none register‹ for index as well as base. So this should be a valid instruction: 03 04 25 10 32 54 76 – add eax, dword [ 0x76543210 ] The address should be calculated like this:…
sivizius
  • 450
  • 2
  • 14
3
votes
2 answers

Is it more efficient to multiply within the address displacement or outside it?

I'm writing an x86 assembly routine that takes as arguments: At [ESP+4]: The number of 32-bit integers following. Starting at [ESP+8]: A list of 32-bit integers to add up. And it returns the sum of all the integers passed starting at [ESP+8]. So,…
Govind Parmar
  • 20,656
  • 7
  • 53
  • 85
3
votes
1 answer

What is the difference between short adressing mode and long addressing mode

While going through some data sheets of a processor architecture , i saw the terms, short addressing mode and long addressing mode Can anybody give me the general idea of the terms(not needed to be processor specific!) /renjith_g
Renjith G
  • 4,718
  • 14
  • 42
  • 56
3
votes
1 answer

6502 Emulation Enhanced Basic Infinite Loop $C000 to $E0ED

I finally got to the point where my 6502 emulator passed all of the tests in AllSuiteA.asm, but my emulator is failing to emulate Enhanced Basic, which I have loaded at $C000. What happens is PC slowly climbs up to $C03E, and then JSRs to $C892. …
NAME__
  • 625
  • 1
  • 7
  • 17
3
votes
2 answers

invalid effective address calculation

Please look at the following program, the error is invalid effective address calculation and i have mentioned that line please tell me why its invalid effective address calculation here is the program [org 0x100] jmp start array1: dw…
Zia ur Rahman
  • 1,411
  • 4
  • 26
  • 43
3
votes
1 answer

Addressing mode in IA-32

I have searched for Addressing modes in IA-32,but I haven't seen any website or an article which have explained the addressing modes simply. I need an article or something which explain the matter simply by some picture of the memory during it…
user3679015
  • 61
  • 1
  • 7
3
votes
1 answer

Memory indirect addressing movl - assembly

I'm trying to understand how exactly memory indirect addressing works in assembly language with AT&T syntax. movl (%eax), %ebx movl %eax, (%ebx) Here is a similar question that explains about memory indirect addressing This is what I've…
pistal
  • 2,310
  • 13
  • 41
  • 65
3
votes
1 answer

Indirect addressing with + and []

Im a bit new to the asm stuff. Looking through asm generated from C for TI's C28x CPU and have the instruction MOVL *+XAR4[0],ACC I know its a long operand move instruction that takes the value in the accumulator and puts it in the location…
Toby
  • 9,696
  • 16
  • 68
  • 132
3
votes
1 answer

How does "mov (%ebx,%eax,4),%eax" work?

Been working on an assembly assignment, and for the most part I understand assembly pretty well. Or well at least well enough for this assignment. But this mov statement is tripping me up. I would really appreciate if someone could just explain how…
Scalahansolo
  • 2,615
  • 6
  • 26
  • 43