Asembler x86/Jak używać debuggera ALD: Różnice pomiędzy wersjami

Usunięta treść Dodana treść
Lethern (dyskusja | edycje)
nawigacja
Linia 179:
 
<source lang=asm>
;; decimalPrint.asm
;; Wypisuje zawartość EAX w systemie dziesiętnym
;;
 
segment .text
.global _start
_start:
movl $0007h, %eax
mov eax,0x0007
call _printEAXdecimal
;#wyjscie
mov incl %eax,1
mov incl %ebx,5
int 0x80
 
 
 
segment .data
msg: db.string '" '"
 
segment .text
 
_printEAXdecimal:
pushpushl %edx
pushpushl %ecx
pushpushl %ebx
pushpushl %eax
 
movmovl ebx,$10,%ebx
movmovl ecx,$10,%ecx
xorxorl %edx,%edx
N1:
divdivl %ebx
addl $48,%ecx
add edx,48
decdecl %ecx
movl %dl,%ecx(%msg)
mov [msg+ecx],dl
cmp ecx,$0,%ecx
jne N1
 
movl $4,%eax
mov eax,4
movl $1,%ebx
mov ebx,1
movmovl ecx,$msg,%ecx
movmovl edx,$10,%edx
int 0x80$80h
 
poppopl %eax
poppopl %ebx
poppopl %ecx
poppopl %edx
ret
</source>
Linia 242 ⟶ 239:
 
<source lang=asm>
divdivl %ebx
</source>
 
Linia 386 ⟶ 383:
 
<source lang=asm>
.text
;;
.global _start
;; Wypisuje zawartość EAX w systemie dziesiętnym
;;
 
segment .text
global _start
_start:
movl %0007h, %eax
mov eax,0x0007
call _printEAXdecimal
;wyjscie
mov eax,$1,%eax
mov ebx$1,5%ebx
int 0x80$80h
 
 
 
segment .data
msg: db.string '" '"
 
segment .text
 
_printEAXdecimal:
pushpushl %edx
pushpushl %ecx
pushpushl %ebx
pushpushl %eax
 
movmovl ebx,$10,%ebx
movmovl ecx,$10,%ecx
N1:
xorxorl %edx,%edx
divdivl %ebx
addaddl edx,$48,%edx
decdecl %ecx
movmovl [msg+%ecx](%msg),dl%eax
cmpl $0,%ecx
cmp ecx,0
jne N1
 
movl $4,%eax
mov eax,4
mov ebx,$1,%ebx
mov ecx,$msg,%ecx
mov edx,$10,%edx
int 0x80$80h
 
poppopl %eax
poppopl %ebx
poppopl %ecx
poppopl %edx
ret
</source>
Linia 448 ⟶ 441:
 
<source lang=asm>
movl $0007h,%eax
mov eax,0x0007
</source>
 
Linia 454 ⟶ 447:
 
<source lang=asm>
mov eax$ffffffff,0xffffffff%eax
</source>