Hallo, könnte das jemand erklären?
Wieso wird long verwendet und nicht int? Was bedeutet in Z 83
Was tut
Code:
arr:
.long 3
.long 5
.long 4
.long 1
.long 9
.long 7
.long 2
.long 6
.long 8
n:
.long 9
iteration:
push rbp
mov rbp, rsp
mov BYTE PTR [rbp-1], 0
mov DWORD PTR [rbp-8], 0
jmp .L2
.L4:
mov eax, DWORD PTR [rbp-8]
cdqe
mov eax, DWORD PTR arr[0+rax*4]
mov DWORD PTR [rbp-12], eax
mov eax, DWORD PTR [rbp-8]
add eax, 1
cdqe
mov eax, DWORD PTR arr[0+rax*4]
mov DWORD PTR [rbp-16], eax
mov eax, DWORD PTR [rbp-12]
cmp eax, DWORD PTR [rbp-16]
jle .L3
mov eax, DWORD PTR [rbp-8]
cdqe
mov edx, DWORD PTR [rbp-16]
mov DWORD PTR arr[0+rax*4], edx
mov eax, DWORD PTR [rbp-8]
add eax, 1
cdqe
mov edx, DWORD PTR [rbp-12]
mov DWORD PTR arr[0+rax*4], edx
mov BYTE PTR [rbp-1], 1
.L3:
add DWORD PTR [rbp-8], 1
.L2:
mov eax, DWORD PTR n[rip]
sub eax, 1
cmp DWORD PTR [rbp-8], eax
jl .L4
movzx eax, BYTE PTR [rbp-1]
pop rbp
ret
.LC0:
.string "%d\n"
print:
push rbp
mov rbp, rsp
sub rsp, 16
mov DWORD PTR [rbp-4], 0
jmp .L7
.L8:
mov eax, DWORD PTR [rbp-4]
cdqe
mov eax, DWORD PTR arr[0+rax*4]
mov esi, eax
mov edi, OFFSET FLAT:.LC0
mov eax, 0
call printf
add DWORD PTR [rbp-4], 1
.L7:
mov eax, DWORD PTR n[rip]
cmp DWORD PTR [rbp-4], eax
jl .L8
nop
nop
leave
ret
main:
push rbp
mov rbp, rsp
nop
.L10:
call iteration
test al, al
jne .L10
call print
mov eax, 0
pop rbp
ret
Wieso wird long verwendet und nicht int? Was bedeutet in Z 83
test al, al? Und allgemein, was bedeutet PTR? Ich dachte, in Assembler gibt es nur Register, aber keine Pointer?Was tut
iteration? Wieso gibt es nop und leave?