Basic NES Screen Tool question
Moderator: Moderators
- sempressimo
- Posts: 46
- Joined: Wed Nov 04, 2015 7:13 am
Basic NES Screen Tool question
When I draw screen (just 1 screen size) and export name table I get a 960 bytes and its not hex numbers as I expected.
I load my screens as .db $03, $06 etc. and just 1 screen size I have no scrolling.
My goal is just to draw 1 screen for now with the tool, instead of by hand on the .db(s) as I do now.
What I am missing?
I load my screens as .db $03, $06 etc. and just 1 screen size I have no scrolling.
My goal is just to draw 1 screen for now with the tool, instead of by hand on the .db(s) as I do now.
What I am missing?
Last edited by sempressimo on Sun Nov 29, 2015 8:54 am, edited 1 time in total.
Re: Basic NES Screen Tool question
A 960-byte file out of a nametable editor is most likely an uncompressed nametable without an attribute table. You can include it in your file with the .incbin command that an assembler is likely to support. But if different parts of the nametable use different 3-color subpalettes, I'd encourage you to include the attribute table so that the NES knows what colors to apply to each 16x16 pixel area. This will make your file 1024 bytes.
- sempressimo
- Posts: 46
- Joined: Wed Nov 04, 2015 7:13 am
Re: Basic NES Screen Tool question
I got the name table working as an .incbin of 1024, but there is something off with the attributes or the pallete:


My pallete section matches the program as I copied the pal ASM here to be sure:
palette:
.db $0f,$00,$10,$30 ,$0f,$01,$21,$31 ,$0f,$06,$16,$05, $0f,$09,$19,$29
.db $0f,$00,$10,$30 ,$0f,$01,$21,$31 ,$0f,$06,$16,$05, $0f,$09,$19,$29


