It is currently Mon Nov 12, 2018 7:53 pm

All times are UTC - 7 hours





Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: Thu Apr 13, 2006 12:04 pm 
Offline
User avatar

Joined: Sun Mar 19, 2006 12:37 am
Posts: 223
Location: San ANto, TX
Hello Again,

I have a question about Name Table, Pattern table, and attribute table data?

What are the in's/out's of these formats : .pal, .dat, .db? (eg. i always see this kind of data in an ASM file:
pallete:
.db $32,$01,$06,$2A,$32,$03,$10,$00
.db $32,$38,$33,$3C,$32,$21,$26,$02
.db $32,$16,$12,$14,$32,$07,$17,$27
.db $32,$0B,$07,$2D,$32,$3A,$35,$31

map:
.db $26,$27,$26,$27,$26,$27,$26,$27,$26,$27 ;Floor
.db $26,$27,$26,$27,$26,$27,$26,$27,$26,$27
.db $26,$27,$26,$27,$26,$27,$26,$27,$26,$27
.db $26,$27,$00
.db $00,$1d,$11,$12,$1c,$00,$12,$1c,$00,$0a ;Text
.db $00,$13,$1e,$16,$19,$12,$17,$10,$00,$1c
.db $19,$1b,$12,$1d,$0e,$00,$00
.db $0b,$22,$00,$2b,$2c,$2d,$2e,$00,$04,$2a,$07
.db $2a,$02,$24,$24,$02)
I know that you can obtain these values in a hex editor. Does it cover all the values im looking for? How do i know which order to put them in?

2. Is there a program that can specify the Hex Number by just clicking on the tile. Or somthing that can extract the ".db" values from graphics editor? Im trying to display some graphitti i made in YY-CHR so that i can scroll through an Art Showcase. But first i have to just get one table up in an emulator (e.g. CC's Atomic Robo-Kid Graphic Demo). Ill worry about the mapping and vblank's later.

3. How can i assemble .pal and .dat files?

Basically i just want to display my graphics on an emulator so i can then transfer them to ROM chips for the NES.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 13, 2006 2:10 pm 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1849
Quote:
What are the in's/out's of these formats : .pal, .dat, .db


Are you talking file formats?

--EDIT--
From reading another post I realized that .pal files are also commonly used for generic binary files to be .incbin'd
--/EDIT--

.dat is a very generic file format. ".dat" typically is for a data file for a specific program, and it's use depends entirely on the program that created it. It's like ".bin" -- it's totally generic and could be anything.


.db isn't even a file format... is it? .db in code like the chunk you pasted just inputs the bytes given "as-is" into the assembled file. They're typically used for lookup tables or other constant data the game uses

Quote:
Does it cover all the values im looking for? How do i know which order to put them in?


I don't know what you're talking about here.

Quote:
Is there a program that can specify the Hex Number by just clicking on the tile. Or somthing that can extract the ".db" values from graphics editor?


Well... you could open up the .chr or whatever graphics file up in a hex editor and copy each byte. IE if you see "00 05 06 08" in the hex editor, you could put ".db $00, $05, $06, $08" in your code.

However save yourself a world of trouble and NEVER EVER EVER EVER DO THIS!!!. Most/all assemblers have an .incbin or some other kind of command will will just slap a binary file into the code without you having to have a million .db lines.

So instead of doing:
Code:
leveldata:
 .db $00, $00, $00  ; etc
 .db $00, $00, $00  ; etc for like 500 lines of leve data


You'd keep all your level data in a .bin other binary file and just do:
Code:
leveldata:
 .incbin "leveldata.bin"


.db is fine for small, quick lookuptables. But I'd say for anything over 32 bytes or so... don't use it and instead use .incbin or something.

It sickens me how so many demos out there have pages and pages of .db lines simply because the programmer wanted to keep everything in 1 file (or maybe he just didn't know better?). I've even seen programs like "HEX2DB" which take a binary file and convert it to a big .txt file containing .db lines. I wanted to punch whoever made that so hard.

Quote:
How can i assemble .pal and .dat files?


You don't


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 13, 2006 5:28 pm 
Offline
User avatar

Joined: Sun Mar 19, 2006 12:37 am
Posts: 223
Location: San ANto, TX
So basically idont have to write out all the .db code but instead just .incbin "file.chr" and it it should read all the data as it is saved. Also ive seen this incbin at at the end of a program. Does it matter if i put in the begining or the end?

Can i do that with .pal and .dat files to? (e.g:
paldata: .db $0f,$06,$00,$36,$0f,$30,$11,$36,$0f,$00,$0c,$30,$0f,$30,$36,$00
.db $0f,$06,$00,$36,$0f,$30,$11,$36,$0f,$00,$0c,$30,$0f,$30,$36,$00

So instead of all this i can just .incbin it as

paldata:
.incbin "file.pal"

Also, what are.nam files what do they do how can i make one?


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 13, 2006 6:13 pm 
Offline

Joined: Sun Sep 19, 2004 11:12 pm
Posts: 20760
Location: NE Indiana, USA (NTSC)
Disch wrote:
I've even seen programs like "HEX2DB" which take a binary file and convert it to a big .txt file containing .db lines. I wanted to punch whoever made that so hard.

Then punch me. I have developed on the GBA, where the dominant assembler (Gas, the GNU assembler from Binutils) did not support .incbin until the relatively recent 2.12 release. To work around this deficiency, I developed a simple C program called bin2s (part of the GBFS distribution) that acted much like the HEX2DB that you describe, generating output for piping into Gas:
Code:
bin2s file1.chr file2.bin file3.pal file4.dat file5.gbfs | arm-elf-as -o data.o


Last edited by tepples on Thu Apr 13, 2006 9:15 pm, edited 1 time in total.

Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 13, 2006 7:32 pm 
Offline
User avatar

Joined: Sun Mar 19, 2006 12:37 am
Posts: 223
Location: San ANto, TX
Disch wrote:
I've even seen programs like "HEX2DB" which take a binary file and convert it to a big .txt file containing .db lines.


Where can i find this program? I googled it with no luck. Ive seen much code that actully uses this data and if push comes to shove i dont want to be left without it.


Top
 Profile  
 
 Post subject:
PostPosted: Thu Apr 13, 2006 8:18 pm 
Offline
User avatar

Joined: Wed Nov 10, 2004 6:47 pm
Posts: 1849
No no no... You have NO reason for such a program. .incbin is what you want.

I don't remember where I got it, but even if I did I wouldn't link you =P


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 7 hours


Who is online

Users browsing this forum: No registered users and 3 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group