Let's throw a little more grease into the fire shall we?
The PSX doen't use floats ^_^. Actually, it has no FPU at all. Now, as you can see, this makes translating things a little trickey.
I'm sure that you are also asking "If the PSX can't do floats, then how on earth does it do 3D?"
The GTE, which hangs out as the second coprosseser (COP2) is a *fixed point* math coprosseser that only works with matrix calculations and color manipulation. That's the whole banana.
To dig deeper, let's throw some types around, shall we ^_^
Let's start out easy.
8 bits = one byte
Now that we have that defined, let's look at some platforms. The core system of the PSX is a RISC chip with the following definitions. The R3000A is preconfigured on powerup for little-endian byte order, (as you can change the endian) and defines a word as 32-bits, a half-word, as 16-bits, and a byte as 8-bits.
The x86 is a little-endian CISC chip that runs in mutiple memory addressing and register access modes. To confuse the matters further ther are two "warring" compiler sets (POSIX vs Microsoft) that define types differently.
Under "Real mode" a double as 32-bits, a word at 16 bits , and a byte at 8 bits. Under "Protected mode" a double is 64 bits, a word is 32 bits, a half-word is 16 bits, and a byte is 8 bits.
Under MSVC, a long is 4 bytes, an int is 2 bytes, a short is 2 bytes and a char is 1 byte.
Using gcc and g++ in Linux, I get the following data back using a debugged version of cyb's code
char size is 1 bytes
short size is 2 bytes
int size is 4 bytes
long size is 4 bytes
long long size is 8 bytes
Let's just keep everything platform independant, shall we?
I like Qhimm's data_types.h, but I don't quite grok why we need a char that's over 8 bits. I've always read "char" as "8 bit type you use for strings... don't play with the sign bit, as it's really an ASCII toggle in this case." (i.e. 0-127 ASCII, 128-255 extended characters)
For giggles, here's a more correct version of Cyb's little program, what kind of data do you guys get on your platforms?
#include "stdio.h"
int main(void)
{
printf("char size is %2d bytes\n", sizeof(char));
printf("short size is %2d bytes\n", sizeof(short));
printf("int size is %2d bytes\n", sizeof(int));
printf("long size is %2d bytes\n", sizeof(long));
printf("long long size is %2d bytes\n", sizeof(long long));
}
Do we all agree that data_types.h is the best way to go? You should really avoid types like "int", Long", and "Word" (and to a small extent "char") as these have some vauge definitions. I'll have to mark this in my "things to clean" in Gears.
While we are at it, let's define a little something on notation too.
-Decmal numbers are written plain. (1, 2, 4, 15, 7) but it's much better to write these out in english. (one, two, four, fifteen, seven)
-Hex numbers should use 0xABCD notation. $ABCD notation insinuates that it's running on an 8 bit platfrom and looks archaic as hell. On really long types, place an underscore between words. This makes reading it much easier. (A trick I picked up doing my PSX doc --> 0xFFFF_FFFF)
-On the subject of langauge, I speak American English and will be converting some of the more "Colourful" language over to something a little more nice to my spell checker. On the same side of the coin, I'm going to probably be altering some of the more informal language on some of your docs to bring a more unifrom feel for the text. (Dropping some of the "then you... I think this is garbage but.... I don't know that this......) This doen't require much brain power and gives me the ability to work on Gears while at school. (As opposed to getting out my hacking toolset to verify some of the sections, I can simply proofread for about an hour while I'm between study sessions)
Also, one more thing....
The reason why I export a copy of gears in DOC format is so you guys can load it up in Microsoft Word and edit my mistakes/add your own content. I don't mind if you guys copy it and make changes. Email me the section you have changed, and I'll import it into my SDW file, and then re-export the changes back into the public /gears directory.
The reason why I post pictures of cute Japanese girls in boxes is because they are pretty and fun to look at.
I think that's it...