private void DisassmRow(ItemRowEntry row, ItemRowEntry nextRow)
        {
            result.AppendLine("; ------------------------------");

            // Label for map row (for previous row to reference)
            result.AppendLine(GetRowLabel(row.MapY) + ":");
            // Byte specifies which row this represents
            result.AppendLine(Pad16(byteCode + " " + FormatByte(row.MapY)));

            result.AppendLine();

            // Word, pointer to nexn row, or FFFF if last row
            if (nextRow == null)   // Last Row
            {
                WriteLine(wordCode + " " + FormatWord(0xFFFF), "Last row of item data");
            }
            else
            {
                WriteLine(wordCode + " " + GetRowLabel(nextRow.MapY), "Pointer to next row's data");
            }

            var seeker = row.Seek();

            DisassmScreen(seeker);
            while (seeker.MoreScreensPresent)
            {
                seeker.NextScreen();
                DisassmScreen(seeker);
            }
        }
Beispiel #2
0
        /// <summary>
        /// Gets the next ItemRowEntry. Chech HasNextEntry first.
        /// </summary>
        /// <returns>The next ItemRowEntry.</returns>
        public ItemRowEntry LoadNextRow()
        {
            ItemRowEntry result = new ItemRowEntry(level, rom, NextEntryOffset, index + 1);

            result.orderIndex = orderIndex + 1;
            return(result);
        }
Beispiel #3
0
        /// <summary>
        /// Creates an item seeker.
        /// </summary>
        /// <param name="data">ItemRowEntry to seek.</param>
        public ItemSeeker(ItemRowEntry data)
        {
            this.data        = data.Rom.data;
            this.startOffset = this.screenOffset = data.Offset + 3;
            itemOffset       = startOffset + 2;

            itemIndex       = new ItemIndex_DEPRECATED();
            itemIndex.Row   = (byte)data.OrderIndex;
            itemIndex.Level = data.Level;
        }
Beispiel #4
0
        private void LoadRow(ItemRowEntry row)
        {
            var seeker = row.Seek();

            LoadScreen(seeker, row.MapY);
            while (seeker.MoreScreensPresent)
            {
                seeker.NextScreen();
                LoadScreen(seeker, row.MapY);
            }
        }
        private ItemDataDisassembler(Level level, DataDirective directive)
        {
            this.level = level;
            SetDirectives(directive);
            CreateRowList(level);

            int dataOffset = rows[0].Offset;
            var pointer    = level.CreatePointer((pRom)dataOffset);

            result.AppendLine("; Offset of item data");
            result.AppendLine(".org " + FormatWord(pointer.Value));

            for (int i = 0; i < rows.Count; i++)
            {
                ItemRowEntry row     = rows[i];
                ItemRowEntry nextRow = GetNextRow(row);

                DisassmRow(row, nextRow);
            }
        }
        private ItemRowEntry GetNextRow(ItemRowEntry row)
        {
            var nextRowPointer = row.NextEntryPointer;

            if (nextRowPointer.Value == 0xFFFF)
            {
                return(null);
            }

            var nextRowOffset = (int)level.ToPRom(nextRowPointer);

            for (int i = 0; i < rows.Count; i++)
            {
                if (rows[i].Offset == nextRowOffset)
                {
                    return(rows[i]);
                }
            }

            throw new ItemDisassmException("Item disassembly error: item row entry's 'next row pointer' did not point to a location within item data.");
        }
 private int CompareRowsByAddress(ItemRowEntry a, ItemRowEntry b)
 {
     return(a.Offset - b.Offset);
 }