aboutsummaryrefslogtreecommitdiff
path: root/examples
diff options
context:
space:
mode:
authorJohn Wilbert M. Villamor <lameguy64@gmail.com>2020-04-24 19:01:28 +0800
committerJohn Wilbert M. Villamor <lameguy64@gmail.com>2020-04-24 19:01:28 +0800
commit1aa0e17df7c325a41de8cf8a57f52ed853f08bf3 (patch)
tree5ec7f69ca0104f2b0a41e2ee7d3cb0cf0c9c54c5 /examples
parente82da2abe4c264d4b48a48d79cf9b8e4c4fb8ab6 (diff)
downloadpsn00bsdk-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.
Diffstat (limited to 'examples')
-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)bin1708 -> 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)bin67532 -> 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)bin16928 -> 16928 bytes
-rw-r--r--examples/demos/n00bdemo/data/celmapi.bmp (renamed from examples/n00bdemo/data/celmapi.bmp)bin3126 -> 3126 bytes
-rw-r--r--examples/demos/n00bdemo/data/celmapi.tim (renamed from examples/n00bdemo/data/celmapi.tim)bin576 -> 576 bytes
-rw-r--r--examples/demos/n00bdemo/data/clktower.tim (renamed from examples/n00bdemo/data/clktower.tim)bin832 -> 832 bytes
-rw-r--r--examples/demos/n00bdemo/data/font.bmp (renamed from examples/n00bdemo/data/font.bmp)bin12406 -> 12406 bytes
-rw-r--r--examples/demos/n00bdemo/data/font.tim (renamed from examples/n00bdemo/data/font.tim)bin12352 -> 12352 bytes
-rw-r--r--examples/demos/n00bdemo/data/hatkid.png (renamed from examples/n00bdemo/data/hatkid.png)bin390 -> 390 bytes
-rw-r--r--examples/demos/n00bdemo/data/hatkid.smd (renamed from examples/n00bdemo/data/hatkid.smd)bin15676 -> 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)bin576 -> 576 bytes
-rw-r--r--examples/demos/n00bdemo/data/lamelotl16c.png (renamed from examples/n00bdemo/data/lamelotl16c.png)bin5777 -> 5777 bytes
-rw-r--r--examples/demos/n00bdemo/data/lamelotl16c.tim (renamed from examples/n00bdemo/data/lamelotl16c.tim)bin24640 -> 24640 bytes
-rw-r--r--examples/demos/n00bdemo/data/lightworld.smd (renamed from examples/n00bdemo/data/lightworld.smd)bin13700 -> 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)bin13524 -> 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)bin4204 -> 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)bin7172 -> 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)bin1035 -> 1035 bytes
-rw-r--r--examples/demos/n00bdemo/data/n00blogo-pixel.tim (renamed from examples/n00bdemo/data/n00blogo-pixel.tim)bin3392 -> 3392 bytes
-rw-r--r--examples/demos/n00bdemo/data/petscum.smd (renamed from examples/n00bdemo/data/petscum.smd)bin13844 -> 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)bin955 -> 955 bytes
-rw-r--r--examples/demos/n00bdemo/data/petscum16c.tim (renamed from examples/n00bdemo/data/petscum16c.tim)bin5184 -> 5184 bytes
-rw-r--r--examples/demos/n00bdemo/data/psn00blogo.smd (renamed from examples/n00bdemo/data/psn00blogo.smd)bin8612 -> 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)bin676 -> 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)bin1088 -> 1088 bytes
-rw-r--r--examples/demos/n00bdemo/data/riftbld2.tim (renamed from examples/n00bdemo/data/riftbld2.tim)bin1088 -> 1088 bytes
-rw-r--r--examples/demos/n00bdemo/data/star.smd (renamed from examples/n00bdemo/data/star.smd)bin220 -> 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)bin220 -> 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)bin16232 -> 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)bin192 -> 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)bin2112 -> 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)bin385 -> 385 bytes
-rw-r--r--examples/graphics/render2tex/blendpattern-16c.tim (renamed from examples/render2tex/blendpattern-16c.tim)bin2112 -> 2112 bytes
-rw-r--r--examples/graphics/render2tex/blendpattern.png (renamed from examples/render2tex/blendpattern.png)bin826 -> 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)bin921620 -> 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/makefile20
-rw-r--r--examples/sdk-common.mk4
-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.h16
-rw-r--r--examples/system/console/main.c284
-rw-r--r--examples/system/console/makefile60
-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.c145
-rw-r--r--examples/system/tty/makefile60
122 files changed, 602 insertions, 36 deletions
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
index 9b77c6d..9b77c6d 100644
--- a/examples/n00bdemo/data/bulb.smd
+++ b/examples/demos/n00bdemo/data/bulb.smd
Binary files differ
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
index 63f96b5..63f96b5 100644
--- a/examples/n00bdemo/data/bungirl.smd
+++ b/examples/demos/n00bdemo/data/bungirl.smd
Binary files differ
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
index 11ee9f4..11ee9f4 100644
--- a/examples/n00bdemo/data/bungirl.tim
+++ b/examples/demos/n00bdemo/data/bungirl.tim
Binary files differ
diff --git a/examples/n00bdemo/data/celmapi.bmp b/examples/demos/n00bdemo/data/celmapi.bmp
index f44f94f..f44f94f 100644
--- a/examples/n00bdemo/data/celmapi.bmp
+++ b/examples/demos/n00bdemo/data/celmapi.bmp
Binary files differ
diff --git a/examples/n00bdemo/data/celmapi.tim b/examples/demos/n00bdemo/data/celmapi.tim
index c043e0b..c043e0b 100644
--- a/examples/n00bdemo/data/celmapi.tim
+++ b/examples/demos/n00bdemo/data/celmapi.tim
Binary files differ
diff --git a/examples/n00bdemo/data/clktower.tim b/examples/demos/n00bdemo/data/clktower.tim
index 15c6edc..15c6edc 100644
--- a/examples/n00bdemo/data/clktower.tim
+++ b/examples/demos/n00bdemo/data/clktower.tim
Binary files differ
diff --git a/examples/n00bdemo/data/font.bmp b/examples/demos/n00bdemo/data/font.bmp
index 1d078f3..1d078f3 100644
--- a/examples/n00bdemo/data/font.bmp
+++ b/examples/demos/n00bdemo/data/font.bmp
Binary files differ
diff --git a/examples/n00bdemo/data/font.tim b/examples/demos/n00bdemo/data/font.tim
index 64cdad2..64cdad2 100644
--- a/examples/n00bdemo/data/font.tim
+++ b/examples/demos/n00bdemo/data/font.tim
Binary files differ
diff --git a/examples/n00bdemo/data/hatkid.png b/examples/demos/n00bdemo/data/hatkid.png
index 369ce32..369ce32 100644
--- a/examples/n00bdemo/data/hatkid.png
+++ b/examples/demos/n00bdemo/data/hatkid.png
Binary files differ
diff --git a/examples/n00bdemo/data/hatkid.smd b/examples/demos/n00bdemo/data/hatkid.smd
index a68f414..a68f414 100644
--- a/examples/n00bdemo/data/hatkid.smd
+++ b/examples/demos/n00bdemo/data/hatkid.smd
Binary files differ
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
index b2e9318..b2e9318 100644
--- a/examples/n00bdemo/data/hatkid.tim
+++ b/examples/demos/n00bdemo/data/hatkid.tim
Binary files differ
diff --git a/examples/n00bdemo/data/lamelotl16c.png b/examples/demos/n00bdemo/data/lamelotl16c.png
index 67490c8..67490c8 100644
--- a/examples/n00bdemo/data/lamelotl16c.png
+++ b/examples/demos/n00bdemo/data/lamelotl16c.png
Binary files differ
diff --git a/examples/n00bdemo/data/lamelotl16c.tim b/examples/demos/n00bdemo/data/lamelotl16c.tim
index 194c034..194c034 100644
--- a/examples/n00bdemo/data/lamelotl16c.tim
+++ b/examples/demos/n00bdemo/data/lamelotl16c.tim
Binary files differ
diff --git a/examples/n00bdemo/data/lightworld.smd b/examples/demos/n00bdemo/data/lightworld.smd
index 4c1bb59..4c1bb59 100644
--- a/examples/n00bdemo/data/lightworld.smd
+++ b/examples/demos/n00bdemo/data/lightworld.smd
Binary files differ
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
index 9eb1954..9eb1954 100644
--- a/examples/n00bdemo/data/logo.smd
+++ b/examples/demos/n00bdemo/data/logo.smd
Binary files differ
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
index f99bd46..f99bd46 100644
--- a/examples/n00bdemo/data/mtekdisk.smd
+++ b/examples/demos/n00bdemo/data/mtekdisk.smd
Binary files differ
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
index a158521..a158521 100644
--- a/examples/n00bdemo/data/mtektext.smd
+++ b/examples/demos/n00bdemo/data/mtektext.smd
Binary files differ
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
index db7aa89..db7aa89 100644
--- a/examples/n00bdemo/data/n00blogo-pixel.png
+++ b/examples/demos/n00bdemo/data/n00blogo-pixel.png
Binary files differ
diff --git a/examples/n00bdemo/data/n00blogo-pixel.tim b/examples/demos/n00bdemo/data/n00blogo-pixel.tim
index c372593..c372593 100644
--- a/examples/n00bdemo/data/n00blogo-pixel.tim
+++ b/examples/demos/n00bdemo/data/n00blogo-pixel.tim
Binary files differ
diff --git a/examples/n00bdemo/data/petscum.smd b/examples/demos/n00bdemo/data/petscum.smd
index 9a1c8eb..9a1c8eb 100644
--- a/examples/n00bdemo/data/petscum.smd
+++ b/examples/demos/n00bdemo/data/petscum.smd
Binary files differ
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
index c9d115c..c9d115c 100644
--- a/examples/n00bdemo/data/petscum16c.png
+++ b/examples/demos/n00bdemo/data/petscum16c.png
Binary files differ
diff --git a/examples/n00bdemo/data/petscum16c.tim b/examples/demos/n00bdemo/data/petscum16c.tim
index 18af842..18af842 100644
--- a/examples/n00bdemo/data/petscum16c.tim
+++ b/examples/demos/n00bdemo/data/petscum16c.tim
Binary files differ
diff --git a/examples/n00bdemo/data/psn00blogo.smd b/examples/demos/n00bdemo/data/psn00blogo.smd
index 3c1412a..3c1412a 100644
--- a/examples/n00bdemo/data/psn00blogo.smd
+++ b/examples/demos/n00bdemo/data/psn00blogo.smd
Binary files differ
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
index c218d05..c218d05 100644
--- a/examples/n00bdemo/data/rbowshade.smd
+++ b/examples/demos/n00bdemo/data/rbowshade.smd
Binary files differ
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
index 5581bb3..5581bb3 100644
--- a/examples/n00bdemo/data/riftbld1.tim
+++ b/examples/demos/n00bdemo/data/riftbld1.tim
Binary files differ
diff --git a/examples/n00bdemo/data/riftbld2.tim b/examples/demos/n00bdemo/data/riftbld2.tim
index 4048024..4048024 100644
--- a/examples/n00bdemo/data/riftbld2.tim
+++ b/examples/demos/n00bdemo/data/riftbld2.tim
Binary files differ
diff --git a/examples/n00bdemo/data/star.smd b/examples/demos/n00bdemo/data/star.smd
index 68a5725..68a5725 100644
--- a/examples/n00bdemo/data/star.smd
+++ b/examples/demos/n00bdemo/data/star.smd
Binary files differ
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
index fe624fe..fe624fe 100644
--- a/examples/n00bdemo/data/star_mask.smd
+++ b/examples/demos/n00bdemo/data/star_mask.smd
Binary files differ
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
index dc22e4d..dc22e4d 100644
--- a/examples/n00bdemo/data/timerift.smd
+++ b/examples/demos/n00bdemo/data/timerift.smd
Binary files differ
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
index e2a5d17..e2a5d17 100644
--- a/examples/balls/ball16c.tim
+++ b/examples/graphics/balls/ball16c.tim
Binary files differ
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
index d3aff3a..d3aff3a 100644
--- a/examples/billboard/texture64.tim
+++ b/examples/graphics/billboard/texture64.tim
Binary files differ
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
index 74ac945..74ac945 100644
--- a/examples/render2tex/blendpattern-16c.png
+++ b/examples/graphics/render2tex/blendpattern-16c.png
Binary files differ
diff --git a/examples/render2tex/blendpattern-16c.tim b/examples/graphics/render2tex/blendpattern-16c.tim
index 2fff580..2fff580 100644
--- a/examples/render2tex/blendpattern-16c.tim
+++ b/examples/graphics/render2tex/blendpattern-16c.tim
Binary files differ
diff --git a/examples/render2tex/blendpattern.png b/examples/graphics/render2tex/blendpattern.png
index 49af62c..49af62c 100644
--- a/examples/render2tex/blendpattern.png
+++ b/examples/graphics/render2tex/blendpattern.png
Binary files differ
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
index f233453..f233453 100644
--- a/examples/rgb24/bunpattern.tim
+++ b/examples/graphics/rgb24/bunpattern.tim
Binary files differ
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)