Skip to content

Commit 68cdace

Browse files
committed
project: reusable print function
1 parent 6270290 commit 68cdace

1 file changed

Lines changed: 34 additions & 0 deletions

File tree

projects/print_function.asm

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
section .data
2+
msg1 db "Hello!", 0xA
3+
len1 equ $ - msg1
4+
5+
msg2 db "This is a reusable print function.", 0xA
6+
len2 equ $ - msg2
7+
8+
section .text
9+
global _start
10+
11+
_start:
12+
; Print msg1
13+
mov ecx, msg1
14+
mov edx, len1
15+
call print
16+
17+
; Print msg2
18+
mov ecx, msg2
19+
mov edx, len2
20+
call print
21+
22+
; Exit
23+
mov eax, 1
24+
xor ebx, ebx
25+
int 0x80
26+
27+
; ----------------------------------------
28+
; print function (uses ecx and edx)
29+
; ----------------------------------------
30+
print:
31+
mov eax, 4
32+
mov ebx, 1
33+
int 0x80
34+
ret

0 commit comments

Comments
 (0)