diff options
| author | John Wilbert M. Villamor <lameguy64@gmail.com> | 2019-08-17 14:44:29 +0800 |
|---|---|---|
| committer | John Wilbert M. Villamor <lameguy64@gmail.com> | 2019-08-17 14:44:29 +0800 |
| commit | 82a441e7bd3a5103330c7d5ca7f9df470953e586 (patch) | |
| tree | a8a933aa9f03767c6cebc5e11380c37931eae5cd /libpsn00b | |
| parent | e7f9e08937f9d556793c1e0ff0a08856a3897b41 (diff) | |
| download | psn00bsdk-82a441e7bd3a5103330c7d5ca7f9df470953e586.tar.gz | |
Added childexec example, added BIOS memory card functions, changed PAD function names, runtime library now 0.13b
Diffstat (limited to 'libpsn00b')
23 files changed, 199 insertions, 48 deletions
diff --git a/libpsn00b/include/psxapi.h b/libpsn00b/include/psxapi.h index f5a3c07..d25e620 100644 --- a/libpsn00b/include/psxapi.h +++ b/libpsn00b/include/psxapi.h @@ -1,6 +1,22 @@ #ifndef __PSXAPI__ #define __PSXAPI__ +#define DescHW 0xf0000000 +#define DescSW 0xf4000000 + +#define HwCARD (DescHW|0x11) +#define HwCARD_1 (DescHW|0x12) +#define HwCARD_0 (DescHW|0x13) +#define SwCARD (DescHW|0x02) + +#define EvSpIOE 0x0004 +#define EvSpERROR 0x8000 +#define EvSpTIMOUT 0x0100 +#define EvSpNEW 0x0200 + +#define EvMdINTR 0x1000 +#define EvMdNOINTR 0x2000 + typedef struct { // Device control block char *name; int flags; @@ -97,8 +113,10 @@ struct DIRENTRY *nextfile(struct DIRENTRY *entry); int erase(const char *name); int chdir(const char *path); -#define delete( p ) erase( p ) -#define cd( p ) chdir( p ) // For compatibility +//#define delete( p ) erase( p ) // May conflict with delete operator in C++ +#define cd( p ) chdir( p ) // For compatibility + +// BIOS device functions int AddDev(DCB *dcb); int DelDev(const char *name); @@ -107,15 +125,34 @@ void ListDev(void); void EnterCriticalSection(void); void ExitCriticalSection(void); +// BIOS CD functions void _InitCd(void); void _96_init(void); void _96_remove(void); // BIOS pad functions -void _InitPad(char *buff1, int len1, char *buff2, int len2); -void _StartPad(void); -void _StopPad(void); - +void InitPAD(char *buff1, int len1, char *buff2, int len2); +void StartPAD(void); +void StopPAD(void); + +// BIOS memory card functions +void InitCARD(int pad_enable); +void StartCARD(void); +void StopCARD(void); +void _bu_init(void); + +int _card_load(int chan); +int _card_info(int chan); +int _card_status(int chan); +int _card_wait(int chan); +int _card_clear(int chan); +int _card_chan(void); +int _card_read(int chan, int sector, unsigned char *buf); +int _card_write(int chan, int sector, unsigned char *buf); +void _new_card(void); + + +// Interrupt acknowledge control void ChangeClearPAD(int mode); void ChangeClearRCnt(int t, int m); diff --git a/libpsn00b/include/psxgpu.h b/libpsn00b/include/psxgpu.h index 2415c83..d6c68cf 100644 --- a/libpsn00b/include/psxgpu.h +++ b/libpsn00b/include/psxgpu.h @@ -31,13 +31,8 @@ // Primitive macros -#define setDrawTPage( p, tp, abr, x, y ) \ - ( (p)->code[0] = getTPage( tp, abr, x, y ), \ - setlen( p, 1 ), setcode( p, 0xe1 ) ) - -/* ORIGINAL */ -#define setDrawTPageVal( p, tp ) \ - ( (p)->code[0] = tp, \ +#define setDrawTPage( p, dfe, dtd, tpage ) \ + ( (p)->code[0] = tpage|(dfe<<10)|(dtd<<9), \ setlen( p, 1 ), setcode( p, 0xe1 ) ) /*#define setVram2Vram( p ) ( setlen( p, 8 ), setcode( p, 0x80 ), \ diff --git a/libpsn00b/include/stdio.h b/libpsn00b/include/stdio.h index 81249de..cf1909d 100644 --- a/libpsn00b/include/stdio.h +++ b/libpsn00b/include/stdio.h @@ -7,6 +7,14 @@ #define NULL 0 #endif +#ifndef true +#define true 1 +#endif + +#ifndef false +#define false 0 +#endif + // BIOS seek modes #ifndef SEEK_SET #define SEEK_SET 0 diff --git a/libpsn00b/psxapi/makefile b/libpsn00b/psxapi/makefile index 49db884..819dc0a 100644 --- a/libpsn00b/psxapi/makefile +++ b/libpsn00b/psxapi/makefile @@ -6,7 +6,7 @@ include ../common.mk TARGET = ../libpsxapi.a -SOURCES = stdio fs sys pad +SOURCES = stdio fs sys AFILES = $(foreach dir,$(SOURCES),$(wildcard $(dir)/*.s)) OFILES = $(addprefix build/,$(AFILES:.s=.o)) diff --git a/libpsn00b/psxapi/pad/startpad.s b/libpsn00b/psxapi/pad/startpad.s deleted file mode 100644 index c8e7da8..0000000 --- a/libpsn00b/psxapi/pad/startpad.s +++ /dev/null @@ -1,10 +0,0 @@ -.set noreorder -.section .text - -.global _StartPad -.type _StartPad, @function -_StartPad: - addiu $t2, $0 , 0xb0 - jr $t2 - addiu $t1, $0 , 0x13 -
\ No newline at end of file diff --git a/libpsn00b/psxapi/pad/stoppad.s b/libpsn00b/psxapi/pad/stoppad.s deleted file mode 100644 index 4465e5a..0000000 --- a/libpsn00b/psxapi/pad/stoppad.s +++ /dev/null @@ -1,10 +0,0 @@ -.set noreorder -.section .text - -.global _StopPad -.type _StopPad, @function -_StopPad: - addiu $t2, $0 , 0xb0 - jr $t2 - addiu $t1, $0 , 0x14 -
\ No newline at end of file diff --git a/libpsn00b/psxapi/sys/_bu_init.s b/libpsn00b/psxapi/sys/_bu_init.s new file mode 100644 index 0000000..f074899 --- /dev/null +++ b/libpsn00b/psxapi/sys/_bu_init.s @@ -0,0 +1,10 @@ +.set noreorder +.section .text + +.global _bu_init +.type _bu_init, @function +_bu_init: + addiu $t2, $0, 0xa0 + jr $t2 + addiu $t1, $0, 0x55 +
\ No newline at end of file diff --git a/libpsn00b/psxapi/sys/_card_chan.s b/libpsn00b/psxapi/sys/_card_chan.s new file mode 100644 index 0000000..7847820 --- /dev/null +++ b/libpsn00b/psxapi/sys/_card_chan.s @@ -0,0 +1,10 @@ +.set noreorder +.section .text + +.global _card_chan +.type _card_chan, @function +_card_chan: + addiu $t2, $0, 0xb0 + jr $t2 + addiu $t1, $0, 0x58 +
\ No newline at end of file diff --git a/libpsn00b/psxapi/sys/_card_clear.s b/libpsn00b/psxapi/sys/_card_clear.s new file mode 100644 index 0000000..163415c --- /dev/null +++ b/libpsn00b/psxapi/sys/_card_clear.s @@ -0,0 +1,10 @@ +.set noreorder +.section .text + +.global _card_clear +.type _card_clear, @function +_card_clear: + addiu $t2, $0, 0xa0 + jr $t2 + addiu $t1, $0, 0xaf +
\ No newline at end of file diff --git a/libpsn00b/psxapi/sys/_card_info.s b/libpsn00b/psxapi/sys/_card_info.s new file mode 100644 index 0000000..5e6720f --- /dev/null +++ b/libpsn00b/psxapi/sys/_card_info.s @@ -0,0 +1,10 @@ +.set noreorder +.section .text + +.global _card_info +.type _card_info, @function +_card_info: + addiu $t2, $0, 0xa0 + jr $t2 + addiu $t1, $0, 0xab +
\ No newline at end of file diff --git a/libpsn00b/psxapi/sys/_card_load.s b/libpsn00b/psxapi/sys/_card_load.s new file mode 100644 index 0000000..0e871cb --- /dev/null +++ b/libpsn00b/psxapi/sys/_card_load.s @@ -0,0 +1,10 @@ +.set noreorder +.section .text + +.global _card_load +.type _card_load, @function +_card_load: + addiu $t2, $0, 0xa0 + jr $t2 + addiu $t1, $0, 0xac +
\ No newline at end of file diff --git a/libpsn00b/psxapi/sys/_card_read.s b/libpsn00b/psxapi/sys/_card_read.s new file mode 100644 index 0000000..9026c63 --- /dev/null +++ b/libpsn00b/psxapi/sys/_card_read.s @@ -0,0 +1,10 @@ +.set noreorder +.section .text + +.global _card_read +.type _card_read, @function +_card_read: + addiu $t2, $0, 0xb0 + jr $t2 + addiu $t1, $0, 0x4f +
\ No newline at end of file diff --git a/libpsn00b/psxapi/sys/_card_status.s b/libpsn00b/psxapi/sys/_card_status.s new file mode 100644 index 0000000..1dd37aa --- /dev/null +++ b/libpsn00b/psxapi/sys/_card_status.s @@ -0,0 +1,10 @@ +.set noreorder +.section .text + +.global _card_status +.type _card_status, @function +_card_status: + addiu $t2, $0, 0xb0 + jr $t2 + addiu $t1, $0, 0x5c +
\ No newline at end of file diff --git a/libpsn00b/psxapi/sys/_card_wait.s b/libpsn00b/psxapi/sys/_card_wait.s new file mode 100644 index 0000000..5ceb4d5 --- /dev/null +++ b/libpsn00b/psxapi/sys/_card_wait.s @@ -0,0 +1,10 @@ +.set noreorder +.section .text + +.global _card_wait +.type _card_wait, @function +_card_wait: + addiu $t2, $0, 0xb0 + jr $t2 + addiu $t1, $0, 0x5d +
\ No newline at end of file diff --git a/libpsn00b/psxapi/sys/_card_write.s b/libpsn00b/psxapi/sys/_card_write.s new file mode 100644 index 0000000..5e1450b --- /dev/null +++ b/libpsn00b/psxapi/sys/_card_write.s @@ -0,0 +1,10 @@ +.set noreorder +.section .text + +.global _card_write +.type _card_write, @function +_card_write: + addiu $t2, $0, 0xb0 + jr $t2 + addiu $t1, $0, 0x4e +
\ No newline at end of file diff --git a/libpsn00b/psxapi/sys/_new_card.s b/libpsn00b/psxapi/sys/_new_card.s new file mode 100644 index 0000000..cfd6f57 --- /dev/null +++ b/libpsn00b/psxapi/sys/_new_card.s @@ -0,0 +1,10 @@ +.set noreorder +.section .text + +.global _new_card +.type _new_card, @function +_new_card: + addiu $t2, $0, 0xb0 + jr $t2 + addiu $t1, $0, 0x50 +
\ No newline at end of file diff --git a/libpsn00b/psxapi/sys/initcard.s b/libpsn00b/psxapi/sys/initcard.s new file mode 100644 index 0000000..bdc3ffd --- /dev/null +++ b/libpsn00b/psxapi/sys/initcard.s @@ -0,0 +1,10 @@ +.set noreorder +.section .text + +.global InitCARD +.type InitCARD, @function +InitCARD: + addiu $t2, $0, 0xb0 + jr $t2 + addiu $t1, $0, 0x4a +
\ No newline at end of file diff --git a/libpsn00b/psxapi/pad/initpad.s b/libpsn00b/psxapi/sys/initpad.s index d983d75..f2a6642 100644 --- a/libpsn00b/psxapi/pad/initpad.s +++ b/libpsn00b/psxapi/sys/initpad.s @@ -1,9 +1,9 @@ .set noreorder .section .text -.global _InitPad -.type _InitPad, @function -_InitPad: +.global InitPAD +.type InitPAD, @function +InitPAD: addiu $t2, $0 , 0xb0 jr $t2 addiu $t1, $0 , 0x12 diff --git a/libpsn00b/psxapi/sys/startcard.s b/libpsn00b/psxapi/sys/startcard.s new file mode 100644 index 0000000..44f1676 --- /dev/null +++ b/libpsn00b/psxapi/sys/startcard.s @@ -0,0 +1,10 @@ +.set noreorder +.section .text + +.global StartCARD +.type StartCARD, @function +StartCARD: + addiu $t2, $0, 0xb0 + jr $t2 + addiu $t1, $0, 0x4b +
\ No newline at end of file diff --git a/libpsn00b/psxapi/sys/startpad.s b/libpsn00b/psxapi/sys/startpad.s index b15b0c0..fdd380f 100644 --- a/libpsn00b/psxapi/sys/startpad.s +++ b/libpsn00b/psxapi/sys/startpad.s @@ -1,10 +1,10 @@ .set noreorder .section .text -.global StartPad -.type StartPad, @function -StartPad: - addiu $t2, $0, 0xb0 +.global StartPAD +.type StartPAD, @function +StartPAD: + addiu $t2, $0 , 0xb0 jr $t2 - addiu $t1, $0, 0x13 + addiu $t1, $0 , 0x13
\ No newline at end of file diff --git a/libpsn00b/psxapi/sys/stopcard.s b/libpsn00b/psxapi/sys/stopcard.s new file mode 100644 index 0000000..9c38d5d --- /dev/null +++ b/libpsn00b/psxapi/sys/stopcard.s @@ -0,0 +1,10 @@ +.set noreorder +.section .text + +.global StopCARD +.type StopCARD, @function +StopCARD: + addiu $t2, $0, 0xb0 + jr $t2 + addiu $t1, $0, 0x4c +
\ No newline at end of file diff --git a/libpsn00b/psxapi/sys/stoppad.s b/libpsn00b/psxapi/sys/stoppad.s index 562ac0f..5e77a43 100644 --- a/libpsn00b/psxapi/sys/stoppad.s +++ b/libpsn00b/psxapi/sys/stoppad.s @@ -1,10 +1,10 @@ .set noreorder .section .text -.global StopPad -.type StopPad, @function -StartPad: - addiu $t2, $0, 0xb0 +.global StopPAD +.type StopPAD, @function +StopPAD: + addiu $t2, $0 , 0xb0 jr $t2 - addiu $t1, $0, 0x14 + addiu $t1, $0 , 0x14
\ No newline at end of file diff --git a/libpsn00b/readme.txt b/libpsn00b/readme.txt index c5fee34..43b120a 100644 --- a/libpsn00b/readme.txt +++ b/libpsn00b/readme.txt @@ -67,7 +67,8 @@ Contributing: with -O2 optimization. * Functions must work flawlessly on both emulators and real hardware. * Don't forget to put your user name in the readme file of the library - you've made a contribution on and details of what you've added/modified. + you've made a contribution on, and details of what you've changed in the + changelog. * New functions that are not originally in the official SDK must be marked as original code in both the library headers and the libn00bref document. |
