当前位置: 首页>>代码示例>>Python>>正文


Python EbModule.toRegAddr方法代码示例

本文整理汇总了Python中EbModule.toRegAddr方法的典型用法代码示例。如果您正苦于以下问题:Python EbModule.toRegAddr方法的具体用法?Python EbModule.toRegAddr怎么用?Python EbModule.toRegAddr使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在EbModule的用法示例。


在下文中一共展示了EbModule.toRegAddr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: writeToRom

# 需要导入模块: import EbModule [as 别名]
# 或者: from EbModule import toRegAddr [as 别名]
 def writeToRom(self, rom):
     map_ptrs_addr = \
         EbModule.toRegAddr(rom.readMulti(self._MAP_PTRS_PTR_ADDR, 3))
     map_addrs = map(lambda x: \
         EbModule.toRegAddr(rom.readMulti(map_ptrs_addr+x*4,4)), \
         range(8))
     for i in range(self._MAP_HEIGHT):
         rom.write(map_addrs[i%8] + ((i>>3)<<8), map(lambda x: x & 0xff,
             self._tiles[i]))
     k = self._LOCAL_TSET_ADDR
     for i in range(self._MAP_HEIGHT>>3):
         for j in range(self._MAP_WIDTH):
             c = ((self._tiles[i<<3][j] >> 8)
                     | ((self._tiles[(i<<3)|1][j] >> 8) << 2)
                     | ((self._tiles[(i<<3)|2][j] >> 8) << 4)
                     | ((self._tiles[(i<<3)|3][j] >> 8) << 6))
             rom.write(k, c)
             c = ((self._tiles[(i<<3)|4][j] >> 8)
                     | ((self._tiles[(i<<3)|5][j] >> 8) << 2)
                     | ((self._tiles[(i<<3)|6][j] >> 8) << 4)
                     | ((self._tiles[(i<<3)|7][j] >> 8) << 6))
             rom.write(k+0x3000, c)
             k += 1
     updateProgress(25)
     # Write sector data
     self._mapSecTsetPalsTbl.writeToRom(rom)
     updateProgress(25.0/4)
     self._mapSecMusicTbl.writeToRom(rom)
     updateProgress(25.0/4)
     self._mapSecMiscTbl.writeToRom(rom)
     updateProgress(25.0/4)
     self._mapSecTownMapTbl.writeToRom(rom)
     updateProgress(25.0/4)
开发者ID:NichtJens,项目名称:CoilSnake,代码行数:35,代码来源:MapModule.py

示例2: readFromRom

# 需要导入模块: import EbModule [as 别名]
# 或者: from EbModule import toRegAddr [as 别名]
 def readFromRom(self, rom):
     # Read map tiles
     map_ptrs_addr = \
         EbModule.toRegAddr(rom.readMulti(self._MAP_PTRS_PTR_ADDR, 3))
     map_addrs = map(lambda x: \
         EbModule.toRegAddr(rom.readMulti(map_ptrs_addr+x*4,4)), \
         range(8))
     self._tiles = map(
             lambda y: rom.readList(map_addrs[y%8] + ((y>>3)<<8),
                 self._MAP_WIDTH).tolist(),
             range(self._MAP_HEIGHT))
     k = self._LOCAL_TSET_ADDR
     for i in range(self._MAP_HEIGHT>>3):
         for j in range(self._MAP_WIDTH):
             self._tiles[i<<3][j] |= (rom[k] & 3) << 8
             self._tiles[(i<<3)|1][j] |= ((rom[k] >> 2) & 3) << 8
             self._tiles[(i<<3)|2][j] |= ((rom[k] >> 4) & 3) << 8
             self._tiles[(i<<3)|3][j] |= ((rom[k] >> 6) & 3) << 8
             self._tiles[(i<<3)|4][j] |= (rom[k+0x3000] & 3) << 8
             self._tiles[(i<<3)|5][j] |= ((rom[k+0x3000] >> 2) & 3) << 8
             self._tiles[(i<<3)|6][j] |= ((rom[k+0x3000] >> 4) & 3) << 8
             self._tiles[(i<<3)|7][j] |= ((rom[k+0x3000] >> 6) & 3) << 8
             k += 1
     updateProgress(25)
     # Read sector data
     self._mapSecTsetPalsTbl.readFromRom(rom)
     updateProgress(25.0/4)
     self._mapSecMusicTbl.readFromRom(rom)
     updateProgress(25.0/4)
     self._mapSecMiscTbl.readFromRom(rom)
     updateProgress(25.0/4)
     self._mapSecTownMapTbl.readFromRom(rom)
     updateProgress(25.0/4)
