GenDev SpritesMind Website SpritesMind.Net
Sega Megadrive/Genesis development
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

68k endianess question

 
Post new topic   Reply to topic    SpritesMind.Net Forum Index -> Blabla
View previous topic :: View next topic  
Author Message
Jorge Nuno
Very interested


Joined: 11 Jun 2007
Posts: 329
Location: Azeitão, PT

PostPosted: Tue Feb 03, 2009 10:48 pm    Post subject: 68k endianess question Reply with quote

When I want to program the word #$00E0 (appearing like that in a HEX editor) into a memory, at address 0, to be read by the 68k, where does the byte #$00 goes to? d15-d8 or d7-d0? Confused

Thanks Cool
Back to top
View user's profile Send private message MSN Messenger
TmEE co.(TM)
Very interested


Joined: 05 Dec 2006
Posts: 1947
Location: Estonia, Mahtra village

PostPosted: Tue Feb 03, 2009 11:15 pm    Post subject: Reply with quote

I just changed my flashing code when I found out that upper and lower bytes were swapped on my flashcart Razz

00 should be on 0 (D0 to D7), and E0 should be on 1 (D8 to D15)... I think, I may be wrong...

EDIT, no, the other way....
_________________
Mida sa loed ? Nagunii aru ei saa Wink
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Jorge Nuno
Very interested


Joined: 11 Jun 2007
Posts: 329
Location: Azeitão, PT

PostPosted: Tue Feb 03, 2009 11:24 pm    Post subject: Reply with quote

TmEE co.(TM) wrote:
I just changed my flashing code when I found out that upper and lower bytes were swapped on my flashcart Razz

00 should be on 0 (D0 to D7), and E0 should be on 1 (D8 to D15)... I think, I may be wrong...

EDIT, no, the other way....


So in 00E0, 00 goes to d15-d8 and E0 is in d7-d0.
Back to top
View user's profile Send private message MSN Messenger
TmEE co.(TM)
Very interested


Joined: 05 Dec 2006
Posts: 1947
Location: Estonia, Mahtra village

PostPosted: Tue Feb 03, 2009 11:33 pm    Post subject: Reply with quote

I think so... 00E0 looks like 00E0 to 68K, while it would look like E000 to x86 or other little-endian things...

If the ROM won't work, you know you got things the wrong way Smile
_________________
Mida sa loed ? Nagunii aru ei saa Wink
Back to top
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Jorge Nuno
Very interested


Joined: 11 Jun 2007
Posts: 329
Location: Azeitão, PT

PostPosted: Tue Feb 03, 2009 11:34 pm    Post subject: Reply with quote

TmEE co.(TM) wrote:
I think so... 00E0 looks like 00E0 to 68K, while it would look like E000 to x86 or other little-endian things...

If the ROM won't work, you know you got things the wrong way Smile



Heh... Or not, when it comes to...


D-RAM!

BAHH...
Back to top
View user's profile Send private message MSN Messenger
Chilly Willy
Very interested


Joined: 17 Aug 2007
Posts: 1956

PostPosted: Tue Feb 03, 2009 11:38 pm    Post subject: Reply with quote

The 68000 is big endian. The value in a register 0x11223344 would be 0x11 0x22 0x33 0x44 in memory seen as bytes in a row from low address to high.
Back to top
View user's profile Send private message
HardWareMan
Very interested


Joined: 15 Dec 2007
Posts: 542
Location: Kazakhstan, Pavlodar

PostPosted: Wed Feb 04, 2009 3:46 am    Post subject: Reply with quote

Chilly Willy wrote:
The 68000 is big endian. The value in a register 0x11223344 would be 0x11 0x22 0x33 0x44 in memory seen as bytes in a row from low address to high.


Confirm. So if memory has at some addr (i.e. $000000) 11 22 33 44, it will be:
Code:

move.b $000000,d0 * d0 = $xxxxxx11
move.b $000001,d1 * d1 = $xxxxxx22
move.b $000002,d2 * d2 = $xxxxxx33
move.b $000003,d3 * d3 = $xxxxxx44

move.w $000000,d0 * d0 = $xxxx1122
move.w $000002,d1 * d1 = $xxxx3344

move.l $000000,d0 * d0 = $11223344

xx means unchanged previous value
word and longword access must be only at even address, or it will generate Address Error exception.

And write to memory is similar with read from it.


Last edited by HardWareMan on Wed Feb 04, 2009 6:52 am; edited 1 time in total
Back to top
View user's profile Send private message
Chilly Willy
Very interested


Joined: 17 Aug 2007
Posts: 1956

PostPosted: Wed Feb 04, 2009 4:05 am    Post subject: Reply with quote

Exactamundo! Big-endian data in a nutshell. The SH2 used by the 32X is also big-endian. Funny enough, the Z80 is not. 16 bit values used by the Z80 are little-endian. That's because the Z80 is based on Intel's 8080 line of CPUs, and all Intel CPUs are little-endian.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    SpritesMind.Net Forum Index -> Blabla All times are GMT
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