1 /* Copyright 2004-2005 Theo Berkau 2 Copyright 2005 Guillaume Duhamel 3 4 This file is part of Yabause. 5 6 Yabause is free software; you can redistribute it and/or modify 7 it under the terms of the GNU General Public License as published by 8 the Free Software Foundation; either version 2 of the License, or 9 (at your option) any later version. 10 11 Yabause is distributed in the hope that it will be useful, 12 but WITHOUT ANY WARRANTY; without even the implied warranty of 13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 GNU General Public License for more details. 15 16 You should have received a copy of the GNU General Public License 17 along with Yabause; if not, write to the Free Software 18 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA 19 */ 20 21 #ifndef CS0_H 22 #define CS0_H 23 24 #include "memory.h" 25 26 #define CART_NONE 0 27 #define CART_PAR 1 28 #define CART_BACKUPRAM4MBIT 2 29 #define CART_BACKUPRAM8MBIT 3 30 #define CART_BACKUPRAM16MBIT 4 31 #define CART_BACKUPRAM32MBIT 5 32 #define CART_DRAM8MBIT 6 33 #define CART_DRAM32MBIT 7 34 #define CART_NETLINK 8 35 #define CART_ROM16MBIT 9 36 #define CART_JAPMODEM 10 37 #define CART_USBDEV 11 38 39 typedef struct 40 { 41 int carttype; 42 int cartid; 43 const char *filename; 44 45 u8 FASTCALL (*Cs0ReadByte)(SH2_struct *sh, u32 addr); 46 u16 FASTCALL (*Cs0ReadWord)(SH2_struct *sh, u32 addr); 47 u32 FASTCALL (*Cs0ReadLong)(SH2_struct *sh, u32 addr); 48 void FASTCALL (*Cs0WriteByte)(SH2_struct *sh, u32 addr, u8 val); 49 void FASTCALL (*Cs0WriteWord)(SH2_struct *sh, u32 addr, u16 val); 50 void FASTCALL (*Cs0WriteLong)(SH2_struct *sh, u32 addr, u32 val); 51 52 u8 FASTCALL (*Cs1ReadByte)(SH2_struct *sh, u32 addr); 53 u16 FASTCALL (*Cs1ReadWord)(SH2_struct *sh, u32 addr); 54 u32 FASTCALL (*Cs1ReadLong)(SH2_struct *sh, u32 addr); 55 void FASTCALL (*Cs1WriteByte)(SH2_struct *sh, u32 addr, u8 val); 56 void FASTCALL (*Cs1WriteWord)(SH2_struct *sh, u32 addr, u16 val); 57 void FASTCALL (*Cs1WriteLong)(SH2_struct *sh, u32 addr, u32 val); 58 59 u8 FASTCALL (*Cs2ReadByte)(SH2_struct *sh, u32 addr); 60 u16 FASTCALL (*Cs2ReadWord)(SH2_struct *sh, u32 addr); 61 u32 FASTCALL (*Cs2ReadLong)(SH2_struct *sh, u32 addr); 62 void FASTCALL (*Cs2WriteByte)(SH2_struct *sh, u32 addr, u8 val); 63 void FASTCALL (*Cs2WriteWord)(SH2_struct *sh, u32 addr, u16 val); 64 void FASTCALL (*Cs2WriteLong)(SH2_struct *sh, u32 addr, u32 val); 65 66 void *rom; 67 void *bupram; 68 void *dram; 69 } cartridge_struct; 70 71 extern cartridge_struct *CartridgeArea; 72 73 int CartInit(const char *filename, int); 74 void CartFlush(void); 75 void CartDeInit(void); 76 77 int CartSaveState(FILE *fp); 78 int CartLoadState(FILE *fp, int version, int size); 79 80 #endif 81