1 |
cebix |
1.1 |
/* |
2 |
|
|
* mem.cpp - Emulator memory management |
3 |
|
|
* |
4 |
cebix |
1.2 |
* SIDPlayer (C) Copyright 1996-2001 Christian Bauer |
5 |
cebix |
1.1 |
* |
6 |
|
|
* This program 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 |
|
|
* This program 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 this program; if not, write to the Free Software |
18 |
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
19 |
|
|
*/ |
20 |
|
|
|
21 |
|
|
#include "sys.h" |
22 |
|
|
|
23 |
|
|
#include <string.h> |
24 |
|
|
|
25 |
|
|
#ifndef __psx__ |
26 |
|
|
#include <errno.h> |
27 |
|
|
#endif |
28 |
|
|
|
29 |
|
|
#include "mem.h" |
30 |
|
|
|
31 |
|
|
|
32 |
|
|
// Memory area |
33 |
|
|
uint8 ram[RAM_SIZE]; |
34 |
|
|
|
35 |
|
|
|
36 |
|
|
/* |
37 |
|
|
* Init memory management |
38 |
|
|
*/ |
39 |
|
|
|
40 |
|
|
void MemoryInit(void) |
41 |
|
|
{ |
42 |
|
|
// Clear memory contents |
43 |
|
|
MemoryClear(); |
44 |
|
|
} |
45 |
|
|
|
46 |
|
|
|
47 |
|
|
/* |
48 |
|
|
* Exit memory management |
49 |
|
|
*/ |
50 |
|
|
|
51 |
|
|
void MemoryExit(void) |
52 |
|
|
{ |
53 |
|
|
} |
54 |
|
|
|
55 |
|
|
|
56 |
|
|
/* |
57 |
|
|
* Clear memory contents |
58 |
|
|
*/ |
59 |
|
|
|
60 |
|
|
void MemoryClear(void) |
61 |
|
|
{ |
62 |
|
|
memset(ram, 0, RAM_SIZE - 0x2000); |
63 |
|
|
memset(ram + 0xe000, 0x40, 0x2000); // Fill kernal ROM area with RTI |
64 |
|
|
ram[1] = 7; // 6510 I/O port |
65 |
|
|
ram[0x0314] = 0x31; // IRQ vector |
66 |
|
|
ram[0x0315] = 0xea; |
67 |
|
|
} |