Forums

Sega Master System / Mark III / Game Gear
SG-1000 / SC-3000 / SF-7000 / OMV
Home - Forums - Games - Scans - Maps - Cheats - Credits
Music - Videos - Development - Hacks - Translations - Homebrew

View topic - Editing graphics on SG-1000 games

Reply to topic
Author Message
  • Joined: 11 Jan 2009
  • Posts: 116
  • Location: Germany
Reply with quote
Editing graphics on SG-1000 games
Post Posted: Sat Dec 15, 2012 3:35 pm
This is something I've been rather puzzled about for quite a while now. My general graphics editing program of choice is Tile Layer Pro, where I can view SG-1000 games in 1BPP format. That works well enough for editing the font, but when it comes to actual graphics (e.g. the title logo for Soukoban), I'm stumped.

I've already done an extensive Google search, but to no avail, so does anybody 'round here know of any programs or could give me any other helpful pointers? How exactly the SG-1000 handles graphics might be a good thing to know (I fail to find any documents, but I guess I'm just not searching hard enough), even though it's probably not gonna help me much when it comes to editing graphics.
  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13166
  • Location: London
Reply with quote
Post Posted: Sat Dec 15, 2012 3:46 pm
If it's stored uncompressed then it's most likely in the same format as when it's in VRAM so you can try dumping that and comparing. If it's compressed then you will have more difficulty.
  View user's profile Send private message Visit poster's website
  • Joined: 11 Jan 2009
  • Posts: 116
  • Location: Germany
Reply with quote
Post Posted: Sat Dec 15, 2012 5:03 pm
I guess it's uncompressed, but I'm not 100% sure.


For some reason, tiles are shifted two pixels upwards into the previous tile, but you can still edit it (even though I didn't have to for my translation).

Right below the font is where the tiles for the title logo are, I think. It doesn't look very editable, as you can see.

Maxim wrote
If it's stored uncompressed then it's most likely in the same format as when it's in VRAM so you can try dumping that and comparing.

And how do I do that? I already tried running the ROM through Tile Decoder, and predictably didn't get anything.
tiles.png (18.48 KB)
tiles.png

  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13166
  • Location: London
Reply with quote
Post Posted: Sat Dec 15, 2012 8:49 pm
The pixel alignment is just because there's no need to align data in Sega roms. There are keypresses to fix that in TLP.

On the title screen, dump VRAM as binary from Meka's debug menu and compare to the ROM. If it's the same then it's not compressed, it's just a matter of the way the data is interpreted. I never learned about the legacy video modes so I can't offer much help... but maybe there are some MSX tools that would help?
  View user's profile Send private message Visit poster's website
  • Joined: 11 Jan 2009
  • Posts: 116
  • Location: Germany
Reply with quote
Post Posted: Sat Dec 15, 2012 10:36 pm
Maxim wrote
The pixel alignment is just because there's no need to align data in Sega roms. There are keypresses to fix that in TLP.

There are? How d'you do that?

Maxim wrote
On the title screen, dump VRAM as binary from Meka's debug menu and compare to the ROM.

Maybe I'm just blind, but I can't seem to find a debug menu of any kind. I'm using Meka v0.73, by the way. Just in case the debug menu has been implemented in a later version...
  View user's profile Send private message
  • Joined: 14 Oct 2008
  • Posts: 330
Reply with quote
Post Posted: Sun Dec 16, 2012 7:51 am
Maxim wrote
The pixel alignment is just because there's no need to align data in Sega roms. There are keypresses to fix that in TLP.

On the title screen, dump VRAM as binary from Meka's debug menu and compare to the ROM. If it's the same then it's not compressed, it's just a matter of the way the data is interpreted. I never learned about the legacy video modes so I can't offer much help... but maybe there are some MSX tools that would help?


My one experience into MSX hacking didn't go so well. (though I'm not exactly sure which version of the MSX the game was for)
As I recall, the data on that was 0x800 for bitplane 1 for every tile in the tileset (256 tiles), then the next 0x800 for bitplane 2 for every tile. And so on.
So, for 16 colors (4 planes, you'd need to combine the data at $0000, $0800, $1000 and $1800 to find the colors for the first 8 pixels of the first tile.)
Would make sense for the font to be visible if that was only using 1 bitplane.

(tile editors I know can do most other consoles because they typically store every bitplane for a single tile together)
  View user's profile Send private message
  • Joined: 11 Jan 2009
  • Posts: 116
  • Location: Germany
Reply with quote
Post Posted: Sun Dec 16, 2012 8:20 am
If it helps any, this is the title logo itself (screenshot taken with Kega Fusion; I noticed how Meka has a bit more vibrant colors).


For reference purposes, here's the SG-1000 palette, taken from Meka:


Now, what I noted about the colors used:
Row 1 and 6: color 7
Row 2 and 5: color 9
Row 3 and 4: color 10
"Shadow": color 6 (6)
Light spots: color 16
(With "row", I always mean a horizontal row that is 8 pixels wide.)

KingMike wrote
So, for 16 colors (4 planes, you'd need to combine the data at $0000, $0800, $1000 and $1800 to find the colors for the first 8 pixels of the first tile.)

I don't quite understand that. Do you mean I need to put together the values at those four offsets?
$0000 F3
$0800 DC
$1000 10
$1800 6E

... And subsequently, would the color data for the second tile be stored at $0001, $0801, $1001 and $1801? Moreover, how are the four aforementioned values supposed to be interpreted?
logo.png (1.44 KB)
logo.png
palette.png (299 B)
palette.png

  View user's profile Send private message
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8192
  • Location: Paris, France
Reply with quote
Post Posted: Sun Dec 16, 2012 12:35 pm
Last edited by Bock on Sun Dec 16, 2012 3:09 pm; edited 1 time in total
It looks like you would be helped to use the MEKA debugger. You can run the setup.bat to activate it or edit meka.cfg
You are better off using the newer MEKA 0.8x branch build because it has many more features.

This is C code to render a graphic mode 2 screen in one shot. It should give you a breakdown of how the data is stored and accessed in VRAM. (it doesn't handle all VDP features here but is appropriate for Soukoban)

If you look in the Tech Info box in MEKA or extract the value from the VDP register, the base address blocks for Sokoban are:
Name Table $3800
Color Table $2000
Pattern Table $0000

I presume there must be Coleco or MSX tools to decode/encode various bits of graphics for Mode 2.

  View user's profile Send private message Visit poster's website
  • Joined: 11 Jan 2009
  • Posts: 116
  • Location: Germany
Reply with quote
Post Posted: Sun Dec 16, 2012 2:51 pm
Bock wrote
This is C code to render a graphic mode 2 screen in one shot. It should give you a breakdown of how the data is stored and accessed in VRAM. (it doesn't handle all VDP features here but is appropriate for Soukoban)

Unfortunately, I know squat about C, so that script makes only limited sense to me.

Bock wrote
If you look in the Tech Info box in MEKA or extract the value from the VDP register, the base address blocks for Sokoban are:
Name Table $3800
Color Table $2000
Pattern Table $0000

I dumped the VDP regs, and that's what's in the file:
MEKA 0.80-alpha
** VRegs dump
** File: Soukoban.sc
** Date: Sun Dec 16 15:45:26 2012

VReg[00] = $02 | %00000010
VReg[01] = $E0 | %11100000
VReg[02] = $0E | %00001110
VReg[03] = $FF | %11111111
VReg[04] = $03 | %00000011
VReg[05] = $76 | %01110110
VReg[06] = $03 | %00000011
VReg[07] = $00 | %00000000
VReg[08] = $00 | %00000000
VReg[09] = $00 | %00000000
VReg[10] = $FF | %11111111
VReg[11] = $00 | %00000000
VReg[12] = $00 | %00000000
VReg[13] = $00 | %00000000
VReg[14] = $00 | %00000000
VReg[15] = $00 | %00000000

Apparently, the regs are 8 bits, or at least I'm too stupid to find the offsets you named.

As for the VRAM, that's what it reads at said offsets:
0000-000F | 00 00 00 00 00 00 00 00 F7 F7 F0 F7 F7 07 F7 F7
2000-200F | F0 F0 F0 F0 F0 F0 F0 F0 6F 6F 6F 6F 6F 6F 6F 6F
3800-380F | 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00


To be honest, I'm even more confused than before.
  View user's profile Send private message
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8192
  • Location: Paris, France
Reply with quote
Post Posted: Sun Dec 16, 2012 3:18 pm
The VDP register are 8-bit are part of their content describe what are the addresses for different name/colour tables. You can see the address extracted in the TECH INFO box and also you can see the VDP registers in the MEMORY EDITOR tools. I quoted the addresses above anyway so you don't need to do that.

The name table starts at $3800 and is 32x24 bytes long = 768 bytes, 1 byte per tile. Take the byte for each tile, multiply by 8 and it gives you the offset where to read from in the colour and pattern tables.

The colour and pattern tables are a maximum 2 kilobytes each (256*8 addressing range) but possibly smaller, that would depend on how the name table is accessing them.

The pattern table hold 8 bytes per tile = 1 byte per line = 1 bit per pixel of a tile, and encode whether to use the first or the second colours.

The colour table also hold 8 bytes per tile = 1 byte per line. The 4 lower and the 4 high bits encode the colour number. So if a pixel bit is 0 in the pattern table it will use the colour index described in the 4 low bits. If a pixel bit is 1 in the pattern table it will use the colour index described in the 4 high bits.

I realize you may not understand all of it but some people may come in and join to help. Any documentation on the TMS9918 would give more detailed information. I haven't looked but there's no doubt that MSX/Coleco scene have developed tools to decode/encode graphics for this video mode.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8192
  • Location: Paris, France
Reply with quote
Part 1 : name table data
Post Posted: Sun Dec 16, 2012 3:25 pm
If you look at the name table in the MEMORY EDITOR, inside the VRAM pane: it starts with a leading block of 00 which describe the black background.

Then you can see 00 81 82 83 84 85 00 86 87 88 89 8A 00 8B
Which is an almost sequential reference to unique tile, that is because the logo has little repeated tiles. The 00 are the empty bits.

Presumably the game is not bothering not store the name table data for the full screen because it is mostly empty, and only store the name table data for the logo. If you look for 81 82 83 etc.. in the ROM with an hex-editor you can find the logo name table in the range $05FA to $0667 (picture attached).

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8192
  • Location: Paris, France
Reply with quote
Part 2 : pattern and color data
Post Posted: Sun Dec 16, 2012 3:35 pm
In the tile viewer the logo data is stored in VRAM in tile $80 (address $0400 within pattern table, $2400 within colour table) to tile $e4 (address $0720 within pattern table, $2720 within colour table).

That's 100 tiles worth of graphics data. Each title use 8 bytes of pattern data and 8 bytes of colour data so that's a total of 800+800 = 1600 bytes, which are presumably stored separately in the ROM.

Looking at the pattern data for tile $81 (because title $80 is empty) :
00 00 00 00 01 07 1F 7F
Which you can find in ROM using an hex-editor from address $6A96 (800 bytes long).

If I look at the colour data for tile $81
00 00 00 00 60 60 60 60
Which you can find in ROM from address $6DBE (800 bytes long).

So in summary the logo consist of:
- name table in range $05FA to $0667
- pattern table in range $6A96 to $6DBE
- colour table in range $6DBE to $70DE

You need to draw a new logo following Mode 2 restrictions (2 colour per 8x1 tile line block) and fitting within 100 unique characters then use a tool to encore your picture into those three sets of data and replace them in ROM at those locations. Again I imagine that Coleco/MSX people came up with such tool already.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8192
  • Location: Paris, France
Reply with quote
Post Posted: Sun Dec 16, 2012 4:18 pm
I updated the tilemap viewer in MEKA to show more information on graphics mode 2, namely when hovering a tile you gets it's name table address along with its pattern and colour data and their respective addresses in VRAM. Hope it is useful. New build:
http://smspower.org/forums/viewtopic.php?p=73370#73370

  View user's profile Send private message Visit poster's website
  • Joined: 11 Jan 2009
  • Posts: 116
  • Location: Germany
Reply with quote
Post Posted: Sun Dec 16, 2012 5:38 pm
Bock wrote
You need to draw a new logo following Mode 2 restrictions (2 colour per 8x1 tile line block) and fitting within 100 unique characters then use a tool to encore your picture into those three sets of data and replace them in ROM at those locations.

Of these, I did what I was most capable of for now, which is designing a logo under these criteria.

(Top: Fully-assembled logo; Bottom: Singular tiles, 63 total)


The rest will have to wait, I guess. I'm feeling a bit exhausted from all the information spoonfed to me in a single day. :P I'm not a programmer by any means, but at least I'm starting to get a grasp of stuff I'm supposed to do to get this done.
(By the way, could it be that there's actually a distinct lack of information on editing SG-1000 games?)
newlogo.png (1.84 KB)
newlogo.png

  View user's profile Send private message
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 13166
  • Location: London
Reply with quote
Post Posted: Sun Dec 16, 2012 7:10 pm
Please, not Comic Sans!
  View user's profile Send private message Visit poster's website
  • Joined: 11 Jan 2009
  • Posts: 116
  • Location: Germany
Reply with quote
Post Posted: Sun Dec 16, 2012 9:25 pm
*sigh* Fine... Then which font would you suggest?
  View user's profile Send private message
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8192
  • Location: Paris, France
Reply with quote
Post Posted: Mon Dec 17, 2012 12:03 am
mk1995 wrote
(By the way, could it be that there's actually a distinct lack of information on editing SG-1000 games?)

There is no dedicated information per-se but a lot of people here would have the knowledge to help, and it should be the exact same technique as Colecovision and MSX1 which use the same video chip and the same CPU. I suggest someone go on a quest on those communities and see what they have to offer us :)
  View user's profile Send private message Visit poster's website
  • Joined: 24 May 2010
  • Posts: 120
  • Location: New York
Reply with quote
Post Posted: Mon Dec 17, 2012 6:47 am
mk1995, glad to see you're delving into SG-1000 games! I think it's actually a great console for a newcomer to work on, or at least it was for me. I was able to do a pretty good job with Chack'n Pop, and a passable job with Ninja Princess, and that was with very limited skills and tools available.

FWIW I used a different program (the unfortunately-named TileMolester) for my forays into SG-1000 graphics hacking, but had somewhat similar issues when I worked on the Ninja Princess title screen. Things weren't lining up and I had to resort to a lot of trial-and-error to get something like a plausible result.

Do you think you might translate the Japanese text in the game too? I think there's only a little bit, and if I have time I could take screenshots and ask some Japanese folks I know to translate. Or once you've hacked the title screen (preferably not with Comic Sans :D ) I could look at the results and work on the text myself.
  View user's profile Send private message
  • Joined: 11 Jan 2009
  • Posts: 116
  • Location: Germany
Reply with quote
Post Posted: Mon Dec 17, 2012 7:20 pm
goldenband wrote
Do you think you might translate the Japanese text in the game too?

I already did. Really, all that's missing is get the title screen translated and then the translation project can be considered complete.

goldenbrand wrote
(preferably not with Comic Sans :D )

What does everyone have against Comic Sans MS, and why does nobody suggest a better alternative?

Edit: Since everyone seems to hate on Comic Sans MS, I decided to take a spin at it with a different font: Gabriola.

This time there's 67 tiles used (not sure if all of them are unique; I was too lazy to weed out the alike ones, since it's less than 100, anyway). See attachment below.
newlogo2.png (2.11 KB)
newlogo2.png

  View user's profile Send private message
  • Joined: 24 May 2010
  • Posts: 120
  • Location: New York
Reply with quote
Post Posted: Tue Dec 18, 2012 1:08 am
Last edited by goldenband on Tue Dec 18, 2012 3:31 am; edited 1 time in total
mk1995 wrote
I already did. Really, all that's missing is get the title screen translated and then the translation project can be considered complete.


Brilliant! Very happy to see that. I was taking a look at it last night and struggling through it, but there was one recurring character I couldn't get a fix on. Actually it was this one:



I know it's アルバイト (arubaito, loanword from German Arbeit), but what's that last kana/kanji? It's out of order in the ROM, and is actually the very first Japanese characer in the tileset IIRC.

mk1995 wrote
What does everyone have against Comic Sans MS, and why does nobody suggest a better alternative?


Here are a couple links that might be interesting:

What's so wrong with Comic Sans?

A Brief History of Comic Sans

Basically, it's seen as clichéd and overused -- a lazy, default choice that has an off-putting, pseudo-infantile quality. It's like Pachelbel's Canon at weddings, or "I've fallen and I can't get up!", or Thomas Kinkade.

It doesn't bother me as much as it bothers typography nuts, but it definitely puts me off when I see it -- though actually the gradient helps a lot in this case. Either way, the revised version is a big improvement IMHO.

Will you be doing more SG-1000 games in the future? At one point, I had a list going of the untranslated games:

Champion Kendou
Mahjong
Okamoto Ayako no Match Play Golf
Loretta no Shouzou: Sherlock Holmes (or is this Mark III-only?)
San-Nin Mahjong
Seriwaza...Shogi
Shinnyushain Toru Kun [aka Mikie]
Uranai Angel Cutie

No idea if that's complete, and some might be arguably unnecessary, but there it is.
unknown kana.gif (1.6 KB)
unknown kana.gif

  View user's profile Send private message
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8192
  • Location: Paris, France
Reply with quote
Post Posted: Tue Dec 18, 2012 1:39 am
Translating Loretta no Shouzzou looks like quite some work but it would be one of the most interesting game to translate.
It was released within the Gold Cartridge collection for being 128 KB for works on the SG-1000. The game has nice artworks too:
http://mercenaryforce.web.fc2.com/sg1000/00080.html
  View user's profile Send private message Visit poster's website
  • Joined: 11 Jan 2009
  • Posts: 116
  • Location: Germany
Reply with quote
Post Posted: Tue Dec 18, 2012 4:34 am
Last edited by mk1995 on Tue Dec 18, 2012 6:58 pm; edited 1 time in total
goldenband wrote


I know it's アルバイト (arubaito, loanword from German Arbeit), but what's that last kana/kanji? It's out of order in the ROM, and is actually the very first Japanese characer in the tileset IIRC.

It's a を (wo, pronounced "o"), which indicates the object of a sentence, as far as my Japanese is concerned.

goldenbrand wrote
Will you be doing more SG-1000 games in the future? At one point, I had a list going of the untranslated games:

Champion Kendou
Mahjong
Okamoto Ayako no Match Play Golf
Loretta no Shouzou: Sherlock Holmes (or is this Mark III-only?)
San-Nin Mahjong
Seriwaza...Shogi
Shinnyushain Toru Kun [aka Mikie]
Uranai Angel Cutie

No idea if that's complete, and some might be arguably unnecessary, but there it is.

Not sure. Once way back I made a German translation of Hang-On II (even a Finnish one, with a friend of mine doing all the translation work and me simply implementing it), but both got lost. Making it anew shouldn't be difficult, though. At that time I was also thinking of translating Zippy Race, but I had problems finding spaces for the umlauts to go into, so I ditched it. Doesn't mean I wouldn't pick it up again, though.
  View user's profile Send private message
  • Joined: 24 May 2010
  • Posts: 120
  • Location: New York
Reply with quote
Post Posted: Tue Dec 18, 2012 5:05 am
mk1995 wrote
It's a を (wo, pronounced "o"), which indicates the object of a sentence, as far as my Japanese is concerned.


Ah, of course! I think that crossed my mind, and had it been in order I probably would've figured it out, but on its own I had a hard time seeing it as を.
  View user's profile Send private message
  • Joined: 11 Jan 2009
  • Posts: 116
  • Location: Germany
Reply with quote
Post Posted: Wed Dec 19, 2012 6:56 pm
I just tried out Loretta no Shôzô, and despite barely having made any progress (since I suck at adventure games and it's all in Japanese to boot), I'm genuinely interested in taking part in its English translation. I've already made a first draft of what the English title logo could look like (see attachment below).

However, with 64 tiles, it's probably too large, so I might have to cut out the "--Sherlock Holmes--" bit (which I got from the Japanese box art, where it reads "ロレッタの肖像 ―Sherlock Holmes―". If anyone's interested, the font used is called Andalus.

Edit: Yeah, seems like I shouldn't use more than 59 unique tiles. Hold on, gonna do a second draft.

Edit 2: Second draft (see other attachment). This time I think the edit will fit into the space limit.
loretta.png (2 KB)
loretta.png
loretta2.png (1.49 KB)
loretta2.png

  View user's profile Send private message
  • Joined: 06 Apr 2009
  • Posts: 199
Reply with quote
Post Posted: Fri Dec 21, 2012 4:24 pm
mk1995 wrote
Maxim wrote
The pixel alignment is just because there's no need to align data in Sega roms. There are keypresses to fix that in TLP.

There are? How d'you do that?


In Tile Layer Pro for fine control, hold Ctrl and use the cursor keys. For this rom Ctrl + Left twice seemed to do the trick.
  View user's profile Send private message Visit poster's website
Reply to topic



Back to the top of this page

Back to SMS Power!