开发者ID:NichtJens,项目名称:CoilSnake,代码行数:35,代码来源:MapModule.py

示例3: readGasFromRom

# 需要导入模块: import EbModule [as 别名]
# 或者: from EbModule import toRegAddr [as 别名]
 def readGasFromRom(self, rom):
     with EbCompressedData() as cb:
         cb.readFromRom(rom,
                 EbModule.toRegAddr(
                     EbModule.readAsmPointer(rom,
                     self._ASMPTR_GAS_GFX)))
         self._gas_gfx.readFromBlock(cb)
     with EbCompressedData() as cb:
         cb.readFromRom(rom,
                 EbModule.toRegAddr(
                     EbModule.readAsmPointer(rom,
                     self._ASMPTR_GAS_ARR)))
         self._gas_arr.readFromBlock(cb)
     with EbCompressedData() as cb:
         cb.readFromRom(rom,
                 EbModule.toRegAddr(
                     EbModule.readAsmPointer(rom,
                     self._ASMPTR_GAS_PAL1)))
         self._gas_pal1.readFromBlock(cb)
     with EbCompressedData() as cb:
         cb.readFromRom(rom,
                 EbModule.toRegAddr(
                     EbModule.readAsmPointer(rom,
                     self._ASMPTR_GAS_PAL2)))
         self._gas_pal2.readFromBlock(cb)
     with EbCompressedData() as cb:
         cb.readFromRom(rom,
                 EbModule.toRegAddr(
                     EbModule.readAsmPointer(rom,
                     self._ASMPTR_GAS_PAL3)))
         self._gas_pal3.readFromBlock(cb)
开发者ID:NichtJens,项目名称:CoilSnake,代码行数:33,代码来源:CompressedGraphicsModule.py

示例4: readFromProject

# 需要导入模块: import EbModule [as 别名]
# 或者: from EbModule import toRegAddr [as 别名]
    def readFromProject(self, resourceOpener):
        # Clear the labels dict
        EbModule.labelsDict.clear()
        # Read the summary file
        sumFile = resourceOpener('ccscript/summary', 'txt')
        summary = sumFile.readlines()
        sumFile.close()
        # Only do anything if the summary file is not empty
        if len(summary) > 0:
            self._usedRange = (EbModule.toRegAddr(int(summary[7][30:36], 16)),
                    EbModule.toRegAddr(int(summary[8][30:36], 16)))

            modName = None
            inModuleSection = False # False = before section, True = in section
            for line in summary:
                line = line.rstrip()
                if inModuleSection:
                    if line.startswith('-'):
                        inModuleSection = False
                    else:
                        labelKey = modName + "." + line.split(' ',1)[0]
                        labelVal = int(line[-6:],16)
                        EbModule.labelsDict[labelKey] = labelVal
                elif line.startswith("-") and modName != None:
                    inModuleSection = True
                elif line.startswith("Labels in module "):
                    modName = line[17:]
        updateProgress(50)
开发者ID:NichtJens,项目名称:CoilSnake,代码行数:30,代码来源:CccInterfaceModule.py

示例5: readFromRom

