08 May 2007, 17:38 | #21 |
Registered User
Join Date: Mar 2006
Location: Germany
Posts: 899
|
For the endian check you have to do:
unsigned short endian_test = 0x0001; if (*(unsigned char*)&endian_test) == 1) /* little endian */ else /* big endian */ Explanation: - with the address operator & you get the address where endian_test is stored. - with (char*) you cast it to a pointer to chars - with indirection operator * you get the char (since you converted it to char pointer) at that memory address - in little endian it is stored in memory as 0x0100, in big endian 0x0001 (in bold the result of the expression) Since you didn't initialize your variable, the result was undefined and therefore didn't work Last edited by thor; 08 May 2007 at 18:05. |
08 May 2007, 17:50 | #22 |
Citizen of Elthesh
Join Date: Sep 2003
Location: UK
Posts: 949
|
Nice one, I can't really help with endian-ness problems, because I usually don't have to deal with them (fortunately).
@Jherek: There's still a little conversion error somewhere (possibly just a forgotten conversion). See my post above for an example and you should probably find it with ease. |
08 May 2007, 22:28 | #23 |
Dazed and Confused
Join Date: Dec 2001
Location: portsmouth/uk
Posts: 242
|
Thanks for the look.
In my haste I overlooked the fact that the second part of the code that converts the buffer contents into strings of registers and values and into display lines and pixel positions relies on the buffer being stored as an Amiga. Needs more work. But then it is a good exercise - and that's what I'm looking for! |
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
Thread Tools | |
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
CF Prob. | Eclipse | support.Hardware | 10 | 01 May 2008 12:11 |
C code prob continued - How a PC stores bytes? | Jherek Carnelia | Coders. General | 5 | 11 May 2007 18:10 |
Not really a prob | amiga | support.WinUAE | 1 | 20 March 2007 20:31 |
Not really a prob | amiga | support.WinUAE | 1 | 25 May 2005 18:53 |
3D code and/or internet code for Blitz Basic 2.1 | EdzUp | Retrogaming General Discussion | 0 | 10 February 2002 11:40 |
|
|