99 butelek piwa) global main extern printf

section .data

beer db "%d bottles of beer on the wall, %d bottles of beer." db 0x0a db "Take one down and pass it around, %d bottles of beer." db 0x0a db 0

main: mov ecx, 99

_loop: dec ecx push ecx push ecx inc ecx push ecx push ecx push beer call printf add esp,16 pop ecx or ecx, ecx jne _loop xor eax,eax ret

Przykład składni AT&T – ten sam program - "99 Bottles of Beer" (ang. 99 butelek piwa) .section .rodata .beer: .ascii "%d bottles of Beer on the wall, %d bottles of Beer.\n" .asciz "Take one down and pass it around, %d bottles of Beer.\n"

.text .global main main:

mov $99, %ecx

loop: dec %ecx push %ecx push %ecx inc %ecx push %ecx push %ecx pushl $.beer call printf add $16,%esp pop %ecx or %ecx, %ecx jne loop xorl %eax,%eax ret

Zobacz też IA-32 mikroprocesory firmy Intel MMX SSE, SSE2, SSE3, SSSE3, SSE4, SSE5 AVX adres pamięci Rejestry procesorów x86

Przypisy

Kategoria:Asembler Kategoria:Architektura x86