// Read data from ROM at given PC address. public override bool ReadFromROM(Rom rom, int addressPC) { byte [] data = new byte [DefaultSize]; rom.Seek(addressPC); if (!rom.Read(data, 0, DefaultSize)) { return(false); } SceTablePtr = Tools.ConcatBytes(data [0], data [1], data [2]); SceSheetPtr = Tools.ConcatBytes(data [3], data [4], data [5]); PalettePtr = Tools.ConcatBytes(data [6], data [7], data [8]); startAddressPC = addressPC; return(true); }
// Read data from ROM at given PC address. public override bool ReadFromROM(Rom rom, int addressPC) { byte ScrollColour = 0x00; byte [] b = new byte [3]; rom.Seek(addressPC); if (!rom.Read(b, 0, 3) || b [0] != 0x08 || b [1] != 0xE2 || b [2] != 0x20) { return(false); } Entries.Clear(); do { if (!rom.Read(b, 0, 2)) { return(false); } switch (b [0]) { case 0xA9: // set scroll colour ScrollColour = b [1]; break; case 0x8F: // set scroll Entries.Add(Tools.ConcatBytes((byte)(b [1] - 0x20), ScrollColour)); if (!rom.Read(b, 0, 2) || (b [0] != 0xCD && b [1] != 0x7E)) { return(false); } break; case 0x28: if (b [1] != 0x60) { return(false); } break; default: return(false); } } while (b [0] != 0x28); startAddressPC = addressPC; return(true); }
// Read data from ROM at given PC address. public override bool ReadFromROM (Rom rom, int addressPC) { byte [] b = new byte [DefaultSize]; rom.Seek (addressPC); if (!rom.Read (b, 0, DefaultSize)) return false; // int TileCount = DefaultSize / 2; for (int n = 0; n < TileCount; n++) { int index = (n & 31) | ((n & 992) << 1) | ((n & 1024) >> 5); Tiles [index] = b [2 * n]; Properties [index] = b [2 * n + 1]; } startAddressPC = addressPC; return true; }
// Read room state header from ROM at given PC address. public override bool ReadFromROM(Rom rom, int addressPC) { byte [] b = new byte [3]; rom.Seek(addressPC); if (!rom.Read(b, 0, 2)) { return(false); } HeaderType = (StateType)Tools.ConcatBytes(b [0], b [1]); switch (HeaderType) { case StateType.Standard: RoomStatePtr = Tools.PCtoLR(addressPC + 2); break; case StateType.Events: case StateType.Bosses: if (!rom.Read(b, 0, 3)) { return(false); } Value = b [0]; RoomStatePtr = Tools.ConcatBytes(b [1], b [2], 0x8F); break; case StateType.TourianBoss: case StateType.Morph: case StateType.MorphMissiles: case StateType.PowerBombs: case StateType.SpeedBooster: if (!rom.Read(b, 0, 2)) { return(false); } RoomStatePtr = Tools.ConcatBytes(b [0], b [1], 0x8F); break; default: Console.WriteLine("Error: unknown state type encountered: ${0}", Tools.IntToHex((int)HeaderType)); return(false); } startAddressPC = addressPC; return(true); }
// Read data from ROM at given PC address. public override bool ReadFromROM(Rom rom, int addressPC) { rom.Seek(addressPC); int compressedSize = rom.Decompress(out List <byte> buffer); CompressedData.Clear(); rom.Seek(addressPC); rom.Read(CompressedData, compressedSize); CompressionUpToDate = true; int decompressedSize = buffer.Count; int Layer1Size = Tools.ConcatBytes(buffer [0], buffer [1]); int BtsSize = Layer1Size / 2; // half the amount of data of layer one int Layer2Size; if (Layer1Size + BtsSize + 2 < decompressedSize) { Layer2Size = Layer1Size; // check if layer 2 data exists, } else { Layer2Size = 0; // if not, set its size to zero. } ScreenCount = BtsSize / 256; // divide by 256 tiles per screen. int Layer1Counter = 2; int BtsCounter = 2 + Layer1Size; int Layer2Counter = 2 + Layer1Size + BtsSize; for (int n = 0; n < BtsSize; n++) { Layer1.Add((ushort)Tools.ConcatBytes(buffer [Layer1Counter], buffer [Layer1Counter + 1])); Bts.Add(buffer [BtsCounter]); if (Layer2Size > 0) { Layer2.Add((ushort)Tools.ConcatBytes(buffer [Layer2Counter], buffer [Layer2Counter + 1])); } Layer1Counter += 2; BtsCounter += 1; Layer2Counter += 2; } startAddressPC = addressPC; return(decompressedSize > 0); }
// Read data from ROM at given PC address. public override bool ReadFromROM(Rom rom, int addressPC) { List <byte> buffer = new List <byte> (); rom.Seek(addressPC); rom.Read(buffer, Size); for (int n = 0; n < ColorCount; n++) { int colour = Tools.ConcatBytes(buffer [n << 1], buffer [n << 1 | 1]); R [n] = ((byte)((colour & 0x001F) << 3)); G [n] = ((byte)((colour & 0x03E0) >> 2)); B [n] = ((byte)((colour & 0x7C00) >> 7)); } startAddressPC = addressPC; return(true); }
// Read raw data from ROM at given PC address. public override bool ReadFromROM(Rom rom, int addressPC) { rom.Seek(addressPC); byte [] newData = new byte [Bytes.Count]; if (!rom.Read(newData, 0, Bytes.Count)) { return(false); } for (int n = 0; n < Bytes.Count; n++) { Bytes [n] = newData [n]; } startAddressPC = addressPC; return(true); }
// Read data from ROM at given PC address. public override bool ReadFromROM(Rom rom, int addressPC) { byte [] b = new byte [DefaultSize]; rom.Seek(addressPC); if (!rom.Read(b, 0, DefaultSize)) { return(false); } PlmID = Tools.ConcatBytes(b [0], b [1]); PosX = b [2]; PosY = b [3]; MainVariable = Tools.ConcatBytes(b [4], b [5], 0x8F); startAddressPC = addressPC; return(true); }
// Read data from ROM at given PC address. (DoorCount must be set beforehand) public override bool ReadFromROM(Rom rom, int addressPC) { byte [] b = new byte [Size]; rom.Seek(addressPC); if (!rom.Read(b, 0, Size)) { return(false); } for (int n = 0; n < DoorCount; n++) { DoorPtrs [n] = Tools.ConcatBytes(b [2 * n], b [2 * n + 1], 0x83); } startAddressPC = addressPC; return(true); }
// Read data from ROM at given PC address. public override bool ReadFromROM (Rom rom, int addressPC) { byte [] b = new byte [DefaultSize]; rom.Seek (addressPC); if (!rom.Read (b, 0, DefaultSize)) return false; RoomPtr = Tools.ConcatBytes (b [ 0], b [ 1], 0x8F); DoorPtr = Tools.ConcatBytes (b [ 2], b [ 3], 0x83); DoorBts = Tools.ConcatBytes (b [ 4], b [ 5]); ScreenX = Tools.ConcatBytes (b [ 6], b [ 7]); ScreenY = Tools.ConcatBytes (b [ 8], b [ 9]); SamusX = Tools.ConcatBytes (b [10], b [11]); SamusY = Tools.ConcatBytes (b [12], b [13]); startAddressPC = addressPC; return true; }
// Read data from ROM at given PC address. public override bool ReadFromROM(Rom rom, int addressPC) { //byte [] buffer; //int DecompressedSize = Compression.ReadCompressedData (out buffer, addressPC); rom.Seek(addressPC); rom.Decompress(out List <byte> buffer); int decompressedSize = buffer.Count; int tile8Count = decompressedSize >> 1; for (int n = 0; n < tile8Count; n++) { Tiles8.Add(Tools.ConcatBytes(buffer [2 * n], buffer [2 * n + 1])); } startAddressPC = addressPC; return(true); }
public void Close() { if (!ProjectLoaded) { return; } Rooms.Clear(); DoorSets.Clear(); Doors.Clear(); ScrollSets.Clear(); PlmSets.Clear(); ScrollPlmDatas.Clear(); Backgrounds.Clear(); Fxs.Clear(); SaveStations.Clear(); LevelDatas.Clear(); EnemySets.Clear(); EnemyGfxs.Clear(); ScrollAsms.Clear(); DoorAsms.Clear(); SetupAsms.Clear(); MainAsms.Clear(); TileSets.Clear(); TileTables.Clear(); TileSheets.Clear(); Palettes.Clear(); AreaMaps.Clear(); PlmTypes.Clear(); EnemyTypes.Clear(); CurrentRom = null; ProjectPath = String.Empty; RomFileName = String.Empty; ProjectFileName = String.Empty; RoomTiles.Clear(); MapTiles.Clear(); BackgroundImage = null; ChangesMade = false; ProjectLoaded = false; ProjectClosed?.Invoke(this, null); }
// Read data from ROM at given PC address. public override bool ReadFromROM(Rom rom, int addressPC) { byte [] b = new byte [DefaultSize]; rom.Seek(addressPC); if (!rom.Read(b, 0, DefaultSize)) { return(false); } EnemyID = Tools.ConcatBytes(b [0], b [1]); PosX = Tools.ConcatBytes(b [2], b [3]); PosY = Tools.ConcatBytes(b [4], b [5]); Tilemaps = Tools.ConcatBytes(b [6], b [7]); Special = Tools.ConcatBytes(b [8], b [9]); Graphics = Tools.ConcatBytes(b [10], b [11]); Speed = Tools.ConcatBytes(b [12], b [13]); Speed2 = Tools.ConcatBytes(b [14], b [15]); startAddressPC = addressPC; return(true); }
// Read all doors from ROM. private void ReadDoors(Rom rom) { List <int> addressesPC = new List <int> (); foreach (DoorSet d in DoorSets) { for (int i = 0; i < d.DoorCount; i++) { int ad_PC = Tools.LRtoPC(d.DoorPtrs [i]); addressesPC.Add(ad_PC); } } Tools.RemoveDuplicates(addressesPC); Doors.Clear(); for (int n = 0; n < addressesPC.Count; n++) { Doors.Add(new Door()); Doors [n].ReadFromROM(rom, addressesPC [n]); } }
// Read all enemy gfxs from ROM. private void ReadEnemyGfxs(Rom rom, List <RoomState> roomStates) { List <int> addressesPC = new List <int> (); foreach (RoomState r in roomStates) { int address = Tools.LRtoPC(r.EnemyGfxPtr); if (address != 0) // Skip invalid addresses { addressesPC.Add(address); } } Tools.RemoveDuplicates(addressesPC); EnemyGfxs.Clear(); for (int n = 0; n < addressesPC.Count; n++) { EnemyGfxs.Add(new EnemyGfx()); EnemyGfxs [n].ReadFromROM(rom, addressesPC [n]); } }
// Read all PLM sets from ROM. private void ReadPlmSets(Rom rom, List <RoomState> roomStates) { List <int> addressesPC = new List <int> (); foreach (RoomState r in roomStates) { int address = Tools.LRtoPC(r.PlmSetPtr); if (address != 0) { addressesPC.Add(address); } } Tools.RemoveDuplicates(addressesPC); PlmSets.Clear(); for (int n = 0; n < addressesPC.Count; n++) { PlmSets.Add(new PlmSet()); PlmSets [n].ReadFromROM(rom, addressesPC [n]); } }
// Read all palettes from ROM. private void ReadPalettes(Rom rom) { List <int> addressesPC = new List <int> (); foreach (TileSet t in TileSets) { int address = Tools.LRtoPC(t.PalettePtr); if (address != 0) // Skip invalid addresses { addressesPC.Add(address); } } Tools.RemoveDuplicates(addressesPC); Palettes.Clear(); for (int n = 0; n < addressesPC.Count; n++) { Palettes.Add(new CompressedPalette()); Palettes [n].ReadFromROM(rom, addressesPC [n]); } }
// Load Map tiles. private void LoadMapTiles(Rom rom) { TileSheet t = new UncompressedTileSheet(); t.SetSize(256 * 64); t.ReadFromROM(rom, MapTileSheetAddress); Palette p = new UncompressedPalette(); p.ColorCount = 128; p.ReadFromROM(rom, 0x1B7000); for (int row = 0; row < 8; row++) { for (int n = 0; n < 256; n++) { byte [] b = t.RenderTile(n, p, row); MapTiles.Add(new BlitImage(b, 8)); } } }
// Read all tile sheets from ROM. private void ReadTileSheets(Rom rom) { List <int> addressesPC = new List <int> (); foreach (TileSet t in TileSets) { int address = Tools.LRtoPC(t.SceSheetPtr); if (address != 0) // Skip invalid addresses { addressesPC.Add(address); } } Tools.RemoveDuplicates(addressesPC); TileSheets.Clear(); TileSheets.Add(new CompressedTileSheet()); TileSheets [0].ReadFromROM(rom, TileSheet.CreAddressPC); for (int n = 0; n < addressesPC.Count; n++) { TileSheets.Add(new CompressedTileSheet()); TileSheets [n + 1].ReadFromROM(rom, addressesPC [n]); } }
// Read all scroll ASMs from ROM. private void ReadScrollAsms(Rom rom) { List <int> addressesPC = new List <int> (); foreach (Door d in Doors) { int address = Tools.LRtoPC(d.DoorAsmPtr); if (address != 0) // Skip invalid addresses { addressesPC.Add(address); } } Tools.RemoveDuplicates(addressesPC); ScrollAsms.Clear(); for (int n = 0; n < addressesPC.Count; n++) { var s = new ScrollAsm(); if (s.ReadFromROM(rom, addressesPC [n])) { ScrollAsms.Add(s); } } }
//---------------------------------------------------------------------------------------- // Read all rooms from ROM. private void ReadRooms(Rom rom, List <Tuple <int, int, string> > rooms, out List <RoomState> roomStates) { roomStates = new List <RoomState> (); Rooms.Clear(); for (int n = 0; n < rooms.Count; n++) { Room newRoom = new Room(); newRoom.ReadFromROM(rom, rooms [n].Item1); newRoom.Name = rooms [n].Item3; Rooms [newRoom.Area].Add(newRoom); var newDoorSet = new DoorSet() { DoorCount = rooms [n].Item2 }; newDoorSet.ReadFromROM(rom, newRoom.DoorsPtrPC); DoorSets.Add(newDoorSet); for (int i = 0; i < newRoom.RoomStates.Count; i++) { roomStates.Add(newRoom.RoomStates [i]); } } }
// Read data from ROM at given PC address. public override bool ReadFromROM(Rom rom, int addressPC) { int sAddress = addressPC; byte [] b = new byte [2]; rom.Seek(addressPC); if (!rom.Read(b, 0, 2)) { return(false); } Enemies.Clear(); while (b [0] != TerminatorByte || b [1] != TerminatorByte) { Enemy newEnemy = new Enemy(); if (!newEnemy.ReadFromROM(rom, addressPC)) { return(false); } addressPC += newEnemy.Size; Enemies.Add(newEnemy); rom.Seek(addressPC); if (!rom.Read(b, 0, 2)) { return(false); } } rom.Seek(addressPC + 2); if (!rom.Read(b, 0, 1)) { return(false); } RequiredToKill = b [0]; startAddressPC = sAddress; return(true); }
// Read data from ROM at given PC address. public override bool ReadFromROM(Rom rom, int addressPC) { byte [] b = new byte [2]; rom.Seek(addressPC); if (!rom.Read(b, 0, 1)) { return(false); } while (b [0] != 0x80 && Entries.Count < 100) { if (!rom.Read(b, 1, 1)) { return(false); } Entries.Add(Tools.ConcatBytes(b [0], b [1])); if (!rom.Read(b, 0, 1)) { return(false); } } startAddressPC = addressPC; return(true); }
// Read all scroll plm datas from ROM. private void ReadScrollPlmDatas(Rom rom) { List <int> addressesPC = new List <int> (); foreach (PlmSet p in PlmSets) { int plmCount = p.PlmCount; for (int i = 0; i < plmCount; i++) { int address = Tools.LRtoPC(p.Plms [i].ScrollDataPtr); if (address != 0) // Skip non-scroll PLMs { addressesPC.Add(address); } } } Tools.RemoveDuplicates(addressesPC); ScrollPlmDatas.Clear(); for (int n = 0; n < addressesPC.Count; n++) { ScrollPlmDatas.Add(new ScrollPlmData()); ScrollPlmDatas [n].ReadFromROM(rom, addressesPC [n]); } }
// Read data from ROM at given PC address. public override bool ReadFromROM(Rom rom, int addressPC) { int sAddressPC = addressPC; byte [] b = new byte [HeaderSize]; rom.Seek(addressPC); if (!rom.Read(b, 0, HeaderSize)) { return(false); } RoomIndex = b [0]; Area = b [1]; MapX = b [2]; MapY = b [3]; Width = b [4]; Height = b [5]; UpScroller = b [6]; DownScroller = b [7]; SpecialGfxBitflag = b [8]; DoorsPtr = Tools.ConcatBytes(b [9], b [10], 0x8F); // read room state headers addressPC += HeaderSize; int i = 0; RoomStateHeaders.Add(new RoomStateHeader()); if (!RoomStateHeaders [i].ReadFromROM(rom, addressPC)) { return(false); } addressPC += RoomStateHeaders [i].Size; while (RoomStateHeaders [i].HeaderType != StateType.Standard) { i++; RoomStateHeaders.Add(new RoomStateHeader()); if (!RoomStateHeaders [i].ReadFromROM(rom, addressPC)) { return(false); } addressPC += RoomStateHeaders [i].Size; } // read room states int StateCount = RoomStateHeaders.Count; for (int j = 0; j < StateCount; j++) { RoomStates.Add(null); } for (int j = 0; j < StateCount; j++) { RoomStates [j] = new RoomState(); addressPC = Tools.LRtoPC(RoomStateHeaders [j].RoomStatePtr); if (!RoomStates [j].ReadFromROM(rom, addressPC)) { return(false); } } startAddressPC = sAddressPC; return(true); }
// Read data from ROM at given PC address. public abstract bool ReadFromROM(Rom rom, int addressPC);
// Read data from ROM at given PC address. public override bool ReadFromROM(Rom rom, int addressPC) { int TilesPtr = 0; byte [] b = new byte [11]; rom.Seek(addressPC); if (!rom.Read(b, 0, 2)) { return(false); } int blockSize; int totalSize = 0; while (b [0] != 0 || b [1] != 0) { int type = Tools.ConcatBytes(b [0], b [1]); // Bytes.Add (b [0]); // Bytes.Add (b [1]); switch (type) { default: Console.WriteLine("Unknown BG block type found: {0}", Tools.IntToHex(type)); return(false); case 0x000A: case 0x000C: blockSize = 2; break; case 0x0004: blockSize = 7; break; case 0x0002: case 0x0008: blockSize = 9; break; case 0x000E: blockSize = 11; break; } if (!rom.Read(b, 2, blockSize - 2)) { return(false); } for (int i = 0; i < blockSize; i++) { Bytes.Add(b [i]); } if (type == 0x0004) { if (TilesPtr == 0) { TilesPtr = Tools.ConcatBytes(b [2], b [3], b [4]); } else { TilesPtr = 0; // [wip] still an ugly hack to skip Kraid background } } totalSize += blockSize; if (!rom.Read(b, 0, 2)) { return(false); } } if (TilesPtr != 0) { MyBackgroundTiles = new BackgroundTiles(); MyBackgroundTiles.ReadFromROM(rom, Tools.LRtoPC(TilesPtr)); } startAddressPC = addressPC; return(true); }
//======================================================================================== // Reading ROM data. // Read the project file in Xml format. private bool ReadProjectFileXml( out List <Tuple <int, int, string> > rooms, out List <Tuple <int, int, string> > doorAsms, out List <Tuple <int, int, string> > setupAsms, out List <Tuple <int, int, string> > mainAsms, out List <Tuple <int, string> > backgrounds) { RomFileName = null; rooms = new List <Tuple <int, int, string> > (); doorAsms = new List <Tuple <int, int, string> > (); setupAsms = new List <Tuple <int, int, string> > (); mainAsms = new List <Tuple <int, int, string> > (); backgrounds = new List <Tuple <int, string> > (); Stream stream; try { stream = new FileStream(ProjectPath + ProjectFileName, FileMode.Open, FileAccess.Read, FileShare.Read); } catch { throw new ProjectLoadException(ProjectLoadException.Type.ProjectFileNotAccessible, ProjectPath + ProjectFileName); } var reader = XmlReader.Create(stream); XElement root = XElement.Load(reader); stream.Close(); RomFileName = root.Attribute("rom")?.Value; if (root.Name != "Project" || RomFileName == null) { throw new ProjectLoadException(ProjectLoadException.Type.RomFileNotSpecified, ProjectPath + ProjectFileName); } try { CurrentRom = new Rom(ProjectPath + RomFileName); } catch (FileNotFoundException) { throw new ProjectLoadException(ProjectLoadException.Type.RomFileNotFound, ProjectPath + RomFileName); } catch { throw new ProjectLoadException(ProjectLoadException.Type.RomFileNotAccessible, ProjectPath + RomFileName); } foreach (XElement x in root.Elements()) { switch (x.Name.ToString()) { case "Areas": foreach (XElement area in x.Elements("Area")) { string areaIndex = area.Attribute("index")?.Value; string areaName = area.Attribute("name")?.Value; if (areaIndex != null && areaName != null) { int i = Convert.ToInt32(areaIndex); Areas [i] = areaName; } } break; case "Sections": foreach (XElement section in x.Elements("Section")) { string sectionName = section.Attribute("name")?.Value; string sectionType = section.Attribute("type")?.Value; if (sectionName == null || sectionType == null) { continue; } CurrentRom.AddSection(sectionName, RomSection.StringToType(sectionType)); foreach (XElement data in section.Elements("Data")) { string dataName = data.Attribute("name")?.Value; if (dataName != null && DataLists.ContainsKey(dataName)) { CurrentRom.AddDataList(sectionName, dataName, DataLists [dataName]); } } foreach (XElement block in section.Elements("Block")) { string blockAddress = block.Attribute("address")?.Value; string blockEnd = block.Attribute("end")?.Value; if (blockAddress != null && blockEnd != null) { CurrentRom.AddBlock(sectionName, Tools.HexToInt(blockAddress), Tools.HexToInt(blockEnd) - Tools.HexToInt(blockAddress)); } } } break; case "Rooms": foreach (XElement room in x.Elements("Room")) { string roomAddress = room.Attribute("address")?.Value; string doorCount = room.Attribute("doorCount")?.Value; string roomName = room.Attribute("name")?.Value; if (roomAddress != null) { int address = Tools.HexToInt(roomAddress); int count = doorCount != null?Tools.DecToInt(doorCount) : 0; rooms.Add(new Tuple <int, int, string> (address, count, roomName ?? String.Empty)); } } break; case "Asms": foreach (XElement asm in x.Elements()) { List <Tuple <int, int, string> > asmList; switch (asm.Name.ToString()) { case "DoorAsm": asmList = doorAsms; break; case "SetupAsm": asmList = setupAsms; break; case "MainAsm": asmList = mainAsms; break; default: continue; } string asmName = asm.Attribute("name")?.Value; string asmAddress = asm.Attribute("address")?.Value; string asmEnd = asm.Attribute("end")?.Value; if (asmAddress != null && asmEnd != null) { asmList.Add(new Tuple <int, int, string> (Tools.HexToInt(asmAddress), Tools.HexToInt(asmEnd), asmName ?? asmAddress)); } } break; case "Backgrounds": foreach (XElement background in x.Elements("Background")) { string address = background.Attribute("address")?.Value; string name = background.Attribute("name")?.Value; if (address != null) { backgrounds.Add(new Tuple <int, string> (Tools.HexToInt(address), name ?? address)); } } break; default: break; } } return(true); }
// Read data from ROM at given PC address. public abstract override bool ReadFromROM(Rom rom, int addressPC);
// Read data from ROM at given PC address. public override bool ReadFromROM(Rom rom, int addressPC) { //byte [] buffer; //int decompressedSize = 0; int pixelCount = 0; byte bite; byte bit; //decompressedSize = Compression.ReadCompressedData (out b, addressPC); rom.Seek(addressPC); int compressedSize = rom.Decompress(out List <byte> buffer); CompressedData.Clear(); rom.Seek(addressPC); rom.Read(CompressedData, compressedSize); CompressionUpToDate = true; int decompressedSize = buffer.Count; // if (decompressedSize > 100000) // decompressedSize = 100000; // Dunno how important these lines are (some safety mechanism?) pixelCount = decompressedSize << 1; // 2x decompressed size (1 pixel uses 4 bits) TileCount = pixelCount >> 6; // this resizes the Bytes list for (int t = 0; t < TileCount; t++) { for (int n = 0; n < 8; n++) // bitplane 0 { bite = buffer [t << 5 | n << 1]; for (int i = 0; i < 8; i++) { bit = (byte)(bite & 1); Bytes [t << 6 | n << 3 | i] = bit; bite >>= 1; } } for (int n = 0; n < 8; n++) // bitplane 1 { bite = buffer [t << 5 | n << 1 | 1]; for (int i = 0; i < 8; i++) { bit = (byte)(bite & 1); Bytes [t << 6 | n << 3 | i] = (byte)(Bytes [t << 6 | n << 3 | i] | bit << 1); bite >>= 1; } } for (int n = 0; n < 8; n++) // bitplane 2 { bite = buffer [t << 5 | n << 1 | 16]; for (int i = 0; i < 8; i++) { bit = (byte)(bite & 1); Bytes [t << 6 | n << 3 | i] = (byte)(Bytes [t << 6 | n << 3 | i] | bit << 2); bite >>= 1; } } for (int n = 0; n < 8; n++) // bitplane 3 { bite = buffer [t << 5 | n << 1 | 17]; for (int i = 0; i < 8; i++) { bit = (byte)(bite & 1); Bytes [t << 6 | n << 3 | i] = (byte)(Bytes [t << 6 | n << 3 | i] | bit << 3); bite >>= 1; } } } startAddressPC = addressPC; return(true); }