Speed up sim65 by 10%

This commit is contained in:
Lauri Kasanen
2022-10-17 13:32:38 +03:00
parent 34ff99aef0
commit b052e64089
2 changed files with 11 additions and 10 deletions

View File

@@ -46,7 +46,7 @@
/* THE memory */ /* THE memory */
static unsigned char Mem[0x10000]; unsigned char Mem[0x10000];
@@ -73,14 +73,6 @@ void MemWriteWord (unsigned Addr, unsigned Val)
unsigned char MemReadByte (unsigned Addr)
/* Read a byte from a memory location */
{
return Mem[Addr];
}
unsigned MemReadWord (unsigned Addr) unsigned MemReadWord (unsigned Addr)
/* Read a word from a memory location */ /* Read a word from a memory location */
{ {

View File

@@ -36,7 +36,9 @@
#ifndef MEMORY_H #ifndef MEMORY_H
#define MEMORY_H #define MEMORY_H
#include "inline.h"
extern unsigned char Mem[0x10000];
/*****************************************************************************/ /*****************************************************************************/
/* Code */ /* Code */
@@ -50,8 +52,15 @@ void MemWriteByte (unsigned Addr, unsigned char Val);
void MemWriteWord (unsigned Addr, unsigned Val); void MemWriteWord (unsigned Addr, unsigned Val);
/* Write a word to a memory location */ /* Write a word to a memory location */
unsigned char MemReadByte (unsigned Addr); #if defined(HAVE_INLINE)
INLINE unsigned char MemReadByte (unsigned Addr)
/* Read a byte from a memory location */ /* Read a byte from a memory location */
{
return Mem[Addr];
}
#else
#define MemReadByte(Addr) Mem[Addr]
#endif
unsigned MemReadWord (unsigned Addr); unsigned MemReadWord (unsigned Addr);
/* Read a word from a memory location */ /* Read a word from a memory location */