How to create .chr file?

Are you new to 6502, NES, or even programming in general? Post any of your questions here. Remember - the only dumb question is the question that remains unasked.

Moderator: Moderators

Post Reply
chmaster
Posts: 14
Joined: Fri Oct 30, 2009 7:34 am

How to create .chr file?

Post by chmaster »

Sorry for asking such a stupid question. I'm new. :oops:

I've finished reading bunnyboy's Nerdy Nights and decided to give it a try. I just want to show some background and sprites the screen, but I found I don't know how to make .chr file. Can anyone tell me please?
User avatar
Banshaku
Posts: 2404
Joined: Tue Jun 24, 2008 8:38 pm
Location: Japan
Contact:

Post by Banshaku »

To make a chr file you will need an editor. One example would be yy-chr that is quite simple to use and can be downloaded here since the original site is down.

There are other one but for now this is the first one that came to mind. There must be other ones available on the same site linked above.
chmaster
Posts: 14
Joined: Fri Oct 30, 2009 7:34 am

Post by chmaster »

Thank you very much. I've got the yy-chr. :D
User avatar
Rid
Posts: 66
Joined: Sun May 10, 2009 4:06 am

Post by Rid »

I never used YY-CHR.

I use Tile Layer Pro instead : very useful to import bitmap and manipulating tiles :)
chmaster
Posts: 14
Joined: Fri Oct 30, 2009 7:34 am

Post by chmaster »

But tile layer pro can only edit a rom. Think I can't use it if I want to make a game from scratch, can I?
User avatar
Rid
Posts: 66
Joined: Sun May 10, 2009 4:06 am

Post by Rid »

Yes that's true. TLP can only edit files that already exist, but it let you to import bitmap files which is quite useful.

In order to short cut this, I usually create a dummy file filled with 00's and I change its extension in order to open it with TLP.
chmaster
Posts: 14
Joined: Fri Oct 30, 2009 7:34 am

Post by chmaster »

What is "create a dummy file filled with 00's" ?

And how do you program if it's already a .nes?
Roth
Posts: 400
Joined: Wed Aug 03, 2005 3:15 pm
Contact:

Post by Roth »

I made a little command line program that creates blank binary files that I use for CHR work. Download the program called 'makebin' on this page:

http://robertlbryant.com/programs/cpp.htm

Run it from the command line, enter 4 for your file size, and hit enter. Then open Tile Layer Pro, set 'Files of type' at the bottom to All Files (*.*), open the file you made with makebin, click View -> Type -> NES. Start editing your file, and don't forget to save!

Hope that helps a little.
User avatar
Rid
Posts: 66
Joined: Sun May 10, 2009 4:06 am

Post by Rid »

I usually create file using Translhextion.
Just open it, and insert as many 00's as you want, and save your file with whatever extension (I prefer .chr as many of us).
chmaster
Posts: 14
Joined: Fri Oct 30, 2009 7:34 am

Post by chmaster »

I've tried both makebin and Translhextion. Sorry I don't really technically understand what .chr file is...

1. The .bin created by makebin is a .nes or .chr?

2. If I enter some 00 in Translhextion and save it as a .chr, is it a clean .chr I can import bmp into? What I mean is that if I import a bmp to the .chr, will those 00 be overwritten and I get a clean .chr with only the bmp imported?

Another question. Nes has 2 tile pattern tables, 1 for background and 1 for sprite. Now I've already made my two 128x128 bmp. How can I include both 2 pattern tables into one .chr?
User avatar
tokumaru
Posts: 12106
Joined: Sat Feb 12, 2005 9:43 pm
Location: Rio de Janeiro - Brazil

Post by tokumaru »

chmaster wrote:1. The .bin created by makebin is a .nes or .chr?
File extensions are there so that the computer knows what program it should use to open the files, they don't have any impact on what the files actually are/contain. If it has the correct size you can use it as a CHR file just fine.
2. If I enter some 00 in Translhextion and save it as a .chr, is it a clean .chr I can import bmp into?
I guess, but I can't say I'm 100% sure because I never used the import features of these tile editors. It seems you'd have to enter 4096 00's if you want a 4KB CHR file though, so "makebin" sounds like a less tedious option to create your empty file.
Now I've already made my two 128x128 bmp. How can I include both 2 pattern tables into one .chr?
If you use a 128x256 BMP instead you will get a CHR file that will fill both pattern tables. If you already have 2 4KB CHR files, you can join them with "copy /b file1.chr + file2.chr file3.chr" in the command prompt. you could also simply include both files, one after the other, in your source code, no problem.
chmaster
Posts: 14
Joined: Fri Oct 30, 2009 7:34 am

Post by chmaster »

I see. Thank you.

Just curious. Is it possible just to enter few 00 to create .chr, and open it with other editors and import bmp, so it becomes the .chr you can use in the game?
tepples
Posts: 22345
Joined: Sun Sep 19, 2004 11:12 pm
Location: NE Indiana, USA (NTSC)
Contact:

Post by tepples »

Do you have Python? I made a BMP/PNG to CHR converter for PIL.
User avatar
Memblers
Site Admin
Posts: 3901
Joined: Mon Sep 20, 2004 6:04 am
Location: Indianapolis
Contact:

Post by Memblers »

The Tile Molester CHR editor is normally what I'd used for importing graphics.
Post Reply