forked from chic_luke/figasm
Update figa.asm
This commit is contained in:
parent
896669d892
commit
974a5a16f2
51
figa.asm
51
figa.asm
@ -1,41 +1,16 @@
|
|||||||
; Console Message, 64 bit. V1.03
|
section .data
|
||||||
NULL EQU 0 ; Constants
|
text1 db "Che schifo la figa.",10,"Meglio Linux",10
|
||||||
STD_OUTPUT_HANDLE EQU -11
|
|
||||||
|
|
||||||
extern GetStdHandle ; Import external symbols
|
section .text
|
||||||
extern WriteFile ; Windows API functions, not decorated
|
global _start
|
||||||
extern ExitProcess
|
|
||||||
|
|
||||||
global Start ; Export symbols. The entry point
|
_start:
|
||||||
|
mov rax, 1
|
||||||
|
mov rdi, 1
|
||||||
|
mov rsi, text1
|
||||||
|
mov rdx, 33
|
||||||
|
syscall
|
||||||
|
|
||||||
section .data ; Initialized data segment
|
mov rax, 60
|
||||||
Message db "Che schifo la figa.", 0Dh, 0Ah,"Meglio Windows", 0Dh, 0Ah
|
mov rdi, 0
|
||||||
MessageLength EQU $-Message ; Address of this line ($) - address of Message
|
syscall
|
||||||
|
|
||||||
section .bss ; Uninitialized data segment
|
|
||||||
alignb 8
|
|
||||||
StandardHandle resq 1
|
|
||||||
Written resq 1
|
|
||||||
|
|
||||||
section .text ; Code segment
|
|
||||||
Start:
|
|
||||||
sub RSP, 8 ; Align the stack to a multiple of 16 bytes
|
|
||||||
|
|
||||||
sub RSP, 32 ; 32 bytes of shadow space
|
|
||||||
mov ECX, STD_OUTPUT_HANDLE
|
|
||||||
call GetStdHandle
|
|
||||||
mov qword [REL StandardHandle], RAX
|
|
||||||
add RSP, 32 ; Remove the 32 bytes
|
|
||||||
|
|
||||||
sub RSP, 32 + 8 + 8 ; Shadow space + 5th parameter + align stack
|
|
||||||
; to a multiple of 16 bytes
|
|
||||||
mov RCX, qword [REL StandardHandle] ; 1st parameter
|
|
||||||
lea RDX, [REL Message] ; 2nd parameter
|
|
||||||
mov R8, MessageLength ; 3rd parameter
|
|
||||||
lea R9, [REL Written] ; 4th parameter
|
|
||||||
mov qword [RSP + 4 * 8], NULL ; 5th parameter
|
|
||||||
call WriteFile ; Output can be redirect to a file using >
|
|
||||||
add RSP, 48 ; Remove the 48 bytes
|
|
||||||
|
|
||||||
xor ECX, ECX
|
|
||||||
call ExitProcess
|
|
||||||
|
Loading…
Reference in New Issue
Block a user