pgubook-readers
[Top][All Lists]
Advanced

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

[Pgubook-readers] Segementation Fault


From: Lord Kain
Subject: [Pgubook-readers] Segementation Fault
Date: Mon, 26 Jun 2006 21:11:22 -0700 (PDT)

Forgot to include my code ...


#PURPOSE: Finds the maximum number of a set of data items

#VARIABLES: The registers have the following uses:
#
#           %edi = holds the index of the data item being examined
#           %ebx = Largest data item found
#           %eax = current data item
#
#           The following memory sections are used:
#
#           data_items = contains the item data, A 0 is used to terminate the data #           list
#
#


 .section .data

data_items:    #this are the data items

 .long 3, 67, 24, 222, 45, 75, 54, 34, 44, 33, 22, 11, 66, 0

 .section .text

 .globl _start

_start:

 movl $0, %edi               #moves 0 into the index register
 movl data_items(,%edi, 4), %eax   #load the first byte of data
 movl %eax, %ebx           #since this is the first item %eax is the biggest

start_loop:

 cmpl $0, %eax               #check to see if we have hit the end
 je loop_exit
 incl %edi               #load the next value
 movl data_items(,%edi, 4), %eax
 cmpl %ebx, %eax           #compare values
 jle start_loop               #jump to start loop if the new one isent bigger
 movl %eax, %ebx               #move the value as the largest
 jmp start_loop               #jump to loop beginning

loop_exit:

#%ebx is the status code for the exit system call and it allready has the #maximum number

 movl $1, %ebx                #1 is the exit() syscall
 int $0x80

There is Life in Death, and Death in Life


Yahoo! Groups gets better. Check out the new email design. Plus there’s much more to come.
reply via email to

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