4 года спустя.
Я учусь программированию в asm с помощью GNU Assembler.
Я сделал это на практике:
.section .rodata
.LC0:
.string "This is the number: %d \n"
.data
.type str, @object
str:
.long .LC0
.section .text
.globl main
.type main, @function
.extern printf
main:
push %ebp
movl %esp, %ebp
andl $-16, %esp
subl $12, %esp
movl $2600, 4(%esp)
movl str, %edx
# Simple printf
movl %edx, %eax
movl %eax, (%esp)
call printf
# putchar
# for loop
movl $0, -4(%ebp)
jmp .check_for
.for_loop:
movl -4(%ebp), %eax
movl str, %edx
leal (%edx, %eax), %eax
movzbl (%eax), %eax
movsbl %al, %eax
movl %eax, (%esp)
call putchar
addl $1, -4(%ebp)
.check_for:
cmp $0x00, (%esp)
jnz .for_loop
leave
ret