ScrapExplorer - main.s

Home / arch / x64 / linux / file_writing Lines: 1 | Size: 1051 bytes [Download] [Show on GitHub] [Search similar files] [Raw] [Raw (proxy)]
[FILE BEGIN]
1; SPDX-License-Identifier: GPL-3.0 2; file_writing 3; 4; main.asm 5; 6; Hello world in assembly for x86_64 Linux 7; 8; Many thanks to https://syscall.sh/, Linus Torvalds and kernel developers. 9; 10; COPYRIGHT NOTICE 11; Copyright (C) 2024-2025 0x4248 and contributors 12; Redistribution and use in source and binary forms, with or without 13; modification, are permitted provided that the license is not changed. 14; 15; This software is free and open source. Licensed under the GNU general 16; public license version 3.0 as published by the Free Software Foundation. 17 18; TODO: Still a work in progress. 19 20; Syscalls: 21; 2 - open 22; 1 - write 23 24global _start 25section .text 26 27_start: 28 mov rax, 2 ; open syscall 29 mov rdi, filename ; filename 30 mov rsi, 1 ; O_WRONLY 31 32 syscall ; Call the kernel 33 34 mov rdi, filename ; File descriptor 35 mov rax, 1 ; write syscall 36 mov rsi, message ; Message 37 38 syscall ; Call the kernel 39 40 mov rax, 60 ; exit syscall 41 mov rdi, 0 ; Set 0 on return 42 43 syscall ; Call the kernel 44 45filename db 'file.txt', 0 46message db 'Hello, world!', 0
[FILE END]
(C) 2025 0x4248 (C) 2025 4248 Media and 4248 Systems, All part of 0x4248 See LICENCE files for more information. Not all files are by 0x4248 always check Licencing.