added yes
This commit is contained in:
parent
2d2a8dffcf
commit
7fd7c2f657
3 changed files with 45 additions and 0 deletions
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
|
@ -0,0 +1 @@
|
||||||
|
build/
|
17
CMakeLists.txt
Normal file
17
CMakeLists.txt
Normal file
|
@ -0,0 +1,17 @@
|
||||||
|
cmake_minimum_required(VERSION 3.14)
|
||||||
|
project (yes)
|
||||||
|
|
||||||
|
#set(CMAKE_ASM_NASM_LINK_EXECUTABLE ld)
|
||||||
|
|
||||||
|
|
||||||
|
#Set C++ language version
|
||||||
|
set(CMAKE_CXX_STANDARD 17)
|
||||||
|
#Enable ASM provided by NASM
|
||||||
|
enable_language(ASM_NASM)
|
||||||
|
|
||||||
|
set(CMAKE_ASM_NASM_LINK_EXECUTABLE "gcc <CMAKE_ASM_NASM_LINK_FLAGS> <LINK_FLAGS> <OBJECTS> -o <TARGET> <LINK_LIBRARIES>")
|
||||||
|
|
||||||
|
add_link_options(-fno-pie -m64 -no-pie -pedantic-errors)
|
||||||
|
|
||||||
|
#Make a EXE with cpp and asm files
|
||||||
|
add_executable(yes yes.asm)
|
27
yes.asm
Normal file
27
yes.asm
Normal file
|
@ -0,0 +1,27 @@
|
||||||
|
extern puts
|
||||||
|
|
||||||
|
section .data
|
||||||
|
text db "y",0
|
||||||
|
section .text
|
||||||
|
global main
|
||||||
|
|
||||||
|
main:
|
||||||
|
sub rsp, 8
|
||||||
|
|
||||||
|
|
||||||
|
_loop:
|
||||||
|
|
||||||
|
mov rdi, text
|
||||||
|
cld
|
||||||
|
call puts ;this is the put s way of printing a string
|
||||||
|
jmp _loop
|
||||||
|
|
||||||
|
_end:
|
||||||
|
add rsp, 8
|
||||||
|
ret
|
||||||
|
|
||||||
|
; mov rax, 60 ; exit
|
||||||
|
; mov edi, 1 ; error 1 dont need the exit anymore beacue libc or somthing
|
||||||
|
; syscall
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue