aboutsummaryrefslogtreecommitdiff
path: root/lstring.inc
blob: 7b711406b1e6134c0b7a869020750e5922e0e8a1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
%ifndef LSTRING_INC
%define LSTRING_INC
%ifndef SYS_INC
%include "sys.inc"
%endif

%macro	make_lstring	2-*
	section .data
%1_len: dq %1_leng
%1:	db %2
	%rep %0-2
	db %3
	%rotate 1
	%endrep
	%rotate 2
%1_leng	equ	$-%1
%endm

	section .text
print_lstring:
	;; rax = lstring address
	push	rbp
	mov	rbp,	rsp
	;;
	push	rax
	mov	rdx,	[rax]
	mov	rsi,	rax
	add	rsi,	8
	mov	rax,	SYS_WRITE
	mov	rdi,	1
	syscall
	;; 
	mov	rsp,	rbp
	pop	rbp
	ret
%endif