├── Linux x64 ├── Extern C │ ├── GAS │ │ ├── C.c │ │ ├── ABI.c │ │ ├── C.asm │ │ ├── ABI.asm │ │ └── README.md │ ├── FASM │ │ ├── C.c │ │ ├── ABI.c │ │ ├── README.md │ │ ├── C.asm │ │ └── ABI.asm │ └── NASM │ │ ├── C.c │ │ ├── ABI.c │ │ ├── README.md │ │ ├── C.asm │ │ └── ABI.asm ├── Inline Assembly │ └── GCC │ │ ├── C.c │ │ ├── ABI.c │ │ ├── README.md │ │ ├── C.h │ │ └── ABI.h ├── Standalone │ ├── C.c │ ├── FASM │ │ ├── README.md │ │ ├── C.asm │ │ ├── ABI.asm │ │ ├── ABI.inc │ │ └── C.inc │ ├── ABI.c │ ├── NASM │ │ ├── ABI.asm │ │ ├── ABI.inc │ │ ├── C.inc │ │ ├── C.asm │ │ └── README.md │ └── GAS │ │ ├── ABI.asm │ │ ├── C.inc │ │ ├── C.asm │ │ ├── ABI.inc │ │ └── README.md └── Extern Assembly │ ├── GAS │ ├── C.c │ ├── C.asm │ ├── ABI.c │ ├── ABI.asm │ └── README.md │ ├── FASM │ ├── C.c │ ├── README.md │ ├── ABI.c │ ├── C.asm │ └── ABI.asm │ └── NASM │ ├── C.c │ ├── README.md │ ├── C.asm │ ├── ABI.c │ └── ABI.asm ├── Windows x64 ├── Extern C │ ├── FASM │ │ ├── C.c │ │ ├── ABI.c │ │ ├── C.asm │ │ ├── ABI.asm │ │ └── README.md │ ├── GAS │ │ ├── C.c │ │ ├── ABI.c │ │ ├── C.asm │ │ ├── ABI.asm │ │ └── README.md │ ├── MASM │ │ ├── C.c │ │ ├── ABI.c │ │ ├── C.asm │ │ ├── ABI.asm │ │ └── README.md │ └── NASM │ │ ├── C.c │ │ ├── ABI.c │ │ ├── C.asm │ │ ├── ABI.asm │ │ └── README.md ├── Inline Assembly │ └── GCC │ │ ├── C.c │ │ ├── ABI.c │ │ ├── C.h │ │ ├── README.md │ │ └── ABI.h ├── Standalone │ ├── C.c │ ├── FASM │ │ ├── README.md │ │ ├── C.asm │ │ ├── ABI.asm │ │ ├── C.inc │ │ └── ABI.inc │ ├── ABI.c │ ├── MASM │ │ ├── C.asm │ │ ├── ABI.asm │ │ ├── C.inc │ │ ├── ABI.inc │ │ └── README.md │ ├── GAS │ │ ├── C.inc │ │ ├── C.asm │ │ ├── ABI.asm │ │ ├── ABI.inc │ │ └── README.md │ └── NASM │ │ ├── C.inc │ │ ├── C.asm │ │ ├── ABI.asm │ │ ├── ABI.inc │ │ └── README.md └── Extern Assembly │ ├── GAS │ ├── C.asm │ ├── C.c │ ├── ABI.c │ ├── ABI.asm │ └── README.md │ ├── FASM │ ├── C.c │ ├── ABI.c │ ├── C.asm │ ├── ABI.asm │ └── README.md │ ├── MASM │ ├── C.c │ ├── C.asm │ ├── ABI.c │ ├── ABI.asm │ └── README.md │ └── NASM │ ├── C.c │ ├── C.asm │ ├── ABI.c │ ├── ABI.asm │ └── README.md ├── Android arm64 ├── Extern C │ └── GAS │ │ ├── C.c │ │ ├── ABI.c │ │ ├── C.asm │ │ ├── ABI.asm │ │ └── README.md ├── Inline Assembly │ └── GCC │ │ ├── C.c │ │ ├── ABI.c │ │ ├── README.md │ │ ├── C.h │ │ └── ABI.h ├── Standalone │ ├── C.c │ ├── ABI.c │ └── GAS │ │ ├── ABI.asm │ │ ├── C.inc │ │ ├── ABI.inc │ │ ├── C.asm │ │ └── README.md └── Extern Assembly │ └── GAS │ ├── C.c │ ├── C.asm │ ├── ABI.asm │ ├── ABI.c │ └── README.md ├── Android x64 ├── Extern C │ ├── GAS │ │ ├── C.c │ │ ├── ABI.c │ │ ├── C.asm │ │ ├── ABI.asm │ │ └── README.md │ └── NASM │ │ ├── C.c │ │ ├── ABI.c │ │ ├── README.md │ │ ├── C.asm │ │ └── ABI.asm ├── Inline Assembly │ └── GCC │ │ ├── C.c │ │ ├── ABI.c │ │ ├── README.md │ │ ├── C.h │ │ └── ABI.h ├── Standalone │ ├── C.c │ ├── ABI.c │ ├── NASM │ │ ├── ABI.asm │ │ ├── ABI.inc │ │ ├── C.inc │ │ ├── C.asm │ │ └── README.md │ └── GAS │ │ ├── ABI.asm │ │ ├── C.inc │ │ ├── C.asm │ │ ├── ABI.inc │ │ └── README.md └── Extern Assembly │ ├── GAS │ ├── C.c │ ├── C.asm │ ├── ABI.c │ ├── ABI.asm │ └── README.md │ └── NASM │ ├── C.c │ ├── C.asm │ ├── ABI.c │ ├── ABI.asm │ └── README.md ├── Linux arm64 ├── Extern C │ └── GAS │ │ ├── C.c │ │ ├── ABI.c │ │ ├── C.asm │ │ ├── ABI.asm │ │ └── README.md ├── Inline Assembly │ └── GCC │ │ ├── C.c │ │ ├── ABI.c │ │ ├── README.md │ │ ├── C.h │ │ └── ABI.h ├── Standalone │ ├── C.c │ ├── ABI.c │ └── GAS │ │ ├── ABI.asm │ │ ├── C.inc │ │ ├── ABI.inc │ │ ├── C.asm │ │ └── README.md └── Extern Assembly │ └── GAS │ ├── C.c │ ├── C.asm │ ├── ABI.c │ ├── ABI.asm │ └── README.md ├── Windows arm64 ├── Extern C │ ├── CLANG │ │ ├── C.c │ │ ├── ABI.c │ │ ├── README.md │ │ ├── C.asm │ │ └── ABI.asm │ └── MARMASM │ │ ├── C.c │ │ ├── ABI.c │ │ ├── C.asm │ │ ├── ABI.asm │ │ └── README.md ├── Inline Assembly │ └── CLANG │ │ ├── C.c │ │ ├── ABI.c │ │ ├── README.md │ │ ├── C.h │ │ └── ABI.h ├── Standalone │ ├── C.c │ ├── CLANG │ │ ├── README.md │ │ ├── ABI.asm │ │ ├── C.asm │ │ ├── C.inc │ │ └── ABI.inc │ ├── ABI.c │ └── MARMASM │ │ ├── C.asm │ │ ├── ABI.asm │ │ ├── C.inc │ │ ├── ABI.inc │ │ └── README.md └── Extern Assembly │ ├── CLANG │ ├── C.asm │ ├── README.md │ ├── C.c │ ├── ABI.c │ └── ABI.asm │ └── MARMASM │ ├── C.c │ ├── ABI.c │ ├── C.asm │ ├── ABI.asm │ └── README.md └── README.md /Linux x64/Extern C/GAS/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Hello(char * msg) 4 | { 5 | printf("%s", msg); 6 | } 7 | -------------------------------------------------------------------------------- /Windows x64/Extern C/FASM/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Hello(char * msg) 4 | { 5 | printf("%s", msg); 6 | } 7 | -------------------------------------------------------------------------------- /Windows x64/Extern C/GAS/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Hello(char * msg) 4 | { 5 | printf("%s", msg); 6 | } 7 | -------------------------------------------------------------------------------- /Windows x64/Extern C/MASM/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Hello(char * msg) 4 | { 5 | printf("%s", msg); 6 | } 7 | -------------------------------------------------------------------------------- /Windows x64/Extern C/NASM/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Hello(char * msg) 4 | { 5 | printf("%s", msg); 6 | } 7 | -------------------------------------------------------------------------------- /Android arm64/Extern C/GAS/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Hello(char * msg) 4 | { 5 | printf("%s", msg); 6 | } 7 | -------------------------------------------------------------------------------- /Android x64/Extern C/GAS/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Hello(char * msg) 4 | { 5 | printf("%s", msg); 6 | } 7 | -------------------------------------------------------------------------------- /Android x64/Extern C/NASM/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Hello(char * msg) 4 | { 5 | printf("%s", msg); 6 | } 7 | -------------------------------------------------------------------------------- /Linux arm64/Extern C/GAS/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Hello(char * msg) 4 | { 5 | printf("%s", msg); 6 | } 7 | -------------------------------------------------------------------------------- /Linux x64/Extern C/FASM/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Hello(char * msg) 4 | { 5 | printf("%s", msg); 6 | } 7 | -------------------------------------------------------------------------------- /Linux x64/Extern C/NASM/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Hello(char * msg) 4 | { 5 | printf("%s", msg); 6 | } 7 | -------------------------------------------------------------------------------- /Windows arm64/Extern C/CLANG/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Hello(char * msg) 4 | { 5 | printf("%s", msg); 6 | } 7 | -------------------------------------------------------------------------------- /Windows arm64/Extern C/MARMASM/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Hello(char * msg) 4 | { 5 | printf("%s", msg); 6 | } 7 | -------------------------------------------------------------------------------- /Android x64/Inline Assembly/GCC/C.c: -------------------------------------------------------------------------------- 1 | #include "C.h" 2 | 3 | int main() 4 | { 5 | Hello("Hello, World!\n"); 6 | 7 | exit(0); 8 | } 9 | -------------------------------------------------------------------------------- /Linux arm64/Inline Assembly/GCC/C.c: -------------------------------------------------------------------------------- 1 | #include "C.h" 2 | 3 | int main() 4 | { 5 | Hello("Hello, World!\n"); 6 | 7 | exit(0); 8 | } 9 | -------------------------------------------------------------------------------- /Linux x64/Inline Assembly/GCC/C.c: -------------------------------------------------------------------------------- 1 | #include "C.h" 2 | 3 | int main() 4 | { 5 | Hello("Hello, World!\n"); 6 | 7 | exit(0); 8 | } 9 | -------------------------------------------------------------------------------- /Android arm64/Inline Assembly/GCC/C.c: -------------------------------------------------------------------------------- 1 | #include "C.h" 2 | 3 | int main() 4 | { 5 | Hello("Hello, World!\n"); 6 | 7 | exit(0); 8 | } 9 | -------------------------------------------------------------------------------- /Windows x64/Inline Assembly/GCC/C.c: -------------------------------------------------------------------------------- 1 | #include "C.h" 2 | 3 | int main() 4 | { 5 | Hello("Hello, World!\n"); 6 | 7 | exit(0); 8 | } 9 | -------------------------------------------------------------------------------- /Windows arm64/Inline Assembly/CLANG/C.c: -------------------------------------------------------------------------------- 1 | #include "C.h" 2 | 3 | int main() 4 | { 5 | Hello("Hello, World!\n"); 6 | 7 | exit(0); 8 | } 9 | -------------------------------------------------------------------------------- /Android x64/Standalone/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | printf("Hello, World!\n"); 7 | 8 | exit(0); 9 | } 10 | -------------------------------------------------------------------------------- /Linux arm64/Standalone/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | printf("Hello, World!\n"); 7 | 8 | exit(0); 9 | } 10 | -------------------------------------------------------------------------------- /Linux x64/Standalone/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | printf("Hello, World!\n"); 7 | 8 | exit(0); 9 | } 10 | -------------------------------------------------------------------------------- /Windows arm64/Standalone/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | printf("Hello, World!"); 7 | 8 | exit(0); 9 | } 10 | -------------------------------------------------------------------------------- /Windows x64/Standalone/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | printf("Hello, World!\n"); 7 | 8 | exit(0); 9 | } 10 | -------------------------------------------------------------------------------- /Android arm64/Standalone/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | printf("Hello, World!\n"); 7 | 8 | exit(0); 9 | } 10 | -------------------------------------------------------------------------------- /Windows x64/Extern Assembly/GAS/C.asm: -------------------------------------------------------------------------------- 1 | .global Hello 2 | 3 | .section .text 4 | Hello: 5 | sub $40, %rsp 6 | 7 | call printf 8 | 9 | add $40, %rsp 10 | 11 | ret 12 | -------------------------------------------------------------------------------- /Windows x64/Standalone/FASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open cmd 5 | - git clone this repo 6 | - cd this path 7 | - fasm ABI.asm/C.asm namefile.exe 8 | -------------------------------------------------------------------------------- /Android arm64/Inline Assembly/GCC/ABI.c: -------------------------------------------------------------------------------- 1 | #include "ABI.h" 2 | 3 | int main() 4 | { 5 | Hello("Hello, World!", sizeof("Hello, World!")); 6 | 7 | syscall(SYS_exit, 0); 8 | } 9 | -------------------------------------------------------------------------------- /Android x64/Inline Assembly/GCC/ABI.c: -------------------------------------------------------------------------------- 1 | #include "ABI.h" 2 | 3 | int main() 4 | { 5 | Hello("Hello, World!", sizeof("Hello, World!")); 6 | 7 | syscall(SYS_exit, 0); 8 | } 9 | -------------------------------------------------------------------------------- /Linux arm64/Inline Assembly/GCC/ABI.c: -------------------------------------------------------------------------------- 1 | #include "ABI.h" 2 | 3 | int main() 4 | { 5 | Hello("Hello, World!", sizeof("Hello, World!")); 6 | 7 | syscall(SYS_exit, 0); 8 | } 9 | -------------------------------------------------------------------------------- /Linux x64/Inline Assembly/GCC/ABI.c: -------------------------------------------------------------------------------- 1 | #include "ABI.h" 2 | 3 | int main() 4 | { 5 | Hello("Hello, World!", sizeof("Hello, World!")); 6 | 7 | syscall(SYS_exit, 0); 8 | } 9 | -------------------------------------------------------------------------------- /Windows arm64/Inline Assembly/CLANG/ABI.c: -------------------------------------------------------------------------------- 1 | #include "ABI.h" 2 | 3 | int main() 4 | { 5 | Hello("Hello, World!", sizeof("Hello, World!") - 1); 6 | 7 | ExitProcess(0); 8 | } 9 | -------------------------------------------------------------------------------- /Windows x64/Inline Assembly/GCC/ABI.c: -------------------------------------------------------------------------------- 1 | #include "ABI.h" 2 | 3 | int main() 4 | { 5 | Hello("Hello, World!", sizeof("Hello, World!") - 1); 6 | 7 | ExitProcess(0); 8 | } 9 | -------------------------------------------------------------------------------- /Linux x64/Extern C/GAS/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void Hello(char * msg, char size) 5 | { 6 | syscall(SYS_write, STDOUT_FILENO, msg, size); 7 | } 8 | -------------------------------------------------------------------------------- /Linux x64/Inline Assembly/GCC/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open terminal 5 | - git clone this repo 6 | - cd this path 7 | - gcc/clang ABI.c/C.c -o namefile -------------------------------------------------------------------------------- /Linux x64/Standalone/FASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open terminal 5 | - git clone this repo 6 | - cd this path 7 | - fasm ABI.asm/C.asm namefile 8 | -------------------------------------------------------------------------------- /Windows x64/Extern C/FASM/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Hello(char * msg, char size) 4 | { 5 | WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), msg, size, NULL, NULL); 6 | } 7 | -------------------------------------------------------------------------------- /Windows x64/Extern C/GAS/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Hello(char * msg, char size) 4 | { 5 | WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), msg, size, NULL, NULL); 6 | } 7 | -------------------------------------------------------------------------------- /Windows x64/Extern C/MASM/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Hello(char * msg, char size) 4 | { 5 | WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), msg, size, NULL, NULL); 6 | } 7 | -------------------------------------------------------------------------------- /Windows x64/Extern C/NASM/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Hello(char * msg, char size) 4 | { 5 | WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), msg, size, NULL, NULL); 6 | } 7 | -------------------------------------------------------------------------------- /Android arm64/Extern C/GAS/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void Hello(char * msg, int size) 5 | { 6 | syscall(SYS_write, STDOUT_FILENO, msg, size); 7 | } 8 | -------------------------------------------------------------------------------- /Android x64/Extern C/GAS/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void Hello(char * msg, char size) 5 | { 6 | syscall(SYS_write, STDOUT_FILENO, msg, size); 7 | } 8 | -------------------------------------------------------------------------------- /Android x64/Extern C/NASM/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void Hello(char * msg, char size) 5 | { 6 | syscall(SYS_write, STDOUT_FILENO, msg, size); 7 | } 8 | -------------------------------------------------------------------------------- /Linux arm64/Extern C/GAS/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void Hello(char * msg, int size) 5 | { 6 | syscall(SYS_write, STDOUT_FILENO, msg, size); 7 | } 8 | -------------------------------------------------------------------------------- /Linux x64/Extern C/FASM/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void Hello(char * msg, char size) 5 | { 6 | syscall(SYS_write, STDOUT_FILENO, msg, size); 7 | } 8 | -------------------------------------------------------------------------------- /Linux x64/Extern C/NASM/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | void Hello(char * msg, char size) 5 | { 6 | syscall(SYS_write, STDOUT_FILENO, msg, size); 7 | } 8 | -------------------------------------------------------------------------------- /Windows arm64/Extern Assembly/CLANG/C.asm: -------------------------------------------------------------------------------- 1 | .global Hello 2 | 3 | .section .text 4 | Hello: 5 | str lr, [sp, -16]! 6 | 7 | bl printf 8 | 9 | ldr lr, [sp], 16 10 | 11 | ret 12 | -------------------------------------------------------------------------------- /Windows arm64/Extern C/CLANG/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Hello(char * msg, int size) 4 | { 5 | WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), msg, size, NULL, NULL); 6 | } 7 | -------------------------------------------------------------------------------- /Windows arm64/Extern C/MARMASM/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | void Hello(char * msg, int size) 4 | { 5 | WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), msg, size, NULL, NULL); 6 | } 7 | -------------------------------------------------------------------------------- /Windows arm64/Inline Assembly/CLANG/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open cmd 5 | - git clone this repo 6 | - cd this path 7 | - clang ABI.c/C.c -o namefile.exe 8 | -------------------------------------------------------------------------------- /Windows arm64/Standalone/CLANG/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open cmd 5 | - git clone this repo 6 | - cd this path 7 | - clang ABI.asm/C.asm -o namefile.exe 8 | -------------------------------------------------------------------------------- /Linux arm64/Inline Assembly/GCC/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open terminal 5 | - git clone this repo 6 | - cd this path 7 | - gcc/clang ABI.c/C.c -o namefile 8 | -------------------------------------------------------------------------------- /Windows arm64/Extern C/CLANG/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - git clone this repo 5 | - Open cmd 6 | - cd this path 7 | - clang ABI.asm/C.asm ABI.C/C.C -o namefile.exe 8 | -------------------------------------------------------------------------------- /Windows x64/Extern Assembly/FASM/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void Hello(char * msg); 4 | 5 | int main() 6 | { 7 | Hello("Hello, World!\n"); 8 | 9 | exit(0); 10 | } 11 | -------------------------------------------------------------------------------- /Windows x64/Extern Assembly/GAS/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void Hello(char * msg); 4 | 5 | int main() 6 | { 7 | Hello("Hello, World!\n"); 8 | 9 | exit(0); 10 | } 11 | -------------------------------------------------------------------------------- /Windows x64/Extern Assembly/MASM/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void Hello(char * msg); 4 | 5 | int main() 6 | { 7 | Hello("Hello, World!\n"); 8 | 9 | exit(0); 10 | } 11 | -------------------------------------------------------------------------------- /Windows x64/Extern Assembly/NASM/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void Hello(char * msg); 4 | 5 | int main() 6 | { 7 | Hello("Hello, World!\n"); 8 | 9 | exit(0); 10 | } 11 | -------------------------------------------------------------------------------- /Linux x64/Extern Assembly/GAS/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void Hello(char * msg); 4 | 5 | int main() 6 | { 7 | Hello("Hello, World!\n"); 8 | 9 | exit(0); 10 | } 11 | -------------------------------------------------------------------------------- /Windows arm64/Extern Assembly/CLANG/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - git clone this repo 5 | - Open cmd 6 | - cd this path 7 | - clang ABI.asm/C.asm ABI.C/C.C -o namefile.exe 8 | -------------------------------------------------------------------------------- /Android arm64/Extern Assembly/GAS/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void Hello(char * msg); 4 | 5 | int main() 6 | { 7 | Hello("Hello, World!\n"); 8 | 9 | exit(0); 10 | } 11 | -------------------------------------------------------------------------------- /Android x64/Extern Assembly/GAS/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void Hello(char * msg); 4 | 5 | int main() 6 | { 7 | Hello("Hello, World!\n"); 8 | 9 | exit(0); 10 | } 11 | -------------------------------------------------------------------------------- /Android x64/Extern Assembly/NASM/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void Hello(char * msg); 4 | 5 | int main() 6 | { 7 | Hello("Hello, World!\n"); 8 | 9 | exit(0); 10 | } 11 | -------------------------------------------------------------------------------- /Linux arm64/Extern Assembly/GAS/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void Hello(char * msg); 4 | 5 | int main() 6 | { 7 | Hello("Hello, World!\n"); 8 | 9 | exit(0); 10 | } 11 | -------------------------------------------------------------------------------- /Linux x64/Extern Assembly/FASM/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void Hello(char * msg); 4 | 5 | int main() 6 | { 7 | Hello("Hello, World!\n"); 8 | 9 | exit(0); 10 | } 11 | -------------------------------------------------------------------------------- /Linux x64/Extern Assembly/NASM/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void Hello(char * msg); 4 | 5 | int main() 6 | { 7 | Hello("Hello, World!\n"); 8 | 9 | exit(0); 10 | } 11 | -------------------------------------------------------------------------------- /Windows arm64/Extern Assembly/CLANG/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void Hello(char * msg); 4 | 5 | int main() 6 | { 7 | Hello("Hello, World!\n"); 8 | 9 | exit(0); 10 | } 11 | -------------------------------------------------------------------------------- /Windows arm64/Extern Assembly/MARMASM/C.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void Hello(char * msg); 4 | 5 | int main() 6 | { 7 | Hello("Hello, World!\n"); 8 | 9 | exit(0); 10 | } 11 | -------------------------------------------------------------------------------- /Windows x64/Extern Assembly/MASM/C.asm: -------------------------------------------------------------------------------- 1 | printf proto 2 | 3 | .code 4 | Hello proc 5 | sub rsp, 40 6 | 7 | call printf 8 | 9 | add rsp, 40 10 | 11 | ret 12 | Hello endp 13 | end -------------------------------------------------------------------------------- /Windows arm64/Standalone/CLANG/ABI.asm: -------------------------------------------------------------------------------- 1 | .include "ABI.inc" 2 | 3 | .global main 4 | 5 | .section .text 6 | main: 7 | str lr, [sp, -16]! 8 | 9 | bl Hello 10 | 11 | mov w0, wzr 12 | bl ExitProcess 13 | -------------------------------------------------------------------------------- /Windows arm64/Standalone/CLANG/C.asm: -------------------------------------------------------------------------------- 1 | .include "C.inc" 2 | 3 | .global main 4 | 5 | .section .text 6 | main: 7 | str lr, [sp, -16]! 8 | 9 | bl Hello 10 | 11 | mov w0, wzr 12 | bl exit 13 | -------------------------------------------------------------------------------- /Windows x64/Extern Assembly/NASM/C.asm: -------------------------------------------------------------------------------- 1 | extern printf 2 | 3 | global Hello 4 | 5 | section .text 6 | Hello: 7 | sub rsp, 40 8 | 9 | call printf 10 | 11 | add rsp, 40 12 | 13 | ret 14 | -------------------------------------------------------------------------------- /Windows x64/Standalone/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), "Hello, World!", sizeof("Hello, World!") - 1, NULL, NULL); 6 | 7 | ExitProcess(0); 8 | } 9 | -------------------------------------------------------------------------------- /Linux x64/Extern Assembly/GAS/C.asm: -------------------------------------------------------------------------------- 1 | .global Hello 2 | 3 | .section .note.GNU-stack, "", @progbits 4 | 5 | .section .text 6 | Hello: 7 | sub $8, %rsp 8 | 9 | call printf 10 | 11 | add $8, %rsp 12 | 13 | ret 14 | -------------------------------------------------------------------------------- /Windows arm64/Standalone/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | int main() 4 | { 5 | WriteConsoleA(GetStdHandle(STD_OUTPUT_HANDLE), "Hello, World!", sizeof("Hello, World!") - 1, NULL, NULL); 6 | 7 | ExitProcess(0); 8 | } 9 | -------------------------------------------------------------------------------- /Android arm64/Extern Assembly/GAS/C.asm: -------------------------------------------------------------------------------- 1 | .section .data 2 | 3 | .global Hello 4 | 5 | .section .text 6 | Hello: 7 | str lr, [sp, -16]! 8 | 9 | bl printf 10 | 11 | ldr lr, [sp], 16 12 | 13 | ret 14 | -------------------------------------------------------------------------------- /Android x64/Extern Assembly/GAS/C.asm: -------------------------------------------------------------------------------- 1 | .global Hello 2 | 3 | .section .note.GNU-stack, "", @progbits 4 | 5 | .section .text 6 | Hello: 7 | sub $8, %rsp 8 | 9 | call printf 10 | 11 | add $8, %rsp 12 | 13 | ret 14 | -------------------------------------------------------------------------------- /Linux arm64/Extern Assembly/GAS/C.asm: -------------------------------------------------------------------------------- 1 | .section .data 2 | 3 | .global Hello 4 | 5 | .section .text 6 | Hello: 7 | str lr, [sp, -16]! 8 | 9 | bl printf 10 | 11 | ldr lr, [sp], 16 12 | 13 | ret 14 | -------------------------------------------------------------------------------- /Linux x64/Extern C/FASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open terminal 5 | - git clone this repo 6 | - cd this path 7 | - fasm ABI.asm/C.asm namefile.o 8 | - gcc/clang ABI.c/C.c namefile.o -o namefile -------------------------------------------------------------------------------- /Windows x64/Standalone/MASM/C.asm: -------------------------------------------------------------------------------- 1 | include C.inc 2 | 3 | .code 4 | mainCRTStartup proc 5 | sub rsp, 40 6 | 7 | call Hello 8 | 9 | xor ecx, ecx 10 | call exit 11 | mainCRTStartup endp 12 | end 13 | -------------------------------------------------------------------------------- /Android x64/Standalone/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | syscall(SYS_write, STDOUT_FILENO, "Hello, World!", sizeof("Hello, World!")); 7 | 8 | syscall(SYS_exit, 0); 9 | } 10 | -------------------------------------------------------------------------------- /Linux arm64/Standalone/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | syscall(SYS_write, STDOUT_FILENO, "Hello, World!", sizeof("Hello, World!")); 7 | 8 | syscall(SYS_exit, 0); 9 | } 10 | -------------------------------------------------------------------------------- /Linux x64/Extern Assembly/FASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open terminal 5 | - git clone this repo 6 | - cd this path 7 | - fasm ABI.asm/C.asm namefile.o 8 | - gcc/clang ABI.c/C.c namefile.o -o namefile -------------------------------------------------------------------------------- /Linux x64/Standalone/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | syscall(SYS_write, STDOUT_FILENO, "Hello, World!", sizeof("Hello, World!")); 7 | 8 | syscall(SYS_exit, 0); 9 | } 10 | -------------------------------------------------------------------------------- /Linux x64/Standalone/FASM/C.asm: -------------------------------------------------------------------------------- 1 | format elf64 executable 3 2 | 3 | entry start 4 | 5 | include 'C.inc' 6 | 7 | segment readable executable 8 | start: 9 | call Hello 10 | 11 | xor edi, edi 12 | call [exit] 13 | 14 | ret -------------------------------------------------------------------------------- /Android arm64/Standalone/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | int main() 5 | { 6 | syscall(SYS_write, STDOUT_FILENO, "Hello, World!", sizeof("Hello, World!")); 7 | 8 | syscall(SYS_exit, 0); 9 | } 10 | -------------------------------------------------------------------------------- /Linux x64/Extern C/NASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open terminal 5 | - git clone this repo 6 | - cd this path 7 | - nasm -f elf64 ABI.asm/C.asm namefile.o 8 | - gcc/clang ABI.c/C.c namefile.o -o namefile -------------------------------------------------------------------------------- /Windows x64/Extern Assembly/GAS/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void Hello(char * msg, int len); 4 | 5 | int main() 6 | { 7 | Hello("Hello, World!", sizeof("Hello, World!") - 1); 8 | 9 | ExitProcess(0); 10 | } 11 | -------------------------------------------------------------------------------- /Windows x64/Standalone/MASM/ABI.asm: -------------------------------------------------------------------------------- 1 | include ABI.inc 2 | 3 | .code 4 | mainCRTStartup proc 5 | sub rsp, 40 6 | 7 | call Hello 8 | 9 | xor ecx, ecx 10 | call ExitProcess 11 | mainCRTStartup endp 12 | end 13 | -------------------------------------------------------------------------------- /Android arm64/Inline Assembly/GCC/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open termux 5 | - git clone this repo 6 | - cd this path 7 | - gcc/clang ABI.c/C.c -o namefile 8 | 9 | Nb: GCC is available in tur-repo 10 | -------------------------------------------------------------------------------- /Android x64/Inline Assembly/GCC/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open termux 5 | - git clone this repo 6 | - cd this path 7 | - gcc/clang ABI.c/C.c -o namefile 8 | 9 | Nb: GCC is available in tur-repo 10 | -------------------------------------------------------------------------------- /Linux x64/Extern Assembly/NASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open terminal 5 | - git clone this repo 6 | - cd this path 7 | - nasm -f elf64 ABI.asm/C.asm namefile.o 8 | - gcc/clang ABI.c/C.c namefile.o -o namefile -------------------------------------------------------------------------------- /Windows x64/Extern Assembly/FASM/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void Hello(char * msg, int len); 4 | 5 | int main() 6 | { 7 | Hello("Hello, World!", sizeof("Hello, World!") - 1); 8 | 9 | ExitProcess(0); 10 | } 11 | -------------------------------------------------------------------------------- /Windows x64/Extern Assembly/MASM/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void Hello(char * msg, int len); 4 | 5 | int main() 6 | { 7 | Hello("Hello, World!", sizeof("Hello, World!") - 1); 8 | 9 | ExitProcess(0); 10 | } 11 | -------------------------------------------------------------------------------- /Windows x64/Extern Assembly/NASM/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void Hello(char * msg, int len); 4 | 5 | int main() 6 | { 7 | Hello("Hello, World!", sizeof("Hello, World!") - 1); 8 | 9 | ExitProcess(0); 10 | } 11 | -------------------------------------------------------------------------------- /Windows x64/Standalone/GAS/C.inc: -------------------------------------------------------------------------------- 1 | .section .data 2 | msg: 3 | .asciz "Hello, World!\n" 4 | 5 | .section .text 6 | Hello: 7 | sub $40, %rsp 8 | 9 | lea msg(%rip), %rcx 10 | call printf 11 | 12 | add $40, %rsp 13 | 14 | ret 15 | 16 | -------------------------------------------------------------------------------- /Android x64/Extern Assembly/NASM/C.asm: -------------------------------------------------------------------------------- 1 | extern printf 2 | 3 | global Hello 4 | 5 | section .note.GNU-stack 6 | 7 | section .text 8 | Hello: 9 | sub rsp, 8 10 | 11 | call [rel printf wrt ..got] 12 | 13 | add rsp, 8 14 | 15 | ret 16 | -------------------------------------------------------------------------------- /Linux x64/Extern Assembly/NASM/C.asm: -------------------------------------------------------------------------------- 1 | extern printf 2 | 3 | global Hello 4 | 5 | section .note.GNU-stack 6 | 7 | section .text 8 | Hello: 9 | sub rsp, 8 10 | 11 | call [rel printf wrt ..got] 12 | 13 | add rsp, 8 14 | 15 | ret 16 | -------------------------------------------------------------------------------- /Windows x64/Extern Assembly/FASM/C.asm: -------------------------------------------------------------------------------- 1 | format ms64 coff 2 | 3 | public Hello 4 | 5 | extrn printf 6 | 7 | section '.text' code readable executable 8 | Hello: 9 | sub rsp, 40 10 | 11 | call printf 12 | 13 | add rsp, 40 14 | 15 | ret 16 | -------------------------------------------------------------------------------- /Linux x64/Standalone/FASM/ABI.asm: -------------------------------------------------------------------------------- 1 | format elf64 executable 3 2 | 3 | entry main 4 | 5 | include 'ABI.inc' 6 | 7 | segment readable executable 8 | main: 9 | call Hello 10 | 11 | mov al, 60 12 | xor dil, dil 13 | syscall 14 | -------------------------------------------------------------------------------- /Windows arm64/Extern Assembly/CLANG/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void Hello(char * msg, int len); 4 | 5 | int main() 6 | { 7 | Hello("Hello, World!", sizeof("Hello, World!") - 1); 8 | 9 | ExitProcess(0); 10 | } 11 | -------------------------------------------------------------------------------- /Windows arm64/Extern Assembly/MARMASM/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern void Hello(char * msg, int len); 4 | 5 | int main() 6 | { 7 | Hello("Hello, World!", sizeof("Hello, World!") - 1); 8 | 9 | ExitProcess(0); 10 | } 11 | -------------------------------------------------------------------------------- /Windows arm64/Extern Assembly/MARMASM/C.asm: -------------------------------------------------------------------------------- 1 | extern printf 2 | 3 | export Hello 4 | 5 | area .text, code 6 | Hello proc 7 | str lr, [sp, -16]! 8 | 9 | bl printf 10 | 11 | ldr lr, [sp], 16 12 | 13 | ret 14 | endp 15 | end -------------------------------------------------------------------------------- /Android arm64/Standalone/GAS/ABI.asm: -------------------------------------------------------------------------------- 1 | .include "ABI.inc" 2 | 3 | .global _start // change into main if assembling/linking with gcc/clang 4 | 5 | .section .text 6 | _start: 7 | bl Hello 8 | 9 | mov w8, 93 10 | mov w0, wzr 11 | svc 0 12 | -------------------------------------------------------------------------------- /Linux arm64/Standalone/GAS/ABI.asm: -------------------------------------------------------------------------------- 1 | .include "ABI.inc" 2 | 3 | .global _start // change into main if assembling/linking with gcc/clang 4 | 5 | .section .text 6 | _start: 7 | bl Hello 8 | 9 | mov w8, 93 10 | mov w0, wzr 11 | svc 0 12 | -------------------------------------------------------------------------------- /Windows arm64/Standalone/MARMASM/C.asm: -------------------------------------------------------------------------------- 1 | get C.inc 2 | 3 | export mainCRTStartup ; change into main if linking with clang 4 | 5 | mainCRTStartup proc 6 | str lr, [sp, -16]! 7 | 8 | bl Hello 9 | 10 | mov w0, wzr 11 | bl exit 12 | endp 13 | end -------------------------------------------------------------------------------- /Windows x64/Extern C/GAS/C.asm: -------------------------------------------------------------------------------- 1 | .global main 2 | 3 | .section .data 4 | msg: 5 | .asciz "Hello, World!\n" 6 | 7 | .section .text 8 | main: 9 | sub $40, %spl 10 | 11 | lea msg(%rip), %rcx 12 | call Hello 13 | 14 | xor %ecx, %ecx 15 | call exit 16 | -------------------------------------------------------------------------------- /Linux x64/Standalone/NASM/ABI.asm: -------------------------------------------------------------------------------- 1 | %include "ABI.inc" 2 | 3 | global _start ; change into main if assembling/linking with gcc/clang 4 | 5 | section .text 6 | _start: 7 | call Hello 8 | 9 | mov al, 60 10 | xor dil, dil 11 | syscall 12 | -------------------------------------------------------------------------------- /Android x64/Standalone/NASM/ABI.asm: -------------------------------------------------------------------------------- 1 | %include "ABI.inc" 2 | 3 | global _start ; change into main if assembling/linking with gcc/clang 4 | 5 | section .text 6 | _start: 7 | call Hello 8 | 9 | mov al, 60 10 | xor dil, dil 11 | syscall 12 | -------------------------------------------------------------------------------- /Windows arm64/Standalone/MARMASM/ABI.asm: -------------------------------------------------------------------------------- 1 | get ABI.inc 2 | 3 | export mainCRTStartup ; change into main if linking with clang 4 | 5 | mainCRTStartup proc 6 | str lr, [sp, -16]! 7 | 8 | bl Hello 9 | 10 | mov w0, wzr 11 | bl ExitProcess 12 | endp 13 | end -------------------------------------------------------------------------------- /Android x64/Standalone/GAS/ABI.asm: -------------------------------------------------------------------------------- 1 | .include "ABI.inc" 2 | 3 | .global _start # change into main if assembling/linking with gcc/clang 4 | 5 | .section .text 6 | _start: 7 | call Hello 8 | 9 | mov $60, %al 10 | xor %dil, %dil 11 | syscall 12 | -------------------------------------------------------------------------------- /Linux x64/Standalone/GAS/ABI.asm: -------------------------------------------------------------------------------- 1 | .include "ABI.inc" 2 | 3 | .global _start # change into main if assembling/linking with gcc/clang 4 | 5 | .section .text 6 | _start: 7 | call Hello 8 | 9 | mov $60, %al 10 | xor %dil, %dil 11 | syscall 12 | -------------------------------------------------------------------------------- /Windows x64/Standalone/FASM/C.asm: -------------------------------------------------------------------------------- 1 | format pe64 console 2 | 3 | entry main 4 | 5 | include 'C.inc' 6 | 7 | section '.text' code readable executable 8 | main: 9 | sub rsp, 40 10 | 11 | call Hello 12 | 13 | xor ecx, ecx 14 | call [exit] 15 | -------------------------------------------------------------------------------- /Android x64/Extern Assembly/GAS/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern void Hello(char * msg, int len); 5 | 6 | int main() 7 | { 8 | Hello("Hello, World!", sizeof("Hello, World!")); 9 | 10 | syscall(SYS_exit, 0); 11 | } 12 | -------------------------------------------------------------------------------- /Android x64/Extern Assembly/NASM/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern void Hello(char * msg, int len); 5 | 6 | int main() 7 | { 8 | Hello("Hello, World!", sizeof("Hello, World!")); 9 | 10 | syscall(SYS_exit, 0); 11 | } 12 | -------------------------------------------------------------------------------- /Linux arm64/Extern Assembly/GAS/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern void Hello(char * msg, int len); 5 | 6 | int main() 7 | { 8 | Hello("Hello, World!", sizeof("Hello, World!")); 9 | 10 | syscall(SYS_exit, 0); 11 | } 12 | -------------------------------------------------------------------------------- /Linux x64/Extern Assembly/FASM/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern void Hello(char * msg, int len); 5 | 6 | int main() 7 | { 8 | Hello("Hello, World!", sizeof("Hello, World!")); 9 | 10 | syscall(SYS_exit, 0); 11 | } 12 | -------------------------------------------------------------------------------- /Linux x64/Extern Assembly/GAS/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern void Hello(char * msg, int len); 5 | 6 | int main() 7 | { 8 | Hello("Hello, World!", sizeof("Hello, World!")); 9 | 10 | syscall(SYS_exit, 0); 11 | } 12 | -------------------------------------------------------------------------------- /Linux x64/Extern Assembly/NASM/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern void Hello(char * msg, int len); 5 | 6 | int main() 7 | { 8 | Hello("Hello, World!", sizeof("Hello, World!")); 9 | 10 | syscall(SYS_exit, 0); 11 | } 12 | -------------------------------------------------------------------------------- /Android arm64/Extern Assembly/GAS/ABI.asm: -------------------------------------------------------------------------------- 1 | .section .data 2 | 3 | .global Hello 4 | 5 | .section .text 6 | Hello: 7 | mov x9, x0 8 | mov w10, w1 9 | mov w8, 64 10 | mov w0, 1 11 | mov x1, x9 12 | mov w2, w10 13 | svc 0 14 | 15 | ret 16 | 17 | -------------------------------------------------------------------------------- /Android arm64/Extern Assembly/GAS/ABI.c: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern void Hello(char * msg, int len); 5 | 6 | int main() 7 | { 8 | Hello("Hello, World!", sizeof("Hello, World!")); 9 | 10 | syscall(SYS_exit, 0); 11 | } 12 | -------------------------------------------------------------------------------- /Linux arm64/Extern Assembly/GAS/ABI.asm: -------------------------------------------------------------------------------- 1 | .section .data 2 | 3 | .global Hello 4 | 5 | .section .text 6 | Hello: 7 | mov x9, x0 8 | mov w10, w1 9 | mov w8, 64 10 | mov w0, 1 11 | mov x1, x9 12 | mov w2, w10 13 | svc 0 14 | 15 | ret 16 | 17 | -------------------------------------------------------------------------------- /Linux x64/Inline Assembly/GCC/C.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern inline void Hello(char * msg) 4 | { 5 | asm volatile 6 | ( 7 | "mov %0, %%rdi\n" 8 | "call printf\n" 9 | : 10 | : "r"(msg) 11 | : "%rdi" 12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /Windows x64/Standalone/FASM/ABI.asm: -------------------------------------------------------------------------------- 1 | format pe64 console 2 | 3 | entry main 4 | 5 | include 'ABI.inc' 6 | 7 | section '.text' code readable executable 8 | main: 9 | sub rsp, 40 10 | 11 | call Hello 12 | 13 | xor ecx, ecx 14 | call [ExitProcess] 15 | -------------------------------------------------------------------------------- /Android arm64/Extern C/GAS/C.asm: -------------------------------------------------------------------------------- 1 | .global main 2 | 3 | .section .data 4 | msg: 5 | .asciz "Hello, World!\n" 6 | 7 | .section .text 8 | main: 9 | adrp x0, msg 10 | add x0, x0, : lo12 : msg 11 | bl Hello 12 | 13 | mov w0, wzr 14 | bl exit 15 | -------------------------------------------------------------------------------- /Android x64/Inline Assembly/GCC/C.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern inline void Hello(char * msg) 4 | { 5 | asm volatile 6 | ( 7 | "mov %0, %%rdi\n" 8 | "call printf\n" 9 | : 10 | : "r"(msg) 11 | : "%rdi" 12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /Linux arm64/Extern C/GAS/C.asm: -------------------------------------------------------------------------------- 1 | .global main 2 | 3 | .section .data 4 | msg: 5 | .asciz "Hello, World!\n" 6 | 7 | .section .text 8 | main: 9 | adrp x0, msg 10 | add x0, x0, : lo12 : msg 11 | bl Hello 12 | 13 | mov w0, wzr 14 | bl exit 15 | -------------------------------------------------------------------------------- /Windows x64/Inline Assembly/GCC/C.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern inline void Hello(char * msg) 4 | { 5 | __asm__ volatile 6 | ( 7 | "mov %0, %%rcx\n" 8 | "call printf\n" 9 | : 10 | : "r"(msg) 11 | : "%rcx" 12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /Windows x64/Inline Assembly/GCC/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open cmd 5 | - git clone this repo 6 | - cd this path 7 | - gcc/clang ABI.c/C.c -o namefile.exe 8 | 9 | Nb: GCC is available in MinGW-w64 and Clang is available in LLVM and MinGW-w64 10 | -------------------------------------------------------------------------------- /Android x64/Extern C/NASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open termux 5 | - git clone this repo 6 | - cd this path 7 | - nasm -f elf64 ABI.asm/C.asm namefile.o 8 | - gcc/clang ABI.c/C.c namefile.o -o namefile 9 | 10 | Nb: GCC is available in tur-repo 11 | -------------------------------------------------------------------------------- /Windows x64/Standalone/NASM/C.inc: -------------------------------------------------------------------------------- 1 | extern printf, exit 2 | 3 | section .data 4 | msg db 'Hello, World!', 10, 0 5 | 6 | section .text 7 | Hello: 8 | sub rsp, 40 9 | 10 | lea rcx, [rel msg] 11 | call printf 12 | 13 | add rsp, 40 14 | 15 | ret 16 | -------------------------------------------------------------------------------- /Android x64/Extern Assembly/NASM/ABI.asm: -------------------------------------------------------------------------------- 1 | global Hello 2 | 3 | section .note.GNU-stack 4 | 5 | section .text 6 | Hello: 7 | mov rbx, rdi 8 | mov ebp, esi 9 | mov eax, 1 10 | mov edi, 1 11 | mov rsi, rbx 12 | mov edx, ebp 13 | syscall 14 | 15 | ret 16 | -------------------------------------------------------------------------------- /Linux x64/Extern Assembly/NASM/ABI.asm: -------------------------------------------------------------------------------- 1 | global Hello 2 | 3 | section .note.GNU-stack 4 | 5 | section .text 6 | Hello: 7 | mov rbx, rdi 8 | mov ebp, esi 9 | mov eax, 1 10 | mov edi, 1 11 | mov rsi, rbx 12 | mov edx, ebp 13 | syscall 14 | 15 | ret 16 | -------------------------------------------------------------------------------- /Windows arm64/Extern C/CLANG/C.asm: -------------------------------------------------------------------------------- 1 | .global main 2 | 3 | .section .data 4 | msg: 5 | .asciz "Hello, World!\n" 6 | 7 | .section .text 8 | main: 9 | str lr, [sp, -16]! 10 | 11 | adrp x0, msg 12 | add x0, x0, : lo12 : msg 13 | bl Hello 14 | 15 | mov w0, wzr 16 | bl exit 17 | -------------------------------------------------------------------------------- /Android x64/Extern Assembly/NASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open termux 5 | - git clone this repo 6 | - cd this path 7 | - nasm -f elf64 ABI.asm/C.asm namefile.o 8 | - gcc/clang ABI.c/C.c namefile.o -o namefile 9 | 10 | Nb: GCC is available in tur-repo 11 | -------------------------------------------------------------------------------- /Linux x64/Standalone/FASM/ABI.inc: -------------------------------------------------------------------------------- 1 | segment readable writable 2 | msg db 'Hello, World!', 0 3 | len = $ - msg 4 | 5 | segment readable executable 6 | Hello: 7 | mov al, 1 8 | mov dil, 1 9 | lea rsi, [msg] 10 | mov dl, len 11 | syscall 12 | 13 | ret 14 | -------------------------------------------------------------------------------- /Android x64/Extern C/GAS/C.asm: -------------------------------------------------------------------------------- 1 | .global main 2 | 3 | .section .note.GNU-stack, "", @progbits 4 | 5 | .section .data 6 | msg: 7 | .asciz "Hello, World!\n" 8 | 9 | .section .text 10 | main: 11 | lea msg(%rip), %rdi 12 | call Hello 13 | 14 | xor %dil, %dil 15 | call exit 16 | -------------------------------------------------------------------------------- /Linux x64/Extern C/GAS/C.asm: -------------------------------------------------------------------------------- 1 | .global main 2 | 3 | .section .note.GNU-stack, "", @progbits 4 | 5 | .section .data 6 | msg: 7 | .asciz "Hello, World!\n" 8 | 9 | .section .text 10 | main: 11 | lea msg(%rip), %rdi 12 | call Hello 13 | 14 | xor %dil, %dil 15 | call exit 16 | -------------------------------------------------------------------------------- /Windows x64/Extern C/NASM/C.asm: -------------------------------------------------------------------------------- 1 | extern exit, Hello 2 | 3 | global main 4 | 5 | section .data 6 | msg db 'Hello, World!', 10, 0 7 | 8 | section .text 9 | main: 10 | sub spl, 40 11 | 12 | lea rcx, [rel msg] 13 | call Hello 14 | 15 | xor ecx, ecx 16 | call exit 17 | -------------------------------------------------------------------------------- /Linux x64/Extern C/NASM/C.asm: -------------------------------------------------------------------------------- 1 | extern exit, Hello 2 | 3 | global main 4 | 5 | section .note.GNU-stack 6 | 7 | section .data 8 | msg db 'Hello, World!', 10, 0 9 | 10 | section .text 11 | main: 12 | lea rdi, [rel msg] 13 | call Hello 14 | 15 | xor dil, dil 16 | call [rel exit wrt ..got] 17 | -------------------------------------------------------------------------------- /Linux x64/Standalone/NASM/ABI.inc: -------------------------------------------------------------------------------- 1 | section .note.GNU-stack 2 | 3 | section .data 4 | msg db 'Hello, World!', 0 5 | len equ $ - msg 6 | 7 | section .text 8 | Hello: 9 | mov eax, 1 10 | mov dil, 1 11 | lea rsi, [rel msg] 12 | mov edx, len 13 | syscall 14 | 15 | ret 16 | -------------------------------------------------------------------------------- /Android x64/Extern C/NASM/C.asm: -------------------------------------------------------------------------------- 1 | extern exit, Hello 2 | 3 | global main 4 | 5 | section .note.GNU-stack 6 | 7 | section .data 8 | msg db 'Hello, World!', 10, 0 9 | 10 | section .text 11 | main: 12 | lea rdi, [rel msg] 13 | call Hello 14 | 15 | xor dil, dil 16 | call [rel exit wrt ..got] 17 | -------------------------------------------------------------------------------- /Android x64/Standalone/NASM/ABI.inc: -------------------------------------------------------------------------------- 1 | section .note.GNU-stack 2 | 3 | section .data 4 | msg db 'Hello, World!', 0 5 | len equ $ - msg 6 | 7 | section .text 8 | Hello: 9 | mov eax, 1 10 | mov dil, 1 11 | lea rsi, [rel msg] 12 | mov edx, len 13 | syscall 14 | 15 | ret 16 | -------------------------------------------------------------------------------- /Linux arm64/Standalone/GAS/C.inc: -------------------------------------------------------------------------------- 1 | .section .data 2 | msg: 3 | .asciz "Hello, World!\n" 4 | 5 | .section .text 6 | Hello: 7 | str lr, [sp, -16]! 8 | 9 | adrp x0, msg 10 | add x0, x0, : lo12 : msg 11 | bl printf 12 | 13 | ldr lr, [sp], 16 14 | 15 | ret 16 | 17 | -------------------------------------------------------------------------------- /Linux x64/Standalone/GAS/C.inc: -------------------------------------------------------------------------------- 1 | .section .note.GNU-stack, "", @progbits 2 | 3 | .section .data 4 | msg: 5 | .asciz "Hello, World!\n" 6 | 7 | .section .text 8 | Hello: 9 | sub $8, %rsp 10 | 11 | lea msg(%rip), %rdi 12 | call printf 13 | 14 | add $8, %rsp 15 | 16 | ret 17 | -------------------------------------------------------------------------------- /Windows arm64/Standalone/MARMASM/C.inc: -------------------------------------------------------------------------------- 1 | extern printf 2 | extern exit 3 | 4 | msg dcb "Hello, World!\n", 0 5 | 6 | area .text, code 7 | Hello proc 8 | str lr, [sp, -16]! 9 | 10 | adrp x0, msg 11 | add x0, x0, msg 12 | bl printf 13 | 14 | ldr lr, [sp], 16 15 | 16 | ret 17 | endp 18 | end -------------------------------------------------------------------------------- /Windows x64/Standalone/GAS/C.asm: -------------------------------------------------------------------------------- 1 | .include "C.inc" 2 | 3 | .global _start # change into main if assembling/linking with gcc/clang or mainCRTStartup if assembling/linking with MSVC compiler/linker 4 | 5 | .section .text 6 | _start: 7 | sub $40, %rsp 8 | 9 | call Hello 10 | 11 | xor %ecx, %ecx 12 | call exit 13 | -------------------------------------------------------------------------------- /Android arm64/Standalone/GAS/C.inc: -------------------------------------------------------------------------------- 1 | .section .data 2 | msg: 3 | .asciz "Hello, World!\n" 4 | 5 | .section .text 6 | Hello: 7 | str lr, [sp, -16]! 8 | 9 | adrp x0, msg 10 | add x0, x0, : lo12 : msg 11 | bl printf 12 | 13 | ldr lr, [sp], 16 14 | 15 | ret 16 | 17 | -------------------------------------------------------------------------------- /Android x64/Standalone/GAS/C.inc: -------------------------------------------------------------------------------- 1 | .section .note.GNU-stack, "", @progbits 2 | 3 | .section .data 4 | msg: 5 | .asciz "Hello, World!\n" 6 | 7 | .section .text 8 | Hello: 9 | sub $8, %rsp 10 | 11 | lea msg(%rip), %rdi 12 | call printf 13 | 14 | add $8, %rsp 15 | 16 | ret 17 | -------------------------------------------------------------------------------- /Windows arm64/Standalone/CLANG/C.inc: -------------------------------------------------------------------------------- 1 | .section .data 2 | msg: 3 | .asciz "Hello, World!\n" 4 | 5 | .section .text 6 | Hello: 7 | str lr, [sp, -16]! 8 | 9 | adrp x0, msg 10 | add x0, x0, : lo12 : msg 11 | bl printf 12 | 13 | ldr lr, [sp], 16 14 | 15 | ret 16 | 17 | -------------------------------------------------------------------------------- /Android arm64/Standalone/GAS/ABI.inc: -------------------------------------------------------------------------------- 1 | .section .data 2 | msg: 3 | .asciz "Hello, World!" 4 | .equ len, . - msg 5 | 6 | .section .text 7 | Hello: 8 | mov w8, 64 9 | mov w0, 1 10 | adrp x1, msg 11 | add x1, x1, : lo12 : msg 12 | ldr w2, = len 13 | svc 0 14 | 15 | ret 16 | 17 | -------------------------------------------------------------------------------- /Linux arm64/Standalone/GAS/ABI.inc: -------------------------------------------------------------------------------- 1 | .section .data 2 | msg: 3 | .asciz "Hello, World!" 4 | .equ len, . - msg 5 | 6 | .section .text 7 | Hello: 8 | mov w8, 64 9 | mov w0, 1 10 | adrp x1, msg 11 | add x1, x1, : lo12 : msg 12 | ldr w2, = len 13 | svc 0 14 | 15 | ret 16 | 17 | -------------------------------------------------------------------------------- /Linux x64/Extern Assembly/FASM/C.asm: -------------------------------------------------------------------------------- 1 | format elf64 2 | 3 | public Hello 4 | 5 | extrn printf 6 | 7 | section '.note.GNU-stack' 8 | 9 | section '.data' writable 10 | _printf dq printf 11 | 12 | section '.code' executable 13 | Hello: 14 | sub rsp, 8 15 | 16 | call [_printf] 17 | 18 | add rsp, 8 19 | 20 | ret 21 | -------------------------------------------------------------------------------- /Windows x64/Standalone/GAS/ABI.asm: -------------------------------------------------------------------------------- 1 | .include "ABI.inc" 2 | 3 | .global _start # change into main if assembling/linking with gcc/clang or mainCRTStartup if assembling/linking with MSVC compiler/linker 4 | 5 | .section .text 6 | _start: 7 | sub $40, %rsp 8 | 9 | call Hello 10 | 11 | xor %ecx, %ecx 12 | call ExitProcess 13 | -------------------------------------------------------------------------------- /Android x64/Extern Assembly/GAS/ABI.asm: -------------------------------------------------------------------------------- 1 | .global Hello 2 | 3 | .section .note.GNU-stack, "", @progbits 4 | 5 | .section .text 6 | Hello: 7 | mov %rdi, %rbx 8 | mov %esi, %ebp 9 | mov $1, %eax 10 | mov $1, %edi 11 | mov %rbx, %rsi 12 | mov %ebp, %edx 13 | syscall 14 | 15 | ret 16 | -------------------------------------------------------------------------------- /Android x64/Standalone/NASM/C.inc: -------------------------------------------------------------------------------- 1 | extern printf, exit 2 | 3 | section .note.GNU-stack 4 | 5 | section .data 6 | msg db 'Hello, World!', 10, 0 7 | 8 | section .text 9 | Hello: 10 | sub rsp, 8 11 | 12 | lea rdi, [rel msg] 13 | call [rel printf wrt ..got] 14 | 15 | add rsp, 8 16 | 17 | ret 18 | -------------------------------------------------------------------------------- /Linux x64/Extern Assembly/FASM/ABI.asm: -------------------------------------------------------------------------------- 1 | format elf64 2 | 3 | public Hello 4 | 5 | section '.note.GNU-stack' 6 | 7 | section '.code' executable 8 | Hello: 9 | mov rbx, rdi 10 | mov ebp, esi 11 | mov eax, 1 12 | mov edi, 1 13 | mov rsi, rbx 14 | mov edx, ebp 15 | syscall 16 | 17 | ret 18 | -------------------------------------------------------------------------------- /Linux x64/Extern Assembly/GAS/ABI.asm: -------------------------------------------------------------------------------- 1 | .global Hello 2 | 3 | .section .note.GNU-stack, "", @progbits 4 | 5 | .section .text 6 | Hello: 7 | mov %rdi, %rbx 8 | mov %esi, %ebp 9 | mov $1, %eax 10 | mov $1, %edi 11 | mov %rbx, %rsi 12 | mov %ebp, %edx 13 | syscall 14 | 15 | ret 16 | -------------------------------------------------------------------------------- /Linux x64/Standalone/NASM/C.inc: -------------------------------------------------------------------------------- 1 | extern printf, exit 2 | 3 | section .note.GNU-stack 4 | 5 | section .data 6 | msg db 'Hello, World!', 10, 0 7 | 8 | section .text 9 | Hello: 10 | sub rsp, 8 11 | 12 | lea rdi, [rel msg] 13 | call [rel printf wrt ..got] 14 | 15 | add rsp, 8 16 | 17 | ret 18 | -------------------------------------------------------------------------------- /Android arm64/Standalone/GAS/C.asm: -------------------------------------------------------------------------------- 1 | .include "C.inc" 2 | 3 | .global _start // change into main if assembling/linking with gcc/clang 4 | 5 | .section .text 6 | _start: 7 | // remove this comment if assembling/linking with gcc/clang 8 | // str lr, [sp, -16]! 9 | 10 | bl Hello 11 | 12 | mov w0, wzr 13 | bl exit 14 | -------------------------------------------------------------------------------- /Linux arm64/Standalone/GAS/C.asm: -------------------------------------------------------------------------------- 1 | .include "C.inc" 2 | 3 | .global _start // change into main if assembling/linking with gcc/clang 4 | 5 | .section .text 6 | _start: 7 | // remove this comment if assembling/linking with gcc/clang 8 | // str lr, [sp, -16]! 9 | 10 | bl Hello 11 | 12 | mov w0, wzr 13 | bl exit 14 | -------------------------------------------------------------------------------- /Linux x64/Standalone/GAS/C.asm: -------------------------------------------------------------------------------- 1 | .include "C.inc" 2 | 3 | .global _start # change into main if assembling/linking with gcc/clang 4 | 5 | .section .text 6 | _start: 7 | # remove this comment if assembling/linking with gcc/clang 8 | # sub $8, %rsp 9 | 10 | call Hello 11 | 12 | xor %dil, %dil 13 | call exit 14 | -------------------------------------------------------------------------------- /Windows x64/Standalone/NASM/C.asm: -------------------------------------------------------------------------------- 1 | %include "C.inc" 2 | 3 | global _start ; change into main if assembling/linking with gcc/clang or mainCRTStartup if assembling/linking with MSVC compiler/linker 4 | 5 | section .text 6 | 7 | _start: 8 | sub rsp, 40 9 | 10 | call Hello 11 | 12 | xor ecx, ecx 13 | call exit 14 | -------------------------------------------------------------------------------- /Android x64/Standalone/GAS/C.asm: -------------------------------------------------------------------------------- 1 | .include "C.inc" 2 | 3 | .global _start # change into main if assembling/linking with gcc/clang 4 | 5 | .section .text 6 | _start: 7 | # remove this comment if assembling/linking with gcc/clang 8 | # sub $8, %rsp 9 | 10 | call Hello 11 | 12 | xor %dil, %dil 13 | call exit 14 | -------------------------------------------------------------------------------- /Windows arm64/Extern C/CLANG/ABI.asm: -------------------------------------------------------------------------------- 1 | .global main 2 | 3 | .section .data 4 | msg: 5 | .ascii "Hello, World!" 6 | .equ len, . - msg 7 | 8 | .section .text 9 | main: 10 | str lr, [sp, -16]! 11 | 12 | adrp x0, msg 13 | add x0, x0, : lo12 : msg 14 | ldr w1, = len 15 | bl Hello 16 | 17 | mov w0, wzr 18 | bl ExitProcess 19 | -------------------------------------------------------------------------------- /Android arm64/Extern C/GAS/ABI.asm: -------------------------------------------------------------------------------- 1 | .global main 2 | 3 | .section .data 4 | msg: 5 | .asciz "Hello, World!" 6 | .equ len, . - msg 7 | 8 | .section .text 9 | main: 10 | adrp x0, msg 11 | add x0, x0, : lo12 : msg 12 | ldr w1, = len 13 | bl Hello 14 | 15 | mov w8, 93 16 | mov w0, wzr 17 | svc 0 18 | -------------------------------------------------------------------------------- /Android x64/Standalone/GAS/ABI.inc: -------------------------------------------------------------------------------- 1 | .section .note.GNU-stack, "", @progbits 2 | 3 | .section .data 4 | msg: 5 | .asciz "Hello, World!" 6 | .equ len, . - msg 7 | 8 | .section .text 9 | Hello: 10 | mov $1, %eax 11 | mov $1, %dil 12 | lea msg(%rip), %rsi 13 | mov $len, %edx 14 | syscall 15 | 16 | ret 17 | -------------------------------------------------------------------------------- /Linux arm64/Extern C/GAS/ABI.asm: -------------------------------------------------------------------------------- 1 | .global main 2 | 3 | .section .data 4 | msg: 5 | .asciz "Hello, World!" 6 | .equ len, . - msg 7 | 8 | .section .text 9 | main: 10 | adrp x0, msg 11 | add x0, x0, : lo12 : msg 12 | ldr w1, = len 13 | bl Hello 14 | 15 | mov w8, 93 16 | mov w0, wzr 17 | svc 0 18 | -------------------------------------------------------------------------------- /Linux x64/Standalone/GAS/ABI.inc: -------------------------------------------------------------------------------- 1 | .section .note.GNU-stack, "", @progbits 2 | 3 | .section .data 4 | msg: 5 | .asciz "Hello, World!" 6 | .equ len, . - msg 7 | 8 | .section .text 9 | Hello: 10 | mov $1, %eax 11 | mov $1, %dil 12 | lea msg(%rip), %rsi 13 | mov $len, %edx 14 | syscall 15 | 16 | ret 17 | -------------------------------------------------------------------------------- /Android x64/Extern C/NASM/ABI.asm: -------------------------------------------------------------------------------- 1 | extern Hello 2 | 3 | global main 4 | 5 | section .note.GNU-stack 6 | 7 | section .data 8 | msg db 'Hello, World!', 0 9 | len equ $ - msg 10 | 11 | section .text 12 | main: 13 | lea rdi, [rel msg] 14 | mov sil, len 15 | call Hello 16 | 17 | mov al, 60 18 | xor dil, dil 19 | syscall 20 | -------------------------------------------------------------------------------- /Android x64/Standalone/NASM/C.asm: -------------------------------------------------------------------------------- 1 | %include "C.inc" 2 | 3 | global _start ; change into main if assembling/linking with gcc/clang 4 | 5 | section .text 6 | _start: 7 | ; remove this comment if assembling/linking with gcc/clang 8 | ; sub rsp, 8 9 | 10 | call Hello 11 | 12 | xor dil, dil 13 | call [rel exit wrt ..got] 14 | -------------------------------------------------------------------------------- /Linux x64/Extern C/NASM/ABI.asm: -------------------------------------------------------------------------------- 1 | extern Hello 2 | 3 | global main 4 | 5 | section .note.GNU-stack 6 | 7 | section .data 8 | msg db 'Hello, World!', 0 9 | len equ $ - msg 10 | 11 | section .text 12 | main: 13 | lea rdi, [rel msg] 14 | mov sil, len 15 | call Hello 16 | 17 | mov al, 60 18 | xor dil, dil 19 | syscall 20 | -------------------------------------------------------------------------------- /Linux x64/Standalone/NASM/C.asm: -------------------------------------------------------------------------------- 1 | %include "C.inc" 2 | 3 | global _start ; change into main if assembling/linking with gcc/clang 4 | 5 | section .text 6 | _start: 7 | ; remove this comment if assembling/linking with gcc/clang 8 | ; sub rsp, 8 9 | 10 | call Hello 11 | 12 | xor dil, dil 13 | call [rel exit wrt ..got] 14 | -------------------------------------------------------------------------------- /Windows x64/Standalone/NASM/ABI.asm: -------------------------------------------------------------------------------- 1 | %include "ABI.inc" 2 | 3 | global _start ; change into main if assembling/linking with gcc/clang or mainCRTStartup if assembling/linking with MSVC compiler/linker 4 | 5 | section .text 6 | 7 | _start: 8 | sub rsp, 40 9 | 10 | call Hello 11 | 12 | xor ecx, ecx 13 | call ExitProcess 14 | -------------------------------------------------------------------------------- /Linux arm64/Inline Assembly/GCC/C.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern inline void Hello(char * msg) 4 | { 5 | asm volatile 6 | ( 7 | "str lr, [sp, -16]!\n" 8 | 9 | "mov x0, %0\n" 10 | "bl printf\n" 11 | 12 | "ldr lr, [sp], 16\n" 13 | : 14 | : "r"(msg) 15 | : "x0" 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /Windows x64/Extern C/GAS/ABI.asm: -------------------------------------------------------------------------------- 1 | .global main # change mainCRTStartup if combining with MSVC compiler 2 | 3 | .section .data 4 | msg: 5 | .ascii "Hello, World!" 6 | .equ len, . - msg 7 | 8 | .section .text 9 | main: 10 | sub $40, %spl 11 | 12 | lea msg(%rip), %rcx 13 | mov $len, %dl 14 | call Hello 15 | 16 | xor %ecx, %ecx 17 | call ExitProcess 18 | -------------------------------------------------------------------------------- /Windows x64/Extern C/NASM/ABI.asm: -------------------------------------------------------------------------------- 1 | extern ExitProcess, Hello 2 | 3 | global main 4 | 5 | section .data 6 | msg db 'Hello, World!' 7 | len equ $ - msg 8 | 9 | section .text 10 | main: 11 | sub spl, 40 12 | 13 | lea rcx, [rel msg] 14 | mov dl, len 15 | call Hello 16 | 17 | xor ecx, ecx 18 | call ExitProcess 19 | -------------------------------------------------------------------------------- /Android arm64/Inline Assembly/GCC/C.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern inline void Hello(char * msg) 4 | { 5 | asm volatile 6 | ( 7 | "str lr, [sp, -16]!\n" 8 | 9 | "mov x0, %0\n" 10 | "bl printf\n" 11 | 12 | "ldr lr, [sp], 16\n" 13 | : 14 | : "r"(msg) 15 | : "x0" 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /Android x64/Extern C/GAS/ABI.asm: -------------------------------------------------------------------------------- 1 | .global main 2 | 3 | .section .note.GNU-stack, "", @progbits 4 | 5 | .section .data 6 | msg: 7 | .asciz "Hello, World!" 8 | .equ len, . - msg 9 | 10 | .section .text 11 | main: 12 | lea msg(%rip), %rdi 13 | mov $len, %sil 14 | call Hello 15 | 16 | mov $60, %al 17 | xor %dil, %dil 18 | syscall 19 | -------------------------------------------------------------------------------- /Linux x64/Extern C/GAS/ABI.asm: -------------------------------------------------------------------------------- 1 | .global main 2 | 3 | .section .note.GNU-stack, "", @progbits 4 | 5 | .section .data 6 | msg: 7 | .asciz "Hello, World!" 8 | .equ len, . - msg 9 | 10 | .section .text 11 | main: 12 | lea msg(%rip), %rdi 13 | mov $len, %sil 14 | call Hello 15 | 16 | mov $60, %al 17 | xor %dil, %dil 18 | syscall 19 | -------------------------------------------------------------------------------- /Windows x64/Extern C/FASM/C.asm: -------------------------------------------------------------------------------- 1 | format ms64 coff 2 | 3 | public main 4 | 5 | extrn exit 6 | extrn Hello 7 | 8 | section '.data' data readable writable 9 | msg db "Hello, World!", 10, 0 10 | 11 | section '.text' code readable executable 12 | main: 13 | sub rsp, 40 14 | 15 | lea rcx, [msg] 16 | call Hello 17 | 18 | xor ecx, ecx 19 | call exit 20 | -------------------------------------------------------------------------------- /Linux x64/Extern C/FASM/C.asm: -------------------------------------------------------------------------------- 1 | format elf64 2 | 3 | public main 4 | 5 | extrn Hello 6 | extrn exit 7 | 8 | section '.note.GNU-stack' 9 | 10 | section '.data' writable 11 | _exit dq exit 12 | msg db 'Hello, World!', 10, 0 13 | 14 | section '.code' executable 15 | main: 16 | lea rdi, [msg] 17 | call Hello 18 | 19 | xor dil, dil 20 | call [_exit] 21 | -------------------------------------------------------------------------------- /Windows arm64/Extern Assembly/CLANG/ABI.asm: -------------------------------------------------------------------------------- 1 | .global Hello 2 | 3 | .section .text 4 | Hello: 5 | str lr, [sp, -16]! 6 | 7 | mov x9, x0 8 | mov w10, w1 9 | mov w0, -11 10 | bl GetStdHandle 11 | 12 | mov x1, x9 13 | mov w2, w10 14 | mov w3, wzr 15 | mov w4, wzr 16 | bl WriteConsoleA 17 | 18 | ldr lr, [sp], 16 19 | 20 | ret 21 | -------------------------------------------------------------------------------- /Windows arm64/Inline Assembly/CLANG/C.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern inline void Hello(char * msg) 4 | { 5 | __asm__ volatile 6 | ( 7 | "str lr, [sp, -16]!\n" 8 | 9 | "mov x0, %0\n" 10 | "bl printf\n" 11 | 12 | "ldr lr, [sp], 16\n" 13 | : 14 | : "r"(msg) 15 | : "x0" 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /Windows arm64/Extern C/MARMASM/C.asm: -------------------------------------------------------------------------------- 1 | extern exit 2 | extern Hello 3 | 4 | export mainCRTStartup ; change into main if linking with clang 5 | 6 | msg dcb "Hello, World!\n", 0 7 | 8 | area .text, code 9 | mainCRTStartup proc 10 | str lr, [sp, - 16]! 11 | 12 | adrp x0, msg 13 | add x0, x0, msg 14 | bl Hello 15 | 16 | mov w0, wzr 17 | bl exit 18 | endp 19 | end -------------------------------------------------------------------------------- /Linux x64/Extern C/FASM/ABI.asm: -------------------------------------------------------------------------------- 1 | format elf64 2 | 3 | public main 4 | 5 | extrn Hello 6 | 7 | section '.note.GNU-stack' 8 | 9 | section '.data' writable 10 | msg db 'Hello, World!', 0 11 | len = $ - msg 12 | 13 | section '.code' executable 14 | main: 15 | lea rdi, [msg] 16 | mov sil, len 17 | call Hello 18 | 19 | mov al, 60 20 | xor dil, dil 21 | syscall 22 | -------------------------------------------------------------------------------- /Windows x64/Extern Assembly/GAS/ABI.asm: -------------------------------------------------------------------------------- 1 | .global Hello 2 | 3 | .section .text 4 | Hello: 5 | sub $40, %rsp 6 | 7 | mov %rcx, %rbx 8 | mov %edx, %ebp 9 | mov $-11, %ecx 10 | call GetStdHandle 11 | 12 | mov %eax, %ecx 13 | mov %rbx, %rdx 14 | mov %ebp, %r8d 15 | xor %r9d, %r9d 16 | movb $0, 32(%rsp) 17 | call WriteConsoleA 18 | 19 | add $40, %rsp 20 | 21 | ret 22 | -------------------------------------------------------------------------------- /Windows x64/Standalone/GAS/ABI.inc: -------------------------------------------------------------------------------- 1 | .section .data 2 | msg: 3 | .ascii "Hello, World!" 4 | .equ len, . - msg 5 | 6 | .section .text 7 | Hello: 8 | sub $40, %rsp 9 | 10 | mov $-11, %ecx 11 | call GetStdHandle 12 | 13 | mov %eax, %ecx 14 | lea msg(%rip), %rdx 15 | mov $len, %r8d 16 | xor %r9d, %r9d 17 | movb $0, 32(%rsp) 18 | call WriteConsoleA 19 | 20 | add $40, %rsp 21 | 22 | ret 23 | -------------------------------------------------------------------------------- /Windows x64/Extern C/FASM/ABI.asm: -------------------------------------------------------------------------------- 1 | format ms64 coff 2 | 3 | public main 4 | 5 | extrn ExitProcess 6 | extrn Hello 7 | 8 | section '.data' data readable writable 9 | msg db "Hello, World!" 10 | len = $ - msg 11 | 12 | section '.text' code readable executable 13 | main: 14 | sub rsp, 40 15 | 16 | lea rcx, [msg] 17 | mov dl, len 18 | call Hello 19 | 20 | xor ecx, ecx 21 | call ExitProcess 22 | -------------------------------------------------------------------------------- /Windows arm64/Standalone/CLANG/ABI.inc: -------------------------------------------------------------------------------- 1 | .section .data 2 | msg: 3 | .ascii "Hello, World!" 4 | .equ len, . - msg 5 | 6 | .section .text 7 | Hello: 8 | str lr, [sp, -16]! 9 | 10 | mov w0, -11 11 | bl GetStdHandle 12 | 13 | adrp x1, msg 14 | add x1, x1, : lo12 : msg 15 | ldr w2, = len 16 | mov w3, wzr 17 | mov w4, wzr 18 | bl WriteConsoleA 19 | 20 | ldr lr, [sp], 16 21 | 22 | ret 23 | -------------------------------------------------------------------------------- /Windows x64/Standalone/MASM/C.inc: -------------------------------------------------------------------------------- 1 | ; Remove this comment for assembling with command line 2 | ; includelib legacy_stdio_definitions.lib 3 | ; includelib ucrt.lib 4 | 5 | printf proto 6 | exit proto 7 | 8 | .data 9 | msg db "Hello, World!", 10, 0 10 | 11 | .code 12 | Hello PROC 13 | sub rsp, 40 14 | 15 | lea rcx, msg 16 | call printf 17 | 18 | add rsp, 40 19 | 20 | ret 21 | Hello ENDP 22 | -------------------------------------------------------------------------------- /Android arm64/Inline Assembly/GCC/ABI.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern inline void Hello(char * msg, long long len) 5 | { 6 | asm volatile 7 | ( 8 | "mov w8, 64\n" 9 | "mov w0, 1\n" 10 | "mov x1, %0\n" 11 | "mov x2, %1\n" 12 | "svc 0\n" 13 | : 14 | : "r"(msg), "r"(len) 15 | : "x0", "x1", "x2", "x8" 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /Linux arm64/Inline Assembly/GCC/ABI.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern inline void Hello(char * msg, long long len) 5 | { 6 | asm volatile 7 | ( 8 | "mov w8, 64\n" 9 | "mov w0, 1\n" 10 | "mov x1, %0\n" 11 | "mov x2, %1\n" 12 | "svc 0\n" 13 | : 14 | : "r"(msg), "r"(len) 15 | : "x0", "x1", "x2", "x8" 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /Android x64/Inline Assembly/GCC/ABI.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern inline void Hello(char * msg, int len) 5 | { 6 | asm volatile 7 | ( 8 | "mov $1, %%eax\n" 9 | "mov $1, %%edi\n" 10 | "mov %0, %%rsi\n" 11 | "mov %1, %%edx\n" 12 | "syscall\n" 13 | : 14 | : "r"(msg), "r"(len) 15 | : "%rax", "%rdi", "%rsi", "%rdx" 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /Linux x64/Inline Assembly/GCC/ABI.h: -------------------------------------------------------------------------------- 1 | #include 2 | #include 3 | 4 | extern inline void Hello(char * msg, int len) 5 | { 6 | asm volatile 7 | ( 8 | "mov $1, %%eax\n" 9 | "mov $1, %%edi\n" 10 | "mov %0, %%rsi\n" 11 | "mov %1, %%edx\n" 12 | "syscall\n" 13 | : 14 | : "r"(msg), "r"(len) 15 | : "%rax", "%rdi", "%rsi", "%rdx" 16 | ); 17 | } 18 | -------------------------------------------------------------------------------- /Windows arm64/Extern C/MARMASM/ABI.asm: -------------------------------------------------------------------------------- 1 | extern ExitProcess 2 | extern Hello 3 | 4 | export mainCRTStartup ; change into main if linking with clang 5 | 6 | msg dcb "Hello, World!" 7 | len equ :len: "Hello, World!" 8 | 9 | area .text, code 10 | mainCRTStartup proc 11 | str lr, [sp, - 16]! 12 | 13 | adrp x0, msg 14 | add x0, x0, msg 15 | ldr w1, = len 16 | bl Hello 17 | 18 | mov w0, wzr 19 | bl ExitProcess 20 | endp 21 | end -------------------------------------------------------------------------------- /Windows arm64/Extern Assembly/MARMASM/ABI.asm: -------------------------------------------------------------------------------- 1 | extern GetStdHandle 2 | extern WriteConsoleA 3 | 4 | export Hello 5 | 6 | area .text, code 7 | Hello proc 8 | str lr, [sp, -16]! 9 | 10 | mov x9, x0 11 | mov w10, w1 12 | mov w0, -11 13 | bl GetStdHandle 14 | 15 | mov x1, x9 16 | mov w2, w10 17 | mov w3, wzr 18 | mov w4, wzr 19 | bl WriteConsoleA 20 | 21 | ldr lr, [sp], 16 22 | 23 | ret 24 | endp 25 | end -------------------------------------------------------------------------------- /Windows x64/Extern C/MASM/C.asm: -------------------------------------------------------------------------------- 1 | ; Remove this comment for assembling with command line if using MSVC compiler for combining with C.c 2 | ; includelib legacy_stdio_definitions.lib 3 | ; includelib ucrt.lib 4 | 5 | exit proto 6 | Hello proto 7 | 8 | .data 9 | msg db "Hello, World!", 10, 0 10 | 11 | .code 12 | main proc 13 | sub spl, 40 14 | 15 | lea rcx, msg 16 | call Hello 17 | 18 | xor ecx, ecx 19 | call exit 20 | main endp 21 | end 22 | -------------------------------------------------------------------------------- /Windows x64/Extern C/MASM/ABI.asm: -------------------------------------------------------------------------------- 1 | ; Remove this comment for assembling with command line if using MSVC compiler for combining with ABI.c 2 | ; includelib kernel32.lib 3 | 4 | ExitProcess proto 5 | Hello proto 6 | 7 | .data 8 | msg db "Hello, World!" 9 | 10 | .code 11 | main proc 12 | sub spl, 40 13 | 14 | lea rcx, msg 15 | mov dl, lengthof msg 16 | call Hello 17 | 18 | xor ecx, ecx 19 | call ExitProcess 20 | main endp 21 | end 22 | -------------------------------------------------------------------------------- /Windows x64/Extern Assembly/NASM/ABI.asm: -------------------------------------------------------------------------------- 1 | extern GetStdHandle, WriteConsoleA 2 | 3 | global Hello 4 | 5 | section .text 6 | Hello: 7 | sub rsp, 40 8 | 9 | mov rbx, rcx 10 | mov ebp, edx 11 | mov ecx, -11 12 | call GetStdHandle 13 | 14 | mov ecx, eax 15 | mov rdx, rbx 16 | mov r8d, ebp 17 | xor r9d, r9d 18 | mov byte 32[rsp], 0 19 | call WriteConsoleA 20 | 21 | add rsp, 40 22 | 23 | ret 24 | -------------------------------------------------------------------------------- /Windows x64/Extern Assembly/FASM/ABI.asm: -------------------------------------------------------------------------------- 1 | format ms64 coff 2 | 3 | public Hello 4 | 5 | extrn GetStdHandle 6 | extrn WriteConsoleA 7 | 8 | section '.text' code readable executable 9 | Hello: 10 | sub rsp, 40 11 | 12 | mov rbx, rcx 13 | mov ebp, edx 14 | mov ecx, -11 15 | call GetStdHandle 16 | 17 | mov ecx, eax 18 | mov rdx, rbx 19 | mov r8d, ebp 20 | xor r9d, r9d 21 | mov byte [rsp + 32], 0 22 | call WriteConsoleA 23 | 24 | add rsp, 40 25 | 26 | ret 27 | -------------------------------------------------------------------------------- /Windows x64/Extern Assembly/MASM/ABI.asm: -------------------------------------------------------------------------------- 1 | GetStdHandle proto 2 | WriteConsoleA proto 3 | 4 | .code 5 | Hello proc 6 | sub rsp, 40 7 | 8 | mov rbx, rcx 9 | mov ebp, edx 10 | mov ecx, -11 11 | call GetStdHandle 12 | 13 | mov ecx, eax 14 | mov rdx, rbx 15 | mov r8d, ebp 16 | xor r9d, r9d 17 | mov byte ptr 32[rsp], 0 18 | call WriteConsoleA 19 | 20 | add rsp, 40 21 | 22 | ret 23 | Hello endp 24 | end -------------------------------------------------------------------------------- /Windows arm64/Standalone/MARMASM/ABI.inc: -------------------------------------------------------------------------------- 1 | extern GetStdHandle 2 | extern WriteConsoleA 3 | extern ExitProcess 4 | 5 | msg dcb "Hello, World!" 6 | len equ :len: "Hello, World!" 7 | 8 | area .text, code 9 | Hello proc 10 | str lr, [sp, -16]! 11 | 12 | mov w0, -11 13 | bl GetStdHandle 14 | 15 | adrp x1, msg 16 | add x1, x1, msg 17 | ldr w2, = len 18 | mov w3, wzr 19 | mov w4, wzr 20 | bl WriteConsoleA 21 | 22 | ldr lr, [sp], 16 23 | 24 | ret 25 | endp 26 | end -------------------------------------------------------------------------------- /Windows x64/Standalone/NASM/ABI.inc: -------------------------------------------------------------------------------- 1 | extern GetStdHandle, WriteConsoleA, ExitProcess 2 | 3 | section .data 4 | msg db 'Hello, World!' 5 | len equ $ - msg 6 | 7 | section .text 8 | Hello: 9 | sub rsp, 40 10 | 11 | mov ecx, -11 12 | call GetStdHandle 13 | 14 | mov ecx, eax 15 | lea rdx, [rel msg] 16 | mov r8d, len 17 | xor r9d, r9d 18 | mov byte 32[rsp], 0 19 | call WriteConsoleA 20 | 21 | add rsp, 40 22 | 23 | ret 24 | -------------------------------------------------------------------------------- /Linux arm64/Extern C/GAS/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | #### With Clang 5 | --------------- 6 | 7 | - Open terminal 8 | - git clone this repo 9 | - cd this path 10 | - clang ABI.asm/C.asm ABI.c/C.c -o namefile 11 | 12 | #### With GNU Assembler 13 | ----------------------- 14 | 15 | - Open terminal 16 | - git clone this repo 17 | - cd this path 18 | - as ABI.asm/C.asm -o namefile.o 19 | - gcc/clang ABI.c/C.c namefile.o -o namefile 20 | 21 | Nb: GNU Assembler is part of binutils which dependency of GCC 22 | -------------------------------------------------------------------------------- /Linux x64/Extern C/GAS/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | #### With Clang 5 | --------------- 6 | 7 | - Open terminal 8 | - git clone this repo 9 | - cd this path 10 | - clang ABI.asm/C.asm ABI.c/C.c -o namefile 11 | 12 | #### With GNU Assembler 13 | ----------------------- 14 | 15 | - Open terminal 16 | - git clone this repo 17 | - cd this path 18 | - as ABI.asm/C.asm -o namefile.o 19 | - gcc/clang ABI.c/C.c namefile.o -o namefile 20 | 21 | Nb: GNU Assembler is part of binutils which dependency of GCC 22 | -------------------------------------------------------------------------------- /Linux x64/Extern Assembly/GAS/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | #### With Clang 5 | --------------- 6 | 7 | - Open terminal 8 | - git clone this repo 9 | - cd this path 10 | - clang ABI.asm/C.asm ABI.c/C.c -o namefile 11 | 12 | #### With GNU Assembler 13 | ----------------------- 14 | 15 | - Open terminal 16 | - git clone this repo 17 | - cd this path 18 | - as ABI.asm/C.asm -o namefile.o 19 | - gcc/clang ABI.c/C.c namefile.o -o namefile 20 | 21 | Nb: GNU Assembler is part of binutils which dependency of GCC 22 | -------------------------------------------------------------------------------- /Linux arm64/Extern Assembly/GAS/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | #### With Clang 5 | --------------- 6 | 7 | - Open terminal 8 | - git clone this repo 9 | - cd this path 10 | - clang ABI.asm/C.asm ABI.c/C.c -o namefile 11 | 12 | #### With GNU Assembler 13 | ----------------------- 14 | 15 | - Open terminal 16 | - git clone this repo 17 | - cd this path 18 | - as ABI.asm/C.asm -o namefile.o 19 | - gcc/clang ABI.c/C.c namefile.o -o namefile 20 | 21 | Nb: GNU Assembler is part of binutils which dependency of GCC 22 | -------------------------------------------------------------------------------- /Windows x64/Inline Assembly/GCC/ABI.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern inline void Hello(char * msg, int len) 4 | { 5 | __asm__ volatile 6 | ( 7 | "mov $-11, %%ecx\n" 8 | "call GetStdHandle\n" 9 | 10 | "mov %%eax, %%ecx\n" 11 | "mov %0, %%rdx\n" 12 | "mov %1, %%r8d\n" 13 | "xor %%r9d, %%r9d\n" 14 | "movb $0, 32(%%rsp)\n" 15 | "call WriteConsoleA\n" 16 | : 17 | : "r"(msg), "r"(len) 18 | : "%rax", "%rcx", "%rdx", "%r8", "%r9" 19 | ); 20 | }; 21 | -------------------------------------------------------------------------------- /Android x64/Extern C/GAS/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | #### With Clang 5 | --------------- 6 | 7 | - Open termux 8 | - git clone this repo 9 | - cd this path 10 | - clang ABI.asm/C.asm ABI.c/C.c -o namefile 11 | 12 | #### With GNU Assembler 13 | ----------------------- 14 | 15 | - Open termux 16 | - git clone this repo 17 | - cd this path 18 | - as ABI.asm/C.asm -o namefile.o 19 | - gcc/clang ABI.c/C.c namefile.o -o namefile 20 | 21 | Nb: GCC is available in tur-repo. GNU Assembler is part of binutils which dependency of GCC -------------------------------------------------------------------------------- /Windows x64/Standalone/FASM/C.inc: -------------------------------------------------------------------------------- 1 | section '.data' data readable writable 2 | msg db "Hello, World!", 10, 0 3 | 4 | section '.text' code readable executable 5 | Hello: 6 | sub rsp, 40 7 | 8 | lea rcx, [msg] 9 | call [printf] 10 | 11 | add rsp, 40 12 | 13 | ret 14 | 15 | section '.idata' import data readable 16 | dd 0, 0, 0, RVA msvcrt, RVA msvcrt_table 17 | 18 | msvcrt_table: 19 | printf dq RVA _printf 20 | exit dq RVA _exit 21 | dq 0 22 | 23 | msvcrt db 'msvcrt.dll', 0 24 | 25 | _printf dw 0 26 | db 'printf', 0 27 | _exit dw 0 28 | db 'exit', 0 29 | -------------------------------------------------------------------------------- /Android arm64/Extern C/GAS/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | #### With Clang 5 | --------------- 6 | 7 | - Open termux 8 | - git clone this repo 9 | - cd this path 10 | - clang ABI.asm/C.asm ABI.c/C.c -o namefile 11 | 12 | #### With GNU Assembler 13 | ----------------------- 14 | 15 | - Open termux 16 | - git clone this repo 17 | - cd this path 18 | - as ABI.asm/C.asm -o namefile.o 19 | - gcc/clang ABI.c/C.c namefile.o -o namefile 20 | 21 | Nb: GCC is available in tur-repo. GNU Assembler is part of binutils which dependency of GCC 22 | -------------------------------------------------------------------------------- /Android arm64/Extern Assembly/GAS/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | #### With Clang 5 | --------------- 6 | 7 | - Open termux 8 | - git clone this repo 9 | - cd this path 10 | - clang ABI.asm/C.asm ABI.c/C.c -o namefile 11 | 12 | #### With GNU Assembler 13 | ----------------------- 14 | 15 | - Open termux 16 | - git clone this repo 17 | - cd this path 18 | - as ABI.asm/C.asm -o namefile.o 19 | - gcc/clang ABI.c/C.c namefile.o -o namefile 20 | 21 | Nb: GCC is available in tur-repo. GNU Assembler is part of binutils which dependency of GCC 22 | -------------------------------------------------------------------------------- /Android x64/Extern Assembly/GAS/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | #### With Clang 5 | --------------- 6 | 7 | - Open termux 8 | - git clone this repo 9 | - cd this path 10 | - clang ABI.asm/C.asm ABI.c/C.c -o namefile 11 | 12 | #### With GNU Assembler 13 | ----------------------- 14 | 15 | - Open termux 16 | - git clone this repo 17 | - cd this path 18 | - as ABI.asm/C.asm -o namefile.o 19 | - gcc/clang ABI.c/C.c namefile.o -o namefile 20 | 21 | Nb: GCC is available in tur-repo. GNU Assembler is part of binutils which dependency of GCC 22 | -------------------------------------------------------------------------------- /Windows arm64/Inline Assembly/CLANG/ABI.h: -------------------------------------------------------------------------------- 1 | #include 2 | 3 | extern inline void Hello(char * msg, long long len) 4 | { 5 | __asm__ volatile 6 | ( 7 | "str lr, [sp, -16]!\n" 8 | 9 | "mov w0, -11\n" 10 | "bl GetStdHandle\n" 11 | 12 | "mov x1, %0\n" 13 | "mov x2, %1\n" 14 | "mov w3, wzr\n" 15 | "mov w4, wzr\n" 16 | "bl WriteConsoleA\n" 17 | 18 | "ldr lr, [sp], 16\n" 19 | : 20 | : "r"(msg), "r"(len) 21 | : "x0", "x1", "x2", "x3", "x4", "x8" 22 | ); 23 | }; 24 | -------------------------------------------------------------------------------- /Windows x64/Standalone/MASM/ABI.inc: -------------------------------------------------------------------------------- 1 | ; Remove this comment for assembling with command line 2 | ; includelib kernel32.lib 3 | 4 | GetStdHandle proto 5 | ExitProcess proto 6 | WriteConsoleA proto 7 | 8 | .data 9 | msg db "Hello, World!" 10 | 11 | .code 12 | Hello proc 13 | sub rsp, 40 14 | 15 | mov ecx, -11 16 | call GetStdHandle 17 | 18 | mov ecx, eax 19 | lea rdx, msg 20 | mov r8d, lengthof msg 21 | xor r9d, r9d 22 | mov byte ptr 32[rsp], 0 23 | call WriteConsoleA 24 | 25 | add rsp, 40 26 | 27 | ret 28 | Hello endp 29 | -------------------------------------------------------------------------------- /Linux x64/Standalone/NASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open terminal 5 | - git clone this repo 6 | - cd this path 7 | - Change _start into main entry if using GCC/Clang in ABI.asm/C.asm 8 | - Remove comment in main entry for C.asm only if using GCC/Clang 9 | - nasm -f elf64 ABI.asm/C.asm -o namefile.o 10 | 11 | #### How to link 12 | ---------------- 13 | 14 | ##### With GNU Linker 15 | --------------------- 16 | 17 | ld namefile.o -o namefile --dynamic-linker=/lib64/ld-linux-x86-64.so.2 -lc for C.asm only 18 | 19 | ##### With GCC/Clang 20 | -------------------- 21 | 22 | gcc/clang namefile.o -o namefile 23 | 24 | NB: GNU GNU Linker is part of binutils which dependency of GCC 25 | -------------------------------------------------------------------------------- /Android x64/Standalone/NASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open terminal 5 | - git clone this repo 6 | - cd this path 7 | - Change _start into main entry if using GCC/Clang in ABI.asm/C.asm 8 | - Remove comment in main entry for C.asm only if using GCC/Clang 9 | - nasm -f elf64 ABI.asm/C.asm -o namefile.o 10 | 11 | #### How to link 12 | ---------------- 13 | 14 | ##### With GNU Linker 15 | --------------------- 16 | 17 | ld namefile.o -o namefile --dynamic-linker=/system/bin/linker64 -lc for C.asm only 18 | 19 | ##### With GCC/Clang 20 | -------------------- 21 | 22 | gcc/clang namefile.o -o namefile 23 | 24 | Nb: GCC is available in tur-repo. GNU Linker is part of binutils which dependency of GCC 25 | -------------------------------------------------------------------------------- /Windows x64/Extern C/FASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open cmd 5 | - git clone this repo 6 | - cd this path 7 | - fasm ABI.asm/C.asm namefile.obj 8 | 9 | #### How to combine with ABI.c/C.c 10 | ---------------------------------- 11 | 12 | ##### With GCC/Clang 13 | -------------------- 14 | 15 | gcc/clang ABI.c/C.c namefile.obj -o namefile.exe 16 | 17 | ##### With MSVC compiler 18 | ------------------------ 19 | 20 | Before using MSVC, install desktop development with C++ in visual studio/build tools for visual studio with including MSVC and Windows SDK first 21 | - Open x64 Native Tools Command Prompt for Visual Studio 22 | - cd this path 23 | - cl ABI.c/C.c namefile.obj /Fo:namefile1.obj /link /subsystem:console /out:namefile.exe 24 | 25 | Nb: GCC is available in MinGW-w64 and Clang is available in LLVM and MinGW-w64 26 | -------------------------------------------------------------------------------- /Windows x64/Extern Assembly/FASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open cmd 5 | - git clone this repo 6 | - cd this path 7 | - fasm ABI.asm/C.asm namefile.obj 8 | 9 | #### How to combine with ABI.c/C.c 10 | ---------------------------------- 11 | 12 | ##### With GCC/Clang 13 | -------------------- 14 | 15 | gcc/clang ABI.c/C.c namefile.obj -o namefile.exe 16 | 17 | ##### With MSVC compiler 18 | ------------------------ 19 | 20 | Before using MSVC, install desktop development with C++ in visual studio/build tools for visual studio with including MSVC and Windows SDK first 21 | - Open x64 Native Tools Command Prompt for Visual Studio 22 | - cd this path 23 | - cl ABI.c/C.c namefile.obj /Fo:namefile1.obj /link /subsystem:console /out:namefile.exe 24 | 25 | Nb: GCC is available in MinGW-w64 and Clang is available in LLVM and MinGW-w64 26 | -------------------------------------------------------------------------------- /Windows x64/Extern C/NASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open cmd 5 | - git clone this repo 6 | - cd this path 7 | - nasm -f win64 ABI.asm/C.asm -o namefile.obj 8 | 9 | #### How to combine with ABI.c/C.c 10 | ---------------------------------- 11 | 12 | Before using MSVC, install desktop development with C++ in visual studio/build tools for visual studio with including MSVC and Windows SDK first 13 | 14 | ##### With GCC/Clang 15 | -------------------- 16 | 17 | gcc/clang ABI.c/C.c namefile.obj -o namefile.exe 18 | 19 | ##### With MSVC compiler 20 | ------------------------ 21 | 22 | - Open x64 Native Tools Command Prompt for Visual Studio 23 | - cd this path 24 | - cl ABI.c/C.c namefile.obj /Fo:namefile1.obj /link /subsystem:console /out:namefile.exe 25 | 26 | Nb: GCC is available in MinGW-w64 and Clang is available in LLVM and MinGW-w64 27 | -------------------------------------------------------------------------------- /Windows x64/Standalone/FASM/ABI.inc: -------------------------------------------------------------------------------- 1 | section '.data' data readable writable 2 | msg db "Hello, World!" 3 | len = $ - msg 4 | 5 | section '.text' code readable executable 6 | Hello: 7 | sub rsp, 40 8 | 9 | mov ecx, -11 10 | call [GetStdHandle] 11 | 12 | mov ecx, eax 13 | lea rdx, [msg] 14 | mov r8d, len 15 | xor r9d, r9d 16 | mov byte [rsp + 32], 0 17 | call [WriteConsoleA] 18 | 19 | add rsp, 40 20 | 21 | ret 22 | 23 | section '.idata' import data readable 24 | dd 0, 0, 0, RVA kernel, RVA kernel_table 25 | 26 | kernel_table: 27 | GetStdHandle dq RVA _GetStdHandle 28 | WriteConsoleA dq RVA _WriteConsoleA 29 | ExitProcess dq RVA _ExitProcess 30 | dq 0 31 | 32 | kernel db 'kernel32.dll', 0 33 | 34 | _GetStdHandle dw 0 35 | db 'GetStdHandle', 0 36 | _WriteConsoleA dw 0 37 | db 'WriteConsoleA', 0 38 | _ExitProcess dw 0 39 | db 'ExitProcess', 0 40 | -------------------------------------------------------------------------------- /Windows x64/Extern Assembly/NASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open cmd 5 | - git clone this repo 6 | - cd this path 7 | - nasm -f win64 ABI.asm/C.asm -o namefile.obj 8 | 9 | #### How to combine with ABI.c/C.c 10 | ---------------------------------- 11 | 12 | Before using MSVC, install desktop development with C++ in visual studio/build tools for visual studio with including MSVC and Windows SDK first 13 | 14 | ##### With GCC/Clang 15 | -------------------- 16 | 17 | gcc/clang ABI.c/C.c namefile.obj -o namefile.exe 18 | 19 | ##### With MSVC compiler 20 | ------------------------ 21 | 22 | - Open x64 Native Tools Command Prompt for Visual Studio 23 | - cd this path 24 | - cl ABI.c/C.c namefile.obj /Fo:namefile1.obj /link /subsystem:console /out:namefile.exe 25 | 26 | Nb: GCC is available in MinGW-w64 and Clang is available in LLVM and MinGW-w64 27 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # Hello World in Assembly and C 2 | ------------------------------- 3 | 4 | Run Hello World program in C and various assembler platform 5 | 6 | ## List Assembler Platform 7 | -------------------------- 8 | 9 | - arm64 Android Clang Termux 10 | - arm64 Android GNU Assembler Termux 11 | - x64 Android Clang Termux 12 | - x64 Android GNU Assembler Termux 13 | - x64 Android NASM Termux 14 | - arm64 Linux Clang 15 | - arm64 Linux GNU Assembler 16 | - x64 Linux Clang 17 | - x64 Linux FASM 18 | - x64 Linux GNU Assembler 19 | - x64 Linux NASM 20 | - arm64 Windows Clang 21 | - arm64 Windows MARMASM Visual Studio 22 | - x64 Windows Clang 23 | - x64 Windows FASM 24 | - x64 Windows GNU Assembler 25 | - x64 Windows MASM Visual Studio 26 | - x64 Windows NASM 27 | 28 | Nb: for x64 Windows Clang and arm64 Windows Clang, you need MinGW-w64's Clang instead of LLVM's Clang if you want targeting for Wine 29 | -------------------------------------------------------------------------------- /Linux arm64/Standalone/GAS/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | #### With Clang 5 | --------------- 6 | 7 | - Open terminal 8 | - git clone this repo 9 | - cd this path 10 | - Change _start into main entry in ABI.asm/C.asm 11 | - Remove comment in main entry for C.asm only 12 | - clang ABI.asm/C.asm -o namefile 13 | 14 | #### With GNU Assembler 15 | ----------------------- 16 | 17 | - Open terminal 18 | - git clone this repo 19 | - cd this path 20 | - Change _start into main entry if using GCC/Clang in ABI.asm/C.asm 21 | - Remove comment in main entry for C.asm only if using GCC/Clang 22 | - as ABI.asm/C.asm -o namefile.o 23 | 24 | ##### How to link 25 | ----------------- 26 | 27 | ###### With GNU Linker 28 | ---------------------- 29 | 30 | ld -pie namefile.o -o namefile --dynamic-linker=/lib/ld-linux-aarch64.so.1 -lc for C.asm only 31 | 32 | ###### With GCC/Clang 33 | --------------------- 34 | 35 | gcc/clang namefile.o -o namefile 36 | 37 | Nb: GNU Assembler and GNU Linker are part of binutils which dependency of GCC 38 | -------------------------------------------------------------------------------- /Linux x64/Standalone/GAS/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | #### With Clang 5 | --------------- 6 | 7 | - Open terminal 8 | - git clone this repo 9 | - cd this path 10 | - Change _start into main entry in ABI.asm/C.asm 11 | - Remove comment in main entry for C.asm only 12 | - clang ABI.asm/C.asm -o namefile 13 | 14 | #### With GNU Assembler 15 | ----------------------- 16 | 17 | - Open terminal 18 | - git clone this repo 19 | - cd this path 20 | - Change _start into main entry if using GCC/Clang in ABI.asm/C.asm 21 | - Remove comment in main entry for C.asm only if using GCC/Clang 22 | - as ABI.asm/C.asm -o namefile.o 23 | 24 | ##### How to link 25 | ----------------- 26 | 27 | ###### With GNU Linker 28 | ---------------------- 29 | 30 | ld namefile.o -o namefile --dynamic-linker=/lib64/ld-linux-x86-64.so.2 -lc for C.asm only 31 | 32 | ###### With GCC/Clang 33 | --------------------- 34 | 35 | gcc/clang namefile.o -o namefile 36 | 37 | NB: GNU Assembler and GNU Linker are part of binutils which dependency of GCC 38 | -------------------------------------------------------------------------------- /Android arm64/Standalone/GAS/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | #### With Clang 5 | --------------- 6 | 7 | - Open termux 8 | - git clone this repo 9 | - cd this path 10 | - Change _start into main entry in ABI.asm/C.asm 11 | - Remove comment in main entry for C.asm only 12 | - clang ABI.asm/C.asm -o namefile 13 | 14 | #### With GNU Assembler 15 | ----------------------- 16 | 17 | - Open termux 18 | - git clone this repo 19 | - cd this path 20 | - Change _start into main entry if using GCC/Clang in ABI.asm/C.asm 21 | - Remove comment in main entry for C.asm only if using GCC/Clang 22 | - as ABI.asm/C.asm -o namefile.o 23 | 24 | ##### How to link 25 | ----------------- 26 | 27 | ##### With GNU Linker 28 | --------------------- 29 | 30 | ld -pie namefile.o -o namefile --dynamic-linker=/system/bin/linker64 -lc for C.asm only 31 | 32 | ##### With GCC/Clang 33 | -------------------- 34 | 35 | gcc/clang namefile.o -o namefile 36 | 37 | Nb: GCC is available in tur-repo. GNU Assembler and GNU Linker are part of binutils which dependency of GCC 38 | -------------------------------------------------------------------------------- /Android x64/Standalone/GAS/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | #### With Clang 5 | --------------- 6 | 7 | - Open termux 8 | - git clone this repo 9 | - cd this path 10 | - Change _start into main entry in ABI.asm/C.asm 11 | - Remove comment in main entry for C.asm only 12 | - clang ABI.asm/C.asm -o namefile 13 | 14 | #### With GNU Assembler 15 | ----------------------- 16 | 17 | - Open termux 18 | - git clone this repo 19 | - cd this path 20 | - Change _start into main entry if using GCC/Clang in ABI.asm/C.asm 21 | - Remove comment in main entry for C.asm only if using GCC/Clang 22 | - as ABI.asm/C.asm -o namefile.o 23 | 24 | ##### How to link 25 | ----------------- 26 | 27 | ###### With GNU Linker 28 | ---------------------- 29 | 30 | ld -pie namefile.o -o namefile --dynamic-linker=/system/bin/linker64 -lc for C.asm only 31 | 32 | ###### With GCC/Clang 33 | --------------------- 34 | 35 | gcc/clang namefile.o -o namefile 36 | 37 | Nb: GCC is available in tur-repo. GNU Assembler and GNU Linker are part of binutils which dependency of GCC 38 | -------------------------------------------------------------------------------- /Windows x64/Extern C/GAS/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | #### With Clang 5 | --------------- 6 | 7 | - git clone this repo 8 | - Open cmd 9 | - cd this path 10 | - clang ABI.asm/C.asm ABI.C/C.C -o namefile.exe 11 | 12 | #### With GNU Assembler 13 | ----------------------- 14 | 15 | - Open cmd 16 | - git clone this repo 17 | - cd this path 18 | - as ABI.asm/C.asm -o namefile.obj 19 | 20 | ##### How to combine with ABI.c/C.c: 21 | ------------------------------------ 22 | 23 | Before using MSVC, install desktop development with C++ in visual studio/build tools for visual studio with including MSVC and Windows SDK first 24 | 25 | ###### With GCC/Clang: 26 | ---------------------- 27 | 28 | gcc/clang ABI.c/C.c namefile.obj -o namefile.exe 29 | 30 | ###### With MSVC compiler 31 | ------------------------- 32 | 33 | - Open x64 Native Tools Command Prompt for Visual Studio 34 | - cd this path 35 | - cl ABI.c/C.c namefile.obj /Fo:namefile1.obj /link /subsystem:console /out:namefile.exe 36 | 37 | Nb: GCC is available in MinGW-w64 and Clang is available in LLVM and MinGW-w64. GNU Assembler is part of binutils which dependency of GCC 38 | -------------------------------------------------------------------------------- /Windows x64/Extern Assembly/GAS/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | #### With Clang 5 | --------------- 6 | 7 | - Open cmd 8 | - git clone this repo 9 | - cd this path 10 | - clang ABI.asm/C.asm ABI.C/C.C -o namefile.exe 11 | 12 | #### With GNU Assembler 13 | ----------------------- 14 | 15 | - Open cmd 16 | - git clone this repo 17 | - cd this path 18 | - as ABI.asm/C.asm -o namefile.obj 19 | 20 | ##### How to combine with ABI.c/C.c 21 | ----------------------------------- 22 | 23 | Before using MSVC, install desktop development with C++ in visual studio/build tools for visual studio with including MSVC and Windows SDK first 24 | 25 | ###### With GCC/Clang 26 | --------------------- 27 | 28 | gcc/clang ABI.c/C.c namefile.obj -o namefile.exe 29 | 30 | ###### With MSVC compiler 31 | ------------------------- 32 | 33 | - Open x64 Native Tools Command Prompt for Visual Studio 34 | - cd this path 35 | - cl ABI.c/C.c namefile.obj /Fo:namefile1.obj /link /subsystem:console /out:namefile.exe 36 | 37 | Nb: GCC is available in MinGW-w64 and Clang is available in LLVM and MinGW-w64. GNU Assembler is part of binutils which dependency of GCC 38 | -------------------------------------------------------------------------------- /Windows x64/Standalone/MASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | Before using masm, install desktop development with C++ in visual studio/build tools for visual studio with including MSVC and Windows SDK first 5 | 6 | #### With visual studio 7 | ----------------------- 8 | 9 | - git clone this repo 10 | - Create empty project 11 | - Set architecture target to x64 12 | - Right click project 13 | - Go to Build Dependencies > Build Customizations 14 | - Checklist masm 15 | - Include ABI/C.inc and ABI/C.asm in this repo to project or create new item with C++ file (.cpp) template 16 | - Go to properties > linker > input 17 | - Include legacy_stdio_definitions.lib and ucrt.lib for C.inc & C.asm (it wasn't necessary including kernel32.lib for ABI.inc & ABI.asm because it was already included by default) 18 | - Check the inc file for item type is does not participate in build and asm file for item type is Microsoft Macro Assembler in properties > general 19 | - Press f5 for start debugging or ctrl + f5 for start without debugging 20 | 21 | #### With command line 22 | ---------------------- 23 | 24 | - Open x64 Native Tools Command Prompt for Visual Studio 25 | - git clone this repo 26 | - cd this path 27 | - Remove comment of includelib in inc file 28 | - ml64 ABI.asm/C.asm /link /subsystem:console /out:namefile.exe 29 | -------------------------------------------------------------------------------- /Windows x64/Standalone/NASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | - Open cmd 5 | - git clone this repo 6 | - cd this path 7 | - Change _start into main entry if using GCC/Clang or mainCRTStartup entry if using MSVC compiler/linker in ABI.asm/C.asm 8 | - nasm -f win64 ABI.asm/C.asm -o namefile.obj 9 | 10 | #### How to link 11 | ---------------- 12 | 13 | Before using MSVC, install desktop development with C++ in visual studio/build tools for visual studio with including MSVC and Windows SDK first 14 | 15 | ##### With GNU Linker 16 | --------------------- 17 | 18 | ld namefile.obj -o namefile.exe -L"full libkernel32.a and libucrt.a path" -lkernel32 for ABI.asm -lucrt for C.asm 19 | 20 | ##### With MSVC Linker 21 | ---------------------- 22 | 23 | - Open x64 Native Tools Command Prompt for Visual Studio 24 | - cd this path 25 | - link namefile.obj /subsystem:console /out:namefile.exe kernel32.lib for ABI.asm legacy_stdio_definitions.lib ucrt.lib for C.asm 26 | 27 | ##### With GCC/Clang 28 | -------------------- 29 | 30 | gcc/clang namefile.obj -o namefile.exe 31 | 32 | #### With MSVC compiler: 33 | ------------------------ 34 | 35 | - Open x64 Native Tools Command Prompt for Visual Studio 36 | - cd this path 37 | - cl namefile.obj /link /subsystem:console /out:namefile.exe kernel32.lib for ABI.asm legacy_stdio_definitions.lib ucrt.lib for C.asm 38 | 39 | Nb: GCC is available in MinGW-w64 and Clang is available in LLVM and MinGW-w64. GNU Linker is part of binutils which dependency of GCC 40 | -------------------------------------------------------------------------------- /Windows x64/Extern Assembly/MASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | Before using masm, install desktop development with C++ in visual studio/build tools for visual studio with including MSVC and Windows SDK first 5 | 6 | #### With visual studio 7 | ----------------------- 8 | 9 | - git clone this repo 10 | - Create empty project 11 | - Set architecture target to x64 12 | - Right click project 13 | - Go to Build Dependencies > Build Customizations 14 | - Checklist masm 15 | - Include ABI/C.c and ABI/C.asm to project or create new item with C++ file (.cpp) template 16 | - Check the C file for item type is C/C++ compiler and asm file for item type is Microsoft Macro Assembler in properties > general 17 | - Check the object file name of C file is different in properties > C/C++ > output files with object file name of asm file in properties > Microsoft Macro Assembler > object file 18 | - Press f5 for start debugging or ctrl + f5 for start without debugging 19 | 20 | #### With command line 21 | ---------------------- 22 | 23 | - Open x64 Native Tools Command Prompt for Visual Studio 24 | - git clone this repo 25 | - cd this path 26 | - ml64 /c ABI.asm/C.asm 27 | 28 | ##### How to combine with ABI.c/C.c 29 | ----------------------------------- 30 | 31 | ###### With GCC/Clang 32 | --------------------- 33 | 34 | gcc/clang ABI.c/C.c ABI.obj/C.obj -o namefile.exe 35 | 36 | ###### With MSVC compiler 37 | ------------------------- 38 | 39 | cl ABI.c/C.c ABI.obj/C.obj /Fo:namefile.obj /link /subsystem:console /out:namefile.exe 40 | 41 | Nb: GCC is available in MinGW-w64 and Clang is available in LLVM and MinGW-w64 42 | -------------------------------------------------------------------------------- /Windows arm64/Extern C/MARMASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | Before using marmasm, install desktop development with C++ in visual studio/build tools for visual studio with including MSVC and Windows SDK first 5 | 6 | #### With visual studio 7 | ----------------------- 8 | 9 | - git clone this repo 10 | - Create empty project 11 | - Set architecture target to x64 12 | - Right click project 13 | - Go to Build Dependencies > Build Customizations 14 | - Checklist marmasm 15 | - Include ABI/C.c and ABI/C.asm to project or create new item with C++ file (.cpp) template 16 | - Check the C file for item type is C/C++ compiler and asm file for item type is Microsoft Arm Assembler in properties > general 17 | - Check the object file name of C file is different in properties > C/C++ > output files with object file name of asm file in properties > Microsoft Arm Assembler > object file 18 | - Press f5 for start debugging or ctrl + f5 for start without debugging 19 | 20 | #### With command line 21 | ---------------------- 22 | 23 | - Open arm64 Native Tools Command Prompt for Visual Studio 24 | - git clone this repo 25 | - cd this path 26 | - Change mainCRTStartup into main entry if using Clang in ABI.asm/C.asm 27 | - marmasm64 ABI.asm/C.asm -o namefile.obj 28 | 29 | ##### How to combine with ABI.c/C.c 30 | ----------------------------------- 31 | 32 | ###### With Clang 33 | ----------------- 34 | 35 | clang ABI.c/C.c ABI.obj/C.obj -o namefile.exe 36 | 37 | ###### With MSVC compiler 38 | ------------------------- 39 | 40 | cl ABI.c/C.c ABI.obj/C.obj /Fo:namefile.obj /link /subsystem:console /out:namefile.exe kernel32.lib for ABI.asm legacy_stdio_definitions.lib ucrt.lib for C.asm 41 | -------------------------------------------------------------------------------- /Windows x64/Extern C/MASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | Before using masm, install desktop development with C++ in visual studio/build tools for visual studio with including MSVC and Windows SDK first 5 | 6 | #### With visual studio 7 | ----------------------- 8 | 9 | - git clone this repo 10 | - Create empty project 11 | - Set architecture target to x64 12 | - Right click project 13 | - Go to Build Dependencies > Build Customizations 14 | - Checklist masm 15 | - Include ABI/C.c and ABI/C.asm to project or create new item with C++ file (.cpp) template 16 | - Check the C file for item type is C/C++ compiler and asm file for item type is Microsoft Macro Assembler in properties > general 17 | - Check the object file name of C file is different in properties > C/C++ > output files with object file name of asm file in properties > Microsoft Macro Assembler > object file 18 | - Press f5 for start debugging or ctrl + f5 for start without debugging 19 | 20 | #### With command line 21 | ---------------------- 22 | 23 | - Open x64 Native Tools Command Prompt for Visual Studio 24 | - git clone this repo 25 | - cd this path 26 | - Remove comment of includelib in ABI.asm/C.asm if using MSVC compiler 27 | - ml64 /c ABI.asm/C.asm 28 | 29 | ##### How to combine with ABI.c/C.c 30 | ----------------------------------- 31 | 32 | ###### With GCC/Clang 33 | --------------------- 34 | 35 | gcc/clang ABI.c/C.c ABI.obj/C.obj -o namefile.exe 36 | 37 | ###### With MSVC compiler 38 | ------------------------- 39 | 40 | cl ABI.c/C.c ABI.obj/C.obj /Fo:namefile.obj /link /subsystem:console /out:namefile.exe 41 | 42 | Nb: GCC is available in MinGW-w64 and Clang is available in LLVM and MinGW-w64 43 | -------------------------------------------------------------------------------- /Windows arm64/Extern Assembly/MARMASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | Before using marmasm, install desktop development with C++ in visual studio/build tools for visual studio with including MSVC and Windows SDK first 5 | 6 | #### With visual studio 7 | ----------------------- 8 | 9 | - git clone this repo 10 | - Create empty project 11 | - Set architecture target to x64 12 | - Right click project 13 | - Go to Build Dependencies > Build Customizations 14 | - Checklist marmasm 15 | - Include ABI/C.c and ABI/C.asm to project or create new item with C++ file (.cpp) template 16 | - Check the C file for item type is C/C++ compiler and asm file for item type is Microsoft Arm Assembler in properties > general 17 | - Check the object file name of C file is different in properties > C/C++ > output files with object file name of asm file in properties > Microsoft Arm Assembler > object file 18 | - Press f5 for start debugging or ctrl + f5 for start without debugging 19 | 20 | #### With command line 21 | ---------------------- 22 | 23 | - Open arm64 Native Tools Command Prompt for Visual Studio 24 | - git clone this repo 25 | - cd this path 26 | - Change mainCRTStartup into main entry if using Clang in ABI.asm/C.asm 27 | - marmasm64 ABI.asm/C.asm -o namefile.obj 28 | 29 | ##### How to combine with ABI.c/C.c 30 | ----------------------------------- 31 | 32 | ###### With Clang 33 | ----------------- 34 | 35 | clang ABI.c/C.c ABI.obj/C.obj -o namefile.exe 36 | 37 | ###### With MSVC compiler 38 | ------------------------- 39 | 40 | cl ABI.c/C.c ABI.obj/C.obj /Fo:namefile.obj /link /subsystem:console /out:namefile.exe kernel32.lib for ABI.asm legacy_stdio_definitions.lib ucrt.lib /nodefaultlib:libucrt.lib for C.asm 41 | -------------------------------------------------------------------------------- /Windows x64/Standalone/GAS/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | #### With Clang 5 | --------------- 6 | 7 | - Open cmd 8 | - git clone this repo 9 | - cd this path 10 | - Change _start into main entry in ABI.asm/C.asm 11 | - clang ABI.asm/C.asm -o namefile.exe 12 | 13 | #### With GNU Assembler 14 | ----------------------- 15 | 16 | - Open cmd 17 | - git clone this repo 18 | - cd this path 19 | - Change _start into main entry if using GCC/Clang or mainCRTStartup entry if using MSVC compiler/linker in ABI.asm/C.asm 20 | - as ABI.asm/C.asm -o namefile.obj 21 | 22 | ##### How to link 23 | ----------------- 24 | 25 | Before using MSVC, install desktop development with C++ in visual studio/build tools for visual studio with including MSVC and Windows SDK first 26 | 27 | ###### With GNU Linker 28 | ---------------------- 29 | 30 | ld namefile.obj -o namefile.exe -L"full libkernel32.a and libucrt.a path" -lkernel32 for ABI.asm -lucrt for C.asm 31 | 32 | ###### With MSVC Linker 33 | ----------------------- 34 | 35 | - Open x64 Native Tools Command Prompt for Visual Studio 36 | - cd this path 37 | - link namefile.obj /subsystem:console /out:namefile.exe kernel32.lib for ABI.asm legacy_stdio_definitions.lib ucrt.lib for C.asm 38 | 39 | ###### With GCC/Clang 40 | --------------------- 41 | 42 | gcc/clang namefile.obj -o namefile.exe 43 | 44 | ###### With MSVC compiler 45 | ------------------------- 46 | 47 | - Open x64 Native Tools Command Prompt for Visual Studio 48 | - cd this path 49 | - cl namefile.obj /link /subsystem:console /out:namefile.exe kernel32.lib for ABI.asm legacy_stdio_definitions.lib ucrt.lib for C.asm 50 | 51 | Nb: GCC is available in MinGW-w64 and Clang is available in LLVM and MinGW-w64. GNU Assembler and GNU Linker are part of binutils which dependency of GCC 52 | -------------------------------------------------------------------------------- /Windows arm64/Standalone/MARMASM/README.md: -------------------------------------------------------------------------------- 1 | ### How to build 2 | ---------------- 3 | 4 | Before using marmasm, install desktop development with C++ in visual studio/build tools for visual studio with including MSVC and Windows SDK first 5 | 6 | #### With visual studio 7 | ----------------------- 8 | 9 | - git clone this repo 10 | - Create empty project 11 | - Set architecture target to arm64 12 | - Right click project 13 | - Go to Build Dependencies > Build Customizations 14 | - Checklist marmasm 15 | - Include ABI/C.inc and ABI/C.asm in this repo to project or create new item with C++ file (.cpp) template 16 | - Go to properties > linker > input 17 | - Include legacy_stdio_definitions.lib and ucrt.lib for C.inc & C.asm (it wasn't necessary including kernel32.lib for ABI.inc & ABI.asm because it was already included by default) 18 | - Check the inc file for item type is does not participate in build and asm file for item type is Microsoft Arm Assembler in properties > general 19 | - Press f5 for start debugging or ctrl + f5 for start without debugging 20 | 21 | #### With command line 22 | ---------------------- 23 | 24 | - Open arm64 Native Tools Command Prompt for Visual Studio 25 | - git clone this repo 26 | - cd this path 27 | - Change mainCRTStartup into main entry if using Clang in ABI.asm/C.asm 28 | - marmasm64 ABI.asm/C.asm -o namefile.obj 29 | 30 | ##### How to link 31 | ----------------- 32 | 33 | ###### With MSVC Linker 34 | ----------------------- 35 | 36 | link namefile.obj /subsystem:console /out:namefile.exe kernel32.lib for ABI.asm legacy_stdio_definitions.lib ucrt.lib for C.asm 37 | 38 | ###### With Clang 39 | ----------------- 40 | 41 | clang namefile.obj -o namefile.exe 42 | 43 | ###### With MSVC compiler 44 | ------------------------- 45 | 46 | cl namefile.obj /link /subsystem:console /out:namefile.exe kernel32.lib for ABI.asm legacy_stdio_definitions.lib ucrt.lib for C.asm -------------------------------------------------------------------------------- /Linux x64/Standalone/FASM/C.inc: -------------------------------------------------------------------------------- 1 | segment readable writeable 2 | DT_NULL = 0 3 | DT_NEEDED = 1 4 | DT_HASH = 4 5 | DT_STRTAB = 5 6 | DT_SYMTAB = 6 7 | DT_RELA = 7 8 | DT_RELASZ = 8 9 | DT_RELAENT = 9 10 | DT_STRSZ = 10 11 | DT_SYMENT = 11 12 | STB_GLOBAL = 1 13 | STT_FUNC = 2 14 | R_X86_64_64 = 1 15 | msg db 'Hello, world!', 10, 0 16 | 17 | segment readable executable 18 | Hello: 19 | sub rsp, 8 20 | 21 | lea rdi,[msg] 22 | call [printf] 23 | 24 | add rsp, 8 25 | 26 | ret 27 | 28 | macro Elf64_Sym name,value,size,bind,type,other,shndx 29 | { 30 | dd name+0 31 | db (bind+0) shl 4 + (type+0) 32 | db other+0 33 | dw shndx+0 34 | dq value+0 35 | dq size+0 36 | } 37 | 38 | virtual at 0 39 | Elf64_Sym 40 | sizeof.Elf64_Sym = $ 41 | end virtual 42 | 43 | macro Elf64_Rela offset,symbol,type,addend 44 | { 45 | dq offset+0 46 | dq (symbol+0) shl 32 + (type+0) 47 | dq addend+0 48 | } 49 | 50 | virtual at 0 51 | Elf64_Rela 52 | sizeof.Elf64_Rela = $ 53 | end virtual 54 | 55 | macro needed [library] 56 | { 57 | local str 58 | match needed,needed@dynamic \{ define needed@dynamic needed,str:library \} 59 | match ,needed@dynamic \{ define needed@dynamic str:library \} 60 | } 61 | define needed@dynamic 62 | 63 | macro import [name] 64 | { 65 | common 66 | local strtab,strsz,symtab,rel,relsz,hash 67 | segment dynamic readable 68 | match needed,needed@dynamic 69 | \{ irp item,needed \\{ match str:library,item \\\{ dq DT_NEEDED,str-strtab \\\} \\} \} 70 | dq DT_STRTAB,strtab 71 | dq DT_STRSZ,strsz 72 | dq DT_SYMTAB,symtab 73 | dq DT_SYMENT,sizeof.Elf64_Sym 74 | dq DT_RELA,rela 75 | dq DT_RELASZ,relasz 76 | dq DT_RELAENT,sizeof.Elf64_Rela 77 | dq DT_HASH,hash 78 | dq DT_NULL,0 79 | segment readable writeable 80 | symtab: Elf64_Sym 81 | forward 82 | local fstr 83 | Elf64_Sym fstr-strtab,0,0,STB_GLOBAL,STT_FUNC,0,0 84 | common 85 | rela: 86 | local counter 87 | counter = 1 88 | forward 89 | Elf64_Rela name,counter,R_X86_64_64 90 | counter = counter+1 91 | common 92 | relasz = $-rela 93 | hash: 94 | dd 1,counter 95 | dd 0 96 | repeat counter 97 | if %=counter 98 | dd 0 99 | else 100 | dd % 101 | end if 102 | end repeat 103 | strtab db 0 104 | forward 105 | fstr db `name,0 106 | common 107 | match needed,needed@dynamic 108 | \{ irp item,needed \\{ match str:library,item \\\{ str db library,0 \\\} \\} \} 109 | strsz = $-strtab 110 | forward 111 | name dq 0 112 | } 113 | 114 | segment interpreter readable 115 | db '/lib64/ld-linux-x86-64.so.2',0 116 | 117 | needed 'libc.so.6' 118 | import printf, exit 119 | --------------------------------------------------------------------------------