# 需要导入模块: import EbModule [as 别名]
# 或者: from EbModule import toRegAddr [as 别名]
    def readFromRom(self, rom):
        self._gfxPtrTbl.readFromRom(rom)
        updateProgress(2)
        self._arrPtrTbl.readFromRom(rom)
        updateProgress(2)
        self._colPtrTbl.readFromRom(rom)
        updateProgress(2)
        self._mapTsetTbl.readFromRom(rom)
        updateProgress(2)
        self._palPtrTbl.readFromRom(rom)
        updateProgress(2)

        # Read tilesets
        pct = 30.0/len(self._tsets)
        i=0
        for tset in self._tsets:
            # Read data
            tset.readMinitilesFromRom(rom,
                    EbModule.toRegAddr(self._gfxPtrTbl[i,0].val()))
            tset.readArrangementsFromRom(rom,
                    EbModule.toRegAddr(self._arrPtrTbl[i,0].val()))
            tset.readCollisionsFromRom(rom,
                    EbModule.toRegAddr(self._colPtrTbl[i,0].val()))
            i += 1
            updateProgress(pct)

        # Read palettes
        pct = 10.0/self._mapTsetTbl.height()
        for i in range(self._mapTsetTbl.height()):
            drawTset = self._mapTsetTbl[i,0].val()
            # Each map tset has 8 maximum palettes
            # We'll just assume they all use 8 and read the garbage
            #romLoc = self._palPtrTbl[i,0].val()
            #for j in xrange(8):
            #    # Read the palette
            #    self._tsets[drawTset].readPaletteFromRom(rom, i, j,
            #            EbModule.toRegAddr(romLoc))
            #    romLoc += 0xc0

            # OK, as it turns out, all palettes need to be in the 1A bank
            # So we actually need to conserve space and not read garbage
            # Estimate the number of palettes for this map tileset
            if i == 31:
                #k = 0xDAFAA7 - self._palPtrTbl[i,0].val()
                k = 7
            else:
                k = self._palPtrTbl[i+1,0].val() - self._palPtrTbl[i,0].val()
                k /= 0xc0
            # Add the palettes
            romLoc = EbModule.toRegAddr(self._palPtrTbl[i,0].val())
            for j in range(k):
                # Read the palette
                self._tsets[drawTset].readPaletteFromRom(rom, i, j, romLoc)
                romLoc += 0xc0
            updateProgress(pct)
开发者ID:Herringway,项目名称:CoilSnake,代码行数:57,代码来源:TilesetModule.py

示例6: readTownMapIconsFromRom

# 需要导入模块: import EbModule [as 别名]
# 或者: from EbModule import toRegAddr [as 别名]
 def readTownMapIconsFromRom(self, rom):
     self._townmap_icons_pal.readFromBlock(rom,
             loc=EbModule.toRegAddr(
                 EbModule.readAsmPointer(rom,
                     self._ASMPTR_TOWN_MAP_ICON_PAL)))
     with EbCompressedData() as cb:
         cb.readFromRom(rom,
                 EbModule.toRegAddr(
                     EbModule.readAsmPointer(rom,
                     self._ASMPTR_TOWN_MAP_ICON_GFX)))
         self._townmap_icons.readFromBlock(cb)
开发者ID:NichtJens,项目名称:CoilSnake,代码行数:13,代码来源:CompressedGraphicsModule.py

示例7: readFromRom

# 需要导入模块: import EbModule [as 别名]
# 或者: from EbModule import toRegAddr [as 别名]
 def readFromRom(self, rom):
     with EbCompressedData() as block:
         block.readFromRom(rom, EbModule.toRegAddr(
                 rom.readMulti(self._ptrLoc, 4)))
         self._arr.readFromBlock(block, 64)
         self._pals.readFromBlock(block, 0)
         self._gfx.readFromBlock(block, 2048+64)
开发者ID:jeffman,项目名称:CoilSnake,代码行数:9,代码来源:CompressedGraphicsModule.py

示例8: readCreditsFontFromRom

# 需要导入模块: import EbModule [as 别名]
# 或者: from EbModule import toRegAddr [as 别名]
 def readCreditsFontFromRom(self, rom):
     self._cpal.readFromBlock(rom, loc=self._ADDR_CREDITS_PAL)
     with EbCompressedData() as cb:
         cb.readFromRom(rom,
                 EbModule.toRegAddr(
                     EbModule.readAsmPointer(
                         rom, self._ASMPTR_CREDITS_GFX)))
         self._cfont.readFromBlock(cb)
开发者ID:NichtJens,项目名称:CoilSnake,代码行数:10,代码来源:FontModule.py

示例9: readFromRom

