Timboy67678 Junior Member
Posts : 20 Join date : 2010-06-09
| Subject: Hello World For PSP Wed Jun 09, 2010 11:35 pm | |
| Welcome to the PSP programing world :mrgreen:. a simple hello world is what will start you into psp programing of any kind, but i wont even touch kernel side of the force, skyend can do that if hes feeling generous now, what we will need is a pspsdk (playstation portable software development kit). you can either get, [You must be registered and logged in to see this link.] or [You must be registered and logged in to see this link.]. if you have linux, goto [You must be registered and logged in to see this link.] they will have the latest toolchain there plus instructions. so here we go. first of, you should get something like [You must be registered and logged in to see this link.] , cause it has cool syntax highlighting. or you could use regular windows notepad. first offf, make sure you installed your pspsdk properly. now for the fun stuff, here is main.c - Code:
-
/*Main.c*/ #include <pspkernel.h> #include <pspdebug.h> #include <pspctrl.h>
#define printf pspDebugScreenPrintf
PSP_MODULE_INFO("Hello World", 0, 1, 1);
int main(int argc, char *argv[]) { pspDebugScreenInit(); printf("\n\tHello World %c!!!!!\n\n\tPress X To Exit",0x01); while (1) { SceCtrlData pad;
sceCtrlReadBufferPositive(&pad, 1);
if(pad.Buttons & PSP_CTRL_CROSS) { pspDebugScreenClear(); printf("\n\n\n\tNow Exiting..."); sceKernelExitGame(); return 0; } } return 0; }
Now for our makefile. - Code:
-
#******Makefile****** TARGET = hello OBJS = main.o
CFLAGS = -O2 -G0 -Wall CXXFLAGS = $(CFLAGS) -fno-exceptions -fno-rtti ASFLAGS = $(CFLAGS)
LIBDIR = LIBS = -lpspgu -lpng -lz -lm LDFLAGS =
EXTRA_TARGETS = EBOOT.PBP PSP_EBOOT_TITLE = Hello World
PSPSDK=$(shell psp-config --pspsdk-path) include $(PSPSDK)/lib/build.mak
now, put those 2 files in a folder and start cmd. now change directory to your folder and where your makefile is and type make Happy Coding | |
|