2013-06-04 2 views
0

나는 최대 숫자를 찾으려고하지만, 주소로 끝내고 싶다. 저는 어셈블리시에 새롭고 AT & T 구문을 사용합니다.가장 큰 숫자의 주소를 찾는다

.section .data 
data_items:      #These are the data items 
.long 3,67,34,222,45,75,54,34,44,33,22,11,66,0 
.section .text 
.globl _start 
_start: 
movl $0, %edi      # move 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:      # start loop 
cmpl $0, %eax      # check to see if we’ve hit the end 
je loop_exit 
incl %edi       # load next value 
movl data_items(,%edi,4), %eax 
cmpl %ebx, %eax     # compare values 
jle start_loop     # jump to loop beginning if the one isn’t bigger 
movl %eax, %ebx     # move the value as the largest 
jmp start_loop     # jump to loop beginning 
loop_exit: 
            # %ebx is the return value, and it already has the number 
movl $1, %eax      #1 is the exit() syscall 
int $0x80 
+1

(%의 EBX)와 비교합니다. 잘못된 경우 적절한 아키텍처로 다시 태그하십시오. 전 세계에 하나 이상의 유형의 프로세서가 있으며 서로 다른 어셈블리 언어를 사용합니다. –

답변

0

EBX에 그냥 아픈 주소, 대신 EBX과 비교, 난 당신이 86 어셈블리를 얘기하는 추측을 촬영하고 태그를 추가 한

관련 문제