Skip to content
This repository was archived by the owner on Jan 20, 2026. It is now read-only.

bla-ce/boeuf

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

boeuf - Dynamic Buffer in Assembly

boeuf is a library used to create and manage dynamic buffers in Netwide Assembly. Dynamic buffers are referred as boeuf in this library.

A complete usage example can be found in /example

Usage

Create a boeuf buffer

mov     rdi, buf        ; pointer to the string
call    boeuf_create
cmp     rax, 0
jl      .error

Append string to a boeuf buffer

mov     rdi, [rsp]      ; pointer to the boeuf
call    boeuf_append
cmp     rax, 0
jl      .error

Reset boeuf buffer

mov     rdi, [rsp]      ; pointer to the boeuf
call    boeuf_reset
cmp     rax, 0
jl      .error

Get length of boeuf and set a new (smaller one)

mov     rdi, [rsp]      ; pointer to the boeuf
call    boeuf_len
cmp     rax, 0
jl      .error

mov     rdi, [rsp]      
mov     rsi, 5          ; assume that the length is smaller
call    boeuf_set_len
cmp     rax, 0
jl      .error

Print error messages

mov     rdi, 10         ; rdi should get a pointer to the boeuf, it will fail
mov     rsi, buf
call    boeuf_append
cmp     rax, 0
jl      .error

; ... logic

.error:
call    boeuf_perror    ; will print '[ERROR] error_message'

Free the boeuf

mov     rdi, [rsp]      ; pointer to the boeuf
call    boeuf_free
cmp     rax, 0
jl      .error

About

Dynamic Buffer in Assembly

Topics

Resources

License

Stars

Watchers

Forks