[Core/MD] optimized SRAM word accesses on big-endian platform

This commit is contained in:
ekeeke 2019-11-28 00:22:13 +01:00
parent 0628db556f
commit e329aa1cc7
2 changed files with 4 additions and 7 deletions

View File

@ -2,7 +2,7 @@
* Genesis Plus
* Backup RAM support
*
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2019 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met:
@ -214,8 +214,7 @@ unsigned int sram_read_byte(unsigned int address)
unsigned int sram_read_word(unsigned int address)
{
address &= 0xfffe;
return (sram.sram[address + 1] | (sram.sram[address] << 8));
return READ_WORD(sram.sram, address & 0xfffe);
}
void sram_write_byte(unsigned int address, unsigned int data)
@ -225,7 +224,5 @@ void sram_write_byte(unsigned int address, unsigned int data)
void sram_write_word(unsigned int address, unsigned int data)
{
address &= 0xfffe;
sram.sram[address] = data >> 8;
sram.sram[address + 1] = data & 0xff;
WRITE_WORD(sram.sram, address & 0xfffe, data);
}

View File

@ -2,7 +2,7 @@
* Genesis Plus
* Backup RAM support
*
* Copyright (C) 2007-2016 Eke-Eke (Genesis Plus GX)
* Copyright (C) 2007-2019 Eke-Eke (Genesis Plus GX)
*
* Redistribution and use of this code or any derivative works are permitted
* provided that the following conditions are met: