forked from MSXALL/pymsx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgen_rom.py
33 lines (23 loc) · 815 Bytes
/
gen_rom.py
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
# (C) 2020 by Folkert van Heusden <[email protected]>
# released under AGPL v3.0
import sys
from typing import List
class gen_rom:
def __init__(self, gen_rom_file, debug, offset=0x4000):
print('Loading gen rom %s at %04x...' % (gen_rom_file, offset), file=sys.stderr)
self.offset: int = offset
fh = open(gen_rom_file, 'rb')
self.rom: List[int] = [ int(b) for b in fh.read() ]
fh.close()
self.debug = debug
def get_ios(self):
return [ [ ], [ ] ]
def get_name(self):
return 'generic ROM'
def get_n_pages(self):
return (len(self.rom) + 16383) // 16384
def write_mem(self, a: int, v: int) -> None:
pass
def read_mem(self, a: int) -> int:
offset = a - self.offset
return self.rom[offset]