Here's the code
primary graphics load routine
Code: Select all
lda $f5 ;current $8000-$9FFF
pha
lda $f6 ;current $A000-$BFFF
pha
lda $08
pha
lda $09
pha
lda #$28 ;bank 28
sta $f6 ;bank 28 to $A000-$BFFF
jsr $ff37 ;mmc3 bankswap
lda $ff ;NES PPUCTRL
and #$fe
jmp $ed38 ;set bits from NES $2000 to SNES equivilents
lda $03b800,x ;lo byte pointer to gfx
sta $02
lda $03b870,x ;hi byte pointer to gfx
sta $03
ldy #$00
lda [$02],y ;if A=FF, no palettes, if 00-7F, palettes
bmi $da42
sta $0618,y ;sprite palette 2 & 3 buffer
sta $0638,y ;sprite palette 2 & 3 buffer
iny
cpy #$08 ;8 bytes loaded yet?
bne $da2d
lda #$ff ;palette buffer write flag
sta $18 ;palette buffer
bne $da43
iny
lda #$28 ;bank 28
sta $f6
jsr $ff37 ;mmc3 bankswap
lda [$02],y ;load bank id for gfx location
bmi $da77 ;if 80-FF, goto pull's to end routine
pha
iny
lda [$02],y ;hi byte # of bytes to transfer to vram
sta $08
iny
lda [$02},y ;hi byte to chr gfx
sta $06
ldx #$00
stx $05
iny
lda $4212 ;originally lda $2002 (nes)
lda [$02],y ;vram hi byte
sta $09
pla ;restore bank id for gfx location
sta $f5 ;store as $8000-$9FFF
sta $f6 ;store as $8000-$9FFF
inc $f6 ;inc so bank id will store as $A000-$BFFF
jsr $ff37 ;mmc3 bankswap
jmp $ecf2 ;dma routine
nop
nop
bne $da43
pla
sta $09
pla
sta $08
pla
sta $f6
pla
sta $f5
jmp $ff37 ;mmc3 bankswap
Code: Select all
phy
lda $09
sta $7b
lda $06
sta $7d
lda $08
sta $7f
rep #$18
lda #$80
sta $2115
ldy $007A ;vram target location
sty $2116
lda $f5 ;bank id
sta $4304
ldy $007c ;chr hi byte location
sty $4302
ldy $007e ;# of bytes to transfer
sty $4305
lda #$01
sta $4300
lda #$18
sta $4301
lda #$01
sta $420b
stz $7b
stz $7d
stz $7f
sep #$30
ply
jmp $da72
Code: Select all
strings represent tiles 00-0F, 10-1F, 20-2F, etc etc
1 string, 100 bytes - 200 bytes
2 strings, 200 bytes - 400 bytes
3 strings, 300 bytes - 600 bytes
4 strings, 400 bytes - 800 bytes
5 strings, 500 bytes - A00 bytes
6 strings, 600 bytes - C00 bytes
7 strings, 700 bytes - E00 bytes
8 strings, 800 bytes - 1000 bytes
9 strings, 900 bytes - 1200 bytes
10 strings, A00 bytes - 1400 bytes
11 strings, B00 bytes - 1600 bytes
12 strings, C00 bytes - 1800 bytes
13 strings, D00 bytes - 1A00 bytes
14 strings, E00 bytes - 1C00 bytes
15 strings, F00 bytes - 1E00 bytes
16 strings, 1000 bytes - 2000 bytes
And when these routines load, i almost got the first dma transfer completed, then the other 3 times, i get nothing. Here is a breakdown of the bytes that are loaded.
Code: Select all
breakdown
[palette (08 bytes, if no palette then first byte is always FF)] [bank id] [# of bytes to transfer in 100's] [hi byte gfx pointer] [hi byte ppu address]
original nes version
FF2408B800 2A089808 08089010 08029B18 02019A1A FF
my snes conversion
FF2B10F000 2C10B010 2410A040 2404B648 2102B44A FF