Skip to content
This repository has been archived by the owner on Sep 3, 2023. It is now read-only.
/ asmlib Public archive

Little library for assembly language (fasm, x86-64, linux).

License

Notifications You must be signed in to change notification settings

number571/asmlib

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

76 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ASMLIB

Little library for assembly language (dialect FASM)

More information about asmlib in the youtube.com/watch?v=TuNiVG2hYuU

Compile library:

$ cd asmlib/
$ make compile

Example (RPN interpret):

format ELF64
public _start

include "asmlib/fmt.inc"
include "asmlib/irp.inc"
include "asmlib/sys.inc"

section '.bss' writeable
    input_size equ 1024
    input rb input_size

section '.data' writeable
    quit db ":q", 0
    console db ">> ", 0

section '.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 exit

section '.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

About

Little library for assembly language (fasm, x86-64, linux).

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages