| Re: [AD] Porting Allegro to the PS2 | 
[ Thread Index | 
Date Index
| More lists.liballeg.org/allegro-developers Archives
] 
Hi there!
	Wow, I am absolutly *stunned* by the responses I've gotten. Here I was 
thinking that because the PS2Linux was so niche I wouldn't see much 
happening. Also especially because I'm such a neophyte at lib 
programming. (I still am not touching anything resembeling autoconf with 
a stick till I understand how the libiary creation process works. I've 
never made a makefile over 20 lines long.
Attached is a patch which wraps any VGA-specific code (ie. the code 
causing Joshua problems) in a preprocessor test for ALLEGRO_LINUX_VGA. 
Since all the iopl() calls were connected with VGA code, I also wrapped 
them in a test for this macro. The logic for this decision is simple: 
VGA is only available on Linux/i386, iopl() is only available on 
Linux/i386, so the presence of one determines the presence of the 
other.
As I said before, I think it's better to just provide a version
of iopl which returns failure; it's simpler than catching all
the places that call it, and not hard to check for in the
configure script if you know how. ;)  It's not necessarily VGA
stuff that needs the ioperms.
what would be *really* nice would be making the makefile that went 
something like:
if UNIX-LIKE
	unixflag=1
	if LINUX
		linuxflag=1
		if X86
			switch==x86stuff
		end
		if PPC
			switch==ppcstuff
		end
		if PS2MIPS
			switch==ps2stuff
		end
	if OSX
		switch==osxstuff
	end
	if X
		switch==xstuff
	end
end
this will incude the unix stuff kind of in the right order. Of couse 
this is in ruby and not in shellscript, (My boss is Japanese so learning 
ruby is a reqirement) but you catch my drift. then we can write nice 
modular dependicies. I also may be on crack too, the jury's still out on 
that.
I'm going to have to disagree with George about the relevance of the 
Linux driver on the PS/2, because I think the mouse, keyboard, timer 
and sound drivers are all relevant. There is also the possibility of 
framebuffer support being added.
more on the framebuffer below
I didn't mean to suggest that the Linux driver should never
support anything other than x86, I just doubt that it's useful
on PS2.  I don't know anything about PS2 Linux but I suspect
it's just a Linux kernel with some hacked together libraries to
access the hardware -- judging by the libraries Sony supply for
real PS2 development, I'd be very surprised if they bothered to
make a working fbdev or anything useful like that! :)
the ps2 kit didn't come with a framebuffer driver for a very good 
reason. You have no direct access to to video memory. Period. Everything 
must be prossesesed by Graphics Synthisiser using primitive packets. The 
packets are deleverd via the Graphics InterFace (GIF), every 
microcontroller, like the CPU and the the Vecter Units(VU) has a Video 
Interface (VIF) that sends packets to the GS.  You can almost do a 
direct read, but not by address, you ask for coordinates from the GS.
So a typical chain is CPU -> VU1 -> VU2 -> VIF -> GIF -> GS
(The VUs are programmable Coprosessers with thier own memory for 
processing polygons) It's very slow to go in the other direction
Not that I'd blame them particularly; the interesting thing
about PS2 Linux is sure to be having access to the more strange
bits of its hardware, rather than porting real world
applications across.
It's primary design was so that programmers can get experiance with the 
hardware for a very low cost ($200 for the kit, PS2 not included) I 
don't have access to the bootloader so I can't make my own commerical 
games with I'll discuss the *real* ps2 devopment system below...
On the other hand, implementing fbdev would be a really simple
way for them to get an X port working... but then, it's been
said that they didn't use XFree86 anyway, so they probably
didn't do it this way.  As I said, I don't know what they
actually provide in PS2 Linux and whether it's any good.
as stated above, a fb is pretty pointless as it's architicture is very 
strange.
My doubts about using the Linux console driver came from looking
through aintlnx.h and remembering what little the Linux console
system driver actually does -- most of it is in the generic Unix
driver.  The Linux console driver itself just does a bit of
console management (finding a console we can have full control
of, handling display switching), keyboard handling (maybe this
is useful on PS2), mouse handling (probably not useful on PS2,
since it doesn't have a serial mouse, though perhaps a PS2 USB
mouse driver would also work in x86 Linux? or maybe it has gpm?)
and graphics drivers (IMHO only fbcon is a candidate for working
on PS2, and that's only if they actually supply a kernel fbdev
driver).
My dev kit came with a black usb mouse and keyboard (The keyboard has no 
windows key, it's a diamond-key instead) Sony's gonna be seeling these 
items when they start pushing thier online games. I just got the 
hardware 6 months in advance, along with a Hard drive and Broadband adapter.
The timer and sound drivers are in the generic unix code, not
the Linux console code, so they can still be used by a separate
PS2 system driver.
Ahh this is cool and may prove useful
Going back to previous points though, I'm a little surprised if
the X system driver for Allegro doesn't work on the PS2 -- I
think the original poster said that Allegro assumes XFree86, but
if it does then this is news to me. :)
Trufully, I never really bothered to check. First of all I don't even 
use the X server (XGS) as it takes up waaay to much overhead and then 
software will be the only option for rendering as I don't have anything 
cool like direct video memeory access. The console will be the best bet.
<snipped sig>
I have a hobbiest's kit, The *REAL* div kit also runs linux, and there 
has been games that have a linux kernel that have released to the 
gameplaying public (I can think of one, but the name escapes me for the 
moment, timestoppers or clockstoppers or something like that)
The real kit is known as the 10kTOOL kit and costs about 10 grand to 
get, you have to fill out an application with Sony to get one. The 
diffrence between what the TOOL kit has and what I have is that the TOOL 
looks like a normal PC (It's black) has 64 meg of memory, and can boot 
CDRs. I have only 32meg, and I have to use Sony's bootloader. (It will 
boot any ELF binary on the first memcard, doesn't have to be linux) I 
aslo have no access to the IOP which controlls copyprotection and the 
boot process. I did get 6 of the 7 devopers manuals (IOP one is missing) 
So it's a good deal. I'm sure that if I make a good Allegro port, it 
will be comaptable with the TOOL kit.
BACK TO MY POINT!! (Sorry, didn't mean to meander)
What the best course of action then is to make the ./configre script 
flag that my linux is not a linux, but should be treated as a generic 
unix. 'uname -s -m -p' returns "Linux mips unknown" But the cool linux 
stuff like keyboard and mouse would be useful.
also My "joystick" is a little more strange than your normal PC 
joystick. (analage butotns, two analage joysticks and a d-pad) so there 
might me a bit of an altercation to the joystick code.
There is a lightgun driver availible already
Also, the PS2 has built-in support for hardware MPG2. New movie player, 
or jpg support can go there.
There are also two primitives that Allegro doen't have that can be 
added. Triangle Fan and Triangle Strip. Also Sprites can't be rotated, 
(But textured polygons can be).
SO anyway, now that I've *TOTALY* wasted your time, I shall try an 
X-only install with the unix driver and see what I get. I'll play with 
the patches too.
-Joshua
--------------000700030307020102050204--