sfl-examples/slide-examples/assembly/ex19.asm

30 lines
491 B
NASM
Raw Normal View History

2023-12-14 14:12:51 +01:00
; string examples
bits 64
%include "macros.asm.inc"
SECTION .data
str1: db 'hello world!',13,10,0
str1len: equ $-str1
strlen: dq 0
SECTION .text
global _start
_start:
%include "header.asm.inc"
mov rax, str1
mov rbx, str1len
sys_write 1, str1, str1len
nop
sys_read 0, str1, str1len
nop
mov [strlen], rax
mov [str1+rax], byte 0
sys_write 1, str1, [strlen]
%include "sysexit.asm.inc"