1 /*
2  *  KCemu -- The emulator for the KC85 homecomputer series and much more.
3  *  Copyright (C) 1997-2010 Torsten Paul
4  *
5  *  This program is free software; you can redistribute it and/or modify
6  *  it under the terms of the GNU General Public License as published by
7  *  the Free Software Foundation; either version 2 of the License, or
8  *  (at your option) any later version.
9  *
10  *  This program is distributed in the hope that it will be useful,
11  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
12  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
13  *  GNU General Public License for more details.
14  *
15  *  You should have received a copy of the GNU General Public License along
16  *  with this program; if not, write to the Free Software Foundation, Inc.,
17  *  51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18  */
19 
20 #ifndef __kc_memory7_h
21 #define __kc_memory7_h
22 
23 #include "kc/system.h"
24 
25 #include "kc/kc.h"
26 #include "kc/romdi.h"
27 #include "kc/memory.h"
28 #include "kc/memoryif.h"
29 
30 class Memory7 : public Memory, public ROMDIInterface
31 {
32 private:
33   byte_t _ram[0x4000];
34   byte_t _irm[0x0800];
35   byte_t _rom_os[0x1000];
36   byte_t _rom_basic[0x2800];
37   byte_t _rom_chargen[0x0800];
38 
39   MemAreaGroup *_m_scr;    /* scratch memory */
40   MemAreaGroup *_m_ram;    /* RAM   0000h - 3fffh */
41   MemAreaGroup *_m_basic;  /* BASIC c000h - e7ffh */
42   MemAreaGroup *_m_irm_e8; /* IRM   e800h - bfffh (color, readonly) */
43   MemAreaGroup *_m_irm_ec; /* IRM   ec00h - efffh (text) */
44   MemAreaGroup *_m_os;     /* OS    f000h - ffffh */
45 
46   typedef std::list<ROMDIInterface *> romdi_list_t;
47   romdi_list_t _romdi_list;
48   bool _romdi;
49 
50   typedef std::list<MemoryInterface *> memory_list_t;
51   memory_list_t _memory_list;
52 
53 public:
54   Memory7(void);
55   virtual ~Memory7(void);
56   void dumpCore(void);
57 
58   byte_t memRead8(word_t addr);
59   void memWrite8(word_t addr, byte_t val);
60 
61   byte_t * get_irm(void);
62   byte_t * get_char_rom(void);
63 
64   void set_romdi(bool val);
65   void register_romdi_handler(ROMDIInterface *handler);
66   void unregister_romdi_handler(ROMDIInterface *handler);
67 
68   void register_memory_handler(MemoryInterface *handler);
69   void unregister_memory_handler(MemoryInterface *handler);
70 
71   virtual void reset(bool power_on = false);
72 
73   /*
74    *  ROMDIInterface
75    */
76   void romdi(bool val);
77 };
78 
79 #endif /* __kc_memory7_h */
80