Get rid of crt0.c

This commit is contained in:
2025-10-01 23:22:08 +02:00
parent a4959782a8
commit 806d87e0f1
3 changed files with 7 additions and 27 deletions

View File

@@ -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

View File

@@ -3,6 +3,11 @@
.att_syntax prefix
#NO_APP
#APP
.section .text.init
.global _start
_start:
.section .text.main
.global main
main:
push %bp

25
crt0.c
View File

@@ -1,25 +0,0 @@
#include <stdint.h>
#include <string.h>
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;
}