AxibugEmuOnline/virtuanessrc097-master/NES/Mapper/Mapper.cpp

62 lines
4.0 KiB
C++
Raw Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/*----------------------------------------------------------------------*/
/* */
/* NES Mapeers */
/* Norix */
/* written 2000/02/05 */
/* last modify ----/--/-- */
/*----------------------------------------------------------------------*/
/*--------------[ INCLUDE ]-------------------------------*/
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <stdio.h>
#include <stdlib.h>
#include "DebugOut.h"
#include "typedef.h"
#include "macro.h"
#include "nes.h"
#include "mmu.h"
#include "mapper.h"
/*--------------[ DEFINE ]-------------------------------*/
/*--------------[ EXTERNAL PROGRAM ]-------------------------------*/
/*--------------[ EXTERNAL WORK ]-------------------------------*/
/*--------------[ WORK ]-------------------------------*/
/*--------------[ PROTOTYPE ]-------------------------------*/
/*--------------[ CONST ]-------------------------------*/
/*--------------[ PROGRAM ]-------------------------------*/
//////////////////////////////////////////////////////////////////////////
// Based class implement
//////////////////////////////////////////////////////////////////////////
Mapper::Mapper( NES* parent ) : nes(parent)
{
}
Mapper::~Mapper()
{
}
// $4100-$7FFF Lower Memory read
BYTE Mapper::ReadLow( WORD addr )
{
// $6000-$7FFF WRAM
if( addr >= 0x6000 && addr <= 0x7FFF ) {
return CPU_MEM_BANK[addr>>13][addr&0x1FFF];
}
return (BYTE)(addr>>8);
}
// $4100-$7FFF Lower Memory write
void Mapper::WriteLow( WORD addr, BYTE data )
{
// $6000-$7FFF WRAM
if( addr >= 0x6000 && addr <= 0x7FFF ) {
CPU_MEM_BANK[addr>>13][addr&0x1FFF] = data;
}
}