#assembly

app asmfmt

A formatter designed for programs in assembly language with AT&T syntax

1 stable release

1.0.0 Feb 26, 2024

#603 in Text processing

GPL-3.0 license

16KB
143 lines

asmfmt

A formatter designed for programs in assembly language with AT&T syntax.

Usage

asmfmt <file.asm>

Install

cargo install asmfmt

Update

asmfmt update

Before format

global _start

section .rodata
  nl: db 10
  nl_len: equ $ - nl

section .text

_start:

  call new_line
       call exit
new_line:
 mov rax, 1                  ; write(
      mov rdi, 1       ;   STDOUT_FILENO,
  mov rsi, nl                 ;   text,
      mov rdx, 1        ;   sizeof(text)
  syscall                ; );
  ret
exit:
  mov rax, 60              ; exit(
  mov rdi, 0            ;   EXIT_SUCCESS
  syscall      ; );

After format

global _start

section .rodata
    nl: db 10

section .text

_start:

    call new_line
    call exit


new_line:

    mov rax, 1             ; write(
    mov rdi, 1             ;   STDOUT_FILENO,
    mov rsi, nl            ;   text,
    mov rdx, 1             ;   sizeof(text)
    syscall                ; );
    ret


exit:

    mov rax, 60            ; exit(
    mov rdi, 0             ;   EXIT_SUCCESS
    syscall                ; );

No runtime deps