Hi, I thought I'd try my hand at writing a SNES ROM (using ca65). I was able to clear WRAM using two DMA requests, and it appears to work right. Then I started on sending another one to clear CGRAM (eventually along with OAM and VRAM), but for some reason CGRAM gets corrupted when the DMA transfer runs.
IRQ and NMI are disabled, and I also turned on F-blank. Any idea what I'm doing wrong? It seems like there is some sort of bus conflict that's trashing CGRAM.
Thanks in advance
IRQ and NMI are disabled, and I also turned on F-blank. Any idea what I'm doing wrong? It seems like there is some sort of bus conflict that's trashing CGRAM.
Thanks in advance
Code:
STZ WMADDL STZ WMADDM STZ WMADDH ; Set WRAM destination address for DMA transfer ($000000 means 7E0000) LDA #$08 STA DMAP0 ; Fixed address source LDA #WMDATA & $FF STA BBAD0 ; B-bus address $2180 LDA #.BANKBYTE(@RESET_BYTE) STA A1B0 LDX #.LOWORD(@RESET_BYTE) STX A1T0L ; Set source address to the 24-bit address of RESET_BYTE STZ DAS0L STZ DAS0H ; Transfer size = 64k LDA #$01 STA MDMAEN ; Copy 64k to $7E0000-$7EFFFF LDA #$01 STA WMADDH ; Change WMADDH for the next 64k ($010000 means $7F0000) LDA #$01 STA MDMAEN ; Copy 64k to $7F0000-$7FFFFF STZ CGADD ; Set CGRAM destination address for DMA transfer LDA #$10 STA DMAP1 ; Fixed address souce, write destination address twice before incrementing LDA #.BANKBYTE(@RESET_BYTE) STA A1B1 LDX #.LOWORD(@RESET_BYTE) STX A1T1L LDA #CGDATA & $FF STA BBAD1 ; B-bus address $2122 STZ DAS1L LDA #$02 STA DAS1H ; Transfer size = 512b LDA #$02 STA MDMAEN ; Copy 512b to CGRAM
Statistics: Posted by bunder — Fri Dec 29, 2023 2:44 pm — Replies 3 — Views 195