33![ License] ( https://img.shields.io/github/license/lina-torovoltas/FasmMacrosLib )
44![ Version] ( https://img.shields.io/github/v/release/lina-torovoltas/FasmMacrosLib )
55![ Downloads] ( https://img.shields.io/github/downloads/lina-torovoltas/FasmMacrosLib/total ) </br >
6- FasmMacroLib is a macro library for simplifying FASM programming on 64-bit Linux.
7-
6+ FasmMacroLib is a macro library for simplifying FASM programming upon both 32-bit and 64-bit Linux architectures.
87
98## Dependencies
109
11- Works only on Linux x86_64 (64-bit).
10+ - Linux x86 (32-bit) or x86_64 (64-bit) operating system
11+ - ` make ` utility for building
12+ - ` fasm ` assembler for compiling the assembly code
13+
14+ Make sure both ` make ` and ` fasm ` are installed and available in thy system PATH before building.
1215
1316
1417## Installation
1518
16- Just include the macros file at the beginning of your .asm file:
19+ Just include the macros file at the fore of thy .asm file, according to thine architecture :
1720
1821``` asm
19- include 'macroslib.inc'
22+ include 'macrolib_x86/macrolib.inc' ; for 32-bit x86
23+ include 'macrolib_x86_64/macrolib.inc' ; for 64-bit x86_64
2024```
2125
2226
2327## Usage
2428
2529Below is a detailed list of available macros and their usage.</br >
26-
27- For practical examples, see [ examples folder] ( macroslib/examples ) .</br >
30+ For practical examples, peruse the [ x86 examples folder] ( macrolib_x86/examples ) or the [ x86_64 examples folder] ( macrolib_x86_64/examples ) .</br >
2831Compiled binaries of these examples are available in the [ releases] ( https://github.com/lina-torovoltas/FasmMacrosLib/releases ) section.</br >
32+ Alternatively, thou canst compile them thyself.
2933
30- Alternatively, you can compile them yourself by running:
34+ To build for a chosen architecture (e.g., x86):
35+ ``` bash
36+ cd FasmMacroLib
37+ make x86
38+ ```
3139
40+ To build for all supported architectures at once:
3241``` bash
3342cd FasmMacroLib
34- make
43+ make all
3544```
3645
3746### clr
3847Clears the specified register (sets it to zero).
3948
4049``` asm
50+ ; 64-bit
4151clr rax
52+
53+ ; 32-bit
54+ clr eax
4255```
4356
4457### exit
@@ -50,47 +63,52 @@ exit 1 ; exit with code 1
5063```
5164
5265### time
53- Stores the current time (seconds since January 1, 1970) in register rax.
66+ Stores the current time (seconds since January 1, 1970) in register rax/eax .
5467
5568``` asm
5669time
5770```
5871
5972### mkdir
6073Creates a directory with the given name and permissions (octal format).</br >
61- Returns error code in rax.
74+ Returns error code in rax/eax .
6275
6376``` asm
6477mkdir "test", 777o
6578```
6679
6780### rmdir
6881Removes the specified directory.</br >
69- Returns error code in rax.
82+ Returns error code in rax/eax .
7083
7184``` asm
7285rmdir "test"
7386```
7487
7588### printnum
7689Prints the given number in decimal.</br >
77- Returns the number of bytes printed in rax.
90+ Supports values from 0 to 4,294,967,295 (32-bit) and up to 18,446,744,073,709,551,615 (64-bit).</br >
91+ Returns the number of bytes printed in rax/eax.
7892
7993``` asm
80- printnum 244939252
94+ ; 64-bit
95+ printnum 18446744073709551615
96+
97+ ; 32-bit
98+ printnum 4294967295
8199```
82100
83101### print
84102Prints the string at the given address with the specified length.</br >
85- Returns the number of bytes printed in rax.
103+ Returns the number of bytes printed in rax/eax .
86104
87105``` asm
88106print "test", 4
89107```
90108
91109### printtim
92110Prints the given string a specified number of times.</br >
93- Returns the number of bytes printed in rax.
111+ Returns the number of bytes printed in rax/eax .
94112
95113``` asm
96114printtim 2, "test", 4
@@ -107,9 +125,15 @@ run "echo test"
107125Pushes or pops multiple registers on/from the stack (like multiple push/pop instructions combined).
108126
109127``` asm
128+ ; 64-bit
110129push rax, rdi, rsi, rdx
111130...
112131pop rdx, rsi, rdi, rax
132+
133+ ; 32-bit
134+ push eax, edi, esi, edx
135+ ...
136+ pop edx, esi, edi, eax
113137```
114138
115139
@@ -121,4 +145,4 @@ Feel free to open pull requests to improve the library.
121145
122146## Author
123147
124- Developed by <a href =" https://github.com/lina-torovoltas " style =" color :#ff4f00 " >Lina Torovoltas</a > — © 2025 All rights reserved.
148+ Developed by <a href =" https://github.com/lina-torovoltas " style =" color :#ff4f00 " >Lina Torovoltas</a > — © 2025 All rights reserved.
0 commit comments