diff options
| author | John Wilbert M. Villamor <lameguy64@gmail.com> | 2020-04-24 19:01:28 +0800 |
|---|---|---|
| committer | John Wilbert M. Villamor <lameguy64@gmail.com> | 2020-04-24 19:01:28 +0800 |
| commit | 1aa0e17df7c325a41de8cf8a57f52ed853f08bf3 (patch) | |
| tree | 5ec7f69ca0104f2b0a41e2ee7d3cb0cf0c9c54c5 | |
| parent | e82da2abe4c264d4b48a48d79cf9b8e4c4fb8ab6 (diff) | |
| download | psn00bsdk-1aa0e17df7c325a41de8cf8a57f52ed853f08bf3.tar.gz | |
Refined toolchain instructions, organized examples, added automatic retry for CdRead(), added FIOCSCAN ioctl in psxsio TTY driver, added tty and console examples.
| -rw-r--r-- | README.md | 11 | ||||
| -rw-r--r-- | changelog.txt | 16 | ||||
| -rw-r--r-- | examples/beginner/hello/main.c (renamed from examples/hello/main.c) | 0 | ||||
| -rw-r--r-- | examples/beginner/hello/makefile (renamed from examples/hello/makefile) | 2 | ||||
| -rw-r--r-- | examples/cdrom/cdbrowse/ball16c.h (renamed from examples/balls/ball16c.h) | 0 | ||||
| -rw-r--r-- | examples/cdrom/cdbrowse/iso.xml (renamed from examples/cdbrowse/iso.xml) | 0 | ||||
| -rw-r--r-- | examples/cdrom/cdbrowse/main.c (renamed from examples/cdbrowse/main.c) | 0 | ||||
| -rw-r--r-- | examples/cdrom/cdbrowse/makefile (renamed from examples/cdbrowse/makefile) | 13 | ||||
| -rw-r--r-- | examples/cdrom/cdbrowse/system.cnf (renamed from examples/cdbrowse/system.cnf) | 0 | ||||
| -rw-r--r-- | examples/cdrom/cdxa/ball16c.h (renamed from examples/cdbrowse/ball16c.h) | 0 | ||||
| -rw-r--r-- | examples/cdrom/cdxa/iso.xml (renamed from examples/cdxa/iso.xml) | 0 | ||||
| -rw-r--r-- | examples/cdrom/cdxa/main.c (renamed from examples/cdxa/main.c) | 0 | ||||
| -rw-r--r-- | examples/cdrom/cdxa/makefile (renamed from examples/cdxa/makefile) | 13 | ||||
| -rw-r--r-- | examples/cdrom/cdxa/system.cnf (renamed from examples/cdxa/system.cnf) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/data.h (renamed from examples/n00bdemo/data.h) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/data.s (renamed from examples/n00bdemo/data.s) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/data.xml (renamed from examples/n00bdemo/data.xml) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/data/bulb.smd (renamed from examples/n00bdemo/data/bulb.smd) | bin | 1708 -> 1708 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/bulb.smx (renamed from examples/n00bdemo/data/bulb.smx) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/data/bungirl.smd (renamed from examples/n00bdemo/data/bungirl.smd) | bin | 67532 -> 67532 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/bungirl.smx (renamed from examples/n00bdemo/data/bungirl.smx) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/data/bungirl.tim (renamed from examples/n00bdemo/data/bungirl.tim) | bin | 16928 -> 16928 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/celmapi.bmp (renamed from examples/n00bdemo/data/celmapi.bmp) | bin | 3126 -> 3126 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/celmapi.tim (renamed from examples/n00bdemo/data/celmapi.tim) | bin | 576 -> 576 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/clktower.tim (renamed from examples/n00bdemo/data/clktower.tim) | bin | 832 -> 832 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/font.bmp (renamed from examples/n00bdemo/data/font.bmp) | bin | 12406 -> 12406 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/font.tim (renamed from examples/n00bdemo/data/font.tim) | bin | 12352 -> 12352 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/hatkid.png (renamed from examples/n00bdemo/data/hatkid.png) | bin | 390 -> 390 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/hatkid.smd (renamed from examples/n00bdemo/data/hatkid.smd) | bin | 15676 -> 15676 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/hatkid.smx (renamed from examples/n00bdemo/data/hatkid.smx) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/data/hatkid.tim (renamed from examples/n00bdemo/data/hatkid.tim) | bin | 576 -> 576 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/lamelotl16c.png (renamed from examples/n00bdemo/data/lamelotl16c.png) | bin | 5777 -> 5777 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/lamelotl16c.tim (renamed from examples/n00bdemo/data/lamelotl16c.tim) | bin | 24640 -> 24640 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/lightworld.smd (renamed from examples/n00bdemo/data/lightworld.smd) | bin | 13700 -> 13700 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/lightworld.smx (renamed from examples/n00bdemo/data/lightworld.smx) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/data/logo.smd (renamed from examples/n00bdemo/data/logo.smd) | bin | 13524 -> 13524 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/logo.smx (renamed from examples/n00bdemo/data/logo.smx) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/data/mtekdisk.smd (renamed from examples/n00bdemo/data/mtekdisk.smd) | bin | 4204 -> 4204 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/mtekdisk.smx (renamed from examples/n00bdemo/data/mtekdisk.smx) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/data/mtektext.smd (renamed from examples/n00bdemo/data/mtektext.smd) | bin | 7172 -> 7172 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/mtektext.smx (renamed from examples/n00bdemo/data/mtektext.smx) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/data/n00blogo-pixel.png (renamed from examples/n00bdemo/data/n00blogo-pixel.png) | bin | 1035 -> 1035 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/n00blogo-pixel.tim (renamed from examples/n00bdemo/data/n00blogo-pixel.tim) | bin | 3392 -> 3392 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/petscum.smd (renamed from examples/n00bdemo/data/petscum.smd) | bin | 13844 -> 13844 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/petscum.smx (renamed from examples/n00bdemo/data/petscum.smx) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/data/petscum16c.png (renamed from examples/n00bdemo/data/petscum16c.png) | bin | 955 -> 955 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/petscum16c.tim (renamed from examples/n00bdemo/data/petscum16c.tim) | bin | 5184 -> 5184 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/psn00blogo.smd (renamed from examples/n00bdemo/data/psn00blogo.smd) | bin | 8612 -> 8612 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/psn00blogo.smx (renamed from examples/n00bdemo/data/psn00blogo.smx) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/data/rbowshade.smd (renamed from examples/n00bdemo/data/rbowshade.smd) | bin | 676 -> 676 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/rbowshade.smx (renamed from examples/n00bdemo/data/rbowshade.smx) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/data/riftbld1.tim (renamed from examples/n00bdemo/data/riftbld1.tim) | bin | 1088 -> 1088 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/riftbld2.tim (renamed from examples/n00bdemo/data/riftbld2.tim) | bin | 1088 -> 1088 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/star.smd (renamed from examples/n00bdemo/data/star.smd) | bin | 220 -> 220 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/star.smx (renamed from examples/n00bdemo/data/star.smx) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/data/star_mask.smd (renamed from examples/n00bdemo/data/star_mask.smd) | bin | 220 -> 220 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/star_mask.smx (renamed from examples/n00bdemo/data/star_mask.smx) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/data/timerift.smd (renamed from examples/n00bdemo/data/timerift.smd) | bin | 16232 -> 16232 bytes | |||
| -rw-r--r-- | examples/demos/n00bdemo/data/timerift.smx (renamed from examples/n00bdemo/data/timerift.smx) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/disp.c (renamed from examples/n00bdemo/disp.c) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/disp.h (renamed from examples/n00bdemo/disp.h) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/lightdemo.c (renamed from examples/n00bdemo/lightdemo.c) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/logo.c (renamed from examples/n00bdemo/logo.c) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/logo.h (renamed from examples/n00bdemo/logo.h) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/main.c (renamed from examples/n00bdemo/main.c) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/makefile (renamed from examples/n00bdemo/makefile) | 5 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/overlay.c (renamed from examples/n00bdemo/overlay.c) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/plasma_tbl.c (renamed from examples/n00bdemo/plasma_tbl.c) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/plasma_tbl.h (renamed from examples/n00bdemo/plasma_tbl.h) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/plasmagen.s (renamed from examples/n00bdemo/plasmagen.s) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/scrolltext.c (renamed from examples/n00bdemo/scrolltext.c) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/smd.h (renamed from examples/n00bdemo/smd.h) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/smd.s (renamed from examples/n00bdemo/smd.s) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/smd_cel.s (renamed from examples/n00bdemo/smd_cel.s) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/smd_flat.s (renamed from examples/n00bdemo/smd_flat.s) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/smd_s.h (renamed from examples/n00bdemo/smd_s.h) | 0 | ||||
| -rw-r--r-- | examples/demos/n00bdemo/smdparser.s (renamed from examples/n00bdemo/smdparser.s) | 0 | ||||
| -rw-r--r-- | examples/graphics/balls/ball16c.h (renamed from examples/cdxa/ball16c.h) | 0 | ||||
| -rw-r--r-- | examples/graphics/balls/ball16c.tim (renamed from examples/balls/ball16c.tim) | bin | 192 -> 192 bytes | |||
| -rw-r--r-- | examples/graphics/balls/main.c (renamed from examples/balls/main.c) | 0 | ||||
| -rw-r--r-- | examples/graphics/balls/makefile (renamed from examples/balls/makefile) | 2 | ||||
| -rw-r--r-- | examples/graphics/billboard/billboard.c (renamed from examples/billboard/billboard.c) | 0 | ||||
| -rw-r--r-- | examples/graphics/billboard/makefile (renamed from examples/billboard/makefile) | 2 | ||||
| -rw-r--r-- | examples/graphics/billboard/texture64.tim (renamed from examples/billboard/texture64.tim) | bin | 2112 -> 2112 bytes | |||
| -rw-r--r-- | examples/graphics/billboard/tim.s (renamed from examples/billboard/tim.s) | 0 | ||||
| -rw-r--r-- | examples/graphics/fpscam/clip.c (renamed from examples/fpscam/clip.c) | 0 | ||||
| -rw-r--r-- | examples/graphics/fpscam/clip.h (renamed from examples/fpscam/clip.h) | 0 | ||||
| -rw-r--r-- | examples/graphics/fpscam/lookat.c (renamed from examples/fpscam/lookat.c) | 0 | ||||
| -rw-r--r-- | examples/graphics/fpscam/lookat.h (renamed from examples/fpscam/lookat.h) | 0 | ||||
| -rw-r--r-- | examples/graphics/fpscam/main.c (renamed from examples/fpscam/main.c) | 0 | ||||
| -rw-r--r-- | examples/graphics/fpscam/makefile (renamed from examples/fpscam/makefile) | 2 | ||||
| -rw-r--r-- | examples/graphics/gte/main.c (renamed from examples/gte/main.c) | 0 | ||||
| -rw-r--r-- | examples/graphics/gte/makefile (renamed from examples/gte/makefile) | 2 | ||||
| -rw-r--r-- | examples/graphics/render2tex/blendpattern-16c.png (renamed from examples/render2tex/blendpattern-16c.png) | bin | 385 -> 385 bytes | |||
| -rw-r--r-- | examples/graphics/render2tex/blendpattern-16c.tim (renamed from examples/render2tex/blendpattern-16c.tim) | bin | 2112 -> 2112 bytes | |||
| -rw-r--r-- | examples/graphics/render2tex/blendpattern.png (renamed from examples/render2tex/blendpattern.png) | bin | 826 -> 826 bytes | |||
| -rw-r--r-- | examples/graphics/render2tex/main.c (renamed from examples/render2tex/main.c) | 0 | ||||
| -rw-r--r-- | examples/graphics/render2tex/makefile (renamed from examples/render2tex/makefile) | 2 | ||||
| -rw-r--r-- | examples/graphics/render2tex/texture.s (renamed from examples/render2tex/texture.s) | 0 | ||||
| -rw-r--r-- | examples/graphics/rgb24/bunpattern.tim (renamed from examples/rgb24/bunpattern.tim) | bin | 921620 -> 921620 bytes | |||
| -rw-r--r-- | examples/graphics/rgb24/main.c (renamed from examples/rgb24/main.c) | 0 | ||||
| -rw-r--r-- | examples/graphics/rgb24/makefile (renamed from examples/rgb24/makefile) | 2 | ||||
| -rw-r--r-- | examples/graphics/rgb24/tim.s (renamed from examples/rgb24/tim.s) | 0 | ||||
| -rw-r--r-- | examples/lowlevel/cartrom/bios.inc (renamed from examples/cartrom/bios.inc) | 0 | ||||
| -rw-r--r-- | examples/lowlevel/cartrom/cop0.inc (renamed from examples/cartrom/cop0.inc) | 0 | ||||
| -rw-r--r-- | examples/lowlevel/cartrom/makefile (renamed from examples/cartrom/makefile) | 0 | ||||
| -rw-r--r-- | examples/lowlevel/cartrom/parse.inc (renamed from examples/cartrom/parse.inc) | 0 | ||||
| -rw-r--r-- | examples/lowlevel/cartrom/readme.txt (renamed from examples/cartrom/readme.txt) | 0 | ||||
| -rw-r--r-- | examples/lowlevel/cartrom/rom.ld (renamed from examples/cartrom/rom.ld) | 0 | ||||
| -rw-r--r-- | examples/lowlevel/cartrom/rom.s (renamed from examples/cartrom/rom.s) | 0 | ||||
| -rw-r--r-- | examples/makefile | 20 | ||||
| -rw-r--r-- | examples/sdk-common.mk | 4 | ||||
| -rw-r--r-- | examples/system/childexec/ball16c.h (renamed from examples/childexec/ball16c.h) | 0 | ||||
| -rw-r--r-- | examples/system/childexec/child.c (renamed from examples/childexec/child.c) | 0 | ||||
| -rw-r--r-- | examples/system/childexec/child_exe.s (renamed from examples/childexec/child_exe.s) | 0 | ||||
| -rw-r--r-- | examples/system/childexec/makefile (renamed from examples/childexec/makefile) | 2 | ||||
| -rw-r--r-- | examples/system/childexec/parent.c (renamed from examples/childexec/parent.c) | 0 | ||||
| -rw-r--r-- | examples/system/console/ball16c.h | 16 | ||||
| -rw-r--r-- | examples/system/console/main.c | 284 | ||||
| -rw-r--r-- | examples/system/console/makefile | 60 | ||||
| -rw-r--r-- | examples/system/timer/main.c (renamed from examples/timer/main.c) | 0 | ||||
| -rw-r--r-- | examples/system/timer/makefile (renamed from examples/timer/makefile) | 2 | ||||
| -rw-r--r-- | examples/system/tty/main.c | 145 | ||||
| -rw-r--r-- | examples/system/tty/makefile | 60 | ||||
| -rw-r--r-- | libpsn00b/include/stdlib.h | 3 | ||||
| -rw-r--r-- | libpsn00b/psxapi/stdio/atoi.s | 9 | ||||
| -rw-r--r-- | libpsn00b/psxapi/stdio/atol.s | 9 | ||||
| -rw-r--r-- | libpsn00b/psxcd/psxcd.c | 61 | ||||
| -rw-r--r-- | libpsn00b/psxsio/siocons.c | 16 | ||||
| -rw-r--r-- | toolchain.txt | 89 |
130 files changed, 769 insertions, 83 deletions
@@ -110,13 +110,12 @@ under Windows than on Linux and BSDs. Clone it in the root of your C drive or in any location you choose. 7. Enter tools directory in PSn00bSDK and run `make` to build all tools. Then, run `make install` to consolidate all tools to a single bin - directory. Add this directory to your PATH variable - (with export=$PATH:<path to SDK>/tools/bin) and make sure `elf2x` can - be called from any directory. + directory. Add this directory to your PATH variable by adding + `export=$PATH:<path to SDK>/tools/bin` in your .bash_profile file. You'll + need to reload the MSys2 shell after making the changes. 8. Enter libpsn00b directory and run `make` to build all libpsn00b libraries. -9. Enter examples directory and run `make`, this also verifies if the SDK - has been set up correctly. Update directory paths in `sdk-common.mk` when - necessary. +6. Compile the example programs to test if the SDK is set up correctly. + Update directory paths in `sdk-common.mk` when necessary. If you prefer to do things in the Command Prompt, you can add the paths c:\msys64\usr\bin, c:\msys64\mingw64\bin (mingw32 for 32-bit), diff --git a/changelog.txt b/changelog.txt index ec3e9b2..23d662d 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,22 @@ PSn00bSDK changelog Items that are lower in the log are more recently implemented. +04-24-2020 by Lameguy64: + +* Refined toolchain instructions a bit. + +* psxcd: Added automatic read retry for CdRead() operations, as long as + CdReadSync() is called until read completion. + +* psxapi: Added BIOS atoi() and atol() calls. Temporary, may be replaced with + a faster implementation + +* psxsio: Added ioctl() support for FIOCSCAN to probe for pending input in + serial tty driver. + +* examples: Reorganized examples, added new tty and console examples. + + 03-11-2020 by Lameguy64: * psxcd: Fixed CdInit() syntax (there should be no arguments). diff --git a/examples/hello/main.c b/examples/beginner/hello/main.c index 1f02f0b..1f02f0b 100644 --- a/examples/hello/main.c +++ b/examples/beginner/hello/main.c diff --git a/examples/hello/makefile b/examples/beginner/hello/makefile index 77edaa7..1893a48 100644 --- a/examples/hello/makefile +++ b/examples/beginner/hello/makefile @@ -1,4 +1,4 @@ -include ../sdk-common.mk +include ../../sdk-common.mk # Project target name TARGET = hello.elf diff --git a/examples/balls/ball16c.h b/examples/cdrom/cdbrowse/ball16c.h index c79f273..c79f273 100644 --- a/examples/balls/ball16c.h +++ b/examples/cdrom/cdbrowse/ball16c.h diff --git a/examples/cdbrowse/iso.xml b/examples/cdrom/cdbrowse/iso.xml index a828df1..a828df1 100644 --- a/examples/cdbrowse/iso.xml +++ b/examples/cdrom/cdbrowse/iso.xml diff --git a/examples/cdbrowse/main.c b/examples/cdrom/cdbrowse/main.c index 65475ad..65475ad 100644 --- a/examples/cdbrowse/main.c +++ b/examples/cdrom/cdbrowse/main.c diff --git a/examples/cdbrowse/makefile b/examples/cdrom/cdbrowse/makefile index 7e90b3c..f5ee962 100644 --- a/examples/cdbrowse/makefile +++ b/examples/cdrom/cdbrowse/makefile @@ -1,4 +1,4 @@ -include ../sdk-common.mk +include ../../sdk-common.mk TARGET = cdbrowse.elf @@ -10,15 +10,6 @@ OFILES = $(addprefix build/,$(CFILES:.c=.o) $(CPPFILES:.cpp=.o) $(AFILES:.s=.o) PREFIX = mipsel-unknown-elf- -# Include directories -INCLUDE = -I../../libpsn00b/include - -# Library directories, last entry must point toolchain libraries -LIBDIRS = -L../../libpsn00b - -LIBDIRS += -L$(GCC_BASE)/lib/gcc/mipsel-unknown-elf/$(GCC_VERSION) -INCLUDE += -I$(GCC_BASE)/lib/gcc/mipsel-unknown-elf/$(GCC_VERSION)/include - LIBS = -lpsxcd -lpsxetc -lpsxgpu -lpsxgte -lpsxspu -lpsxsio -lpsxapi -lc CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections @@ -41,6 +32,8 @@ LD = $(PREFIX)ld all: $(OFILES) $(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET) elf2x -q $(TARGET) + +iso: mkpsxiso -y -q iso.xml build/%.o: %.c diff --git a/examples/cdbrowse/system.cnf b/examples/cdrom/cdbrowse/system.cnf index 9cf5593..9cf5593 100644 --- a/examples/cdbrowse/system.cnf +++ b/examples/cdrom/cdbrowse/system.cnf diff --git a/examples/cdbrowse/ball16c.h b/examples/cdrom/cdxa/ball16c.h index c79f273..c79f273 100644 --- a/examples/cdbrowse/ball16c.h +++ b/examples/cdrom/cdxa/ball16c.h diff --git a/examples/cdxa/iso.xml b/examples/cdrom/cdxa/iso.xml index 840b414..840b414 100644 --- a/examples/cdxa/iso.xml +++ b/examples/cdrom/cdxa/iso.xml diff --git a/examples/cdxa/main.c b/examples/cdrom/cdxa/main.c index 55cb508..55cb508 100644 --- a/examples/cdxa/main.c +++ b/examples/cdrom/cdxa/main.c diff --git a/examples/cdxa/makefile b/examples/cdrom/cdxa/makefile index 57f1959..8858979 100644 --- a/examples/cdxa/makefile +++ b/examples/cdrom/cdxa/makefile @@ -1,4 +1,4 @@ -include ../sdk-common.mk +include ../../sdk-common.mk TARGET = cdxa.elf @@ -10,15 +10,6 @@ OFILES = $(addprefix build/,$(CFILES:.c=.o) $(CPPFILES:.cpp=.o) $(AFILES:.s=.o) PREFIX = mipsel-unknown-elf- -# Include directories -INCLUDE = -I../../libpsn00b/include - -# Library directories, last entry must point toolchain libraries -LIBDIRS = -L../../libpsn00b - -LIBDIRS += -L$(GCC_BASE)/lib/gcc/mipsel-unknown-elf/$(GCC_VERSION) -INCLUDE += -I$(GCC_BASE)/lib/gcc/mipsel-unknown-elf/$(GCC_VERSION)/include - LIBS = -lpsxcd -lpsxetc -lpsxgpu -lpsxgte -lpsxspu -lpsxsio -lpsxapi -lc CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections @@ -41,6 +32,8 @@ LD = $(PREFIX)ld all: $(OFILES) $(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET) elf2x -q $(TARGET) + +iso: mkpsxiso -y -q iso.xml build/%.o: %.c diff --git a/examples/cdxa/system.cnf b/examples/cdrom/cdxa/system.cnf index e61e50e..e61e50e 100644 --- a/examples/cdxa/system.cnf +++ b/examples/cdrom/cdxa/system.cnf diff --git a/examples/n00bdemo/data.h b/examples/demos/n00bdemo/data.h index 3be0e3d..3be0e3d 100644 --- a/examples/n00bdemo/data.h +++ b/examples/demos/n00bdemo/data.h diff --git a/examples/n00bdemo/data.s b/examples/demos/n00bdemo/data.s index 3ca33cb..3ca33cb 100644 --- a/examples/n00bdemo/data.s +++ b/examples/demos/n00bdemo/data.s diff --git a/examples/n00bdemo/data.xml b/examples/demos/n00bdemo/data.xml index 292a325..292a325 100644 --- a/examples/n00bdemo/data.xml +++ b/examples/demos/n00bdemo/data.xml diff --git a/examples/n00bdemo/data/bulb.smd b/examples/demos/n00bdemo/data/bulb.smd Binary files differindex 9b77c6d..9b77c6d 100644 --- a/examples/n00bdemo/data/bulb.smd +++ b/examples/demos/n00bdemo/data/bulb.smd diff --git a/examples/n00bdemo/data/bulb.smx b/examples/demos/n00bdemo/data/bulb.smx index 89225e6..89225e6 100644 --- a/examples/n00bdemo/data/bulb.smx +++ b/examples/demos/n00bdemo/data/bulb.smx diff --git a/examples/n00bdemo/data/bungirl.smd b/examples/demos/n00bdemo/data/bungirl.smd Binary files differindex 63f96b5..63f96b5 100644 --- a/examples/n00bdemo/data/bungirl.smd +++ b/examples/demos/n00bdemo/data/bungirl.smd diff --git a/examples/n00bdemo/data/bungirl.smx b/examples/demos/n00bdemo/data/bungirl.smx index 6093d70..6093d70 100644 --- a/examples/n00bdemo/data/bungirl.smx +++ b/examples/demos/n00bdemo/data/bungirl.smx diff --git a/examples/n00bdemo/data/bungirl.tim b/examples/demos/n00bdemo/data/bungirl.tim Binary files differindex 11ee9f4..11ee9f4 100644 --- a/examples/n00bdemo/data/bungirl.tim +++ b/examples/demos/n00bdemo/data/bungirl.tim diff --git a/examples/n00bdemo/data/celmapi.bmp b/examples/demos/n00bdemo/data/celmapi.bmp Binary files differindex f44f94f..f44f94f 100644 --- a/examples/n00bdemo/data/celmapi.bmp +++ b/examples/demos/n00bdemo/data/celmapi.bmp diff --git a/examples/n00bdemo/data/celmapi.tim b/examples/demos/n00bdemo/data/celmapi.tim Binary files differindex c043e0b..c043e0b 100644 --- a/examples/n00bdemo/data/celmapi.tim +++ b/examples/demos/n00bdemo/data/celmapi.tim diff --git a/examples/n00bdemo/data/clktower.tim b/examples/demos/n00bdemo/data/clktower.tim Binary files differindex 15c6edc..15c6edc 100644 --- a/examples/n00bdemo/data/clktower.tim +++ b/examples/demos/n00bdemo/data/clktower.tim diff --git a/examples/n00bdemo/data/font.bmp b/examples/demos/n00bdemo/data/font.bmp Binary files differindex 1d078f3..1d078f3 100644 --- a/examples/n00bdemo/data/font.bmp +++ b/examples/demos/n00bdemo/data/font.bmp diff --git a/examples/n00bdemo/data/font.tim b/examples/demos/n00bdemo/data/font.tim Binary files differindex 64cdad2..64cdad2 100644 --- a/examples/n00bdemo/data/font.tim +++ b/examples/demos/n00bdemo/data/font.tim diff --git a/examples/n00bdemo/data/hatkid.png b/examples/demos/n00bdemo/data/hatkid.png Binary files differindex 369ce32..369ce32 100644 --- a/examples/n00bdemo/data/hatkid.png +++ b/examples/demos/n00bdemo/data/hatkid.png diff --git a/examples/n00bdemo/data/hatkid.smd b/examples/demos/n00bdemo/data/hatkid.smd Binary files differindex a68f414..a68f414 100644 --- a/examples/n00bdemo/data/hatkid.smd +++ b/examples/demos/n00bdemo/data/hatkid.smd diff --git a/examples/n00bdemo/data/hatkid.smx b/examples/demos/n00bdemo/data/hatkid.smx index f9e8012..f9e8012 100644 --- a/examples/n00bdemo/data/hatkid.smx +++ b/examples/demos/n00bdemo/data/hatkid.smx diff --git a/examples/n00bdemo/data/hatkid.tim b/examples/demos/n00bdemo/data/hatkid.tim Binary files differindex b2e9318..b2e9318 100644 --- a/examples/n00bdemo/data/hatkid.tim +++ b/examples/demos/n00bdemo/data/hatkid.tim diff --git a/examples/n00bdemo/data/lamelotl16c.png b/examples/demos/n00bdemo/data/lamelotl16c.png Binary files differindex 67490c8..67490c8 100644 --- a/examples/n00bdemo/data/lamelotl16c.png +++ b/examples/demos/n00bdemo/data/lamelotl16c.png diff --git a/examples/n00bdemo/data/lamelotl16c.tim b/examples/demos/n00bdemo/data/lamelotl16c.tim Binary files differindex 194c034..194c034 100644 --- a/examples/n00bdemo/data/lamelotl16c.tim +++ b/examples/demos/n00bdemo/data/lamelotl16c.tim diff --git a/examples/n00bdemo/data/lightworld.smd b/examples/demos/n00bdemo/data/lightworld.smd Binary files differindex 4c1bb59..4c1bb59 100644 --- a/examples/n00bdemo/data/lightworld.smd +++ b/examples/demos/n00bdemo/data/lightworld.smd diff --git a/examples/n00bdemo/data/lightworld.smx b/examples/demos/n00bdemo/data/lightworld.smx index 665e8c9..665e8c9 100644 --- a/examples/n00bdemo/data/lightworld.smx +++ b/examples/demos/n00bdemo/data/lightworld.smx diff --git a/examples/n00bdemo/data/logo.smd b/examples/demos/n00bdemo/data/logo.smd Binary files differindex 9eb1954..9eb1954 100644 --- a/examples/n00bdemo/data/logo.smd +++ b/examples/demos/n00bdemo/data/logo.smd diff --git a/examples/n00bdemo/data/logo.smx b/examples/demos/n00bdemo/data/logo.smx index 1ed0549..1ed0549 100644 --- a/examples/n00bdemo/data/logo.smx +++ b/examples/demos/n00bdemo/data/logo.smx diff --git a/examples/n00bdemo/data/mtekdisk.smd b/examples/demos/n00bdemo/data/mtekdisk.smd Binary files differindex f99bd46..f99bd46 100644 --- a/examples/n00bdemo/data/mtekdisk.smd +++ b/examples/demos/n00bdemo/data/mtekdisk.smd diff --git a/examples/n00bdemo/data/mtekdisk.smx b/examples/demos/n00bdemo/data/mtekdisk.smx index fce2fa2..fce2fa2 100644 --- a/examples/n00bdemo/data/mtekdisk.smx +++ b/examples/demos/n00bdemo/data/mtekdisk.smx diff --git a/examples/n00bdemo/data/mtektext.smd b/examples/demos/n00bdemo/data/mtektext.smd Binary files differindex a158521..a158521 100644 --- a/examples/n00bdemo/data/mtektext.smd +++ b/examples/demos/n00bdemo/data/mtektext.smd diff --git a/examples/n00bdemo/data/mtektext.smx b/examples/demos/n00bdemo/data/mtektext.smx index 50aa59d..50aa59d 100644 --- a/examples/n00bdemo/data/mtektext.smx +++ b/examples/demos/n00bdemo/data/mtektext.smx diff --git a/examples/n00bdemo/data/n00blogo-pixel.png b/examples/demos/n00bdemo/data/n00blogo-pixel.png Binary files differindex db7aa89..db7aa89 100644 --- a/examples/n00bdemo/data/n00blogo-pixel.png +++ b/examples/demos/n00bdemo/data/n00blogo-pixel.png diff --git a/examples/n00bdemo/data/n00blogo-pixel.tim b/examples/demos/n00bdemo/data/n00blogo-pixel.tim Binary files differindex c372593..c372593 100644 --- a/examples/n00bdemo/data/n00blogo-pixel.tim +++ b/examples/demos/n00bdemo/data/n00blogo-pixel.tim diff --git a/examples/n00bdemo/data/petscum.smd b/examples/demos/n00bdemo/data/petscum.smd Binary files differindex 9a1c8eb..9a1c8eb 100644 --- a/examples/n00bdemo/data/petscum.smd +++ b/examples/demos/n00bdemo/data/petscum.smd diff --git a/examples/n00bdemo/data/petscum.smx b/examples/demos/n00bdemo/data/petscum.smx index 8f1b9e5..8f1b9e5 100644 --- a/examples/n00bdemo/data/petscum.smx +++ b/examples/demos/n00bdemo/data/petscum.smx diff --git a/examples/n00bdemo/data/petscum16c.png b/examples/demos/n00bdemo/data/petscum16c.png Binary files differindex c9d115c..c9d115c 100644 --- a/examples/n00bdemo/data/petscum16c.png +++ b/examples/demos/n00bdemo/data/petscum16c.png diff --git a/examples/n00bdemo/data/petscum16c.tim b/examples/demos/n00bdemo/data/petscum16c.tim Binary files differindex 18af842..18af842 100644 --- a/examples/n00bdemo/data/petscum16c.tim +++ b/examples/demos/n00bdemo/data/petscum16c.tim diff --git a/examples/n00bdemo/data/psn00blogo.smd b/examples/demos/n00bdemo/data/psn00blogo.smd Binary files differindex 3c1412a..3c1412a 100644 --- a/examples/n00bdemo/data/psn00blogo.smd +++ b/examples/demos/n00bdemo/data/psn00blogo.smd diff --git a/examples/n00bdemo/data/psn00blogo.smx b/examples/demos/n00bdemo/data/psn00blogo.smx index 0921b6c..0921b6c 100644 --- a/examples/n00bdemo/data/psn00blogo.smx +++ b/examples/demos/n00bdemo/data/psn00blogo.smx diff --git a/examples/n00bdemo/data/rbowshade.smd b/examples/demos/n00bdemo/data/rbowshade.smd Binary files differindex c218d05..c218d05 100644 --- a/examples/n00bdemo/data/rbowshade.smd +++ b/examples/demos/n00bdemo/data/rbowshade.smd diff --git a/examples/n00bdemo/data/rbowshade.smx b/examples/demos/n00bdemo/data/rbowshade.smx index 6648b5d..6648b5d 100644 --- a/examples/n00bdemo/data/rbowshade.smx +++ b/examples/demos/n00bdemo/data/rbowshade.smx diff --git a/examples/n00bdemo/data/riftbld1.tim b/examples/demos/n00bdemo/data/riftbld1.tim Binary files differindex 5581bb3..5581bb3 100644 --- a/examples/n00bdemo/data/riftbld1.tim +++ b/examples/demos/n00bdemo/data/riftbld1.tim diff --git a/examples/n00bdemo/data/riftbld2.tim b/examples/demos/n00bdemo/data/riftbld2.tim Binary files differindex 4048024..4048024 100644 --- a/examples/n00bdemo/data/riftbld2.tim +++ b/examples/demos/n00bdemo/data/riftbld2.tim diff --git a/examples/n00bdemo/data/star.smd b/examples/demos/n00bdemo/data/star.smd Binary files differindex 68a5725..68a5725 100644 --- a/examples/n00bdemo/data/star.smd +++ b/examples/demos/n00bdemo/data/star.smd diff --git a/examples/n00bdemo/data/star.smx b/examples/demos/n00bdemo/data/star.smx index c91947e..c91947e 100644 --- a/examples/n00bdemo/data/star.smx +++ b/examples/demos/n00bdemo/data/star.smx diff --git a/examples/n00bdemo/data/star_mask.smd b/examples/demos/n00bdemo/data/star_mask.smd Binary files differindex fe624fe..fe624fe 100644 --- a/examples/n00bdemo/data/star_mask.smd +++ b/examples/demos/n00bdemo/data/star_mask.smd diff --git a/examples/n00bdemo/data/star_mask.smx b/examples/demos/n00bdemo/data/star_mask.smx index 695bd47..695bd47 100644 --- a/examples/n00bdemo/data/star_mask.smx +++ b/examples/demos/n00bdemo/data/star_mask.smx diff --git a/examples/n00bdemo/data/timerift.smd b/examples/demos/n00bdemo/data/timerift.smd Binary files differindex dc22e4d..dc22e4d 100644 --- a/examples/n00bdemo/data/timerift.smd +++ b/examples/demos/n00bdemo/data/timerift.smd diff --git a/examples/n00bdemo/data/timerift.smx b/examples/demos/n00bdemo/data/timerift.smx index 38d53f6..38d53f6 100644 --- a/examples/n00bdemo/data/timerift.smx +++ b/examples/demos/n00bdemo/data/timerift.smx diff --git a/examples/n00bdemo/disp.c b/examples/demos/n00bdemo/disp.c index d798ee9..d798ee9 100644 --- a/examples/n00bdemo/disp.c +++ b/examples/demos/n00bdemo/disp.c diff --git a/examples/n00bdemo/disp.h b/examples/demos/n00bdemo/disp.h index ecf6dcf..ecf6dcf 100644 --- a/examples/n00bdemo/disp.h +++ b/examples/demos/n00bdemo/disp.h diff --git a/examples/n00bdemo/lightdemo.c b/examples/demos/n00bdemo/lightdemo.c index ff858c0..ff858c0 100644 --- a/examples/n00bdemo/lightdemo.c +++ b/examples/demos/n00bdemo/lightdemo.c diff --git a/examples/n00bdemo/logo.c b/examples/demos/n00bdemo/logo.c index 3fdef5e..3fdef5e 100644 --- a/examples/n00bdemo/logo.c +++ b/examples/demos/n00bdemo/logo.c diff --git a/examples/n00bdemo/logo.h b/examples/demos/n00bdemo/logo.h index 6429c8e..6429c8e 100644 --- a/examples/n00bdemo/logo.h +++ b/examples/demos/n00bdemo/logo.h diff --git a/examples/n00bdemo/main.c b/examples/demos/n00bdemo/main.c index a6eb57e..a6eb57e 100644 --- a/examples/n00bdemo/main.c +++ b/examples/demos/n00bdemo/main.c diff --git a/examples/n00bdemo/makefile b/examples/demos/n00bdemo/makefile index 96275fb..63dc345 100644 --- a/examples/n00bdemo/makefile +++ b/examples/demos/n00bdemo/makefile @@ -1,4 +1,4 @@ -include ../sdk-common.mk +include ../../sdk-common.mk TARGET = demo.elf @@ -7,8 +7,7 @@ AFILES = $(notdir $(wildcard *.s)) OFILES = $(addprefix build/,$(CFILES:.c=.o) $(AFILES:.s=.o)) -INCLUDE += -I../../libpsn00b/lzp -LIBDIRS += -L../../libpsn00b/lzp +INCLUDE += -I../../../libpsn00b/lzp LIBS = -llzp -lc -lpsxetc -lpsxgpu -lpsxgte -lpsxspu -lpsxapi -lc diff --git a/examples/n00bdemo/overlay.c b/examples/demos/n00bdemo/overlay.c index 847bc96..847bc96 100644 --- a/examples/n00bdemo/overlay.c +++ b/examples/demos/n00bdemo/overlay.c diff --git a/examples/n00bdemo/plasma_tbl.c b/examples/demos/n00bdemo/plasma_tbl.c index af6654a..af6654a 100644 --- a/examples/n00bdemo/plasma_tbl.c +++ b/examples/demos/n00bdemo/plasma_tbl.c diff --git a/examples/n00bdemo/plasma_tbl.h b/examples/demos/n00bdemo/plasma_tbl.h index dd322e6..dd322e6 100644 --- a/examples/n00bdemo/plasma_tbl.h +++ b/examples/demos/n00bdemo/plasma_tbl.h diff --git a/examples/n00bdemo/plasmagen.s b/examples/demos/n00bdemo/plasmagen.s index 07b3f48..07b3f48 100644 --- a/examples/n00bdemo/plasmagen.s +++ b/examples/demos/n00bdemo/plasmagen.s diff --git a/examples/n00bdemo/scrolltext.c b/examples/demos/n00bdemo/scrolltext.c index e844f21..e844f21 100644 --- a/examples/n00bdemo/scrolltext.c +++ b/examples/demos/n00bdemo/scrolltext.c diff --git a/examples/n00bdemo/smd.h b/examples/demos/n00bdemo/smd.h index 29c2812..29c2812 100644 --- a/examples/n00bdemo/smd.h +++ b/examples/demos/n00bdemo/smd.h diff --git a/examples/n00bdemo/smd.s b/examples/demos/n00bdemo/smd.s index f9cf2fe..f9cf2fe 100644 --- a/examples/n00bdemo/smd.s +++ b/examples/demos/n00bdemo/smd.s diff --git a/examples/n00bdemo/smd_cel.s b/examples/demos/n00bdemo/smd_cel.s index ece0dd8..ece0dd8 100644 --- a/examples/n00bdemo/smd_cel.s +++ b/examples/demos/n00bdemo/smd_cel.s diff --git a/examples/n00bdemo/smd_flat.s b/examples/demos/n00bdemo/smd_flat.s index 0d48c63..0d48c63 100644 --- a/examples/n00bdemo/smd_flat.s +++ b/examples/demos/n00bdemo/smd_flat.s diff --git a/examples/n00bdemo/smd_s.h b/examples/demos/n00bdemo/smd_s.h index 4dca4dd..4dca4dd 100644 --- a/examples/n00bdemo/smd_s.h +++ b/examples/demos/n00bdemo/smd_s.h diff --git a/examples/n00bdemo/smdparser.s b/examples/demos/n00bdemo/smdparser.s index 379690f..379690f 100644 --- a/examples/n00bdemo/smdparser.s +++ b/examples/demos/n00bdemo/smdparser.s diff --git a/examples/cdxa/ball16c.h b/examples/graphics/balls/ball16c.h index c79f273..c79f273 100644 --- a/examples/cdxa/ball16c.h +++ b/examples/graphics/balls/ball16c.h diff --git a/examples/balls/ball16c.tim b/examples/graphics/balls/ball16c.tim Binary files differindex e2a5d17..e2a5d17 100644 --- a/examples/balls/ball16c.tim +++ b/examples/graphics/balls/ball16c.tim diff --git a/examples/balls/main.c b/examples/graphics/balls/main.c index 89c8063..89c8063 100644 --- a/examples/balls/main.c +++ b/examples/graphics/balls/main.c diff --git a/examples/balls/makefile b/examples/graphics/balls/makefile index e0f6bc3..50ed0f1 100644 --- a/examples/balls/makefile +++ b/examples/graphics/balls/makefile @@ -1,4 +1,4 @@ -include ../sdk-common.mk +include ../../sdk-common.mk # Project target name TARGET = balls.elf diff --git a/examples/billboard/billboard.c b/examples/graphics/billboard/billboard.c index bba5dda..bba5dda 100644 --- a/examples/billboard/billboard.c +++ b/examples/graphics/billboard/billboard.c diff --git a/examples/billboard/makefile b/examples/graphics/billboard/makefile index 4c22b0c..d6add7a 100644 --- a/examples/billboard/makefile +++ b/examples/graphics/billboard/makefile @@ -1,4 +1,4 @@ -include ../sdk-common.mk +include ../../sdk-common.mk TARGET = billboard.elf diff --git a/examples/billboard/texture64.tim b/examples/graphics/billboard/texture64.tim Binary files differindex d3aff3a..d3aff3a 100644 --- a/examples/billboard/texture64.tim +++ b/examples/graphics/billboard/texture64.tim diff --git a/examples/billboard/tim.s b/examples/graphics/billboard/tim.s index 1fa8d69..1fa8d69 100644 --- a/examples/billboard/tim.s +++ b/examples/graphics/billboard/tim.s diff --git a/examples/fpscam/clip.c b/examples/graphics/fpscam/clip.c index 7f2b780..7f2b780 100644 --- a/examples/fpscam/clip.c +++ b/examples/graphics/fpscam/clip.c diff --git a/examples/fpscam/clip.h b/examples/graphics/fpscam/clip.h index 3b428bb..3b428bb 100644 --- a/examples/fpscam/clip.h +++ b/examples/graphics/fpscam/clip.h diff --git a/examples/fpscam/lookat.c b/examples/graphics/fpscam/lookat.c index d7c9ce4..d7c9ce4 100644 --- a/examples/fpscam/lookat.c +++ b/examples/graphics/fpscam/lookat.c diff --git a/examples/fpscam/lookat.h b/examples/graphics/fpscam/lookat.h index c57e50a..c57e50a 100644 --- a/examples/fpscam/lookat.h +++ b/examples/graphics/fpscam/lookat.h diff --git a/examples/fpscam/main.c b/examples/graphics/fpscam/main.c index 9dedf06..9dedf06 100644 --- a/examples/fpscam/main.c +++ b/examples/graphics/fpscam/main.c diff --git a/examples/fpscam/makefile b/examples/graphics/fpscam/makefile index 4f344eb..339bb91 100644 --- a/examples/fpscam/makefile +++ b/examples/graphics/fpscam/makefile @@ -1,4 +1,4 @@ -include ../sdk-common.mk +include ../../sdk-common.mk TARGET = fpscam.elf diff --git a/examples/gte/main.c b/examples/graphics/gte/main.c index 432ef95..432ef95 100644 --- a/examples/gte/main.c +++ b/examples/graphics/gte/main.c diff --git a/examples/gte/makefile b/examples/graphics/gte/makefile index 2be2374..8b3f81f 100644 --- a/examples/gte/makefile +++ b/examples/graphics/gte/makefile @@ -1,4 +1,4 @@ -include ../sdk-common.mk +include ../../sdk-common.mk TARGET = gte.elf diff --git a/examples/render2tex/blendpattern-16c.png b/examples/graphics/render2tex/blendpattern-16c.png Binary files differindex 74ac945..74ac945 100644 --- a/examples/render2tex/blendpattern-16c.png +++ b/examples/graphics/render2tex/blendpattern-16c.png diff --git a/examples/render2tex/blendpattern-16c.tim b/examples/graphics/render2tex/blendpattern-16c.tim Binary files differindex 2fff580..2fff580 100644 --- a/examples/render2tex/blendpattern-16c.tim +++ b/examples/graphics/render2tex/blendpattern-16c.tim diff --git a/examples/render2tex/blendpattern.png b/examples/graphics/render2tex/blendpattern.png Binary files differindex 49af62c..49af62c 100644 --- a/examples/render2tex/blendpattern.png +++ b/examples/graphics/render2tex/blendpattern.png diff --git a/examples/render2tex/main.c b/examples/graphics/render2tex/main.c index 6ae450a..6ae450a 100644 --- a/examples/render2tex/main.c +++ b/examples/graphics/render2tex/main.c diff --git a/examples/render2tex/makefile b/examples/graphics/render2tex/makefile index 59ff579..aaa3b1d 100644 --- a/examples/render2tex/makefile +++ b/examples/graphics/render2tex/makefile @@ -1,4 +1,4 @@ -include ../sdk-common.mk +include ../../sdk-common.mk TARGET = render2tex.elf diff --git a/examples/render2tex/texture.s b/examples/graphics/render2tex/texture.s index e786dce..e786dce 100644 --- a/examples/render2tex/texture.s +++ b/examples/graphics/render2tex/texture.s diff --git a/examples/rgb24/bunpattern.tim b/examples/graphics/rgb24/bunpattern.tim Binary files differindex f233453..f233453 100644 --- a/examples/rgb24/bunpattern.tim +++ b/examples/graphics/rgb24/bunpattern.tim diff --git a/examples/rgb24/main.c b/examples/graphics/rgb24/main.c index 9f1a647..9f1a647 100644 --- a/examples/rgb24/main.c +++ b/examples/graphics/rgb24/main.c diff --git a/examples/rgb24/makefile b/examples/graphics/rgb24/makefile index eea866d..61ef24f 100644 --- a/examples/rgb24/makefile +++ b/examples/graphics/rgb24/makefile @@ -1,4 +1,4 @@ -include ../sdk-common.mk +include ../../sdk-common.mk TARGET = rgb24.elf diff --git a/examples/rgb24/tim.s b/examples/graphics/rgb24/tim.s index a4432d9..a4432d9 100644 --- a/examples/rgb24/tim.s +++ b/examples/graphics/rgb24/tim.s diff --git a/examples/cartrom/bios.inc b/examples/lowlevel/cartrom/bios.inc index 1c0201d..1c0201d 100644 --- a/examples/cartrom/bios.inc +++ b/examples/lowlevel/cartrom/bios.inc diff --git a/examples/cartrom/cop0.inc b/examples/lowlevel/cartrom/cop0.inc index 620fa44..620fa44 100644 --- a/examples/cartrom/cop0.inc +++ b/examples/lowlevel/cartrom/cop0.inc diff --git a/examples/cartrom/makefile b/examples/lowlevel/cartrom/makefile index 2434685..2434685 100644 --- a/examples/cartrom/makefile +++ b/examples/lowlevel/cartrom/makefile diff --git a/examples/cartrom/parse.inc b/examples/lowlevel/cartrom/parse.inc index b1190f7..b1190f7 100644 --- a/examples/cartrom/parse.inc +++ b/examples/lowlevel/cartrom/parse.inc diff --git a/examples/cartrom/readme.txt b/examples/lowlevel/cartrom/readme.txt index 8d11a7f..8d11a7f 100644 --- a/examples/cartrom/readme.txt +++ b/examples/lowlevel/cartrom/readme.txt diff --git a/examples/cartrom/rom.ld b/examples/lowlevel/cartrom/rom.ld index f3f9cd3..f3f9cd3 100644 --- a/examples/cartrom/rom.ld +++ b/examples/lowlevel/cartrom/rom.ld diff --git a/examples/cartrom/rom.s b/examples/lowlevel/cartrom/rom.s index 14c1167..14c1167 100644 --- a/examples/cartrom/rom.s +++ b/examples/lowlevel/cartrom/rom.s diff --git a/examples/makefile b/examples/makefile index 4c4aadf..00911a6 100644 --- a/examples/makefile +++ b/examples/makefile @@ -1,11 +1,27 @@ # Run using make (Linux) or gmake (BSD) # Part of the PSn00bSDK Project -# 2019 Lameguy64 / Meido-Tek Productions +# 2019-2020 Lameguy64 / Meido-Tek Productions TOPTARGETS = all clean -DIRS = balls gte n00bdemo fpscam childexec render2tex rgb24 timer billboard +# Beginner examples +DIRS = beginner/hello +# Graphics examples +DIRS += graphics/balls graphics/billboard graphics/fpscam graphics/gte \ + graphics/render2tex graphics/rgb24 + +# System related examples +DIRS += system/childexec system/console system/timer + +# Low-level examples +DIRS += lowlevel/cartrom + +# CD-ROM examples +DIRS += cdrom/cdbrowse cdrom/cdxa + +# Demos +DIRS += demos/n00bdemo $(TOPTARGETS): $(DIRS) $(DIRS): diff --git a/examples/sdk-common.mk b/examples/sdk-common.mk index 312fda3..0503b57 100644 --- a/examples/sdk-common.mk +++ b/examples/sdk-common.mk @@ -5,10 +5,10 @@ PREFIX = mipsel-unknown-elf- # Include directories -INCLUDE = -I../../libpsn00b/include +INCLUDE = -I../../../libpsn00b/include # Library directories, last entry must point toolchain libraries -LIBDIRS = -L../../libpsn00b +LIBDIRS = -L../../../libpsn00b ifndef GCC_VERSION diff --git a/examples/childexec/ball16c.h b/examples/system/childexec/ball16c.h index c79f273..c79f273 100644 --- a/examples/childexec/ball16c.h +++ b/examples/system/childexec/ball16c.h diff --git a/examples/childexec/child.c b/examples/system/childexec/child.c index fb38b63..fb38b63 100644 --- a/examples/childexec/child.c +++ b/examples/system/childexec/child.c diff --git a/examples/childexec/child_exe.s b/examples/system/childexec/child_exe.s index 842ac88..842ac88 100644 --- a/examples/childexec/child_exe.s +++ b/examples/system/childexec/child_exe.s diff --git a/examples/childexec/makefile b/examples/system/childexec/makefile index 9cf7218..79a27b6 100644 --- a/examples/childexec/makefile +++ b/examples/system/childexec/makefile @@ -1,4 +1,4 @@ -include ../sdk-common.mk +include ../../sdk-common.mk INCLUDE += LIBDIRS += diff --git a/examples/childexec/parent.c b/examples/system/childexec/parent.c index 7f577e4..7f577e4 100644 --- a/examples/childexec/parent.c +++ b/examples/system/childexec/parent.c diff --git a/examples/system/console/ball16c.h b/examples/system/console/ball16c.h new file mode 100644 index 0000000..c79f273 --- /dev/null +++ b/examples/system/console/ball16c.h @@ -0,0 +1,16 @@ +unsigned int ball16c_size=192; +unsigned char ball16c[] = { +0x10,0x00,0x00,0x00,0x08,0x00,0x00,0x00,0x2c,0x00,0x00,0x00,0xc0,0x03,0x10, +0x01,0x10,0x00,0x01,0x00,0x00,0x00,0x31,0xc6,0x73,0xce,0x94,0xd2,0x07,0x9d, +0xd6,0xda,0x38,0xe3,0xef,0xbd,0x9b,0xef,0x8c,0xb1,0xc6,0x98,0xde,0xfb,0x4a, +0xa9,0xa4,0x90,0xad,0xb5,0x00,0x00,0x8c,0x00,0x00,0x00,0xc0,0x03,0x00,0x01, +0x04,0x00,0x10,0x00,0x00,0x00,0x10,0x22,0x12,0x02,0x00,0x00,0x00,0x10,0x32, +0x33,0x23,0x11,0x04,0x00,0x00,0x23,0x55,0x66,0x35,0x72,0x47,0x00,0x20,0x52, +0x86,0x68,0x36,0x12,0x97,0x0a,0x20,0x65,0xbb,0x8b,0x36,0x12,0x91,0x04,0x31, +0x85,0xbb,0x68,0x35,0x12,0x97,0xdc,0x32,0x86,0x8b,0x56,0x35,0x73,0x97,0xa4, +0x32,0x66,0x68,0x55,0x23,0x71,0x9e,0xac,0x32,0x65,0x56,0x33,0x13,0x71,0xce, +0xa4,0x21,0x33,0x33,0x23,0x11,0xe7,0xc9,0xd4,0x12,0x22,0x22,0x13,0x71,0xe7, +0xc9,0xda,0x10,0x17,0x11,0x77,0x77,0x9e,0x4c,0x0d,0x40,0x77,0x71,0xe7,0x9e, +0xc9,0xd4,0x0d,0x00,0x94,0x99,0x99,0xcc,0x4c,0xda,0x00,0x00,0xa0,0xc4,0xc4, +0x44,0xda,0x0d,0x00,0x00,0x00,0xd0,0xaa,0xda,0x0d,0x00,0x00 +}; diff --git a/examples/system/console/main.c b/examples/system/console/main.c new file mode 100644 index 0000000..988b428 --- /dev/null +++ b/examples/system/console/main.c @@ -0,0 +1,284 @@ +/* + * LibPSn00b Example Programs + * + * Text Console Example + * 2020 Meido-Tek Productions / PSn00bSDK Project + * + * This example demonstrates a tty text console implementation for gameplay + * sections, or sections with continuously updating graphics. The console is + * brought up by the tilde key in which, execution of the gameplay section would + * get paused until the console is exited. A fully asynchronous implementation + * should be possible, but this is beyond the scope of this simple example. + * + * + * Example by Lameguy64 + * + * Changelog: + * + * April 23, 2020 - Initial version. + * + */ + +#include <stdio.h> +#include <stdlib.h> +#include <string.h> +#include <ioctl.h> +#include <sys/fcntl.h> +#include <psxapi.h> +#include <psxetc.h> +#include <psxgte.h> +#include <psxgpu.h> +#include <psxsio.h> +#include "ball16c.h" + + +#define MAX_BALLS 1024 + +#define OT_LEN 8 + +#define SCREEN_XRES 640 +#define SCREEN_YRES 480 + +#define CENTER_X SCREEN_XRES/2 +#define CENTER_Y SCREEN_YRES/2 + + +/* Display and drawing environments */ +DISPENV disp; +DRAWENV draw; + +char pribuff[2][65536]; /* Primitive packet buffers */ +unsigned int ot[2][OT_LEN]; /* Ordering tables */ +char *nextpri; /* Pointer to next packet buffer offset */ +int db = 0; /* Double buffer index */ + + +/* Ball struct and array */ +typedef struct { + short x,y; + short xdir,ydir; + unsigned char r,g,b,p; +} BALL_TYPE; + +BALL_TYPE balls[MAX_BALLS]; + + +/* TIM image parameters for loading the ball texture and drawing sprites */ +TIM_IMAGE tim; + + +void init() { + + int i; + + /* Reset GPU (also installs event handler for VSync) */ + printf("Init GPU... "); + ResetGraph( 0 ); + printf("Done.\n"); + + + printf("Set video mode... "); + + /* Set display and draw environment parameters */ + SetDefDispEnv( &disp, 0, 0, SCREEN_XRES, SCREEN_YRES ); + SetDefDrawEnv( &draw, 0, 0, SCREEN_XRES, SCREEN_YRES ); + disp.isinter = 1; /* Enable interlace (required for hires) */ + + /* Set clear color, area clear and dither processing */ + setRGB0( &draw, 63, 0, 127 ); + draw.isbg = 1; + draw.dtd = 1; + + /* Apply the display and drawing environments */ + PutDispEnv( &disp ); + PutDrawEnv( &draw ); + + /* Enable video output */ + SetDispMask( 1 ); + + printf("Done.\n"); + + + /* Upload the ball texture */ + printf("Upload texture... "); + GetTimInfo( (unsigned int*)ball16c, &tim ); /* Get TIM parameters */ + + LoadImage( tim.prect, tim.paddr ); /* Upload texture to VRAM */ + if( tim.mode & 0x8 ) { + LoadImage( tim.crect, tim.caddr ); /* Upload CLUT if present */ + } + + printf("Done.\n"); + + + /* Calculate ball positions */ + printf("Calculating balls... "); + + for( i=0; i<MAX_BALLS; i++ ) + { + balls[i].x = (rand()%624); + balls[i].y = (rand()%464); + balls[i].xdir = 1-(rand()%3); + balls[i].ydir = 1-(rand()%3); + if( !balls[i].xdir ) balls[i].xdir = 1; + if( !balls[i].ydir ) balls[i].ydir = 1; + balls[i].xdir *= 2; + balls[i].ydir *= 2; + balls[i].r = (rand()%256); + balls[i].g = (rand()%256); + balls[i].b = (rand()%256); + } + + printf("Done.\n"); + +} + + +void do_console(void) +{ + char line[32]; + + /* Print console banner */ + printf("\nConsole mode! Enter 'exit' to return to gameplay.\n"); + + /* The parser loop */ + while(1) + { + /* Print a prompt character and read a line of input */ + putchar('>'); + gets(line); + + /* Exit the parser if the text entered is exit */ + if( strcmp(line, "exit") == 0 ) + break; + + /* Print the input */ + printf("You entered: %s\n", line); + } +} + + +int main(int argc, const char* argv[]) { + + SPRT_16 *sprt; + DR_TPAGE *tpri; + + int i,counter=0; + + + /* Init graphics and stuff before doing anything else */ + init(); + + + /* Uncomment this line if you don't have tty interfaces + * provided by n00brom or similar development environments with tty */ + AddSIO(115200); + + + /* Main loop */ + printf("Entering loop...\n"); + + while(1) + { + /* FIOCSCAN will return a non-zero value when there's + * input pending in tty, file handle 0 is usually stdin */ + if( ioctl(0, FIOCSCAN, 0) ) + { + /* Get the character */ + i = getchar(); + + /* If the key that's pressed is a tilde, enter the console */ + if( i == '`' ) + do_console(); + } + + /* Clear ordering table and set start address of primitive + * buffer for next frame */ + ClearOTagR(ot[db], OT_LEN); + nextpri = pribuff[db]; + + /* Sort a balls snake */ + sprt = (SPRT_16*)nextpri; + srand(64); + for( i=0; i<32; i++ ) + { + setSprt16(sprt); + setXY0(sprt, + (CENTER_X-8)+(isin((counter-(i<<4))<<3)>>5), + (CENTER_Y-8)-(icos((counter-(i<<2))<<3)>>5)); + setRGB0(sprt, rand()%256, rand()%256, rand()%256); + setUV0(sprt, 0, 0); + setClut(sprt, tim.crect->x, tim.crect->y); + + addPrim(ot[db]+(OT_LEN-1), sprt); + sprt++; + + } + + /* Sort the balls */ + for( i=0; i<MAX_BALLS; i++ ) + { + setSprt16(sprt); + setXY0(sprt, balls[i].x, balls[i].y); + setRGB0(sprt, balls[i].r, balls[i].g, balls[i].b); + setUV0(sprt, 0, 0 ); + setClut(sprt, tim.crect->x, tim.crect->y); + + addPrim(ot[db]+(OT_LEN-1), sprt); + sprt++; + + balls[i].x += balls[i].xdir; + balls[i].y += balls[i].ydir; + + if( ( balls[i].x+16 ) > 640 ) + { + balls[i].xdir = -2; + } + else if( balls[i].x < 0 ) + { + balls[i].xdir = 2; + } + + if( ( balls[i].y+16 ) > 480 ) + { + balls[i].ydir = -2; + } + else if( balls[i].y < 0 ) + { + balls[i].ydir = 2; + } + + } + + nextpri = (char*)sprt; + + + /* Sort a TPage primitive so the sprites will draw pixels from + * the correct texture page in VRAM */ + tpri = (DR_TPAGE*)nextpri; + setDrawTPage(tpri, 0, 0, + getTPage(0, 0, tim.prect->x, tim.prect->y)); + addPrim(ot[db]+(OT_LEN-1), tpri); + nextpri += sizeof(DR_TPAGE); + + /* Wait for GPU and VSync */ + DrawSync(0); + VSync(0); + + /* Since draw.isbg is non-zero this clears the screen */ + PutDrawEnv(&draw); + + /* Begin drawing the new frame */ + DrawOTag(ot[db]+(OT_LEN-1)); + + /* Alternate to the next buffer */ + db = !db; + + /* Increment counter for the snake animation */ + counter++; + + } + + return 0; + +} diff --git a/examples/system/console/makefile b/examples/system/console/makefile new file mode 100644 index 0000000..0c27b55 --- /dev/null +++ b/examples/system/console/makefile @@ -0,0 +1,60 @@ +include ../../sdk-common.mk + +# Project target name +TARGET = console.elf + +# Searches for C, C++ and S (assembler) files in local directory +CFILES = $(notdir $(wildcard *.c)) +CPPFILES = $(notdir $(wildcard *.cpp)) +AFILES = $(notdir $(wildcard *.s)) + +# Determine object files +OFILES = $(addprefix build/,$(CFILES:.c=.o)) \ + $(addprefix build/,$(CPPFILES:.cpp=.o)) \ + $(addprefix build/,$(AFILES:.s=.o)) + +# Project specific include and library directories +# (use -I for include dirs, -L for library dirs) +INCLUDE += +LIBDIRS += + +# Libraries to link +LIBS = -lpsxsio -lpsxetc -lpsxgpu -lpsxgte -lpsxspu -lpsxapi -lc + +# C compiler flags +CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections + +# C++ compiler flags +CPPFLAGS = $(CFLAGS) -fno-exceptions + +# Assembler flags +AFLAGS = -g -msoft-float + +# Linker flags +LDFLAGS = -g -Ttext=0x80010000 -gc-sections \ + -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x + +# Toolchain programs +CC = $(PREFIX)gcc +CXX = $(PREFIX)g++ +AS = $(PREFIX)as +LD = $(PREFIX)ld + +all: $(OFILES) + $(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET) + elf2x -q $(TARGET) + +build/%.o: %.c + @mkdir -p $(dir $@) + $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ + +build/%.o: %.cpp + @mkdir -p $(dir $@) + $(CXX) $(AFLAGS) $(INCLUDE) -c $< -o $@ + +build/%.o: %.s + @mkdir -p $(dir $@) + $(CC) $(AFLAGS) $(INCLUDE) -c $< -o $@ + +clean: + rm -rf build $(TARGET) $(TARGET:.elf=.exe) diff --git a/examples/timer/main.c b/examples/system/timer/main.c index 7d9f7b3..7d9f7b3 100644 --- a/examples/timer/main.c +++ b/examples/system/timer/main.c diff --git a/examples/timer/makefile b/examples/system/timer/makefile index 0c1340d..c35c445 100644 --- a/examples/timer/makefile +++ b/examples/system/timer/makefile @@ -1,4 +1,4 @@ -include ../sdk-common.mk +include ../../sdk-common.mk TARGET = timer.elf diff --git a/examples/system/tty/main.c b/examples/system/tty/main.c new file mode 100644 index 0000000..8333746 --- /dev/null +++ b/examples/system/tty/main.c @@ -0,0 +1,145 @@ +/* + * LibPSn00b Example Programs + * + * Teletype Example + * 2020 Meido-Tek Productions / PSn00bSDK Project + * + * This example showcases the uses of tty through stdio facilities. If you've + * written text console applications before, this one is not too dissimilar to + * that. Escape codes for formatting and such should work as this is more + * dependant on the terminal program used than the PS1 console itself. + * + * + * Example by Lameguy64 + * + * Changelog: + * + * April 23, 2020 - Initial version. + * + */ + +#include <stdio.h> +#include <ctype.h> +#include <psxgpu.h> + +/* Memory viewer thing, you may use this in your own applications + * for testing or analysis */ +void memory_browser(unsigned int addr) +{ + int i,j,key; + unsigned char *ptr,*pptr; + + while(1) + { + /* Set cursor position to top-left */ + printf("\033[1;1H"); + printf("MEMVIEW 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F 0123456789ABCDEF"); + + ptr = (unsigned char*)addr; + + /* Print contents from current location of memory */ + for(j=0; j<23; j++) + { + printf("\n%04X: ", (unsigned int)ptr); + pptr = ptr; + for(i=0; i<16; i++) + { + printf("%02X ", *ptr); + ptr++; + } + printf(" "); + for(i=0; i<16; i++) + { + if(( *pptr < 32 ) || ( *pptr > 127 ) ) + { + printf("."); + } + else + { + printf("%c", *pptr); + } + pptr++; + } + } + + /* Parse input */ + while(1) + { + key = getchar(); + if( key == 0x1B ) + { + key = getchar(); + + if( key == 0x5B ) + { + key = getchar(); + if( key == 0x41 ) // Up + { + addr -= 16; + break; + } + else if( key == 0x42 ) // Down + { + addr += 16; + break; + } + if( key == 0x35 ) // Page up + { + addr -= 16*23; + break; + } + else if( key == 0x36 ) // Page down + { + addr += 16*23; + break; + } + } + } + + } + } + +} + + +int main(int argc, const char *argv[]) +{ + int i; + char strbuff[32]; + + /* Mostly to get interrupts going for this example */ + ResetGraph( 0 ); + + /* Uncomment if you don't have an environment that provides tty access + * by default */ + //AddSIO(115200); + + /* A standby loop until 'Y' is entered */ + while(1) + { + /* Print banner */ + printf("Hello world!\n"); + printf("Press 'Y' to proceed with this demonstration.\n"); + + /* Get input for a Y character */ + i = getchar(); + if( tolower(i) == 'y' ) + break; + } + + /* Do a classic text input prompt and display the inputted text */ + printf("Enter a string, any string (no more than 32 characters):\n"); + gets(strbuff); + + printf("You've entered: %s\n\n", strbuff); + + /* Prompt entering into the memory browser */ + printf("Press a key to enter a memory browser demo...\n"); + printf("Make sure your terminal or text console supports vt100 escape codes!\n"); + getchar(); + + /* Start the memory browser interface */ + memory_browser(0x80010000); + + return 0; +} diff --git a/examples/system/tty/makefile b/examples/system/tty/makefile new file mode 100644 index 0000000..a3884ad --- /dev/null +++ b/examples/system/tty/makefile @@ -0,0 +1,60 @@ +include ../../sdk-common.mk + +# Project target name +TARGET = tty.elf + +# Searches for C, C++ and S (assembler) files in local directory +CFILES = $(notdir $(wildcard *.c)) +CPPFILES = $(notdir $(wildcard *.cpp)) +AFILES = $(notdir $(wildcard *.s)) + +# Determine object files +OFILES = $(addprefix build/,$(CFILES:.c=.o)) \ + $(addprefix build/,$(CPPFILES:.cpp=.o)) \ + $(addprefix build/,$(AFILES:.s=.o)) + +# Project specific include and library directories +# (use -I for include dirs, -L for library dirs) +INCLUDE += +LIBDIRS += + +# Libraries to link +LIBS = -lpsxetc -lpsxgpu -lpsxgte -lpsxspu -lpsxapi -lc + +# C compiler flags +CFLAGS = -g -O2 -fno-builtin -fdata-sections -ffunction-sections + +# C++ compiler flags +CPPFLAGS = $(CFLAGS) -fno-exceptions + +# Assembler flags +AFLAGS = -g -msoft-float + +# Linker flags +LDFLAGS = -g -Ttext=0x80010000 -gc-sections \ + -T $(GCC_BASE)/mipsel-unknown-elf/lib/ldscripts/elf32elmip.x + +# Toolchain programs +CC = $(PREFIX)gcc +CXX = $(PREFIX)g++ +AS = $(PREFIX)as +LD = $(PREFIX)ld + +all: $(OFILES) + $(LD) $(LDFLAGS) $(LIBDIRS) $(OFILES) $(LIBS) -o $(TARGET) + elf2x -q $(TARGET) + +build/%.o: %.c + @mkdir -p $(dir $@) + $(CC) $(CFLAGS) $(INCLUDE) -c $< -o $@ + +build/%.o: %.cpp + @mkdir -p $(dir $@) + $(CXX) $(AFLAGS) $(INCLUDE) -c $< -o $@ + +build/%.o: %.s + @mkdir -p $(dir $@) + $(CC) $(AFLAGS) $(INCLUDE) -c $< -o $@ + +clean: + rm -rf build $(TARGET) $(TARGET:.elf=.exe) diff --git a/libpsn00b/include/stdlib.h b/libpsn00b/include/stdlib.h index fb20207..845cbea 100644 --- a/libpsn00b/include/stdlib.h +++ b/libpsn00b/include/stdlib.h @@ -53,6 +53,9 @@ 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); diff --git a/libpsn00b/psxapi/stdio/atoi.s b/libpsn00b/psxapi/stdio/atoi.s new file mode 100644 index 0000000..74c4ae7 --- /dev/null +++ b/libpsn00b/psxapi/stdio/atoi.s @@ -0,0 +1,9 @@ +.set noreorder +.section .text + +.global atoi +.type atoi, @function +atoi: + addiu $t2, $0, 0xa0 + jr $t2 + addiu $t1, $0, 0x10 diff --git a/libpsn00b/psxapi/stdio/atol.s b/libpsn00b/psxapi/stdio/atol.s new file mode 100644 index 0000000..f0da653 --- /dev/null +++ b/libpsn00b/psxapi/stdio/atol.s @@ -0,0 +1,9 @@ +.set noreorder +.section .text + +.global atol +.type atol, @function +atol: + addiu $t2, $0, 0xa0 + jr $t2 + addiu $t1, $0, 0x11 diff --git a/libpsn00b/psxcd/psxcd.c b/libpsn00b/psxcd/psxcd.c index 7b4aa20..76b6c08 100644 --- a/libpsn00b/psxcd/psxcd.c +++ b/libpsn00b/psxcd/psxcd.c @@ -1,13 +1,22 @@ #include <stdio.h> +#include <psxgpu.h> #include "psxcd.h" +#define READ_TIMEOUT 600 // 10 seconds for NTSC + extern volatile char _cd_ack_wait; extern volatile unsigned char _cd_last_int; extern volatile unsigned char _cd_last_mode; extern volatile unsigned char _cd_status; extern volatile CdlCB _cd_callback_int1_data; + volatile unsigned char *_cd_result_ptr; +// For read retry +volatile CdlLOC _cd_last_setloc; +volatile unsigned int *_cd_last_read_addr; +volatile int _cd_last_sector_count; + extern volatile char _cd_media_changed; void _cd_init(void); @@ -76,6 +85,7 @@ int CdControlF(unsigned char com, unsigned char *param) { case CdlSetloc: param_len = 3; + _cd_last_setloc = *((CdlLOC*)param); break; case CdlPlay: if( param ) @@ -105,6 +115,7 @@ int CdControlF(unsigned char com, unsigned char *param) if( param ) { _cd_control(CdlSetloc, param, 3); + _cd_last_setloc = *((CdlLOC*)param); } } @@ -220,11 +231,17 @@ volatile unsigned int *_cd_read_addr; volatile unsigned char _cd_read_result[8]; volatile unsigned int _cd_read_oldcb; volatile unsigned int _cd_read_sector_sz; +volatile unsigned int _cd_read_counter; + + + volatile CdlCB _cd_read_cb; // Sector callback static void _CdReadReadyCallback(int status, unsigned char *result) { + _cd_read_counter = VSync(-1); + if( status == CdlDataReady ) { // Fetch sector from CD controller @@ -259,6 +276,8 @@ int CdRead(int sectors, unsigned int *buf, int mode) { // Set sectors to read count _cd_sector_count = sectors; + _cd_last_sector_count = sectors; + _cd_last_read_addr = buf; _cd_read_addr = buf; // Determine sector based on mode flags @@ -275,7 +294,9 @@ int CdRead(int sectors, unsigned int *buf, int mode) _cd_read_sector_sz = 2048; } - // Set readt callback + _cd_read_counter = VSync(-1); + + // Set read callback _cd_read_oldcb = CdReadyCallback(_CdReadReadyCallback); // Set specified mode @@ -287,8 +308,37 @@ int CdRead(int sectors, unsigned int *buf, int mode) return 0; } +static void CdDoRetry() +{ + int cb; + + printf( "CdRead: Retrying...\n" ); + + // Stop reading + CdControl(CdlPause, 0, 0); + CdSync(0, 0); + + // Reset parameters for retrying read operation + _cd_sector_count = _cd_last_sector_count; + _cd_read_addr = _cd_last_read_addr; + + // Reset timeout + _cd_read_counter = VSync(-1); + + CdReadyCallback(_CdReadReadyCallback); + + // Retry read + CdControl(CdlSetloc, (void*)&_cd_last_setloc, 0); + CdControl(CdlReadN, 0, (unsigned char*)_cd_read_result); +} + int CdReadSync(int mode, unsigned char *result) { + if( (VSync(-1)-_cd_read_counter) > READ_TIMEOUT ) + { + CdDoRetry(); + } + if( mode ) { if( CdSync(1, 0) == CdlDiskError ) @@ -298,7 +348,14 @@ int CdReadSync(int mode, unsigned char *result) return _cd_sector_count; } - while(_cd_sector_count > 0); + while(_cd_sector_count > 0) + { + if( (VSync(-1)-_cd_read_counter) > READ_TIMEOUT ) + { + CdDoRetry(); + } + } + if( CdSync(0, result) != CdlComplete ) { return -1; diff --git a/libpsn00b/psxsio/siocons.c b/libpsn00b/psxsio/siocons.c index 76bf8be..703504f 100644 --- a/libpsn00b/psxsio/siocons.c +++ b/libpsn00b/psxsio/siocons.c @@ -1,5 +1,6 @@ #include <stdio.h> #include <string.h> +#include <ioctl.h> #include <psxapi.h> #include <psxgpu.h> #include <psxsio.h> @@ -74,6 +75,19 @@ static int _sio_inout(FCB *fcb, int cmd) { } +static int _sio_ioctl(FCB *fcb, int cmd, int arg) +{ + if( cmd == FIOCSCAN ) + { + if( _sio_key_pending ) + { + return 0; + } + } + + return -1; +} + static int _sio_close(int h) { return h; @@ -112,7 +126,7 @@ static DCB _sio_dcb = { (void*)_sio_open, // open (void*)_sio_inout, // inout _sio_close, // close - NULL, // ioctl + _sio_ioctl, // ioctl NULL, // read NULL, // write NULL, // erase diff --git a/toolchain.txt b/toolchain.txt index 70fae9f..9496f50 100644 --- a/toolchain.txt +++ b/toolchain.txt @@ -25,48 +25,57 @@ Make sure the following packages are installed prior to building: * isl (development libs, if your distro offers it in a separate package) * gmp (development libs, if your distro offers it in a separate package) * mpc (development libs, if your distro offers it in a separate package) +* build-essential or build-essentials, if you don't have GCC installed yet. Building binutils: -Binutils must be built first as GCC depends on binutils that is built for -the same target architecture as the compilers. +Binutils must be built first as GCC depends on binutils built for the same +target architecture. In this case, to compile GCC targetting mipsel-unknown-elf, +there must be a build of binutils targetting mipsel-unknown-elf as well. -* Download binutils source files at ftp://ftp.gnu.org, choose a version you +* Download binutils source files at ftp://ftp.gnu.org. Choose a version you wish to use with PSn00bSDK. -* Extract the contents of the archive, preferably in a directory called gcc + +* Extract the contents of the archive, preferably in a directory named gcc for example. + * Create a directory named binutils-build inside the gcc directory. Do not - create it inside the binutils directory containing the source files. -* Enter the binutils-build directory and configure binutils from there, - using the following command line: + create it inside the binutils directory with the source files. + +* Enter the binutils-build directory and configure binutils from there + with the following command line: ../binutils-<version>/configure --prefix=/usr/local/mipsel-unknown-elf \ --target=mipsel-unknown-elf --with-float=soft Replace <version> with the version of binutils you wish to use. You may also -change the prefix to a path you prefer to install the toolchain (ie. -somewhere in your home directory so you don't need root privileges to -install). +want to change the prefix argument to a path you prefer to have the toolchain +installed to (ie. somewhere within your home directory so you wouldn't need +root privileges to install). * Run `make -j 4` to compile binutils (-j specifies how many simultaneous - jobs to spawn at once, set this to the number of threads available in your - system to speed up compile times). -* Run `make install-strip` to install binutils to the path specified by - --prefix (requires root privileges if you install to /usr/local). + jobs to spawn at once, set it equal to the number of cores/threads your + system has available to speed up compiling). + +* Run `make install-strip` to install binutils to the path specified by the + --prefix argument (requires root privileges if you install to /usr/local). Building gcc: -Once binutils has been built, it should now be possible to build GCC. GCC -is considerably larger than binutils, so it's going to take a little more -time to build than binutils. +With binutils built it should be possible to build the GCC compilers. Since +GCC is considerably larger than binutils, compile time is going to be much +longer so it's going to take a longer while to finish building. * Download gcc source files at ftp://ftp.gnu.org and choose a version you wish to use with PSn00bSDK. + * Extract it to the same gcc directory you extracted binutils in. + * Create a directory named gcc-build inside the gcc directory. -* Enter the gcc-build directory and configure gcc from there, using the + +* Enter the gcc-build directory and configure gcc from there with the following command line: ../gcc-<version>/configure --disable-nls --disable-libada --disable-libssp \ @@ -78,13 +87,14 @@ Replace <version> with the version of gcc you downloaded. The prefix path must match to what you've specified for binutils earlier, if you've decided on a different path to install the toolchain to. -When building under Windows, you must additionally specify --disable-libgcc -so libgcc won't be built, as libgcc would simply not build in Windows due to -the symlink requirement. +When building under Windows you must additionally specify --disable-libgcc, so +libgcc won't be built as it requires symlinks not supported by the host system. * Run make in the same manner as you built binutils to build gcc. -* Run `make install-strip` to install gcc (may require root privileges if you - set the prefix to /usr/local). + +* Run `make install-strip` to install gcc to the path specified by --prefix + (may require root privileges if you set the prefix to /usr/local). + * Add a path to the bin directory of the toolchain into your PATH environment variable by adding the following line in your .bashrc file: @@ -94,18 +104,19 @@ Under Windows, you'll have to add the path to the PATH environment variable through System Properties. -Update ldscript: +Updating the ldscript: -The following changes to one of the ldscripts of the toolchain allows basic -C++ functionality to work in PSn00bSDK such as classes. These define the -constructor and deconstructor sections which are needed for the relevant -support functions in PSn00bSDK's libc library to link properly. +The following changes are required in order for basic C++ functionality to work +in PSn00bSDK. The changes define the constructor and deconstructor sections +which are required for the relevant support functions in PSn00bSDK's libc +library to be linked properly. -* Go to mipsel-unknown-elf/lib/ldscripts in the mipsel-unknown-elf toolchain - directory. +* Go to mipsel-unknown-elf/lib/ldscripts in the toolchain directory. + * Open elf32elmip.x in any text editor. + * Locate the .text definition (with the {} brackets) and place the following - in between the bracket block: + inside the bracket block: __CTOR_LIST__ = .; ___CTOR_LIST__ = .; @@ -127,19 +138,21 @@ __DTOR_END__ = .; * Save script changes. -Since there's no known way (at least to Lameguy64) to configure GCC to use -a customized script in the ldscripts directory by default, you must specify -the modified script during the linking stage of your projects. +Since there's no known way (at least to me, Lameguy64) to configure GCC to use +one of the scripts in ldscripts directory as a default, you must specify +the modified script during the linking stage of your projects with the -T +argument, when invoking mipsel-unknown-elf-ld. Alternatively, you can make a copy of the ldscript file and modify it within -your project directory if you wish to customize it specifically for your -project, particularly when using code overlays. +your project directory. This is especially useful when code overlaying is used. Note regarding C++ support: C++ support in PSn00bSDK only goes as far as basic classes, namespaces and the ability to dynamically create and delete class objects at any point of -the program, the required dependencies are supplied by libc of libpsn00b. +the program. The required dependencies are supplied by libc of libpsn00b. + Standard C++ libraries are not implemented and likely never going to be -implemented due to bloat concerns that it may introduce. +implemented due to bloat concerns that it may introduce. Besides, the official +SDK lacks full C++ support as well. |
