PSP Dev Commands

Discuss the development of new homebrew software, tools and libraries.

Moderators: cheriff, TyRaNiD

Post Reply
webjeff
Posts: 66
Joined: Thu May 05, 2005 2:51 am

PSP Dev Commands

Post by webjeff »

1st thing... Great work on getting the hello world to work.

2nd,
OK, I got the source for it, and it works on my old psp I imported from japan several months ago. I did get it compiled and it worked fine. What other commands are there except the ones listed in pg.h:

void pgInit();
void pgWaitV();
void pgWaitVn(unsigned long count);
void pgScreenFrame(long mode,long frame);
void pgScreenFlip();
void pgScreenFlipV();
void pgPrint(unsigned long x,unsigned long y,unsigned long color,const char *str);
void pgPrint2(unsigned long x,unsigned long y,unsigned long color,const char *str);
void pgPrint4(unsigned long x,unsigned long y,unsigned long color,const char *str);
void pgFillvram(unsigned long color);
void pgBitBlt(unsigned long x,unsigned long y,unsigned long w,unsigned long h,unsigned long mag,const unsigned short *d);
void pgPutChar(unsigned long x,unsigned long y,unsigned long color,unsigned long bgcolor,unsigned char ch,char drawfg,char drawbg,char mag);


Where did you figure these out? I know you we are using the ps2 dev toolchain, however I am not familiar with it so please bare with me. I looked through the docs and could not even find these commands so, where am I suppose to find other commands?

Thanks a lot guys!
Jeff.
User avatar
Saotome
Posts: 182
Joined: Sat Apr 03, 2004 3:45 am

Post by Saotome »

actually all those functions you listed were written by nem himself (see pg.c in the source-code).
they are using only 3 functions that he found out from his dumped firmware/bios :
pspDisplaySetMode
pspDisplaySetFrameBuf
pspDisplayWaitVblankStart
infj
webjeff
Posts: 66
Joined: Thu May 05, 2005 2:51 am

Post by webjeff »

wow,

I'm even more impressed with Nem! That guy is insane. OK, now I get it, thanks a lot for clearing that up, I was getting confused. I hope to have something cool written in a couple of days.

Thanks!
Jeff.
Vampire
Posts: 138
Joined: Tue Apr 12, 2005 8:16 am

Post by Vampire »

Saotome wrote:actually all those functions you listed were written by nem himself (see pg.c in the source-code).
they are using only 3 functions that he found out from his dumped firmware/bios :
pspDisplaySetMode
pspDisplaySetFrameBuf
pspDisplayWaitVblankStart
and they should be called:
sceDisplaySetMode
sceDisplaySetFrameBuf
sceDisplayWaitVblankStart
webjeff
Posts: 66
Joined: Thu May 05, 2005 2:51 am

Post by webjeff »

I got one more question related so I didn't want to start another thread.

How can I compile the helloworld code in C++ rather than C?

I have converted hellopsp.c to C++ but its giving me errors on the final GCC compile & link saying all the PG and psp Functions are undefined. Hmm, are there other parameters I need when compiling this?

Thanks a lot
Jeff.
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

If you don't rename pg.c to pg.cpp, then you have to wrap 'extern "C" { }' around the function declarations in pg.h.
webjeff
Posts: 66
Joined: Thu May 05, 2005 2:51 am

Post by webjeff »

Thanks a lot!

I did that but running into a few problems still,

Here is what I'm trying to run (From the helloworld example - minor changes for C++/C code):
c:\ps2dev\gcc\ee\bin\ee-g++ -march=r4000 -g -mgp32 -mlong32 -c hellopsp.cpp
c:\ps2dev\gcc\ee\bin\ee-gcc -march=r4000 -g -mgp32 -mlong32 -c pg.c
c:\ps2dev\gcc\ee\bin\ee-g++ -march=r4000 -g -mgp32 -c -xassembler -O -o startup.o startup.s
c:\ps2dev\gcc\ee\bin\ee-ld -O0 startup.o hellopsp.o pg.o -M -Ttext 8900000 -q -lstdc++ -o out > hellopsp.map


And this is what i'm getting:
C:\helloworldpsp\testcpp>c:\ps2dev\gcc\ee\bin\ee-ld -O0 startup.o hellopsp.o pg.
o -M -Ttext 8900000 -q -o out 1>hellopsp.map
hellopsp.o(.data+0x11): In function `xmain':
/cygdrive/c/helloworldpsp/testcpp/hellopsp.cpp:19: undefined reference to `__gxx
_personality_v0'

now, I also tried (after some research) adding -lstdc++ to the link step but then I get this:


C:\helloworldpsp\testcpp>c:\ps2dev\gcc\ee\bin\ee-ld -O0 startup.o hellopsp.o pg.
o -M -Ttext 8900000 -q -lstdc++ -o out 1>hellopsp.map
/cygdrive/c/ps2dev/gcc/ee/bin/ee-ld: /cygdrive/c/ps2dev/gcc/ee/bin/../ee/lib/lib
stdc++.a(eh_personality.o): linking 32-bit code with 64-bit code
/cygdrive/c/ps2dev/gcc/ee/bin/ee-ld: /cygdrive/c/ps2dev/gcc/ee/bin/../ee/lib/lib
stdc++.a(eh_personality.o): ABI mismatch: linking EABI64 module with previous EA
BI32 modules
...
ETC.



Hmm,
Any ideas??

Thanks a ton.
Jeff
mrbrown
Site Admin
Posts: 1537
Joined: Sat Jan 17, 2004 11:24 am

Post by mrbrown »

-fno-exceptions to get rid of the personality error.

You won't be able to link with any EE-speciific libraries, well, because they were compiled for the EE.
webjeff
Posts: 66
Joined: Thu May 05, 2005 2:51 am

Post by webjeff »

Hmm,

I'm confused now, I did what you said and it built even though it had an assertion:

C:\helloworldpsp\testcpp>c:\ps2dev\gcc\ee\bin\ee-ld -O0 startup.o hellopsp.o pg.
o -M -Ttext 8900000 -q -fno-exceptions -shared -o out 1>hellopsp.map
/cygdrive/c/ps2dev/gcc/ee/bin/ee-ld: BFD 2.14 20030612 assertion fail ../../bfd/
elflink.h:5274


I just want to use C++ rather than C. I'm unfamiliar with GCC and its linking options (I'm sure you could tell). I have code already to go once I figure out how to link with a C++ hello world.

Can you give me any insight how this might be possible? You also said I won't be able to link with any EE-specific libs, why not? if I use C++ I can't link with EE?

Thanks
Jeff.
blackdroid
Posts: 564
Joined: Sat Jan 17, 2004 10:22 am
Location: Sweden
Contact:

Post by blackdroid »

The EE libraries contain code specific for operating on the ps2 EE, some stuff might work, and some wont, all in all its a risky business and you should wait until there is a pspsdk with libc and friends, or write the routines you need yourself.
Kung VU
Post Reply