forums.ps2dev.org Forum Index forums.ps2dev.org
Homebrew PS2, PSP & PS3 Development Discussions
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

PSP Dev Commands

 
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development
View previous topic :: View next topic  
Author Message
webjeff



Joined: 05 May 2005
Posts: 66

PostPosted: Mon May 09, 2005 12:24 am    Post subject: PSP Dev Commands Reply with quote

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.
Back to top
View user's profile Send private message
Saotome



Joined: 03 Apr 2004
Posts: 182

PostPosted: Mon May 09, 2005 12:38 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
webjeff



Joined: 05 May 2005
Posts: 66

PostPosted: Mon May 09, 2005 1:11 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Vampire



Joined: 12 Apr 2005
Posts: 138

PostPosted: Mon May 09, 2005 1:43 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
webjeff



Joined: 05 May 2005
Posts: 66

PostPosted: Mon May 09, 2005 2:04 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Mon May 09, 2005 3:02 am    Post subject: Reply with quote

If you don't rename pg.c to pg.cpp, then you have to wrap 'extern "C" { }' around the function declarations in pg.h.
Back to top
View user's profile Send private message
webjeff



Joined: 05 May 2005
Posts: 66

PostPosted: Mon May 09, 2005 4:05 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
mrbrown



Joined: 17 Jan 2004
Posts: 1536

PostPosted: Mon May 09, 2005 6:48 am    Post subject: Reply with quote

-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.
Back to top
View user's profile Send private message
webjeff



Joined: 05 May 2005
Posts: 66

PostPosted: Mon May 09, 2005 7:23 am    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
blackdroid



Joined: 17 Jan 2004
Posts: 564
Location: Sweden

PostPosted: Mon May 09, 2005 7:30 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PSP Development All times are GMT + 10 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group