/* Copyright 2003-2005 Guillaume Duhamel1Copyright 2005 Theo Berkau23This file is part of Yabause.45Yabause is free software; you can redistribute it and/or modify6it under the terms of the GNU General Public License as published by7the Free Software Foundation; either version 2 of the License, or8(at your option) any later version.910Yabause is distributed in the hope that it will be useful,11but WITHOUT ANY WARRANTY; without even the implied warranty of12MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13GNU General Public License for more details.1415You should have received a copy of the GNU General Public License16along with Yabause; if not, write to the Free Software17Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA18*/1920#include <stdlib.h>21#include "cs1.h"22#include "cs0.h"2324//////////////////////////////////////////////////////////////////////////////2526u8 FASTCALL Cs1ReadByte(u32 addr)27{28addr &= 0xFFFFFF;2930if (addr == 0xFFFFFF)31return CartridgeArea->cartid;3233return CartridgeArea->Cs1ReadByte(addr);34}3536//////////////////////////////////////////////////////////////////////////////3738u16 FASTCALL Cs1ReadWord(u32 addr)39{40addr &= 0xFFFFFF;4142if (addr == 0xFFFFFE)43return (0xFF00 | CartridgeArea->cartid);4445return CartridgeArea->Cs1ReadWord(addr);46}4748//////////////////////////////////////////////////////////////////////////////4950u32 FASTCALL Cs1ReadLong(u32 addr)51{52addr &= 0xFFFFFF;5354if (addr == 0xFFFFFC)55return (0xFF00FF00 | (CartridgeArea->cartid << 16) | CartridgeArea->cartid);5657return CartridgeArea->Cs1ReadLong(addr);58}5960//////////////////////////////////////////////////////////////////////////////6162void FASTCALL Cs1WriteByte(u32 addr, u8 val)63{64addr &= 0xFFFFFF;6566if (addr == 0xFFFFFF)67return;6869CartridgeArea->Cs1WriteByte(addr, val);70}7172//////////////////////////////////////////////////////////////////////////////7374void FASTCALL Cs1WriteWord(u32 addr, u16 val)75{76addr &= 0xFFFFFF;7778if (addr == 0xFFFFFE)79return;8081CartridgeArea->Cs1WriteWord(addr, val);82}8384//////////////////////////////////////////////////////////////////////////////8586void FASTCALL Cs1WriteLong(u32 addr, u32 val)87{88addr &= 0xFFFFFF;8990if (addr == 0xFFFFFC)91return;9293CartridgeArea->Cs1WriteLong(addr, val);94}9596//////////////////////////////////////////////////////////////////////////////979899