Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Lec4
Language:
Ada
Assembly
Bash
C#
C++ (gcc)
C++ (clang)
C++ (vc++)
C (gcc)
C (clang)
C (vc)
Client Side
Clojure
Common Lisp
D
Elixir
Erlang
F#
Fortran
Go
Haskell
Java
Javascript
Kotlin
Lua
MySql
Node.js
Ocaml
Octave
Objective-C
Oracle
Pascal
Perl
Php
PostgreSQL
Prolog
Python
Python 3
R
Rust
Ruby
Scala
Scheme
Sql Server
Swift
Tcl
Visual Basic
Layout:
Vertical
Horizontal
;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
Hello
Show compiler warnings
[
-
]
Show input
Compilation time: 0.24 sec, absolute running time: 0.16 sec, cpu time: 0.01 sec, memory peak: 5 Mb, absolute service time: 0,56 sec
edit mode
|
history
|
discussion
Enter string: Hello