2 FUJITSU FM Towns Emulator 'eFMTowns'
4 Author : Kyuma.Ohta <whatisthis.sowhat _at_ gmail.com>
7 [ SYSTEM rom & RAM area 0x000f8000 - 0x000fffff]
9 * 0x000f8000 - 0x000fffff : RAM / DICTIONARY (BANKED)
10 * 0xfffc0000 - 0xffffffff : SYSTEM ROM
15 #include "./towns_common.h"
16 #include "./towns_sysrom.h"
17 #include "./towns_dictionary.h"
18 #include "../../fileio.h"
21 void SYSROM::initialize()
23 memset(rom, 0xff, sizeof(rom));
25 FILEIO* fio = new FILEIO();
26 if(fio->Fopen(create_local_path(_T("FMT_SYS.ROM")), FILEIO_READ_BINARY)) { // DICTIONARIES
27 fio->Fread(rom, sizeof(rom), 1);
38 uint32_t SYSROM::read_memory_mapped_io8(uint32_t addr)
40 uint8_t n_data = 0xff;
41 if(addr < 0xfffc0000) { // Banked (from MSDOS/i86 compatible mode)
42 if((addr >= 0x000f8000) && (addr < 0x00100000)) {
43 n_data = rom[(addr & 0x7fff) + 0x38000];
46 n_data = rom[addr & 0x3ffff];
48 return (uint32_t)n_data;
51 uint32_t SYSROM::read_memory_mapped_io16(uint32_t addr)
57 nd.b.l = read_memory_mapped_io8(addr + 0);
58 nd.b.h = read_memory_mapped_io8(addr + 1);
62 uint32_t SYSROM::read_memory_mapped_io32(uint32_t addr)
67 nd.b.l = read_memory_mapped_io8(addr + 0);
68 nd.b.h = read_memory_mapped_io8(addr + 1);
69 nd.b.h2 = read_memory_mapped_io8(addr + 2);
70 nd.b.h3 = read_memory_mapped_io8(addr + 3);
74 void SYSROM::write_memory_mapped_io8(uint32_t addr, uint32_t data)
81 void SYSROM::write_memory_mapped_io16(uint32_t addr, uint32_t data)
84 nd.w = (uint16_t)data;
86 write_memory_mapped_io8(addr + 0, nd.b.l);
87 write_memory_mapped_io8(addr + 1, nd.b.h);
90 void SYSROM::write_memory_mapped_io32(uint32_t addr, uint32_t data)
94 write_memory_mapped_io8(addr + 0, nd.b.l);
95 write_memory_mapped_io8(addr + 1, nd.b.h);
96 write_memory_mapped_io8(addr + 2, nd.b.h2);
97 write_memory_mapped_io8(addr + 3, nd.b.h3);