initial commit
This commit is contained in:
commit
f7c9c6f454
2 changed files with 41 additions and 0 deletions
18
README.md
Normal file
18
README.md
Normal file
|
@ -0,0 +1,18 @@
|
|||
# LIBM
|
||||
An ultra-basic assembly library.
|
||||
|
||||
### Files
|
||||
|
||||
##### basicmacros.asm
|
||||
`basicmacro.asm` contains, as the title would imply, basic macros. Simple syscalls to do stuff like print or read some data.
|
||||
|
||||
This file includes:
|
||||
|
||||
print 2. Prints data onto the console. Usage: `print SomeString LengthOfSomeString`
|
||||
|
||||
read 2. Reads data from stdin and stores it somewhere. Usage: `read SomeMemory MaxBytes`
|
||||
|
||||
sys_exit 0. Exits the program. Usage: `sys_exit`
|
||||
|
||||
|
||||
TODO: make literally anything else.
|
23
basic.asm
Normal file
23
basic.asm
Normal file
|
@ -0,0 +1,23 @@
|
|||
%define NEWLN 0xa
|
||||
|
||||
%macro print 2
|
||||
mov eax, 4
|
||||
mov ebx, 1
|
||||
mov ecx, %1 ; text to print
|
||||
mov edx, %2 ; length of text
|
||||
int 80h
|
||||
%endmacro
|
||||
|
||||
%macro read 2
|
||||
mov eax, 3
|
||||
mov ebx, 2
|
||||
mov ecx, %1 ; place to store data
|
||||
mov edx, %2 ; number of bytes to read
|
||||
int 80h
|
||||
%endmacro
|
||||
|
||||
%macro sys_exit 0
|
||||
mov eax, 1
|
||||
mov ebx, 0
|
||||
int 80h
|
||||
%endmacro
|
Loading…
Reference in a new issue