We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 6270290 commit 68cdaceCopy full SHA for 68cdace
1 file changed
projects/print_function.asm
@@ -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
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
34
+ ret
0 commit comments