2020-02-19 00:12:15 +00:00
|
|
|
// /***************************************************************************
|
2020-02-27 12:31:25 +00:00
|
|
|
// Aaru Data Preservation Suite
|
2020-02-19 00:12:15 +00:00
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
//
|
2020-03-11 21:56:55 +00:00
|
|
|
// Filename : Info.cs
|
2020-02-19 00:12:15 +00:00
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
//
|
2020-03-11 21:56:55 +00:00
|
|
|
// Component : Common Apple file systems.
|
2020-02-19 00:12:15 +00:00
|
|
|
//
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
//
|
2020-03-11 21:56:55 +00:00
|
|
|
// Apple Macintosh Boot Block information.
|
2020-02-19 00:12:15 +00:00
|
|
|
//
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
//
|
|
|
|
|
// This library is free software; you can redistribute it and/or modify
|
|
|
|
|
// it under the terms of the GNU Lesser General Public License as
|
|
|
|
|
// published by the Free Software Foundation; either version 2.1 of the
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
//
|
|
|
|
|
// This library is distributed in the hope that it will be useful, but
|
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
|
//
|
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
//
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2022-02-18 10:02:53 +00:00
|
|
|
// Copyright © 2011-2022 Natalia Portillo
|
2020-02-19 00:12:15 +00:00
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
2022-03-07 07:36:44 +00:00
|
|
|
namespace Aaru.Filesystems;
|
|
|
|
|
|
2020-02-19 00:12:15 +00:00
|
|
|
using System.Text;
|
2020-02-27 00:33:26 +00:00
|
|
|
using Aaru.Helpers;
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
// Information from Inside Macintosh
|
|
|
|
|
// https://developer.apple.com/legacy/library/documentation/mac/pdf/Files/File_Manager.pdf
|
2022-03-07 07:36:44 +00:00
|
|
|
static partial class AppleCommon
|
2020-02-19 00:12:15 +00:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
internal static string GetBootBlockInformation(byte[] bbSector, Encoding encoding)
|
2020-02-19 00:12:15 +00:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
if(bbSector is null ||
|
|
|
|
|
bbSector.Length < 0x100)
|
|
|
|
|
return null;
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
BootBlock bb = Marshal.ByteArrayToStructureBigEndian<BootBlock>(bbSector);
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
if(bb.bbID != BB_MAGIC)
|
|
|
|
|
return null;
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
var sb = new StringBuilder();
|
|
|
|
|
sb.AppendLine("Boot Block:");
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
if((bb.bbVersion & 0x8000) > 0)
|
|
|
|
|
{
|
|
|
|
|
sb.AppendLine("Boot block is in new format.");
|
2020-02-19 00:42:34 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
if((bb.bbVersion & 0x4000) > 0)
|
|
|
|
|
{
|
|
|
|
|
sb.AppendLine("Boot block should be executed.");
|
2020-02-19 00:42:34 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
if((bb.bbVersion & 0x2000) > 0)
|
2022-03-07 07:36:44 +00:00
|
|
|
sb.AppendFormat("System heap will be extended by {0} bytes and a {1} fraction of the available RAM",
|
|
|
|
|
bb.bbSysHeapExtra, bb.bbSysHeapFract).AppendLine();
|
2020-02-19 00:42:34 +00:00
|
|
|
}
|
2022-03-06 13:29:38 +00:00
|
|
|
}
|
|
|
|
|
else if((bb.bbVersion & 0xFF) == 0x0D)
|
|
|
|
|
sb.AppendLine("Boot block should be executed.");
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-11-13 19:38:03 +00:00
|
|
|
switch(bb.bbPageFlags)
|
|
|
|
|
{
|
|
|
|
|
case > 0:
|
|
|
|
|
sb.AppendLine("Allocate secondary sound buffer at boot.");
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
case < 0:
|
|
|
|
|
sb.AppendLine("Allocate secondary sound and video buffers at boot.");
|
|
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
}
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
sb.AppendFormat("System filename: {0}", StringHandlers.PascalToString(bb.bbSysName, encoding)).AppendLine();
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-03-07 07:36:44 +00:00
|
|
|
sb.AppendFormat("Finder filename: {0}", StringHandlers.PascalToString(bb.bbShellName, encoding)).AppendLine();
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-03-07 07:36:44 +00:00
|
|
|
sb.AppendFormat("Debugger filename: {0}", StringHandlers.PascalToString(bb.bbDbg1Name, encoding)).AppendLine();
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
sb.AppendFormat("Disassembler filename: {0}", StringHandlers.PascalToString(bb.bbDbg2Name, encoding)).
|
|
|
|
|
AppendLine();
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
sb.AppendFormat("Startup screen filename: {0}", StringHandlers.PascalToString(bb.bbScreenName, encoding)).
|
|
|
|
|
AppendLine();
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
sb.AppendFormat("First program to execute at boot: {0}",
|
|
|
|
|
StringHandlers.PascalToString(bb.bbHelloName, encoding)).AppendLine();
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
sb.AppendFormat("Clipboard filename: {0}", StringHandlers.PascalToString(bb.bbScrapName, encoding)).
|
|
|
|
|
AppendLine();
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
sb.AppendFormat("Maximum opened files: {0}", bb.bbCntFCBs * 4).AppendLine();
|
|
|
|
|
sb.AppendFormat("Event queue size: {0}", bb.bbCntEvts).AppendLine();
|
|
|
|
|
sb.AppendFormat("Heap size with 128KiB of RAM: {0} bytes", bb.bb128KSHeap).AppendLine();
|
|
|
|
|
sb.AppendFormat("Heap size with 256KiB of RAM: {0} bytes", bb.bb256KSHeap).AppendLine();
|
|
|
|
|
sb.AppendFormat("Heap size with 512KiB of RAM or more: {0} bytes", bb.bbSysHeapSize).AppendLine();
|
2020-02-19 00:12:15 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
return sb.ToString();
|
2020-02-19 00:12:15 +00:00
|
|
|
}
|
|
|
|
|
}
|