pgubook-readers
[Top][All Lists]
Advanced

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

[Pgubook-readers] problem with maximum


From: Stefan Ciobaca
Subject: [Pgubook-readers] problem with maximum
Date: Sat, 22 Nov 2008 22:48:17 +0100

Hi!

I have just started to read the book but I have a problem with the first
real program in the book (that computes the maximum value from an
array) -- it always outputs 0.

In fact, I have isolated the problem to a couple of instructions. Here is
my code

.section .data

data_items:
        .long 34,67,34,222,45,75,38,19,29,39,100,0

.section .text

.globl _start
_start:
        movl data_items, %eax
        movl %eax, %ebx
        movl $1, %eax
        int $0x80

This code exits with error code 0.

However, if instead of
        movl data_items, %eax
        movl %eax, %ebx
I do
        movl data_items, %ebx

it exits with the expected error code 34.

Does anyone have any idea what's wrong?

Stefan Ciobaca




reply via email to

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