Does Memory Chip have endianness?

For hardware talk only (please avoid ROM dumper stuff)
Post Reply
mickagame
Very interested
Posts: 256
Joined: Sat Jun 07, 2008 7:37 am

Does Memory Chip have endianness?

Post by mickagame » Fri May 29, 2015 6:16 am

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?

Stef
Very interested
Posts: 3131
Joined: Thu Nov 30, 2006 9:46 pm
Location: France - Sevres
Contact:

Post by Stef » Fri May 29, 2015 9:30 am

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.

mickagame
Very interested
Posts: 256
Joined: Sat Jun 07, 2008 7:37 am

Post by mickagame » Fri May 29, 2015 1:02 pm

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);
}

r57shell
Very interested
Posts: 478
Joined: Sun Dec 23, 2012 1:30 pm
Location: Russia
Contact:

Post by r57shell » Mon Jun 22, 2015 1:59 pm

didn't read your way of thinking...
but code looks correct.
Image

Post Reply