Page 1 of 1

Does Memory Chip have endianness?

Posted: Fri May 29, 2015 6:16 am
by mickagame
Writing my genesis emulator i'm asking myself question about memory Chip.
Does a memory chip is made to take part or in MSB or LSB system?

If i take the example of M68000.
If I write 0x1100 at 0x000000, the processor waiting that :
- If I read data at 0x000000 it return 0x11 (MSB)
- If I read data at 0x000001 it return 0x00 (LSB)

So I conclude that genesis RAM couldn't work in LSB system?

Posted: Fri May 29, 2015 9:30 am
by Stef
Endianess is just a CPU thing, not memory.
Just just connect the BUS address and data BUS to memory then the CPU does its stuff. The 68000 does work in big endian.

Posted: Fri May 29, 2015 1:02 pm
by mickagame
I think whatever th access m68000 do (word or byte) the 68000 always do word access. Lds and uds complete the access.
In exemple i take the m68000 do word access and because uds is set (access to addr 0x000000 so msb) the CPU takes only thé msb of the word and put in register.

That s my point of view. I hope this is correct :-)

I would emulate the bus access this way :

CPU 68K readByte Internal Method (without optimization)

Code: Select all

u8 M68000::readByte(u32 addr)
{
     u8 data;

     data = bus->readWord(addr & 0xFFFFE);
     
     if (addr & 0x01)
          data &= 0xFF); // A0 = 1 <=> LDS Low <=> LSB of Word
     else
          data = (data >> 8) & 0xFF; // A0 = 0 <=> UDS Low <=> MSB of Word

     return (data);
}

Posted: Mon Jun 22, 2015 1:59 pm
by r57shell
didn't read your way of thinking...
but code looks correct.