I'm super mega noob with nes asm programming....
I need help with Nullslepp NSF play code:
http://www.nullsleep.com/treasure/nsf_cart_guide/
I try load SMB1 nsf file.... But without success
SMB NSF:
load address: C48D (-80 C40D)
init address: 34BE
play address: D0F2
Next:
How to load Name table from file (.map) ???
I try load name table using Gba Gay tutorial, lesson 13 "Making Background:
http://www.patatersoft.info/gbaguy/day13n.htm
But dont work...:/ I dont see any bkg tiles...:/
I need help with Nullslepp NSF play code:
http://www.nullsleep.com/treasure/nsf_cart_guide/
I try load SMB1 nsf file.... But without success
SMB NSF:
load address: C48D (-80 C40D)
init address: 34BE
play address: D0F2
Code:
;-----------------------demo-------
.inesprg 1
.ineschr 1
.inesmir 1
.inesmap 0
.org $8000
.bank 0
.org $c40d ; replace dashes with load address MINUS $80
.incbin "demo.nsf" ; include NSF tune
Reset_Routine:
cld ; clear decimal flag
sei ; disable interrupts
lda #%00000000 ; disable vblank interrupts by clearing
sta $2000 ; the most significant bit of $2000
Start:
lda #%00001000
sta $2000
lda #%00011110
sta $2001
lda #$3F ;set ppu to start of palette
sta $2006
lda #$00
sta $2006
ldx #$00
loadpal:
lda titlepal, x ;loads a 32 byte palette
sta $2007
inx
cpx #$20 ;gotta be one extra b/c of inx
bne loadpal
vwait:
lda $2002 ;wait...
bpl vwait
lda #$20 ;set ppu to start vram
sta $2006
lda #$20
sta $2006
lda #$01 ;write pattern table tile numbers to the name table
sta $2007
lda #$02
sta $2007
lda #$03
sta $2007
lda #$01
sta $2007
lda #$02
sta $2007
lda #$03
sta $2007
lda #$01
sta $2007
lda #$03
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00 ;write pattern table tile numbers to the name table
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$02
sta $2007
lda #$02
sta $2007
lda #$01
sta $2007
lda #$01
sta $2007
lda #$01
sta $2007
ldx #$00 ;set 2004 to the start SPRRAM
stx $2003
stx $2003
lda #$00 ;Y (w pionie)
sta $2004
lda #$00 ;sprite pattern number (numer tilesa w pliku .SPR)
sta $2004
lda #%00000001
sta $2004
lda #$00 ;X (w poziomie)
sta $2004
lda #$10
sta $2004
lda #$01
sta $2004
lda #%00000001
sta $2004
lda #$10
sta $2004
; *** WAIT 2 VBLANKS ***
WaitV1:
lda $2002 ; give the PPU a little time to initialize
bpl WaitV1 ; by waiting for a vblank
WaitV2:
lda $2002 ; wait for a second vblank to be safe
bpl WaitV2 ; and now the PPU should be initialized
; *** CLEAR SOUND REGISTERS ***
lda #$00 ; clear all the sound registers by setting
ldx #$00 ; everything to 0 in the Clear_Sound loop
Clear_Sound:
sta $4000,x ; store accumulator at $4000 offset by x
inx ; increment x
cpx #$0F ; compare x to $0F
bne Clear_Sound ; branch back to Clear_Sound if x != $0F
lda #$10 ; load accumulator with $10
sta $4010 ; store accumulator in $4010
lda #$00 ; load accumulator with 0
sta $4011 ; clear these 3 registers that are
sta $4012 ; associated with the delta modulation
sta $4013 ; channel of the NES
; *** ENABLE SOUND CHANNELS ***
lda #%00001111 ; enable all sound channels except
sta $4015 ; the delta modulation channel
; *** RESET FRAME COUNTER AND CLOCK DIVIDER ***
lda #$C0 ; synchronize the sound playback routine
sta $4017 ; to the internal timing of the NES
; *** SET SONG # & PAL/NTSC SETTING ***
lda #$00 ; replace dashes with song number
ldx #$00 ; replace with $00 for NTSC or $01 for PAL
jsr $be34 ; replace dashes with init address
; *** ENABLE VBLANK NMI ***
lda #%10000000 ; enable vblank interrupts by setting the
sta $2000 ; most significant bit of $2000
Loop:
jmp Loop
titlepal:
.incbin "demo.pal" ;palette data
NMI_Routine:
lda $2002 ; read $2002 to reset the vblank flag
lda #%00000000 ; clear the first PPU control register
sta $2000 ; writing 0 to it
lda #%10000000 ; reenable vblank interrupts by setting
sta $2000 ; the most significant bit of $2000
jsr $f2d0 ; replace dashes with play address
rti ; return from interrupt routine
IRQ_Routine:
rti ; return from interrupt routine
.bank 1
.org $FFFA
.dw 0 ; NMI_Rutine
.dw Start ; Reset_Rutine
.dw 0 ; IRQ_Rutine
.bank 2
.org $0000
.incbin "demo.bkg"
.incbin "demo.spr"
;-----------------------end----
.inesprg 1
.ineschr 1
.inesmir 1
.inesmap 0
.org $8000
.bank 0
.org $c40d ; replace dashes with load address MINUS $80
.incbin "demo.nsf" ; include NSF tune
Reset_Routine:
cld ; clear decimal flag
sei ; disable interrupts
lda #%00000000 ; disable vblank interrupts by clearing
sta $2000 ; the most significant bit of $2000
Start:
lda #%00001000
sta $2000
lda #%00011110
sta $2001
lda #$3F ;set ppu to start of palette
sta $2006
lda #$00
sta $2006
ldx #$00
loadpal:
lda titlepal, x ;loads a 32 byte palette
sta $2007
inx
cpx #$20 ;gotta be one extra b/c of inx
bne loadpal
vwait:
lda $2002 ;wait...
bpl vwait
lda #$20 ;set ppu to start vram
sta $2006
lda #$20
sta $2006
lda #$01 ;write pattern table tile numbers to the name table
sta $2007
lda #$02
sta $2007
lda #$03
sta $2007
lda #$01
sta $2007
lda #$02
sta $2007
lda #$03
sta $2007
lda #$01
sta $2007
lda #$03
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00 ;write pattern table tile numbers to the name table
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$00
sta $2007
lda #$02
sta $2007
lda #$02
sta $2007
lda #$01
sta $2007
lda #$01
sta $2007
lda #$01
sta $2007
ldx #$00 ;set 2004 to the start SPRRAM
stx $2003
stx $2003
lda #$00 ;Y (w pionie)
sta $2004
lda #$00 ;sprite pattern number (numer tilesa w pliku .SPR)
sta $2004
lda #%00000001
sta $2004
lda #$00 ;X (w poziomie)
sta $2004
lda #$10
sta $2004
lda #$01
sta $2004
lda #%00000001
sta $2004
lda #$10
sta $2004
; *** WAIT 2 VBLANKS ***
WaitV1:
lda $2002 ; give the PPU a little time to initialize
bpl WaitV1 ; by waiting for a vblank
WaitV2:
lda $2002 ; wait for a second vblank to be safe
bpl WaitV2 ; and now the PPU should be initialized
; *** CLEAR SOUND REGISTERS ***
lda #$00 ; clear all the sound registers by setting
ldx #$00 ; everything to 0 in the Clear_Sound loop
Clear_Sound:
sta $4000,x ; store accumulator at $4000 offset by x
inx ; increment x
cpx #$0F ; compare x to $0F
bne Clear_Sound ; branch back to Clear_Sound if x != $0F
lda #$10 ; load accumulator with $10
sta $4010 ; store accumulator in $4010
lda #$00 ; load accumulator with 0
sta $4011 ; clear these 3 registers that are
sta $4012 ; associated with the delta modulation
sta $4013 ; channel of the NES
; *** ENABLE SOUND CHANNELS ***
lda #%00001111 ; enable all sound channels except
sta $4015 ; the delta modulation channel
; *** RESET FRAME COUNTER AND CLOCK DIVIDER ***
lda #$C0 ; synchronize the sound playback routine
sta $4017 ; to the internal timing of the NES
; *** SET SONG # & PAL/NTSC SETTING ***
lda #$00 ; replace dashes with song number
ldx #$00 ; replace with $00 for NTSC or $01 for PAL
jsr $be34 ; replace dashes with init address
; *** ENABLE VBLANK NMI ***
lda #%10000000 ; enable vblank interrupts by setting the
sta $2000 ; most significant bit of $2000
Loop:
jmp Loop
titlepal:
.incbin "demo.pal" ;palette data
NMI_Routine:
lda $2002 ; read $2002 to reset the vblank flag
lda #%00000000 ; clear the first PPU control register
sta $2000 ; writing 0 to it
lda #%10000000 ; reenable vblank interrupts by setting
sta $2000 ; the most significant bit of $2000
jsr $f2d0 ; replace dashes with play address
rti ; return from interrupt routine
IRQ_Routine:
rti ; return from interrupt routine
.bank 1
.org $FFFA
.dw 0 ; NMI_Rutine
.dw Start ; Reset_Rutine
.dw 0 ; IRQ_Rutine
.bank 2
.org $0000
.incbin "demo.bkg"
.incbin "demo.spr"
;-----------------------end----
Next:
How to load Name table from file (.map) ???
I try load name table using Gba Gay tutorial, lesson 13 "Making Background:
http://www.patatersoft.info/gbaguy/day13n.htm
But dont work...:/ I dont see any bkg tiles...:/