Created
January 28, 2020 23:26
-
-
Save micromaomao/3251e97a6147b531739e9b6b1cbb9144 to your computer and use it in GitHub Desktop.
simple asm template
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
cmake_minimum_required(VERSION 3.16) | |
project(main NONE) | |
add_custom_command( | |
OUTPUT main.o | |
DEPENDS main.asm | |
COMMAND nasm -f elf64 main.asm -o main.o | |
) | |
add_custom_command( | |
OUTPUT main | |
DEPENDS main.o | |
COMMAND ld main.o -o main | |
) | |
add_custom_target(build ALL DEPENDS main) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global _start | |
section .text | |
_start: | |
xor eax, eax | |
not rax | |
xor eax, eax | |
mov byte [0x0], 0 ; cause trap |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment