Пример #1
0
  def __init__(self, raw_mem, cpu, path_mgr):
    self.raw_mem = raw_mem
    self.ram_size = raw_mem.ram_size
    self.cpu = cpu
    self.path_mgr = path_mgr

    # create a label manager and error tracker
    self.label_mgr = LabelManager()
    self.error_tracker = ErrorTracker(cpu, self.label_mgr)
    self.label_mgr.error_tracker = self.error_tracker

    # set a label for first two dwords
    label = LabelRange("zero_page",0,8)
    self.label_mgr.add_label(label)
    
    # create memory access
    self.mem = MainMemory(self.raw_mem, self.error_tracker)
    self.mem.ctx = self

    # create memory allocator
    self.mem_begin = 0x1000
    self.alloc = MemoryAlloc(self.mem, 0, self.ram_size, self.mem_begin, self.label_mgr)
    
    # create segment loader
    self.seg_loader = SegmentLoader( self.mem, self.alloc, self.label_mgr, self.path_mgr )

    # lib manager
    self.lib_mgr = LibManager( self.label_mgr )
    
    # no current process right now
    self.process = None
    self.proc_list = []
    self.tr_list = []
Пример #2
0
    def __init__(self, raw_mem, cpu, traps, cfg):
        self.raw_mem = raw_mem
        self.ram_size = raw_mem.get_ram_size() * 1024  # in bytes
        self.cpu = cpu
        self.cpu_type = cfg.cpu
        self.traps = traps
        self.cfg = cfg
        #sys.settrace(Tracer().traceit)

        # too much RAM requested?
        # our "custom chips" start at $BFxxxx so we allow RAM only to be below
        if self.ram_size >= 0xbf0000 and self.cfg.hw_access != "disable":
            raise VamosConfigError(
                "Too much RAM configured! Only up to $BF0000 allowed.")

        # setup custom chips
        if self.cfg.hw_access != "disable":
            self.hw_access = HardwareAccess(raw_mem)
            self._setup_hw_access()

        # path manager
        self.path_mgr = PathManager(cfg)

        # create a label manager and error tracker
        if self.cfg.label_mgr != "disable":
            self.label_mgr = LabelManager()
        else:
            self.label_mgr = None
        self.error_tracker = ErrorTracker(cpu, self.label_mgr)
        if self.label_mgr != None:
            self.label_mgr.error_tracker = self.error_tracker

        # set a label for first two dwords
        if self.label_mgr != None:
            label = LabelRange("zero_page", 0, 8)
            self.label_mgr.add_label(label)

        # create memory access
        self.mem = MainMemory(raw_mem, self.error_tracker)
        self.mem.ctx = self
        self._setup_memory(raw_mem)

        # create memory allocator
        self.mem_begin = 0x1000
        self.alloc = MemoryAlloc(self.mem, 0, self.ram_size, self.mem_begin,
                                 self.label_mgr)

        # create segment loader
        self.seg_loader = SegmentLoader(self.mem, self.alloc, self.label_mgr,
                                        self.path_mgr)

        # lib manager
        self.lib_mgr = LibManager(self.label_mgr, cfg)

        # no current process right now
        self.process = None
        self.proc_list = []