# 需要导入模块: import EbModule [as 别名]
# 或者: from EbModule import toRegAddr [as 别名]
 def readFromRom(self, rom):
     map_ptrs_addr = EbModule.toRegAddr(rom.readMulti(self._MAP_PTRS_PTR_ADDR, 3))
     map_addrs = map(lambda x: EbModule.toRegAddr(rom.readMulti(map_ptrs_addr + x * 4, 4)), range(8))
     self._tiles = map(
         lambda y: rom.readList(map_addrs[y % 8] + ((y >> 3) << 8), self._MAP_WIDTH).tolist(),
         range(self._MAP_HEIGHT),
     )
     k = self._LOCAL_TSET_ADDR
     for i in range(self._MAP_HEIGHT >> 3):
         for j in range(self._MAP_WIDTH):
             self._tiles[i << 3][j] |= (rom[k] & 3) << 8
             self._tiles[(i << 3) | 1][j] |= ((rom[k] >> 2) & 3) << 8
             self._tiles[(i << 3) | 2][j] |= ((rom[k] >> 4) & 3) << 8
             self._tiles[(i << 3) | 3][j] |= ((rom[k] >> 6) & 3) << 8
             self._tiles[(i << 3) | 4][j] |= (rom[k + 0x3000] & 3) << 8
             self._tiles[(i << 3) | 5][j] |= ((rom[k + 0x3000] >> 2) & 3) << 8
             self._tiles[(i << 3) | 6][j] |= ((rom[k + 0x3000] >> 4) & 3) << 8
             self._tiles[(i << 3) | 7][j] |= ((rom[k + 0x3000] >> 6) & 3) << 8
             k += 1
开发者ID:jeffman,项目名称:CoilSnake,代码行数:21,代码来源:MapModule.py

示例10: readFromRom

# 需要导入模块: import EbModule [as 别名]
# 或者: from EbModule import toRegAddr [as 别名]
 def readFromRom(self, rom):
     self._ptrTbl.readFromRom(rom,
             EbModule.toRegAddr(EbModule.readAsmPointer(rom,
                 self._ASMPTR_PTR_TBL)))
     updateProgress(5)
     for i in range(self._ptrTbl.height()):
         loc = EbModule.toRegAddr(self._ptrTbl[i,0].val())
         entry = []
         while True:
             x = rom[loc]
             if x == 0xff:
                 break
             y = rom[loc+1]
             icon = rom[loc+2]
             flag = rom.readMulti(loc+3, 2)
             entry.append((x, y, icon, flag))
             loc += 5
         self._entries.append(entry)
         i += 1
     updateProgress(45)
开发者ID:NichtJens,项目名称:CoilSnake,代码行数:22,代码来源:TownMapIconModule.py

示例11: readFromRom

# 需要导入模块: import EbModule [as 别名]
# 或者: from EbModule import toRegAddr [as 别名]
    def readFromRom(self, rom):
        self._bsPtrTbl.readFromRom(rom,
                EbModule.toRegAddr(EbModule.readAsmPointer(rom,
                    self._ASMPTR_GFX)))
        self._bsPalsTable.readFromRom(rom,
                EbModule.toRegAddr(EbModule.readAsmPointer(rom,
                    self._ASMPTR_PAL)))
        pct = 45.0/(self._bsPtrTbl.height()
                + self._bsPalsTable.height() + 1)
        self._enemyCfgTable.readFromRom(rom)
        updateProgress(pct)
        # Read the palettes
        for i in range(self._bsPalsTable.height()):
            pal = EbPalettes(1,16)
            pal.set(0, self._bsPalsTable[i,0].val())
            self._bsPals.append(pal)
            updateProgress(pct)
        # Read the sprites
        for i in range(self._bsPtrTbl.height()):
            with EbCompressedData() as bsb:
                bsb.readFromRom(rom,
                        EbModule.toRegAddr(self._bsPtrTbl[i,0].val()))
                bs = EbBattleSprite()
                bs.readFromBlock(bsb, self._bsPtrTbl[i,1].val())
                self._bsprites.append(bs)
            updateProgress(pct)

        # Read the group data
        self._enemyGroupTbl.readFromRom(rom)
        self._enemyGroupBgTbl.readFromRom(rom)
        self._enemyGroups = [ ]
        pct = 5.0/self._enemyGroupTbl.height()
        for i in range(self._enemyGroupTbl.height()):
            group = [ ]
            ptr = EbModule.toRegAddr(self._enemyGroupTbl[i,0].val())
            while(rom[ptr] != 0xff):
                group.append((rom.readMulti(ptr+1,2), rom[ptr]))
                ptr += 3
            self._enemyGroups.append(group)
            updateProgress(pct)
开发者ID:jeffman,项目名称:CoilSnake,代码行数:42,代码来源:EnemyModule.py

示例12: readFromRom

