Untitled

mail@pastecode.io avatar
unknown
assembly_x86
2 months ago
721 B
1
Indexable
Never
.data

        .equ	liczba_elementow, 16

        napis:		.asciz	"max = %hd w elemencie %hu\n"

        tablica:	.word	64, 4, 3, 3, 0, 8, 7, 10, -1, 8 ,8 ,8 ,-8, 4, 15, 72

        element:	.long	0
        maks:		.long	0

.text
.global	main

main:
        push %rbp

        xor %esi, %esi
        xor %edx, %edx

        mov $-1, %eax

for_loop:
        inc %eax
        cmp $liczba_elementow, %eax
        je end
        mov tablica(, %eax, 2), %r8d
        cmp %r8d, %esi
        jl handle_max
        jmp for_loop

handle_max:
        mov %r8d, %esi
        mov %eax, %edx
        jmp for_loop

end:
        mov $napis, %rdi

        call printf

        pop %rbp
        ret
Leave a Comment