68k endianess question

Talk about anything else you want

Moderator: BigEvilCorporation

Post Reply
Jorge Nuno
Very interested
Posts: 374
Joined: Mon Jun 11, 2007 3:09 am
Location: Azeitão, PT

68k endianess question

Post by Jorge Nuno » Tue Feb 03, 2009 10:48 pm

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? :?

Thanks 8)

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Tue Feb 03, 2009 11:15 pm

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

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 ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Jorge Nuno
Very interested
Posts: 374
Joined: Mon Jun 11, 2007 3:09 am
Location: Azeitão, PT

Post by Jorge Nuno » Tue Feb 03, 2009 11:24 pm

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

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.

TmEE co.(TM)
Very interested
Posts: 2440
Joined: Tue Dec 05, 2006 1:37 pm
Location: Estonia, Rapla City
Contact:

Post by TmEE co.(TM) » Tue Feb 03, 2009 11:33 pm

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 :)
Mida sa loed ? Nagunii aru ei saa ;)
http://www.tmeeco.eu
Files of all broken links and images of mine are found here : http://www.tmeeco.eu/FileDen

Jorge Nuno
Very interested
Posts: 374
Joined: Mon Jun 11, 2007 3:09 am
Location: Azeitão, PT

Post by Jorge Nuno » Tue Feb 03, 2009 11:34 pm

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 :)

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


D-RAM!

BAHH...

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Tue Feb 03, 2009 11:38 pm

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.

HardWareMan
Very interested
Posts: 745
Joined: Sat Dec 15, 2007 7:49 am
Location: Kazakhstan, Pavlodar

Post by HardWareMan » Wed Feb 04, 2009 3:46 am

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: Select all

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.

Chilly Willy
Very interested
Posts: 2984
Joined: Fri Aug 17, 2007 9:33 pm

Post by Chilly Willy » Wed Feb 04, 2009 4:05 am

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.

Post Reply