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 

New Starsim version (tutorial and test program)

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



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Wed Dec 29, 2004 12:23 am    Post subject: New Starsim version (tutorial and test program) Reply with quote

I've updated the Starsim demo, you can download it from http://www.frank-buss.de/ps2/index.html

A screenshot (the code for generating screenshots like this is integrated):



The original version uses DMA transfer for writing the general GS registers and lots of assembler for VSync counting, DMA handling and graphics initialization. This might be fast, but it is not good for learning the PS2.

My version uses only one assembler function for writing to a general GS register, which could be written in C, too, but the compiler doesn't generate nice code for the 128 bit operations, so I've implemented it in assember. All the rest is C and easy to understand. No DMA transfer and no interrupt handler are used. You can use this program for learning and quick testing how to use the GS registers, without the need to think about how to setup the GIF tag etc. When you know how to program the GS, you can optimize it later with DMA memory transfer.

Another change is the resolution. For PAL for example I've read that the number of visible lines is 576, which the program now uses and now the stars fills my whole TV screen :-)
Back to top
View user's profile Send private message
Neil Stevens



Joined: 27 Jan 2005
Posts: 79
Location: California

PostPosted: Fri Jan 28, 2005 3:26 pm    Post subject: Reply with quote

Not quite working here. It compiles but doesn't link:

Code:
ee-gcc -D_EE -O2 -G0 -Wall  -I/usr/local/ps2dev/ps2sdk/ee/include -I/usr/local/ps2dev/ps2sdk/common/include -I. -I/usr/local/ps2dev/ee/include
-I/usr/local/ps2dev/ps2sdk/ee/include -I/usr/local/ps2dev/ps2sdk/common/include -c main.c -o main.o
ee-gcc -D_EE -O2 -G0 -Wall  -I/usr/local/ps2dev/ps2sdk/ee/include -I/usr/local/ps2dev/ps2sdk/common/include -I. -I/usr/local/ps2dev/ee/include -I/usr/local/ps2dev/ps2sdk/ee/include -I/usr/local/ps2dev/ps2sdk/common/include -c gs.c -o gs.o
ee-gcc -D_EE -O2 -G0 -Wall  -I/usr/local/ps2dev/ps2sdk/ee/include -I/usr/local/ps2dev/ps2sdk/common/include -I. -I/usr/local/ps2dev/ee/include -I/usr/local/ps2dev/ps2sdk/ee/include -I/usr/local/ps2dev/ps2sdk/common/include -c hershey.c -o hershey.o
ee-gcc -D_EE -O2 -G0 -Wall  -I/usr/local/ps2dev/ps2sdk/ee/include -I/usr/local/ps2dev/ps2sdk/common/include -I. -I/usr/local/ps2dev/ee/include -I/usr/local/ps2dev/ps2sdk/ee/include -I/usr/local/ps2dev/ps2sdk/common/include -c screenshot.c -o screenshot.o
ee-gcc -xassembler-with-cpp -c  setgsreg.s -o setgsreg.o
ee-gcc -mno-crt0 -T/usr/local/ps2dev/ps2sdk/ee/startup/linkfile -L/usr/local/ps2dev/ps2sdk/ee/lib  \
        -o starsim.elf /usr/local/ps2dev/ps2sdk/ee/startup/crt0.o main.o gs.o hershey.o screenshot.o setgsreg.o -L/usr/local/ps2dev/ee/lib -L/usr/local/ps2dev/ps2sdk/ee/lib -lkernel -lsyscall -lc
/usr/local/ps2dev/ps2sdk/ee/lib/libc.a(__alloc_internals.o)(.text+0xa8): In function `_ps2sdk_alloc_unlock':
src/alloc.c: undefined reference to `SignalSema'
/usr/local/ps2dev/ps2sdk/ee/lib/libc.a(npmPuts.o)(.text+0xb4): In function `npm_puts_init':
src/xprintf.c: undefined reference to `SignalSema'
/usr/local/ps2dev/ps2sdk/ee/lib/libc.a(npmPuts.o)(.text+0x178): In function `npmPuts':
src/xprintf.c: undefined reference to `SignalSema'
/usr/local/ps2dev/ps2sdk/ee/lib/libc.a(sbrk.o)(.text+0x44): In function `ps2_sbrk':
src/sbrk.c: undefined reference to `EndOfHeap'
collect2: ld returned 1 exit status
gmake: *** [starsim.elf] Error 1


