💾 Archived View for home.tobot.dev › cgi › hello_c.c captured on 2022-03-01 at 15:13:00.
-=-=-=-=-=-=-
typedef unsigned size_t; #define noreturn _Noreturn #define SYS_exit 1 #define SYS_write 4 #define STDOUT 1 inline void sys_exit(int error_code) { asm("mov r0, %0\n\t" "mov r7, %1\n\t" "swi 0\n\t" : : "r" (error_code), "r" (SYS_exit) : "r0", "r7"); } inline int sys_write(unsigned int fd, const char* buf, size_t count) { asm("mov r0, %0\n\t" "mov r1, %1\n\t " "mov r2, %2\n\t" "mov r7, %3\n\t" "swi 0\n\t" : : "r" (fd), "r" (buf), "r" (count), "r" (SYS_write) : "r0", "r1", "r2", "r7"); } void _start(void) { sys_write(STDOUT, "20 text/gemini\r\n# Hello, C!\r\nThis page was generated from C code (without any libraries!)", 16+13+60); sys_exit(0); }