Thanks to visit codestin.com
Credit goes to github.com

Skip to content

A collection of macros intended at making assembly more convenient to write and a bit closer to C. Only for x86_64 linux and the FASM assembler (for now).

Notifications You must be signed in to change notification settings

alkhizanah/bento

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

43 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🍱 bento (弁当)

A collection of macros intended at making assembly more convenient to write and a bit closer to C. Only for x86_64 linux and the FASM assembler (for now).

Example:

format ELF64 executable 3
include 'bento.inc'

segment executable readable writeable
entry $
  @mkstr hello_world, "Hello, World"

  xor eax, eax
  .if (eax = 0)
    @for i, 0, 9
      @for j, 0, 9
        @for k, 0, 9
          mov r14, QWORD [k]
          mov QWORD [dummy], r14
          add QWORD [dummy], 48
          write STDOUT, dummy, 1
        @k
        write STDOUT, newline, 1
      @j
      write STDOUT, newline, 1
    @i
  .endif

  puts hello_world
  exit 0
@@

segment readable writeable 
dummy: dq 0
newline: db 0xA

Important

As of now, using any macros that make and modify labels like @for (the counter is a label) requires that the executable (current) segment be also writeable, which may be a security concern.

compile with:

$ fasm main.s
$ ./main

About

A collection of macros intended at making assembly more convenient to write and a bit closer to C. Only for x86_64 linux and the FASM assembler (for now).

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published