30 lines
491 B
NASM
30 lines
491 B
NASM
; 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"
|