@gaialabs/core 0.1.12 → 0.1.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1,4 +1,4 @@
1
- import { BitStream, MemberType, Address, AddressSpace, AddressType, RomProcessingConstants, ChunkFileUtils, Op, RegisterType, BlockReaderConstants, createTableEntry, ChunkFile, BinType, createChunkFileFromDbFile, createChunkFileFromDbBlock, LocationWrapper, CompressionRegistry, Word, Byte, StatusFlags, readJsonFile, getDirectory, TypedNumber, AsmBlock, Long, summaryFromSupabaseByProject, crc32_buffer, DbRootUtils } from '@gaialabs/shared';
1
+ import { BitStream, RomProcessingConstants, Op, RegisterType, Address, ChunkFileUtils, BlockReaderConstants, createTableEntry, ChunkFile, BinType, createChunkFileFromDbFile, createChunkFileFromDbBlock, LocationWrapper, CompressionRegistry, Word, Byte, StatusFlags, AddressSpace, AddressType, MemberType, readJsonFile, getDirectory, TypedNumber, AsmBlock, Long, summaryFromSupabaseByProject, crc32_buffer, DbRootUtils } from '@gaialabs/shared';
2
2
 
3
3
  // src/rom/project.ts
4
4
  var QuintetLZ = class _QuintetLZ {
@@ -713,9 +713,11 @@ var AddressingModeHandler = class {
713
713
  case "Immediate":
714
714
  this.handleImmediateMode(code.mnem, context.size, operands, reg);
715
715
  break;
716
+ case "AbsoluteIndexedIndirect":
717
+ this.handleAbsoluteMode(code.mnem, void 0, context.nextAddress, reg.dataBank, operands, reg, true);
718
+ break;
716
719
  case "AbsoluteIndirect":
717
720
  case "AbsoluteIndirectLong":
718
- case "AbsoluteIndexedIndirect":
719
721
  case "Absolute":
720
722
  case "AbsoluteIndexedX":
721
723
  case "AbsoluteIndexedY":
@@ -845,19 +847,20 @@ var AddressingModeHandler = class {
845
847
  const stackOperations = new StackOperations(reg, this._blockReader);
846
848
  stackOperations.handleStackOperation(mnemonic);
847
849
  }
848
- handleAbsoluteMode(mnemonic, xBank1, next, dataBank, operands, registers) {
850
+ handleAbsoluteMode(mnemonic, xBank1, next, dataBank, operands, registers, isIndexedIndirect = false) {
849
851
  let refLoc = this._dataReader.readUShort();
850
852
  const isPush = this.isPushInstruction(mnemonic);
851
853
  if (isPush) {
852
854
  refLoc++;
853
855
  }
854
- const isJump = isPush || this.isJumpInstruction(mnemonic);
856
+ const isJump = isPush || isIndexedIndirect || this.isJumpInstruction(mnemonic);
855
857
  const bank = xBank1 ?? (isJump ? this._dataReader.position >> 16 : dataBank ?? 129);
856
858
  const addr = new Address(bank, refLoc);
857
859
  if (addr.isROM) {
858
860
  const wrapper = new LocationWrapper(addr.toInt(), AddressType.Offset);
859
861
  if (isJump) {
860
- const name = this._blockReader.noteType(wrapper.location, "Code", isPush, registers);
862
+ const type = isIndexedIndirect ? "*Code" : "Code";
863
+ const name = this._blockReader.noteType(wrapper.location, type, isPush, registers);
861
864
  if (isPush) {
862
865
  operands.push(`&${name}-1`);
863
866
  return;
@@ -2666,11 +2669,15 @@ var RomWriter = class {
2666
2669
  }
2667
2670
  writeChecksum() {
2668
2671
  const buf = this.outBuffer;
2672
+ buf[65500] = 255;
2673
+ buf[65501] = 255;
2674
+ buf[65502] = 0;
2675
+ buf[65503] = 0;
2669
2676
  let sum = 0;
2670
- for (let i = 0; i < buf.length; i++) sum += buf[i] & 255;
2677
+ for (let i = 0; i < buf.length; i++) sum += buf[i];
2671
2678
  buf[65502] = sum & 255;
2672
2679
  buf[65503] = sum >> 8 & 255;
2673
- const comp = ~sum & 65535;
2680
+ const comp = ~sum;
2674
2681
  buf[65500] = comp & 255;
2675
2682
  buf[65501] = comp >> 8 & 255;
2676
2683
  }