Run Code
|
API
|
Code Wall
|
Users
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
write
;File: lec4.asm ;read from standard in and write to standard out ;assemble using NASM: nasm -felf64 lec4.asm -o lec4.o ;link with ld: ld –o lec4 lec4.o ;execute with ./lec4 %define STDIN 0 %define STDOUT 1 %define EXIT 60 %define WRITE 1 %define READ 0 %define BUFLEN 256 section .data msg1: db "Enter string: " len1: equ $-msg1 ;length of first message section .bss buf: resb BUFLEN section .text global _start _start: mov rax, WRITE mov rdi, STDOUT mov rsi, msg1 mov rdx, len1 syscall mov rax, READ mov rdi, STDIN mov rsi, buf mov rdx, BUFLEN syscall mov rax, WRITE mov rdi, STDOUT mov rsi, buf mov rdx, BUFLEN syscall mov rax,EXIT xor rdi,rdi syscall
run
|
edit
|
history
|
help
0
Please
log in
to post a comment.
printHelp
helloworld
qw
Hello World
lec4bb
scanf
lec4b.asm
mortgage
lecture6-1
Passwd
Please log in to post a comment.