Readable Assembly - VonΒΆ

%define	stdin	      0
%define	stdout	    1
%define	stderr	    2

%define $move mov

%define $accumulator-register rax
%define $base-register rbx
%define $counter-register rcx
%define $destination-register rdx
%define $stack-pointer rsp
%define $base-pointer rbp
%define $source-index rsi
%define $destination-index rsi

%define $segment-accumulator-register ax
%define $segment-base-register bx
%define $segment-counter-register cx
%define $segment-destination-register dx
%define $segment-stack-pointer sp
%define $segment-base-pointer bp
%define $segment-source-index si
%define $segment-destination-index si

%define $word-accumulator-register eax
%define $word-base-register ebx
%define $word-counter-register ecx
%define $word-destination-register edx
%define $word-stack-pointer esp
%define $word-base-pointer ebp
%define $word-source-index esi
%define $word-destination-index esi



%define CLASS       0x2000000     ;this is a class needed from syscall_sw.h
%define SYS_nosys   (CLASS + 0)
%define	SYS_exit    (CLASS + 1)
%define	SYS_fork    (CLASS + 2)
%define	SYS_read    (CLASS + 3)
%define	SYS_write   (CLASS + 4)

section	.text
align 4
access.the.osx.kernel:
    syscall
    ret

%macro	system	1
    mov	rax, %1
    call    access.the.osx.kernel
%endmacro

%macro	sys.exit    0
    system  SYS_exit
%endmacro

%macro	sys.write   0
    system  SYS_write
%endmacro