# 需要导入模块: import EbModule [as 别名]
# 或者: from EbModule import toRegAddr [as 别名]
 def readFromRom(self, rom):
     with EbCompressedData() as tgb1:
         tgb1.readFromRom(rom, EbModule.toRegAddr(
             EbModule.readAsmPointer(rom, self._ASMPTR_1)))
         self._gfx1.readFromBlock(tgb1)
     updateProgress(20)
     with EbCompressedData() as tgb2:
         tgb2.readFromRom(rom, EbModule.toRegAddr(
             EbModule.readAsmPointer(rom, self._ASMPTR_2)))
         self._gfx2.readFromBlock(tgb2)
     updateProgress(20)
     # Read palettes
     loc = 0x201fc8
     for pal in self._flavPals:
         pal.readFromBlock(rom, loc=loc)
         loc += 64
     updateProgress(5)
     # Read names
     for ptr, field in self._flavNames:
         field.readFromRom(rom, EbModule.toRegAddr(
             EbModule.readAsmPointer(rom, ptr)))
     updateProgress(5)
开发者ID:NichtJens,项目名称:CoilSnake,代码行数:24,代码来源:WindowGraphicsModule.py

示例13: __init__

# 需要导入模块: import EbModule [as 别名]
# 或者: from EbModule import toRegAddr [as 别名]
 def __init__(self, addr):
     if EbTable.eb_table_map == None:
         #print "Loading eb.yml"
         with open("structures/eb.yml") as f:
             i=1
             for doc in yaml.load_all(f, Loader=yaml.CSafeLoader):
                 if i == 1:
                     i += 1
                 elif i == 2:
                     EbTable.eb_table_map = doc
                     break
         #print "Done"
     Table.__init__(self,addr,EbTable.eb_table_map)
     self._addr = EbModule.toRegAddr(self._addr)
开发者ID:Herringway,项目名称:CoilSnake,代码行数:16,代码来源:EbTablesModule.py

示例14: writeToRom

# 需要导入模块: import EbModule [as 别名]
# 或者: from EbModule import toRegAddr [as 别名]
 def writeToRom(self, rom):
     map_ptrs_addr = EbModule.toRegAddr(rom.readMulti(self._MAP_PTRS_PTR_ADDR, 3))
     map_addrs = map(lambda x: EbModule.toRegAddr(rom.readMulti(map_ptrs_addr + x * 4, 4)), range(8))
     for i in range(self._MAP_HEIGHT):
         rom.write(map_addrs[i % 8] + ((i >> 3) << 8), map(lambda x: x & 0xFF, self._tiles[i]))
     k = self._LOCAL_TSET_ADDR
     for i in range(self._MAP_HEIGHT >> 3):
         for j in range(self._MAP_WIDTH):
             c = (
                 (self._tiles[i << 3][j] >> 8)
                 | ((self._tiles[(i << 3) | 1][j] >> 8) << 2)
                 | ((self._tiles[(i << 3) | 2][j] >> 8) << 4)
                 | ((self._tiles[(i << 3) | 3][j] >> 8) << 6)
             )
             rom.write(k, c)
             c = (
                 (self._tiles[(i << 3) | 4][j] >> 8)
                 | ((self._tiles[(i << 3) | 5][j] >> 8) << 2)
                 | ((self._tiles[(i << 3) | 6][j] >> 8) << 4)
                 | ((self._tiles[(i << 3) | 7][j] >> 8) << 6)
             )
             rom.write(k + 0x3000, c)
             k += 1
开发者ID:jeffman,项目名称:CoilSnake,代码行数:25,代码来源:MapModule.py

示例15: readFromRom

# 需要导入模块: import EbModule [as 别名]
# 或者: from EbModule import toRegAddr [as 别名]
 def readFromRom(self, rom):
     self._ptrTbl.readFromRom(rom,
             EbModule.toRegAddr(rom.readMulti(self._ASMPTR, 3)))
     updateProgress(25)
     for i in range(self._ptrTbl.height()):
         loc = 0xf0000 | self._ptrTbl[i,0].val()
         entry = [ ]
         flag = 1
         while flag != 0:
             flag = rom.readMulti(loc, 2)
             music = rom[loc+2]
             entry.append((flag, music))
             loc += 4
         self._entries.append(entry)
     updateProgress(25)
开发者ID:NichtJens,项目名称:CoilSnake,代码行数:17,代码来源:MapMusicModule.py


注:本文中的EbModule.toRegAddr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。