add files
[idlebox.git] / maximum.s
blobfe9707564f7951bbf12a05a7961383a03d1ce29a
1 # purpose: this program finds the maximum number of a set of data items.
3 # variables: the registers have the following uses:
4 # %edi - holds the index of the data item being examined
5 # %ebx - largest data item found
6 # %eax - current data item
8 # data_items - contains the item data. A 0 is used to terminate the data
10 .section .data
11 data_items:
12 .long 3, 64, 34, 37, 0
14 .section .text
15 .globl _start
16 _start:
17 movl $0, %edi
18 movl data_items(,%edi,4), %eax
19 movl %eax, %ebx
21 start_loop:
22 cmpl $0, %eax
23 je loop_exit
24 incl %edi
25 movl data_items(,%edi, 4), %eax
26 cmpl %ebx, %eax
27 jle start_loop
28 movl %eax, %ebx
29 jmp start_loop
31 loop_exit:
32 movl $1, %eax
33 int $0x80