~ubuntu-branches/ubuntu/raring/vice/raring

« back to all changes in this revision

Viewing changes to src/c64dtv/c64dtvmemrom.c

  • Committer: Bazaar Package Importer
  • Author(s): Laszlo Boszormenyi (GCS)
  • Date: 2009-03-31 00:37:15 UTC
  • mfrom: (1.2.2 upstream)
  • mto: This revision was merged to the branch mainline in revision 17.
  • Revision ID: james.westby@ubuntu.com-20090331003715-mzclchtl0dp7fcl0
Tags: upstream-2.1.dfsg
ImportĀ upstreamĀ versionĀ 2.1.dfsg

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * c64dtvmemrom.c -- C64 DTV ROM access.
 
3
 *
 
4
 * Written by
 
5
 *  M.Kiesel <mayne@users.sourceforge.net>
 
6
 * Based on code by
 
7
 *  Andreas Boose <viceteam@t-online.de>
 
8
 *
 
9
 * This file is part of VICE, the Versatile Commodore Emulator.
 
10
 * See README for copyright notice.
 
11
 *
 
12
 *  This program is free software; you can redistribute it and/or modify
 
13
 *  it under the terms of the GNU General Public License as published by
 
14
 *  the Free Software Foundation; either version 2 of the License, or
 
15
 *  (at your option) any later version.
 
16
 *
 
17
 *  This program is distributed in the hope that it will be useful,
 
18
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
19
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
20
 *  GNU General Public License for more details.
 
21
 *
 
22
 *  You should have received a copy of the GNU General Public License
 
23
 *  along with this program; if not, write to the Free Software
 
24
 *  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
 
25
 *  02111-1307  USA.
 
26
 *
 
27
 */
 
28
 
 
29
#include "vice.h"
 
30
 
 
31
#include "c64mem.h"
 
32
#include "c64memrom.h"
 
33
#include "types.h"
 
34
#include "c64dtvmem.h"
 
35
#include "c64dtvflash.h"
 
36
 
 
37
/* These are read directly from flash in the DTV emulation and not used. */
 
38
BYTE c64memrom_basic64_rom[C64_BASIC_ROM_SIZE];
 
39
BYTE c64memrom_kernal64_rom[C64_KERNAL_ROM_SIZE];
 
40
BYTE c64memrom_kernal64_trap_rom[C64_KERNAL_ROM_SIZE];
 
41
 
 
42
BYTE REGPARM1 c64memrom_kernal64_read(WORD addr)
 
43
{
 
44
    int mapping = c64dtvmem_memmapper[0];
 
45
    int paddr = ((mapping & 0x1f) << 16) + addr;
 
46
    if((mapping >> 6)==0)
 
47
        return c64dtvflash_read(paddr);
 
48
    else
 
49
        return mem_ram[paddr];
 
50
}
 
51
 
 
52
static void REGPARM2 c64memrom_kernal64_store(WORD addr, BYTE value)
 
53
{
 
54
    int mapping = c64dtvmem_memmapper[0];
 
55
    int paddr = ((mapping & 0x1f) << 16) + addr;
 
56
    if((mapping >> 6)==0)
 
57
        c64dtvflash_store_direct(paddr, value);
 
58
    else
 
59
        mem_ram[paddr] = value;
 
60
}
 
61
 
 
62
BYTE REGPARM1 c64memrom_basic64_read(WORD addr)
 
63
{
 
64
    int mapping = c64dtvmem_memmapper[1];
 
65
    int paddr = ((mapping & 0x1f) << 16) + addr;
 
66
    if((mapping >> 6)==0)
 
67
        return c64dtvflash_read(paddr);
 
68
    else
 
69
        return mem_ram[paddr];
 
70
}
 
71
 
 
72
/* static void REGPARM2 c64memrom_basic64_store(WORD addr, BYTE value)
 
73
{
 
74
}
 
75
*/
 
76
 
 
77
/* We don't use trap_rom in the DTV emulation. Traps are installed in */
 
78
/* flash/RAM directly and temporarily removed when accessing $d10x. */
 
79
 
 
80
BYTE REGPARM1 c64memrom_trap_read(WORD addr)
 
81
{
 
82
    switch (addr & 0xf000) {
 
83
      case 0xe000:
 
84
      case 0xf000:
 
85
        return c64memrom_kernal64_read(addr);
 
86
        break;
 
87
    }
 
88
    return 0;
 
89
}
 
90
 
 
91
void REGPARM2 c64memrom_trap_store(WORD addr, BYTE value)
 
92
{
 
93
    switch (addr & 0xf000) {
 
94
      case 0xe000:
 
95
      case 0xf000:
 
96
        c64memrom_kernal64_store(addr, value);
 
97
        break;
 
98
    }
 
99
}
 
100
 
 
101
BYTE REGPARM1 c64memrom_rom64_read(WORD addr)
 
102
{
 
103
    switch (addr & 0xf000) {
 
104
      case 0xa000:
 
105
      case 0xb000:
 
106
        return c64dtvflash_read(addr);
 
107
      case 0xd000:
 
108
        return chargen_read(addr);
 
109
      case 0xe000:
 
110
      case 0xf000:
 
111
        return c64dtvflash_read(addr);
 
112
    }
 
113
 
 
114
    return 0;
 
115
}
 
116
 
 
117
void REGPARM2 c64memrom_rom64_store(WORD addr, BYTE value)
 
118
{
 
119
    switch (addr & 0xf000) {
 
120
      case 0xa000:
 
121
      case 0xb000:
 
122
        break;
 
123
      case 0xd000:
 
124
        chargen_store(addr, value);
 
125
        break;
 
126
      case 0xe000:
 
127
      case 0xf000:
 
128
        break;
 
129
    }
 
130
}
 
131