pgubook-readers
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pgubook-readers] ending-address using base pointer addressing mode


From: William Rodrigues
Subject: [Pgubook-readers] ending-address using base pointer addressing mode
Date: Fri, 6 Nov 2015 21:36:56 -0200

Hi everyone,
I'm William from Brazil; this is my first participation on here. I am reading the 4th chapter from pgubook, but at
one exercise of the third I'm at some difficulty. The text says to modify the maximum.s code and use an
ending address rather than the number 0 to know when to stop.

I tried this,

 .section .data

data_items:
  .long 3,62,14,20,35,49,74,55,0

 .section .text
 .globl _start
_start:
  movl $data_items, %ecx     # initialize %ecx with the address of data_items
  movl 4(%ecx), %ebx           # go to base pointer addressing mode, trying to get the value 62.
  movl $1, %eax
  int $0x80

If %ecx has the (pointer) address of data_items. So, why the return value was 0 instead of 62 or 35?

Thanks.

reply via email to

[Prev in Thread] Current Thread [Next in Thread]