| View previous topic :: View next topic |
| Author |
Message |
Jorge Nuno Very interested

Joined: 11 Jun 2007 Posts: 329 Location: Azeitão, PT
|
Posted: Tue Feb 03, 2009 10:48 pm Post subject: 68k endianess question |
|
|
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  |
|
| Back to top |
|
 |
TmEE co.(TM) Very interested

Joined: 05 Dec 2006 Posts: 1947 Location: Estonia, Mahtra village
|
Posted: Tue Feb 03, 2009 11:15 pm Post subject: |
|
|
I just changed my flashing code when I found out that upper and lower bytes were swapped on my flashcart
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  |
|
| Back to top |
|
 |
Jorge Nuno Very interested

Joined: 11 Jun 2007 Posts: 329 Location: Azeitão, PT
|
Posted: Tue Feb 03, 2009 11:24 pm Post subject: |
|
|
| TmEE co.(TM) wrote: | I just changed my flashing code when I found out that upper and lower bytes were swapped on my flashcart
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 |
|
 |
TmEE co.(TM) Very interested

Joined: 05 Dec 2006 Posts: 1947 Location: Estonia, Mahtra village
|
Posted: Tue Feb 03, 2009 11:33 pm Post subject: |
|
|
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  |
|
| Back to top |
|
 |
Jorge Nuno Very interested

Joined: 11 Jun 2007 Posts: 329 Location: Azeitão, PT
|
Posted: Tue Feb 03, 2009 11:34 pm Post subject: |
|
|
| 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... |
|
| Back to top |
|
 |
Chilly Willy Very interested
Joined: 17 Aug 2007 Posts: 1956
|
Posted: Tue Feb 03, 2009 11:38 pm Post subject: |
|
|
| 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 |
|
 |
HardWareMan Very interested
Joined: 15 Dec 2007 Posts: 542 Location: Kazakhstan, Pavlodar
|
Posted: Wed Feb 04, 2009 3:46 am Post subject: |
|
|
| 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 |
|
 |
Chilly Willy Very interested
Joined: 17 Aug 2007 Posts: 1956
|
Posted: Wed Feb 04, 2009 4:05 am Post subject: |
|
|
| 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 |
|
 |
|