UNPKG

snes-disassembler

Version:

A Super Nintendo (SNES) ROM disassembler for 65816 assembly

119 lines 3.23 kB
import { CartridgeInfo } from './cartridge-types'; /** * Enhanced bank switching handler with support for all SNES mapping modes * Handles LoROM, HiROM, ExLoROM, ExHiROM, and special chip configurations */ export declare class BankHandler { private cartridgeInfo; private mappingMode; private bankMask; private addressMask; constructor(cartridgeInfo: CartridgeInfo); /** * Detect mapping mode from cartridge info */ private detectMappingMode; /** * Initialize bank and address masks based on mapping mode */ private initializeMasks; /** * Convert logical address to ROM offset with enhanced bank switching */ addressToRomOffset(address: number): number; /** * Convert ROM offset to logical address */ romOffsetToAddress(romOffset: number): number; /** * LoROM mapping calculation (Mode 20) * Banks 00-7F: ROM at $8000-$FFFF (32KB per bank) * Banks 80-FF: FastROM mirror */ private calculateLoROMOffset; /** * HiROM mapping calculation (Mode 21) * Banks C0-FF: Direct ROM mapping (64KB per bank) * Banks 40-7F: Direct ROM mapping (64KB per bank) */ private calculateHiROMOffset; /** * ExLoROM mapping calculation (Mode 25) * Extended LoROM for ROMs > 2MB */ private calculateExLoROMOffset; /** * ExHiROM mapping calculation (Mode 25) * Extended HiROM for ROMs > 4MB */ private calculateExHiROMOffset; /** * Calculate LoROM address from ROM offset */ private calculateLoROMAddress; /** * Calculate HiROM address from ROM offset */ private calculateHiROMAddress; /** * Calculate ExLoROM address from ROM offset */ private calculateExLoROMAddress; /** * Calculate ExHiROM address from ROM offset */ private calculateExHiROMAddress; /** * Get valid address ranges for the current mapping mode */ getValidAddressRanges(): Array<{ start: number; end: number; type: string; }>; /** * Check if an address is valid for the current mapping mode */ isValidAddress(address: number): boolean; /** * Get the mapping mode */ getMappingMode(): string; /** * Get bank size for the current mapping mode */ getBankSize(): number; /** * Handle special chip bank switching * This method can be extended to handle SA-1, SuperFX, etc. */ handleSpecialChipBanking(address: number, chipType?: string): number | null; /** * Handle SA-1 specific banking */ private handleSA1Banking; /** * Handle SuperFX specific banking */ private handleSuperFXBanking; /** * Get bank information for an address */ getBankInfo(address: number): { bank: number; offset: number; type: string; physicalAddress?: number; }; /** * Get statistics about the current mapping */ getMappingStats(): { mode: string; bankSize: number; romSize: number; totalBanks: number; validRanges: number; }; } //# sourceMappingURL=bank-handler.d.ts.map