Testing with flat assembler...
This commit is contained in:
parent
70cc687d65
commit
da08d3543a
31
heyo.asm
Normal file
31
heyo.asm
Normal file
@ -0,0 +1,31 @@
|
||||
|
||||
format ELF64 executable 3
|
||||
|
||||
segment readable executable
|
||||
|
||||
entry main
|
||||
|
||||
main:
|
||||
|
||||
; system ({...});
|
||||
mov rax, 1
|
||||
mov rdi, 1
|
||||
mov rsi, text
|
||||
mov rdx, [size]
|
||||
syscall
|
||||
|
||||
; return;
|
||||
xor rax, rax
|
||||
ret
|
||||
|
||||
;end
|
||||
mov rax, 60
|
||||
mov rdi, 0
|
||||
syscall
|
||||
|
||||
segment readable writable
|
||||
|
||||
text db 'Heyo world!', 10, 0
|
||||
|
||||
size dq 12
|
||||
|
@ -146,7 +146,7 @@ int main (void) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
for (length = 0; length < coin_code; ++length) {
|
||||
switch (coin_enum [length]) {
|
||||
case coin_string: printf ("\033[1;32m%s\033[0m ", coin_text [length]); break;
|
||||
@ -164,11 +164,13 @@ int main (void) {
|
||||
default: printf ("\033[1;31m%s\033[0m ", coin_text [length]); break;
|
||||
}
|
||||
}
|
||||
|
||||
*/
|
||||
printf ("\n");
|
||||
|
||||
printf ("format ELF64 executable 3\n\n");
|
||||
printf ("segment readable executable\n\n");
|
||||
printf ("entry main\n\n");
|
||||
printf ("main:\n\n");
|
||||
|
||||
for (length = 0; length < coin_code; ++length) {
|
||||
if ((coin_enum [length] == coin_return) && (coin_enum [length + 1] == coin_stop)) {
|
||||
@ -201,7 +203,10 @@ int main (void) {
|
||||
}
|
||||
}
|
||||
|
||||
printf (";end\nmov rax, 60\nmov rdi, 0\nsyscall\n\n");
|
||||
printf ("segment readable writable\n\n");
|
||||
printf ("text db 'Heyo world!', 10, 0\n\n");
|
||||
printf ("size dq 12\n\n");
|
||||
|
||||
buffer = deallocate (buffer);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user