From f7c9c6f454e278c651fd25eab0e876a38f928f16 Mon Sep 17 00:00:00 2001 From: Mason Date: Wed, 7 Aug 2019 12:53:05 -0400 Subject: [PATCH] initial commit --- README.md | 18 ++++++++++++++++++ basic.asm | 23 +++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 README.md create mode 100644 basic.asm diff --git a/README.md b/README.md new file mode 100644 index 0000000..6ddc293 --- /dev/null +++ b/README.md @@ -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. diff --git a/basic.asm b/basic.asm new file mode 100644 index 0000000..192e874 --- /dev/null +++ b/basic.asm @@ -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