Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Number571/asmlib
Little library for assembly language (fasm, x86-64, linux).
https://github.com/Number571/asmlib
asm library
Last synced: 14 days ago
JSON representation
Little library for assembly language (fasm, x86-64, linux).
- Host: GitHub
- URL: https://github.com/Number571/asmlib
- Owner: number571
- License: mit
- Archived: true
- Created: 2019-08-03T18:23:10.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2023-08-27T07:22:42.000Z (about 1 year ago)
- Last Synced: 2024-08-01T03:18:41.799Z (3 months ago)
- Topics: asm, library
- Language: Assembly
- Homepage:
- Size: 77.1 KB
- Stars: 42
- Watchers: 5
- Forks: 10
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# ASMLIB
> Little library for assembly language (dialect FASM)
> More information about asmlib in the [youtube.com/watch?v=TuNiVG2hYuU](https://www.youtube.com/watch?v=TuNiVG2hYuU "asmlib")
### Compile library:
```
$ cd asmlib/
$ make compile
```### Example (RPN interpret):
```asm
format ELF64
public _startinclude "asmlib/fmt.inc"
include "asmlib/irp.inc"
include "asmlib/sys.inc"section '.bss' writeable
input_size equ 1024
input rb input_sizesection '.data' writeable
quit db ":q", 0
console db ">> ", 0section '.text' executable
_start:
.next_iter:
mov rax, console
call print_string
mov rax, input
mov rbx, input_size
call input_string
push rax
call readline
cmp rax, 1 ; quit code
je .close
pop rax
call interpret_rpn
call print_integer
call print_line
jmp .next_iter
.close:
jmp exitsection '.readline' executable
; | input:
; rax = string
; | output:
; rax = number
; ; 0 = nothing
; ; 1 = quit
readline:
push rcx
push rsi
push rdi
mov rsi, rax
mov rdi, quit
mov rcx, 3
repe cmpsb
cmp rcx, 0
je .is_quit
jmp .nothing
.is_quit:
mov rax, 1
jmp .close
.nothing:
mov rax, 0
.close:
pop rdi
pop rsi
pop rcx
ret
```