From 806d87e0f1acdd0b3ebecf22d03ae1d1569f01d9 Mon Sep 17 00:00:00 2001 From: Paul Mathieu Date: Wed, 1 Oct 2025 23:22:08 +0200 Subject: [PATCH] Get rid of crt0.c --- Makefile | 4 ++-- crc16.s | 5 +++++ crt0.c | 25 ------------------------- 3 files changed, 7 insertions(+), 27 deletions(-) delete mode 100644 crt0.c diff --git a/Makefile b/Makefile index 7b60160..597d503 100644 --- a/Makefile +++ b/Makefile @@ -6,8 +6,8 @@ dev-image = 5150-dev crc16.s: crc16.c ia16-elf-gcc -S -Os -o crc16.s crc16.c -crc16.bin: crc16.s crt0.c - ia16-elf-gcc -o crc16.bin -Os -nostdlib crc16.s crt0.c +crc16.bin: crc16.s + ia16-elf-gcc -o crc16.bin -Os -nostdlib crc16.s CC = ia16-elf-gcc CXX = ia16-elf-gcc diff --git a/crc16.s b/crc16.s index 16f446d..5ac8d68 100644 --- a/crc16.s +++ b/crc16.s @@ -3,6 +3,11 @@ .att_syntax prefix #NO_APP #APP + .section .text.init + .global _start +_start: + + .section .text.main .global main main: push %bp diff --git a/crt0.c b/crt0.c deleted file mode 100644 index 43f40b8..0000000 --- a/crt0.c +++ /dev/null @@ -1,25 +0,0 @@ -#include -#include - -int main(); - -asm(".section .init \n" - ".global _start \n" - "_start: \n\t" - "mov %cs, %ax \n\t" - "mov %ax, %ds \n\t" - "mov %ax, %es \n\t" - "cli \n\t" - "mov %ax, %ss \n\t" - "mov $0x1000, %ax \n\t" - "mov %ax, %sp \n\t" - "sti \n\t" - "jmp main"); - -void* memset(void* ptr, int val, size_t len) { - uint8_t* p = ptr; - while (len--) { - *p++ = val; - } - return ptr; -}