示例#1
0
        private void UpdateAsmFile(AsmFile fileObj)
        {
            // Local Variables
            var objectsFile = (ObjectsFile)_objectsFiles.Peek();


            // Update current offset.
            AsmFile.CurrentFileOffset = RomFile.TotalOffset;
            _subOffArray.Add((uint)(RomFile.TotalOffset + _subOffsets[fileObj.Id] + _baseRam));

            // Create a local byte[] and pass it decompressed file info.
            byte[] asmFile = DecompressFile(fileObj);

            // Get _upperRAM value
            byte[] objFile = DecompressFile(objectsFile);
            _upperRAM = (uint)(_BASERAM + asmFile.Length + objFile.Length + objectsFile.ReservedLength);

            // Update JAL and LUI commands.
            ProcessCommands(asmFile);

            // Update F39F90 JALs
            UpdateF37F90(fileObj);

            RomFile.UpdateTotalsOffset(asmFile.Length, 0);

            // Update file buffer.
            _fileBuffer.Add(asmFile);
        }
示例#2
0
        private void UpdateObjectsFile(ObjectsFile fileObj)
        {
            byte[] objectsFile            = DecompressFile(fileObj);
            byte[] reservedSpace          = new byte[fileObj.ReservedLength];
            byte[] reservedSpaceConstants = (byte[])_variableSpaceArrays.Dequeue();

            // Scan for RAM addresses.
            for (int i = 0; i < objectsFile.Length; i += 4)
            {
                uint ramAddress = ASM.GetObjectsRamAddress(objectsFile, i);

                if (ramAddress < _BASERAM)
                {
                    continue;
                }

                if (ramAddress > _upperRAM)
                {
                    continue;
                }

                if (!((ramAddress & 0xFF000000) == 0x80000000))
                {
                    continue;
                }

                // Update RAM address.
                WriteObjectsAddress(objectsFile, ramAddress, i);
            }

            RomFile.UpdateTotalsOffset(objectsFile.Length, reservedSpace.Length);

            Array.Copy(reservedSpaceConstants, reservedSpace, reservedSpaceConstants.Length);

            // Update file buffer.
            _fileBuffer.Add(objectsFile);
            _fileBuffer.Add(reservedSpace);
        }