memset, size_t

This commit is contained in:
corey 2024-01-09 20:33:14 -06:00
parent fc9df72d76
commit 1563c84457
3 changed files with 17 additions and 5 deletions

View File

@ -1,6 +1,7 @@
#include"stdio.h"
#include"stdint.h"
#include"stdbool.h"
#include"string.h"
#define at at8
#define at8(x) (*(char*)x)
@ -28,7 +29,6 @@ __attribute__ ((naked)) static void halt(void)
);
}
uint8_t*const vram=(uint8_t*)0xB8000;
void putpixel(uint8_t*const screen,int32_t x,int32_t y,int32_t color)
{
@ -45,8 +45,7 @@ void kernelmain(void*multiboot_structure,uint32_t magicnumber)
{
// Clear text mode buffer
for(int32_t i=0;i<1000;++i)
((uint16_t*)0xb8000)[i]=0;
memset((void*)0xb8000,0,2000);
puts("");
puts("");

View File

@ -1,9 +1,12 @@
#pragma once
typedef unsigned char uint8_t;
typedef unsigned long uint32_t;
typedef unsigned short uint16_t;
typedef unsigned long uint32_t;
typedef unsigned long long uint64_t;
typedef uint64_t size_t;
typedef char int8_t;
typedef long int32_t;
typedef short int16_t;
typedef long int32_t;
typedef long long int64_t;

10
string.h Normal file
View File

@ -0,0 +1,10 @@
#pragma once
#include"stdint.h"
void*memset(void*dst,uint8_t val,size_t count)
{
for(uint32_t i=0;i<count;++i)
((uint8_t*)dst)[i]=val;
return dst;
}