Do I just have an old version of the libraries?
Back to top
View user's profile Send private message Visit poster's website
cory1492



Joined: 10 Dec 2004
Posts: 216

PostPosted: Fri Jan 28, 2005 9:29 pm    Post subject: Reply with quote

It looks like the sample is using the old ps2lib...

edit: I added the ps2lib (partially built with make) from the cvs and a new environment variable PS2LIB pointing to it and the starsim builds fine. now to test it out and see if I had enough of the lib built for it to function fully...

Thanks for the new code to gawk at!
Back to top
View user's profile Send private message
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Fri Jan 28, 2005 10:38 pm    Post subject: Reply with quote

cory1492 wrote:
It looks like the sample is using the old ps2lib...


I don't know. I have downloaded this packet for Windows: http://ps2dev.org/kb.x?T=1081 With this tool chain and library versions it compiles without problems. Perhaps it is not up-to-date.
Back to top
View user's profile Send private message
cory1492



Joined: 10 Dec 2004
Posts: 216

PostPosted: Fri Jan 28, 2005 11:09 pm    Post subject: Reply with quote

yeah, the more up to the minute one is at http://www.oopo.net/consoledev/ and I use that with cygwin. Like I mentioned, adding ps2lib and the PS2LIB environment variable seems to have fixed the compile errors mentioned above.
Back to top
View user's profile Send private message
Neil Stevens



Joined: 27 Jan 2005
Posts: 79
Location: California

PostPosted: Sat Jan 29, 2005 10:25 am    Post subject: Reply with quote

I also built my toolchain and libs from http://www.oopo.net/consoledev/ , but I might have had something old. I'll build the latest from there and see what happens.
Back to top
View user's profile Send private message Visit poster's website
Neil Stevens



Joined: 27 Jan 2005
Posts: 79
Location: California

PostPosted: Sat Jan 29, 2005 5:36 pm    Post subject: Reply with quote

Drat.. I rebuilt tonight with the latest ps2toolchain tarball and I'm still getting the same link errors. Either I'm too new (and need some compatibility layer somewhere) or too old (and need CVS versions), heh.
Back to top
View user's profile Send private message Visit poster's website
Drakonite
Site Admin


Joined: 17 Jan 2004
Posts: 989

PostPosted: Sat Jan 29, 2005 5:46 pm    Post subject: Reply with quote

You need to add an -lkernel to the end of the linker line.
_________________
Shoot Pixels Not People!
Makeshift Development
Back to top
View user's profile Send private message Visit poster's website
Neil Stevens



Joined: 27 Jan 2005
Posts: 79
Location: California

PostPosted: Sat Jan 29, 2005 5:47 pm    Post subject: Reply with quote

Thanks to Drakonite on IRC, it was pointed out to me that libkernel has to be linked in LAST, though my copy of Makefile.eeglobal did NOT have it last. Fixing that made everything OK.

So the thing links and runs nice and pretty here in NTSC land.

Edit: Heh.. so Drakonite was lurking here too as I commented on IRC.. nice timing!
Back to top
View user's profile Send private message Visit poster's website
Shine



Joined: 03 Dec 2004
Posts: 728
Location: Germany

PostPosted: Sat Jan 29, 2005 5:49 pm    Post subject: Reply with quote

Neil Stevens wrote:
Drat.. I rebuilt tonight with the latest ps2toolchain tarball and I'm still getting the same link errors. Either I'm too new (and need some compatibility layer somewhere) or too old (and need CVS versions), heh.


You can try to remove the SifInitRpc, all nprintfs and the screenshot.c/.h, because this is not needed to run the demo.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    forums.ps2dev.org Forum Index -> PS2 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