Hello all,
I'm trying to Assemble my source code for NSF to Cart and I'm getting some errors. I would be much very much obliged if some could help me with this, as I'm very VERY new to NES programming and really need some help.
Also, I got the idea for doing this from the following article:
http://www.nullsleep.com/treasure/nsf_c ... e_v1.0.txt
They are using X816 as the assembler.
Below my posted code are the errors I receive in NESASM3
Here is my code:
.mem 8 ; 8-bit memory mode
.index 8 ; 8-bit index mode
.opt on ; address optimize
.org $0000 ; replace dashes with load address MINUS $80
.incbin "metroid.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
; *** 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 $A000 ; replace dashes with init address
; *** ENABLE VBLANK NMI ***
lda #%10000000 ; enable vblank interrupts by setting the
sta $2000 ; most significant bit of $2000
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 $B3B4 ; replace dashes with play address
rti ; return from interrupt routine
IRQ_Routine:
rti ; return from interrupt routine
.pad $FFFA
.dw NMI_Routine ; setup the NMI vector at $FFFA
.dw Reset_Routine ; setup the Reset vector at $FFFC
.dw IRQ_Routine ; setup the IRQ vector at $FFFE
When I run this in NESASM3 I get the following errors:
pass 1
#[1] NSF.asm
1 00:E000 .mem 8 ; 8-bit memory mode
Local symbol not allowed here!
2 00:E000 .index 8 ; 8-bit index mode
Local symbol not allowed here!
3 00:E000 .opt on ; address optimize
Local symbol not allowed here!
5 00:E000 .org $0000 ; replace dashes with load add
ress MINUS $80
Local symbol not allowed here!
6 00:E000 .incbin "metroid.nsf" ; include NSF tune
Local symbol not allowed here!
67 00:E055 .pad $FFFA
Unknown instruction!
# 6 error(s)
Any help with this would be greatly appreciated.
Thank You
-M
I'm trying to Assemble my source code for NSF to Cart and I'm getting some errors. I would be much very much obliged if some could help me with this, as I'm very VERY new to NES programming and really need some help.
Also, I got the idea for doing this from the following article:
http://www.nullsleep.com/treasure/nsf_c ... e_v1.0.txt
They are using X816 as the assembler.
Below my posted code are the errors I receive in NESASM3
Here is my code:
Code:
.mem 8 ; 8-bit memory mode
.index 8 ; 8-bit index mode
.opt on ; address optimize
.org $0000 ; replace dashes with load address MINUS $80
.incbin "metroid.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
; *** 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 $A000 ; replace dashes with init address
; *** ENABLE VBLANK NMI ***
lda #%10000000 ; enable vblank interrupts by setting the
sta $2000 ; most significant bit of $2000
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 $B3B4 ; replace dashes with play address
rti ; return from interrupt routine
IRQ_Routine:
rti ; return from interrupt routine
.pad $FFFA
.dw NMI_Routine ; setup the NMI vector at $FFFA
.dw Reset_Routine ; setup the Reset vector at $FFFC
.dw IRQ_Routine ; setup the IRQ vector at $FFFE
When I run this in NESASM3 I get the following errors:
pass 1
#[1] NSF.asm
1 00:E000 .mem 8 ; 8-bit memory mode
Local symbol not allowed here!
2 00:E000 .index 8 ; 8-bit index mode
Local symbol not allowed here!
3 00:E000 .opt on ; address optimize
Local symbol not allowed here!
5 00:E000 .org $0000 ; replace dashes with load add
ress MINUS $80
Local symbol not allowed here!
6 00:E000 .incbin "metroid.nsf" ; include NSF tune
Local symbol not allowed here!
67 00:E055 .pad $FFFA
Unknown instruction!
# 6 error(s)
Any help with this would be greatly appreciated.
Thank You
-M