English Amiga Board


Go Back   English Amiga Board > Coders > Coders. General

 
 
Thread Tools
Old 08 May 2007, 17:38   #21
thor
Registered User
 
thor's Avatar
 
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.
thor is offline  
Old 08 May 2007, 17:50   #22
eLowar
Citizen of Elthesh
 
eLowar's Avatar
 
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.
eLowar is offline  
Old 08 May 2007, 22:28   #23
Jherek Carnelia
Dazed and Confused
 
Jherek Carnelia's Avatar
 
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!
Jherek Carnelia is offline  
 


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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +2. The time now is 19:30.

Top

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Page generated in 0.06395 seconds with 16 queries