Lately I’ve been working on reading the CF card contents on the PowerPak. I thought I’d share my findings so far.
This post is just to publish a few of my notes on reading the CF card contents on the PowerPak on the NES.
The information was gained from disassembling and reverse-engineering the PowerPak boot ROM, thus it’s incomplete. At this point, I’m only able to read sectors; Not write.
The PowerPak boot ROM used was obtained from the PowerPak Mappers v1.34 archive found on RetroZone‘s site.
;---------------------------------------------------------------- ; Notes ;---------------------------------------------------------------- ; ; Reading from $5007 will return the status of the CF card ; 0xFF - No card inserted ; 0x80 - Card busy[1] ; 0x58 - Card busy[1] ; 0x50 - Unknown ; 0x01 - Fatal card read error ; ; Reading form $5001 - Unknown ; ; Reading from $5000 - Read bytes from sector ; ; Writing to $5402 ; 0x01 - Enter CF access mode. PRG ROM will be disabled[2] during this time. ; 0x00 - Leave CF access mode. PRG ROM is now available as usual. ; ; Writing to $5407 ; 0x20 - Unknown ; ; Writing to $5403 - $5405 ; Sector address ; ; Writing to $5406 ; Unknown[3] ; ; [1] - I'm not sure what the different "busy" codes means, but the bottom line is that ; the card is not ready to be read from just yet. ; ; [2] - What might actually happen here is that the boot ROM will be accessable, ; but I haven't tested this yet. All I know is that the PRG ROM will be inaccessable. ; ; [3] - It would be logical that this is the 4th byte of the sector address, but ; I can successfully load the first sectors of the card when writing $E0 here. ; Dunno what it REALLY is... I'll have to experiment with this later. LoadCFCardSector: ; Enter CF access mode. ; At this point, the PRG ROM will be disabled LDA #$01 STA $4207 JSR WaitForCard LDA #$01 STA $5402 ; Sector to read LDA SectorAddr0 STA $5403 LDA SectorAddr1 STA $5404 LDA SectorAddr2 STA $5405 LDA #$E0 STA $5406 LDA #$20 STA $5407 NOP NOP JSR WaitForCard2 ; Load the 512 bytes of the sector into memory LDX #$00 LoadLoop: LDA $5000 STA $0500,X INX BNE LoadLoop LDX #$00 LoadLoop: LDA $5000 STA $0600,X INX BNE LoadLoop ; Leave CF access mode. ; PRG ROM is now accessable again, and no further CF reads can be made ; until CF access mode is entered again. LDA #$00 STA $4207 RTS WaitForCard: LDA $5007 AND #$80 BNE WaitForCard RTS WaitForCard2: LDA $5007 AND #$58 CMP #$58 BNE WaitForCard2 RTS CheckError: LDA $5007 AND #$01 CMP #$01 BEQ CheckError_Found RTS CheckError_Found: ; There was an error. ; Do something here... RTS
Sorry, the comment form is closed at this time.