annotate Plugins/Input/sexypsf/PsxMem.h @ 790:8f437afc4f4a trunk

[svn] - more sanity checking
author nenolod
date Fri, 03 Mar 2006 20:09:52 -0800
parents d539e5c5f730
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
333
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
1 /* Pcsx - Pc Psx Emulator
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
2 * Copyright (C) 1999-2002 Pcsx Team
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
3 *
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
4 * This program is free software; you can redistribute it and/or modify
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
5 * it under the terms of the GNU General Public License as published by
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
6 * the Free Software Foundation; either version 2 of the License, or
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
7 * (at your option) any later version.
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
8 *
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
9 * This program is distributed in the hope that it will be useful,
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
12 * GNU General Public License for more details.
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
13 *
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
14 * You should have received a copy of the GNU General Public License
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
15 * along with this program; if not, write to the Free Software
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
16 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
17 */
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
18
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
19 #ifndef __PSXMEMORY_H__
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
20 #define __PSXMEMORY_H__
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
21
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
22 #ifdef MSB_FIRST
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
23 static INLINE u16 BFLIP16(u16 x)
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
24 {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
25 return( ((x>>8)&0xFF)| ((x&0xFF)<<8) );
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
26 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
27
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
28 static INLINE u32 BFLIP32(u32 x)
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
29 {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
30 return ( ((x>>24)&0xFF) | ((x>>8)&0xFF00) | ((x<<8)&0xFF0000) | ((x<<24)&0xFF000000) );
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
31 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
32 #else
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
33 static INLINE u16 BFLIP16(u16 x)
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
34 {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
35 return x;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
36 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
37
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
38 static INLINE u32 BFLIP32(u32 x)
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
39 {
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
40 return x;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
41 }
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
42 #endif
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
43
701
d539e5c5f730 [svn] Fixes of the remaining GCC 4.1 warnings from external contributor Diego "Flameeyes" Petteno (Gentoo).
chainsaw
parents: 640
diff changeset
44 static INLINE s32 BFLIP32S(s32 x)
d539e5c5f730 [svn] Fixes of the remaining GCC 4.1 warnings from external contributor Diego "Flameeyes" Petteno (Gentoo).
chainsaw
parents: 640
diff changeset
45 { return (s32)BFLIP32((u32)x); }
d539e5c5f730 [svn] Fixes of the remaining GCC 4.1 warnings from external contributor Diego "Flameeyes" Petteno (Gentoo).
chainsaw
parents: 640
diff changeset
46
d539e5c5f730 [svn] Fixes of the remaining GCC 4.1 warnings from external contributor Diego "Flameeyes" Petteno (Gentoo).
chainsaw
parents: 640
diff changeset
47 static INLINE s16 BFLIP16S(s16 x)
d539e5c5f730 [svn] Fixes of the remaining GCC 4.1 warnings from external contributor Diego "Flameeyes" Petteno (Gentoo).
chainsaw
parents: 640
diff changeset
48 { return (s16)BFLIP16((u16)x); }
d539e5c5f730 [svn] Fixes of the remaining GCC 4.1 warnings from external contributor Diego "Flameeyes" Petteno (Gentoo).
chainsaw
parents: 640
diff changeset
49
640
f26682a2825b [svn] Addresses most of the warnings in the code, and uses a -W CFLAG to disable the non-null checks. From external contributor Harald van Dijk (Gentoo).
chainsaw
parents: 410
diff changeset
50 char *psxM;
333
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
51 #define psxMu32(mem) (*(u32*)&psxM[(mem) & 0x1fffff])
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
52
640
f26682a2825b [svn] Addresses most of the warnings in the code, and uses a -W CFLAG to disable the non-null checks. From external contributor Harald van Dijk (Gentoo).
chainsaw
parents: 410
diff changeset
53 char *psxP;
f26682a2825b [svn] Addresses most of the warnings in the code, and uses a -W CFLAG to disable the non-null checks. From external contributor Harald van Dijk (Gentoo).
chainsaw
parents: 410
diff changeset
54 char *psxR;
333
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
55 #define psxRu32(mem) (*(u32*)&psxR[(mem) & 0x7ffff])
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
56
640
f26682a2825b [svn] Addresses most of the warnings in the code, and uses a -W CFLAG to disable the non-null checks. From external contributor Harald van Dijk (Gentoo).
chainsaw
parents: 410
diff changeset
57 char *psxH;
333
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
58
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
59 #define psxHu8(mem) (*(u8*) &psxH[(mem) & 0xffff])
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
60
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
61 #define psxHu16(mem) (*(u16*)&psxH[(mem) & 0xffff])
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
62 #define psxHu32(mem) (*(u32*)&psxH[(mem) & 0xffff])
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
63
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
64 char **psxMemLUT;
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
65
640
f26682a2825b [svn] Addresses most of the warnings in the code, and uses a -W CFLAG to disable the non-null checks. From external contributor Harald van Dijk (Gentoo).
chainsaw
parents: 410
diff changeset
66 #define PSXM(mem) (psxMemLUT[(mem) >> 16] == 0 ? NULL : (void*)(psxMemLUT[(mem) >> 16] + ((mem) & 0xffff)))
333
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
67
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
68 #define PSXMu8(mem) (*(u8 *)PSXM(mem))
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
69 #define PSXMu32(mem) (*(u32*)PSXM(mem))
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
70
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
71 #define PSXMuR8(mem) (PSXM(mem)?PSXMu8(mem):0)
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
72 #define PSXMuW8(mem,val) (PSXM(mem)?PSXMu8(mem)=val:;)
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
73
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
74 int psxMemInit();
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
75 void psxMemReset();
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
76 void psxMemShutdown();
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
77
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
78 u8 psxMemRead8 (u32 mem);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
79 u16 psxMemRead16(u32 mem);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
80 u32 psxMemRead32(u32 mem);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
81 void psxMemWrite8 (u32 mem, u8 value);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
82 void psxMemWrite16(u32 mem, u16 value);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
83 void psxMemWrite32(u32 mem, u32 value);
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
84
640
f26682a2825b [svn] Addresses most of the warnings in the code, and uses a -W CFLAG to disable the non-null checks. From external contributor Harald van Dijk (Gentoo).
chainsaw
parents: 410
diff changeset
85 void LoadPSXMem(u32 address, s32 length, unsigned char *data);
333
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
86
42cdc99e395a [svn] Now that the build system is ready, upload the plugin code.
chainsaw
parents:
diff changeset
87 #endif /* __PSXMEMORY_H__ */