Yes, I compiled your provided source, so I think the binary is working fine. I suppose there was something wrong with my code (which I really can't figure out), but I've since gotten another source to compile with no errors. It's just an adaptation of one of blargg's tutorials (to print 'Hello World'):
Code:
;FILLVALUE 0
$ = $0000
; iNES identifier
.byte "NES",$1a
.byte $01 ; 1 PRG-ROM block
.byte $01 ; 1 CHR-ROM block
.byte $00 ; unsure about these...which is mapper?
.byte $00 ;
.pad 16,0 ; fill out remainder of header
$ = $C000
; Give names to NES registers
PPUCTRL = $2000 ; These two control the PPU in various ways
PPUMASK = $2001
PPUSTATUS = $2002 ; Can be read to get current PPU status
PPUSCROLL = $2005 ; Sets X/Y scrolling of background
PPUADDR = $2006 ; Sets VRAM address in PPU
PPUDATA = $2007 ; Writes data to current VRAM address
reset:
; Initialize NES hardware
ldx #$FF ; reset stack pointer to $FF
txs
sei ; be sure IRQ interrupt is disabled
lda #0
sta PPUCTRL ; be sure NMI is off
sta PPUMASK ; be sure PPU rendering is off
; Give PPU time to warm up
@wait1: bit PPUSTATUS ; loop until top bit of PPUSTATUS is set
bpl @wait1
; reading PPUSTATUS also clears top bit,
; so it's clear now
@wait2: bit PPUSTATUS ; wait for bit to be set AGAIN
bpl @wait2
; Set first four palette entries
lda #$3F ; set PPU address to palette RAM
sta PPUADDR
lda #0
sta PPUADDR
lda #$0F
sta PPUDATA ; set background to black
lda #$30
sta PPUDATA ; set three foreground colors to white
sta PPUDATA
sta PPUDATA
; Clear nametable
lda #$20 ; nametable is at $2000
sta PPUADDR
lda #$00
sta PPUADDR
lda #0
ldx #0 ; execute loop 256 times (0 wraps around)
@clear_nt:
sta PPUDATA ; clear four bytes each time through loop
sta PPUDATA
sta PPUDATA
sta PPUDATA
dex
bne @clear_nt
; Write message at center of screen
lda #$21 ; put it at address $21AA
sta PPUADDR
lda #$AA
sta PPUADDR
ldx #0
lda message ; first byte of message
@next_char:
sta PPUDATA ; write byte to nametable
inx
lda message,x ; get next byte of message
bne @next_char ; loop back if it's not zero
; Wait for VBL before enabling display
bit PPUSTATUS
@wait3: bit PPUSTATUS
bpl @wait3
; Enable background display
lda #%00001000 ; enable background
sta PPUMASK
lda #0 ; scroll to top-left of nametable at $2000
sta PPUCTRL
sta PPUSCROLL
sta PPUSCROLL
; Loop forever
forever:
jmp forever
; Message to print, terminated by zero byte
message:
.byte "Hello, world!",0
; Interrupt handlers (not used in this example)
irq: rti
nmi: rti
.pad $FFAA
.dw nmi
.dw reset
.dw irq
.incbin "ascii.chr"
So this assembles to an .nes file (as well as another source I tried) but won't open in NEStopia. It claims the file may be 'damaged'. I'm stumped at this point. I don't know if it's the code, the binary, or the .nes file.
Also, I didn't know what you meant by checking the fill value. Did you mean inserting
Code:
FILLVALUE 0
at the beginning of my code?