Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .data
- SYSEXIT = 60
- EXIT_SUCCESS = 0
- STDIN = 0
- STDOUT = 1
- SYSWRITE = 1
- SYSREAD = 0
- BUFLEN = 100
- .bss
- .comm input, 100
- .comm output, 100
- .text
- .global main
- main:
- movq $SYSREAD, %rax
- movq $STDIN, %rdi
- movq $input, %rsi
- movq $BUFLEN, %rdx
- syscall
- movq %rax, %rdx
- dec %rdx
- movq %rdx, %r8
- dec %r8
- movq $0, %rdi
- petla:
- movq $0, %rbx
- movb input(,%rdi,1), %bl
- movb %bl, output(, %r8, 1)
- inc %rdi
- dec %r8
- cmp %rdx, %rdi
- jl petla
- movb $'\n', output(,%rdi,1)
- movq $SYSWRITE, %rax
- movq $STDOUT, %rdi
- movq $output, %rsi
- movq $BUFLEN, %rdx
- syscall
- movq $SYSEXIT, %rax
- movq $EXIT_SUCCESS, %rdi
- syscall
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement