コード例 #1
0
        public ZAbbreviations(ZHeader header, IMemoryManager manager)
        {
            var abbreviationsTable = manager.AsSpan(header.AbbreviationsTable).ToArray();
            var dynamicMemory      = manager.AsSpan(0, header.DynamicMemorySize);
            var abbrevs            = new List <string>();
            var anyMoreEntries     = true;

            var abbrIdx = 0;

            while (anyMoreEntries && abbrIdx < 96)
            {
                var addr = abbreviationsTable.GetUShort((ushort)(abbrIdx * 2));
                anyMoreEntries = addr != 0;
                if (anyMoreEntries)
                {
                    var zStr = ZsciiString.Get(dynamicMemory.AsSpan((ushort)(addr * 2)), null, header);
                    abbrevs.Add(zStr);
                    abbrIdx++;
                }
            }

//            for (int abbrIdx = 0; abbrIdx < 96 ; abbrIdx++)
//            {
//                var addr = abbreviationsTable.GetUShort((ushort) (abbrIdx * 2));
//
//                if (addr == 0) break;
//
//                var zStr = ZsciiString.Get(dynamicMemory.AsSpan((ushort)(addr * 2)), null);
//                abbrevs.Add(zStr);
//            }

            Abbreviations = abbrevs.ToArray();
        }
コード例 #2
0
 public string GetZscii(byte[] data)
 {
     return(ZsciiString.Get(data, Abbreviations, Header));
 }
コード例 #3
0
 public string GetZscii(ushort address)
 {
     return(ZsciiString.Get(Manager.AsSpan(address), Abbreviations, Header));
 }