My pallete section matches the program as I copied the pal ASM here to be sure:
palette:
.db $0f,$00,$10,$30 ,$0f,$01,$21,$31 ,$0f,$06,$16,$05, $0f,$09,$19,$29
.db $0f,$00,$10,$30 ,$0f,$01,$21,$31 ,$0f,$06,$16,$05, $0f,$09,$19,$29
Re: Basic NES Screen Tool question
How are you uploading the palette?
- sempressimo
- Posts: 46
- Joined: Wed Nov 04, 2015 7:13 am
Re: Basic NES Screen Tool question
LoadGamePalettes:lidnariq wrote:How are you uploading the palette?
LoadPalettes:
LDA $2002 ; read PPU status to reset the high/low latch
LDA #$3F
STA $2006 ; write the high byte of $3F00 address
LDA #$00
STA $2006 ; write the low byte of $3F00 address
LDX #$00 ; start out at 0
LoadPalettesLoop:
LDA roomindex
CMP #$00
BNE .next
LDA palette_dark, x ; load data from address (palette + the value in x)
JMP ResumePaletteLoading
.next
LDA palette, x ; load data from address (palette + the value in x)
ResumePaletteLoading:
STA $2007 ; write to PPU
INX ; X = X + 1
CPX #$20 ; Compare X to hex $10, decimal 16 - copying 16 bytes = 4 sprites
BNE LoadPalettesLoop ; Branch to LoadPalettesLoop if compare was Not Equal to zero
; if compare was equal to 32, keep going down
RTS
--------------------
First 16 are for the background, last 16 for the sprites. Want to mention this was all working when I was doing this by hand (i.e. editing the .db(s) for all things.
This is the "old way" and the "new way" for nametable data:
; New way shown on pictures..
Room0:
.incbin "demo.nam"
; Old way, no problem with this
Room1:
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
.db $24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24
.db $99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99
.db $99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$24,$99,$99
.db $99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$26,$27,$26,$27,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99
.db $99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$36,$37,$36,$37,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99,$99
attributes_1: ;8 x 8 = 64 bytes
.db %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111, %11111111
.db %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.db %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.db %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.db %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.db %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.db %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
.db %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000, %00000000
Re: Basic NES Screen Tool question
You're attribute table looks wrong. How was it generated? By hand?
Looks to me like it should be...
0, 0, 0, 0, 0, 0, 0, 0
(11110101=)$f5, $f5, $f5, $f5, $f5, $f5, $f5, $f5
$ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff
Then zero to the end.
Although your output doesn't match your attribute table either, according to your data, the "Lv 1" would be green and the rest of the screen gray. It's not being loaded right. Are you sure it's going to 23c0?
Looks to me like it should be...
0, 0, 0, 0, 0, 0, 0, 0
(11110101=)$f5, $f5, $f5, $f5, $f5, $f5, $f5, $f5
$ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff
Then zero to the end.
Although your output doesn't match your attribute table either, according to your data, the "Lv 1" would be green and the rest of the screen gray. It's not being loaded right. Are you sure it's going to 23c0?
nesdoug.com -- blog/tutorial on programming for the NES
- sempressimo
- Posts: 46
- Joined: Wed Nov 04, 2015 7:13 am
Re: Basic NES Screen Tool question
Atribute table for Room 1 was generated by hand but so far seems to be working fine. The problem I present is with Room 0 where the attribute table is included in the .nam file created by the NES Screen Tool.
Re: Basic NES Screen Tool question
In FCEUX, open hex editor, set view = PPU, and scroll down to 23c0. What numbers are you getting?
nesdoug.com -- blog/tutorial on programming for the NES
- sempressimo
- Posts: 46
- Joined: Wed Nov 04, 2015 7:13 am
Re: Basic NES Screen Tool question
dougeff wrote:In FCEUX, open hex editor, set view = PPU, and scroll down to 23c0. What numbers are you getting?

Re: Basic NES Screen Tool question
That matches the data.
So, I was misunderstanding at first. The above pictures are unrelated to current problem?
So, I was misunderstanding at first. The above pictures are unrelated to current problem?
nesdoug.com -- blog/tutorial on programming for the NES
- sempressimo
- Posts: 46
- Joined: Wed Nov 04, 2015 7:13 am
Re: Basic NES Screen Tool question
I will summarize, the problem is seen here:dougeff wrote:That matches the data.
So, I was misunderstanding at first. The above pictures are unrelated to current problem?


My code to load the name table is:
Code: Select all
Room0:
.incbin "demo.nam" ; This is a 1024 bytes file created with Screen Tool, it should contain the attribute table
Code: Select all
;----------------------
; LoadGamePalettes()
;----------------------
LoadGamePalettes:
LoadPalettes:
LDA $2002 ; read PPU status to reset the high/low latch
LDA #$3F
STA $2006 ; write the high byte of $3F00 address
LDA #$00
STA $2006 ; write the low byte of $3F00 address
LDX #$00 ; start out at 0
LoadPalettesLoop:
LDA roomindex
CMP #$00
BNE .next
LDA palette_dark, x ; load data from address (palette + the value in x)
JMP ResumePaletteLoading
.next
LDA palette, x ; load data from address (palette + the value in x)
ResumePaletteLoading:
STA $2007 ; write to PPU
INX ; X = X + 1
CPX #$20 ; Compare X to hex $10, decimal 16 - copying 16 bytes = 4 sprites
BNE LoadPalettesLoop ; Branch to LoadPalettesLoop if compare was Not Equal to zero
; if compare was equal to 32, keep going down
RTS
Re: Basic NES Screen Tool question
Oh, then my original statement holds true.
Your attribute table data is wrong. It doesn't match the picture you're showing us.
To quote myself...
Your attribute table data is wrong. It doesn't match the picture you're showing us.
To quote myself...
Looks to me like it should be...
0, 0, 0, 0, 0, 0, 0, 0
(11110101=)$f5, $f5, $f5, $f5, $f5, $f5, $f5, $f5
$ff, $ff, $ff, $ff, $ff, $ff, $ff, $ff
Then zero to the end.
Last edited by dougeff on Sun Nov 29, 2015 7:04 pm, edited 2 times in total.
nesdoug.com -- blog/tutorial on programming for the NES
Re: Basic NES Screen Tool question
You can look at the palette in FCEUX, you know. Nametables also. (I'm not sure if FCEUX can display attribute table values, but Nintendulator can show those ones as well.)
Download STREEMERZ for NES from fauxgame.com! — Some other stuff I've done: fo.aspekt.fi
- sempressimo
- Posts: 46
- Joined: Wed Nov 04, 2015 7:13 am
Re: Basic NES Screen Tool question
I keep forgetting about these tools. I did point me to my issue, I was loading a diff palette based on the room and I was pointing to the incorrect one.thefox wrote:You can look at the palette in FCEUX, you know. Nametables also. (I'm not sure if FCEUX can display attribute table values, but Nintendulator can show those ones as well.)
Thanks all!
Re: Basic NES Screen Tool question
At some point, you will have to consider compressing your data. The Nes Screen Tool (i think) has a RLE compression tool...and a bit of code to insert to uncompress it. (I've never used it personally).
nesdoug.com -- blog/tutorial on programming for the NES