What's the easiest way to display text?
Moderator: Moderators
Forum rules
- For making cartridges of your Super NES games, see Reproduction.
-
- Posts: 3
- Joined: Sun Oct 01, 2017 1:38 pm
What's the easiest way to display text?
Hey folks,
I'm a total noob to SNES-Development, so please excuse my very basic question. Some googling didn't help me, so I thought this might be a good place to ask.
When programming for the SNES, is there any way to output text to something like a console, that can then be displayed to the screen? If not, what is the easiest way to output text? Some examples would help me a lot,
thanks in advance,
Boland
I'm a total noob to SNES-Development, so please excuse my very basic question. Some googling didn't help me, so I thought this might be a good place to ask.
When programming for the SNES, is there any way to output text to something like a console, that can then be displayed to the screen? If not, what is the easiest way to output text? Some examples would help me a lot,
thanks in advance,
Boland
Re: What's the easiest way to display text?
On hardware: draw it yourself, in one of the SNES videomode of your choice.
On emulators: some might support separate console windows, eg. in no$sns: 21FCh.W Write ASCII character to Debug Message Window
On emulators: some might support separate console windows, eg. in no$sns: 21FCh.W Write ASCII character to Debug Message Window
-
- Posts: 611
- Joined: Mon Jan 23, 2006 7:47 am
- Location: Germany
- Contact:
Re: What's the easiest way to display text?
You can also write text to a specific RAM section and watch that in an emulator's memory viewer if it doesn't have a Debug Message Window.
My current setup:
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10
Super Famicom ("2/1/3" SNS-CPU-GPM-02) → SCART → OSSC → StarTech USB3HDCAP → AmaRecTV 3.10
-
- Posts: 3
- Joined: Sun Oct 01, 2017 1:38 pm
Re: What's the easiest way to display text?
@creaothceann and @nocash, thank you very much for your help!
Regarding the video/text mode, are there any code examples you could point to?
Regarding the video/text mode, are there any code examples you could point to?
Re: What's the easiest way to display text?
SNES doesn't have a 'text mode'.
You probably want Mode 1. BG layer 0 will have 16 colors, 4 bits per pixel (bpp). You write text by placing the appropriate letter tiles in the correct order on the BG.
You could modify one of the 'hello world' examples out there (I wrote one) and change the data.
You can make CHR-ROM (graphics) with most tile editors. If you use YY-CHR, you can write any font in Photoshop or GIMP, flatten image, change image mode to indexed, 15 or 16 colors, cut. Paste into YY-CHR, set to 4bpp mode. Save CHR, replacing the graphics from the example code.
Changing the data (BG tile map) will require some actual SNES knowledge. It's 2 bytes per tile*. Read the wiki. I would be lousy at explaining it.
*quote from wiki...
Each entry in the tilemap is 2 bytes, formatted as (high low):
vhopppcc cccccccc
v/h = Vertical/Horizontal flip this tile.
o = Tile priority.
ppp = Tile palette. The number of entries in the palette depends on the Mode and the BG.
cccccccccc = Tile number.
You probably want Mode 1. BG layer 0 will have 16 colors, 4 bits per pixel (bpp). You write text by placing the appropriate letter tiles in the correct order on the BG.
You could modify one of the 'hello world' examples out there (I wrote one) and change the data.
You can make CHR-ROM (graphics) with most tile editors. If you use YY-CHR, you can write any font in Photoshop or GIMP, flatten image, change image mode to indexed, 15 or 16 colors, cut. Paste into YY-CHR, set to 4bpp mode. Save CHR, replacing the graphics from the example code.
Changing the data (BG tile map) will require some actual SNES knowledge. It's 2 bytes per tile*. Read the wiki. I would be lousy at explaining it.
*quote from wiki...
Each entry in the tilemap is 2 bytes, formatted as (high low):
vhopppcc cccccccc
v/h = Vertical/Horizontal flip this tile.
o = Tile priority.
ppp = Tile palette. The number of entries in the palette depends on the Mode and the BG.
cccccccccc = Tile number.
nesdoug.com -- blog/tutorial on programming for the NES
- mikejmoffitt
- Posts: 1353
- Joined: Sun May 27, 2012 8:43 pm
Re: What's the easiest way to display text?
SNES sort of has a text mode - in that tile graphics modes can be traced back to classic computer text modes, just with more attribute bits, custom characters, and fine scrolling.
An easy way to print is to place the ASCII charater set in VRAM, and have it line up to ASCII values - e.g. tile 0x41 contains an 'A' character.
Then it's a matter of writing a really simple copy loop, with a source string pointing towards a VRAM destination.
An easy way to print is to place the ASCII charater set in VRAM, and have it line up to ASCII values - e.g. tile 0x41 contains an 'A' character.
Then it's a matter of writing a really simple copy loop, with a source string pointing towards a VRAM destination.
- Drew Sebastino
- Formerly Espozo
- Posts: 3496
- Joined: Mon Sep 15, 2014 4:35 pm
- Location: Richmond, Virginia
Re: What's the easiest way to display text?
This is exactly what I did for my history presentation ROM (I don't know where I posted it). I actually wrote the text in Microsoft Word, and then pasted it into the ASCII window of HxD and added spaces when necessary. I made sure to have my VRAM upload routine only write to the low bytes of VRAM, because that's where the tile selection data is.mikejmoffitt wrote:An easy way to print is to place the ASCII charater set in VRAM, and have it line up to ASCII values - e.g. tile 0x41 contains an 'A' character.
Then it's a matter of writing a really simple copy loop, with a source string pointing towards a VRAM destination.
-
- Posts: 3140
- Joined: Wed May 19, 2010 6:12 pm
Re: What's the easiest way to display text?
The backgrounds layers are made out of 8x8 blocks positioned in a grid. So you need to make blocks with letters and numbers on them, and spell words with the letter blocks. It's the same reason why in Super Mario World, the blocks all look the same and are in a fixed grid.
Re: What's the easiest way to display text?
My SNES framework, whichdougeff wrote:Changing the data (BG tile map) will require some actual SNES knowledge. It's 2 bytes per tile*. Read the wiki. I would be lousy at explaining it.
Last edited by HihiDanni on Wed Nov 01, 2017 4:30 pm, edited 3 times in total.
SNES NTSC 2/1/3 1CHIP | serial number UN318588627
Re: What's the easiest way to display text?
Cool.My SNES framework, which will have its first release in a couple weeks, includes a raw tilemap editor. Stay tuned.
nesdoug.com -- blog/tutorial on programming for the NES
-
- Posts: 3140
- Joined: Wed May 19, 2010 6:12 pm
Re: What's the easiest way to display text?
Nice. Is this going to use tiles or metatiles?HihiDanni wrote:My SNES framework, which will have its first release in a couple weeks, includes a raw tilemap editor. Stay tuned.dougeff wrote:Changing the data (BG tile map) will require some actual SNES knowledge. It's 2 bytes per tile*. Read the wiki. I would be lousy at explaining it.
Re: What's the easiest way to display text?
Well, I said it was a raw tilemap editor. So it just makes plain static, low level tilemaps for use in title screens and other single screen use cases. Metatiles will come later when I write a level format.
SNES NTSC 2/1/3 1CHIP | serial number UN318588627
-
- Posts: 3
- Joined: Sun Oct 01, 2017 1:38 pm
Re: What's the easiest way to display text?
Wow, thanks for all your input! I'm glad this place exists, so much helpful stuff!