aboutsummaryrefslogtreecommitdiff
path: root/SrcShared/Hardware/EmRegs.h
blob: 1a48907b21834b38ff35d5db0aaa7fe3de537e14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
/* -*- mode: C++; tab-width: 4 -*- */
/* ===================================================================== *\
	Copyright (c) 2000-2001 Palm, Inc. or its subsidiaries.
	All rights reserved.

	This file is part of the Palm OS Emulator.

	This program is free software; you can redistribute it and/or modify
	it under the terms of the GNU General Public License as published by
	the Free Software Foundation; either version 2 of the License, or
	(at your option) any later version.
\* ===================================================================== */

#ifndef EmRegs_h
#define EmRegs_h

#include <vector>

class SessionFile;
struct EmAddressBank;

class EmRegs
{
	public:
								EmRegs					(void);
		virtual					~EmRegs					(void);

		virtual void			Initialize				(void);
		virtual void			Reset					(Bool hardwareReset);
		virtual void			Save					(SessionFile&);
		virtual void			Load					(SessionFile&);
		virtual void			Dispose					(void);

		void 					SetBankHandlers			(EmAddressBank&);
		virtual void			SetSubBankHandlers		(void) = 0;

		virtual uint32			GetLong					(emuptr address);
		virtual uint32			GetWord					(emuptr address);
		virtual uint32			GetByte					(emuptr address);
		virtual void			SetLong					(emuptr address, uint32 value);
		virtual void			SetWord					(emuptr address, uint32 value);
		virtual void			SetByte					(emuptr address, uint32 value);
		virtual int				ValidAddress			(emuptr address, uint32 size);
		virtual uint8*			GetRealAddress			(emuptr address) = 0;
		virtual emuptr			GetAddressStart			(void) = 0;
		virtual uint32			GetAddressRange			(void) = 0;

	protected:
		typedef uint32			(EmRegs::*ReadFunction) (emuptr address, int size);
		typedef void			(EmRegs::*WriteFunction) (emuptr address, int size, uint32 value);

		void					SetHandler				(ReadFunction read,
														 WriteFunction write,
														 uint32 start, int count);

		uint32					UnsupportedRead			(emuptr address, int size);
		uint32					StdRead					(emuptr address, int size);
		uint32					StdReadBE				(emuptr address, int size);
		uint32					ZeroRead				(emuptr address, int size);

		void					UnsupportedWrite		(emuptr address, int size, uint32 value);
		void					StdWrite				(emuptr address, int size, uint32 value);
		void					StdWriteBE				(emuptr address, int size, uint32 value);
		void					NullWrite				(emuptr address, int size, uint32 value);

	private:
		typedef vector<ReadFunction>	ReadFunctionList;
		typedef vector<WriteFunction>	WriteFunctionList;

		ReadFunctionList		fReadFunctions;
		WriteFunctionList		fWriteFunctions;
};


typedef vector<EmRegs*>	EmRegsList;

#endif	/* EmRegs_h */