From 3f43c466ca282ba14473d974659b5423c7067b08 Mon Sep 17 00:00:00 2001 From: spicyjpeg <88942473+spicyjpeg@users.noreply.github.com> Date: Mon, 7 Feb 2022 01:11:35 +0100 Subject: Rewrite psxapi with BIOS API stub generator script --- libpsn00b/include/stdlib.h | 3 --- 1 file changed, 3 deletions(-) (limited to 'libpsn00b/include/stdlib.h') diff --git a/libpsn00b/include/stdlib.h b/libpsn00b/include/stdlib.h index de3ab47..b187a6f 100644 --- a/libpsn00b/include/stdlib.h +++ b/libpsn00b/include/stdlib.h @@ -38,9 +38,6 @@ long labs(long i); long long strtoll(const char *nptr, char **endptr, int base); long strtol(const char *nptr, char **endptr, int base); long double strtold(const char *nptr, char **endptr); -// BIOS temporary -int atoi(const char *s); -long atol(const char *s); // Note: these use floats internally! double strtod(const char *nptr, char **endptr); -- cgit v1.2.3 From 4bbfe640a8c357137524e797a8d2bd0a94d3abfa Mon Sep 17 00:00:00 2001 From: spicyjpeg <88942473+spicyjpeg@users.noreply.github.com> Date: Sun, 20 Mar 2022 10:56:23 +0100 Subject: Remove stdint.h, fix n00bdemo crashing --- examples/demos/n00bdemo/logo.c | 4 +++- examples/demos/n00bdemo/main.c | 5 ++--- examples/io/pads/spi.c | 1 + examples/io/pads/spi.h | 1 + libpsn00b/include/stdint.h | 16 ---------------- libpsn00b/include/stdlib.h | 2 +- libpsn00b/libc/start.c | 23 ++++++++++++----------- 7 files changed, 20 insertions(+), 32 deletions(-) delete mode 100644 libpsn00b/include/stdint.h (limited to 'libpsn00b/include/stdlib.h') diff --git a/examples/demos/n00bdemo/logo.c b/examples/demos/n00bdemo/logo.c index 40160e7..784c9e1 100644 --- a/examples/demos/n00bdemo/logo.c +++ b/examples/demos/n00bdemo/logo.c @@ -51,9 +51,11 @@ typedef struct { int size; } NODE; +extern NODE _end[]; + void DumpHeap() { - NODE *n = (NODE*)GetBSSend(); + NODE *n = _end; printf( "--\n" ); diff --git a/examples/demos/n00bdemo/main.c b/examples/demos/n00bdemo/main.c index cb64c42..439bccc 100644 --- a/examples/demos/n00bdemo/main.c +++ b/examples/demos/n00bdemo/main.c @@ -232,12 +232,11 @@ void unpackModels() { } void init() { + // Init display + initDisplay(); #ifdef SYSTEM_573_SUPPORT system573Setup(); #endif - - // Init display - initDisplay(); FntLoad( 960, 0 ); diff --git a/examples/io/pads/spi.c b/examples/io/pads/spi.c index 43b5bc3..133782c 100644 --- a/examples/io/pads/spi.c +++ b/examples/io/pads/spi.c @@ -27,6 +27,7 @@ */ #include +#include #include #include #include diff --git a/examples/io/pads/spi.h b/examples/io/pads/spi.h index 7d4d75b..8c17df3 100644 --- a/examples/io/pads/spi.h +++ b/examples/io/pads/spi.h @@ -7,6 +7,7 @@ #define __SPI_H #include +#include #include // Maximum request/response length (34 bytes for pads, 140 for memory cards). diff --git a/libpsn00b/include/stdint.h b/libpsn00b/include/stdint.h deleted file mode 100644 index 83acb00..0000000 --- a/libpsn00b/include/stdint.h +++ /dev/null @@ -1,16 +0,0 @@ -#ifndef _STDINT_H -#define _STDINT_H - -typedef unsigned int size_t; - -typedef char int8_t; -typedef short int16_t; -typedef int int32_t; -typedef long long int64_t; - -typedef unsigned char uint8_t; -typedef unsigned short uint16_t; -typedef unsigned int uint32_t; -typedef unsigned long long uint64_t; - -#endif // _STDINT_H \ No newline at end of file diff --git a/libpsn00b/include/stdlib.h b/libpsn00b/include/stdlib.h index b187a6f..4c4fcd3 100644 --- a/libpsn00b/include/stdlib.h +++ b/libpsn00b/include/stdlib.h @@ -44,7 +44,7 @@ double strtod(const char *nptr, char **endptr); float strtof(const char *nptr, char **endptr); // Memory allocation functions -unsigned int *GetBSSend(); +void _mem_init(int ram_size, int stack_max_size); void InitHeap(unsigned int *addr, int size); int SetHeapSize(int size); void *malloc(int size); diff --git a/libpsn00b/libc/start.c b/libpsn00b/libc/start.c index f190794..fd6fe33 100644 --- a/libpsn00b/libc/start.c +++ b/libpsn00b/libc/start.c @@ -6,19 +6,20 @@ #include #include #include +#include -#define KERNEL_ARG_STRING ((const char *) 0x80000180) -#define KERNEL_RETURN_VALUE ((volatile int *) 0x8000dffc) +#define KERNEL_ARG_STRING ((const char *) 0x80000180) +#define KERNEL_RETURN_VALUE ((volatile int *) 0x8000dffc) /* Argument parsing */ -int32_t __argc; -const char **__argv; +int __argc; +const char **__argv; #define ARGC_MAX 16 -static const char *_argv_buffer[ARGC_MAX]; -static char _arg_string_buffer[132]; +static const char *_argv_buffer[ARGC_MAX]; +static char _arg_string_buffer[132]; static void _parse_kernel_args() { // Copy the argument string from kernel memory into a private buffer (which @@ -61,10 +62,10 @@ extern uint8_t _end[]; // useful though to change the stack size and/or reinitialize the heap on // systems that have more than 2 MB of RAM (e.g. emulators, devkits, PS1-based // arcade boards). -void _mem_init(size_t ram_size, size_t stack_max_size) { - void *exe_end = _end + 4; - size_t exe_size = (size_t) exe_end - (size_t) __text_start; - size_t ram_used = (0x10000 + exe_size + stack_max_size) & 0xfffffffc; +void _mem_init(int ram_size, int stack_max_size) { + void *exe_end = _end + 4; + int exe_size = (int) exe_end - (int) __text_start; + int ram_used = (0x10000 + exe_size + stack_max_size) & 0xfffffffc; InitHeap(exe_end, ram_size - ram_used); } @@ -74,7 +75,7 @@ void _mem_init(size_t ram_size, size_t stack_max_size) { extern void (*__CTOR_LIST__[])(void); extern void (*__DTOR_LIST__[])(void); -extern int32_t main(int32_t argc, const char* argv[]); +extern int main(int argc, const char* argv[]); // Even though _start() usually takes no arguments, this implementation allows // parent executables to pass args directly to child executables without having -- cgit v1.2.3