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 - Dragon Crystal Exploration and Disassembly

Reply to topic
Author Message
  • Joined: 04 Sep 2014
  • Posts: 37
Reply with quote
Dragon Crystal Exploration and Disassembly
Post Posted: Tue Sep 23, 2014 9:57 pm
Hello everyone,

I have begun a disassembly of Dragon Crystal for SMS as a project to become more familiar with z80 assembly and the workings of older games. I hope to eventually be able to hack the game enough to produce some interesting variations on gameplay, but right now I'm just getting a feel for z80 and the structure of the game. I'd like to move onto the Game Gear version eventually as well.

I am keeping notes on the game on the development page here with memory and text locations, and I have checked my disassembly into Github here under my username. The disassembly reassembles with WLA DX (thanks to Calindro for help getting this working!) A very helpful resource has been Dammit9x's Dragon Crystal Shrine on RPGClassics (also linked from development page), which has a wealth of information on items and monsters laid out in a very helpful manner.

Notes and curiosities so far:

- The game uses the exact same random number generator function as the one given for Phantasy Star in the Code Snippets section.

- In the Game Gear version, holding down Start makes the player move faster (and increases the speed of animations and possibly other things). In the SMS version, pressing the Pause button toggles the game speed between "slow" and "fast"- the default is fast. The manual for the SMS version notes this (online version available on The Sega Notebook page), but the knowledge doesn't seem to have been as widely documented as the Game Gear's "hold start" trick.

- The messages in both Game Gear and SMS versions seem to come from the same source, but are translated differently- see the Dragon Crystal Shrine (linked on development page) for examples:

“I blew the enemy away!” vs “The monster is blown away!”
“The enemy transformed!” vs “The enemy mutates!”
“We've swapped our hit points!” vs “You've swapped hit points!”
"I can move faster!" vs "Your speed improves!"

The Game Gear version is consistent with a first-person point of view in its messages (eg it's always "I do whatever"), but the SMS version varies between first and second person ("You do whatever"). This makes me believe that there was, at some point, a Japanese original of the SMS Dragon Crystal that was translated independently, although no version seems to have been released in that region.

- The game over/player death messages contain the text "I KILLED MYSELF"- has anyone seen this occur in actual gameplay? It's distinctive from the starvation message ("I STARVED TO DEATH"), and I know of no other situation involving self-inflicted damage- poison does not kill the player, it just prevents healing, and there's a rod that will swap the player's hit points with a monster, but no other items do direct self-inflicted damage.

- It appears the game is checking for particular input during startup:

   in a, ($DC)                         ; Read controller 1 input
   cpl                                 ; Invert so 1 means button pressed
   and $3F                             ; %00111111 Ignore bits used for Player 2 controller up and down input- not useful
   cp $05                              ; %00000101 Up and left pressed together? Cheat?
   jp nz, _LABEL_111_                  ; If not, go here
   ld a, $01                           ; If pressed, set $C0D6 to $01
   ld ($C0D6), a
   jp _LABEL_111_

I just found this yesterday evening, and haven't had time to follow it all out, but it appears to change something during the game setup process- I couldn't get anything to change when I tried it once last night. Do I have the code figured correctly there- is that up and left button pressed together?

- I keep seeing a cheat around (eg in a FAQ by "BCole" on GameFAQs) that if you press Start continuously while the game is starting up, you will end up in a room with lots of items and armor, but I see nothing to support that- the FAQ has it as "Game Gear version only," so it could be that's the case, but the "if it doesn't work, keep trying" caveat makes me think it's just trying to luck out with the random generation of the room, and the start button doesn't matter at all.

- A page of Action Replay codes for the SMS version (linked on Dev page) gives a code 00C0-1AXX, "World Modifier." My attempts to play with this code with various values (using the PAR support in Kega Fusion, as I don't own an Action Replay) and manually change the value with a memory editor during gameplay have met with no results, and I don't see this variable referenced doing anything interesting in the disassembly.

My best guess at this point is that Dammit9x's hacking guide in the Dragon Crystal shrine gives $C01A as the Floor location on Game Gear, so perhaps this code listing is confused between versions?

More as I come across it.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14687
  • Location: London
Reply with quote
Post Posted: Wed Sep 24, 2014 8:30 am
Moved to Development forum.

The Game Gear version also has completely different music. I guess there was somehow different development for the two - I wonder if the code is shared?

For the cheat, search for the memory address in a disassembly and see what happens after it's accessed. You can also try using a breakpoint in an emulator.
  View user's profile Send private message Visit poster's website
  • Joined: 04 Sep 2014
  • Posts: 37
Reply with quote
Post Posted: Wed Sep 24, 2014 4:46 pm
Thanks for moving this to the correct place, Maxim. There are no direct references to that address in the disassembly (or to the adjacent addresses, so I don't think it's part of a 16-bit variable), but that doesn't rule out it being accessed indirectly. I've not had any luck with the breakpoints, but I'll keep trying- perhaps I just haven't set it at the right point yet.

There are numerous graphical differences (different monsters, and the one-use magical items are scrolls in the GG version and books in the SMS version) between the two versions as well, though the behavior of the underlying objects/monsters is the same.

There is also quite a bit of similarity with Fatal Labyrinth on the Genesis/Mega Drive in design, but Fatal Labyrinth has no dragon following the player (which means it is possible to be attacked from behind) and more weapons- in addition to swords there are axes, which do more damage with less accuracy, spears, which do less damage with more accuracy, and shuriken, which have very low attack when equipped but do more damage when thrown.

There are also bows, which are their own item class, and several differences in the gameplay- there's a town where you can go around and talk to people before you enter the labyrinth, the labyrinth has pits where you can drop down to a previous floor, and you can continue after the fifth floor, but return to the fifth floor when you continue. You can also kill the character by acquiring too much food (over 99) in Fatal Labyrinth, and become sluggish after above 80 food, where Dragon Crystal just caps you out at 99 food and discards extras with no ill effect.

Dragon Crystal seems to be considered the "sequel" to Fatal Labyrinth by many people, but GG Dragon Crystal seems to be the first released- its box is dated 1990, and various sources online show a late December release date. (SMS Dragon Crystal and Fatal Labyrinth are both copyrighted 1991, but I can't find enough information to tell which came first.)

I have a feeling that Fatal Labyrinth's very monotonous graphics lead people to think it's a much earlier game, but I believe that this was instead intentional to keep the file size down due to the game being distributed as a download through Sega Game Toshokan in Japan. It seems most likely to me that all three games were in development concurrently, but I think it's ambiguous if Fatal Labyrinth's additional features are great ideas that came too late to make it into Dragon Crystal or if Dragon Crystal was a refinement of the ideas in Fatal Labyrinth- going by how fun the games are to play, I would be inclined to say the latter, unnecessary weapon complexity thrown out and the dragon added to make it harder for the player to get surrounded and overwhelmed.

Looking at the credits, only the composer, E. Fugu, is credited in both Dragon Crystal versions and Fatal Labyrinth, at least by the same name:

Dragon Crystal Game Gear Credits:

Graphic: Tamun, Manabu, Fudo
Program: Totoyo, Kim.P
Sound: E.Fugu
Coordinate: Pata, Totoyo
Special Thanks: Asohy, Tomozou, The Hase, LLG

Dragon Crystal Master System Credits:

Graphic: Gaga
Program: XYZ
Sound: E.Fugu
Coordinate: Gaga
Special Thanks: Waka

Fatal Labyrinth Credits:

Planner: Carol
Programmer: Mr. Lee, Papa
Designer: Big Island, Azarashi, Sato (Tokumei)
Music & Sound Composer: E Fugu
Thanks to: Large Torrent, Hou-Ou
Sega 1991

There almost certainly has to be a lot of shared code, because the games play so similarly and because the RAM locations for most data are the same between the GG and SMS versions- the CloneSpy analysis you posted in the Spellcaster/Kenseiden thread in Main shows only a 72% similarity between GG Dragon Crystal JP and English, and ~50% similarity between GG Dragon Crystal and the SMS version, though.

I do know for sure there are differences in the code- the text in the GG Dragon Crystal seems to be compressed somehow, as I could not find it through relative search, while I was able to easily locate the text in the SMS Dragon Crystal.
  View user's profile Send private message Visit poster's website
  • Joined: 04 Sep 2014
  • Posts: 37
Reply with quote
Post Posted: Thu Oct 02, 2014 4:55 am


I've extracted item names into human-readable text in the repository with WLA-DX's .asciitable and .asc, so you can now edit item names (swords, armor, and both identified and unidentified scrolls, rods, potions, and rings) to your heart's content.

Item names are fifteen characters wide, prefixed with a length byte and padded out with spaces (with the exceptions of GHOST KILLER and VIOLET RING, which are padded to sixteen characters).

The above screenshot changes
.db $04
.asc "ROBE          "

to

.db $0E
.asc "LACONIAN ARMOR"

Remember, if you change the item name, you must update the preceding length byte as well.

I've already located most of the rest of the text, so I'll probably extract character levels, monster names, and the in-game messages next.

My next priority after the text will probably be picking the low-hanging fruit of some of the game logic, now that I have the variables defined- much of the status effect stuff seems pretty straightforward, for example. I've also started defining a lot of the known variables, like character and game statistics, and reorganized the code a little bit to separate out defines and some large (several hundred lines) blocks of unrolled loops, so I'll continue that kind of thing as well.

I have also been looking into the sound driver- I believe it is a version of SMPS, after comparing my codebase with a disassembly of Sonic 2 for SMS and finding large sections that are pretty much the same line by line. I believe that the Game Gear version of Dragon Crystal is also SMPS because it seems to share the same music layout in RAM, so far as I can tell. (For what it's worth, Fatal Labyrinth seems to use SMPS-z80.)

Can anybody point me to any documentation specifically about the Master System version of SMPS? Almost all of what I've found has been pretty much Mega-Drive-centric. I assume some things like headers and the like are pretty similar cross-platform?

jmimu has kindly pointed me to Master Tile Converter, which I have not used in any depth yet, but it appears that some of the tiles are uncompressed (eg the font) and some use Phantasy Star RLE compression, so that's a start there.

More updates as I have more to report.
oie_2163846etAvBrK4.png (2.56 KB)
Attachment fairy
oie_2163846etAvBrK4.png

  View user's profile Send private message Visit poster's website
  • Joined: 08 Dec 2013
  • Posts: 200
Reply with quote
Post Posted: Thu Oct 02, 2014 1:34 pm
Superlative work. This is a very interesting game, I never knew such a thing existed on the SMS.
  View user's profile Send private message Visit poster's website
  • Joined: 04 Sep 2014
  • Posts: 37
Reply with quote
Post Posted: Thu Oct 02, 2014 1:57 pm


I do believe that's the map data!

Kroc wrote
Superlative work. This is a very interesting game, I never knew such a thing existed on the SMS.


Thank you! This game is a lot of fun- the SMS version was only released in Europe and doesn't seem too rare, but the Game Gear version seems common in at least the US, Europe, and Japan.
oie_21639259YEilNcK.png (96.28 KB)
Attachment fairy
oie_21639259YEilNcK.png

  View user's profile Send private message Visit poster's website
  • Joined: 25 Feb 2006
  • Posts: 863
  • Location: Belo Horizonte, MG, Brazil
Reply with quote
Post Posted: Thu Oct 02, 2014 9:54 pm
Great job, so far! ;)

trykaar wrote

Thank you! This game is a lot of fun- the SMS version was only released in Europe and doesn't seem too rare, but the Game Gear version seems common in at least the US, Europe, and Japan.


Actually, the SMS version was released in Brazil, too: http://www.sega-brasil.com.br/Tectoy/index.php?title=Dragon_Crystal
  View user's profile Send private message Visit poster's website
  • Joined: 04 Sep 2014
  • Posts: 37
Reply with quote
Post Posted: Thu Oct 02, 2014 11:13 pm
haroldoop wrote
Actually, the SMS version was released in Brazil, too: http://www.sega-brasil.com.br/Tectoy/index.php?title=Dragon_Crystal

You must have read my mind- I was actually going to post asking about that later today! The release data here on SMS Power! says EU only, but had a Tectoy box too- I found on Sega 8-Bit's release data page that there was a Brazil version, but it had no model number so I was really wondering if it actually existed or not- thanks for the info! I wonder when it came out?

I've been using the highly scientific method of browsing through magazine scans looking at the mail order sellers' inventory to see when the games seem to have come out; it appears that the Game Gear version came before the Master System version in the UK as well. The Game Gear version first appears in inventories in the June issue of Mean Machines, and the Master System version not until October. (Scans here: https://archive.org/details/meanmachines) So, tentatively May-June and September-October for each version? I'm not sure how early magazines run in the UK.

I've come across a few reviews of the Game Gear version as well:

Games-X 5 UK, May 1991: http://amr.abime.net/review_15341

This review mentions NPCs you could talk to showing up in the game:
Quote
As you wander around you will enter clearings or natural 'rooms'. Here you will see a character to chat to or money, weapons, etc to pick up.

Quote
A push of a button takes you to your inventory screen. Here you can see what items you have. In addition, along the top of the screen there are a number of icons (sword, ring, talk, etc) that you can choose.

The reviewer seems quite thoroughly baffled by the idea that you pick up items and then must select them from your inventory to use them, though.

Considering the Japanese version of the game has a release date of December 1990, it's hard to believe this would have been any kind of a beta version of the game- perhaps the reviewer was confused? A menu for a talk command seems like an odd choice when interaction with monsters is just walk up to them and push into them, and interaction with objects is just "push button to pick up."

Fatal Labyrinth does have a town in the beginning, though, so the idea is not too far-fetched. The concept of random NPCs reminds me quite a bit of the first random-dungeon game I played, Dragon Warrior Monsters on the Ni****do Gameboy Color, which had healers, merchants, and others randomly appear in dungeons.

Sega Visions Volume 1 Issue 5, June 1991, USA

This review is posted here on the site already.

Dragon Magazine USA, Issue 175 November 1991 (p 59-60): http://www.annarchive.com/files/Drmg175.pdf

Nothing about NPCs here- pretty typical summary of the game.

Bonus, Japanese Dragon Crystal commercial:
  View user's profile Send private message Visit poster's website
  • Joined: 01 May 2011
  • Posts: 467
Reply with quote
Post Posted: Fri Oct 03, 2014 8:21 pm
trykaar wrote

I've been using the highly scientific method of browsing through magazine scans looking at the mail order sellers' inventory to see when the games seem to have come out; it appears that the Game Gear version came before the Master System version in the UK as well. The Game Gear version first appears in inventories in the June issue of Mean Machines, and the Master System version not until October. (Scans here: https://archive.org/details/meanmachines) So, tentatively May-June and September-October for each version? I'm not sure how early magazines run in the UK.

I've come across a few reviews of the Game Gear version as well:

Games-X 5 UK, May 1991: http://amr.abime.net/review_15341

This review mentions NPCs you could talk to showing up in the game:
Quote
As you wander around you will enter clearings or natural 'rooms'. Here you will see a character to chat to or money, weapons, etc to pick up.

Quote
A push of a button takes you to your inventory screen. Here you can see what items you have. In addition, along the top of the screen there are a number of icons (sword, ring, talk, etc) that you can choose.

The reviewer seems quite thoroughly baffled by the idea that you pick up items and then must select them from your inventory to use them, though.

Considering the Japanese version of the game has a release date of December 1990, it's hard to believe this would have been any kind of a beta version of the game- perhaps the reviewer was confused? A menu for a talk command seems like an odd choice when interaction with monsters is just walk up to them and push into them, and interaction with objects is just "push button to pick up."


I think that Games-X review is of the Japanese import version (they give the supplier as a well known importer). This is an issue with all Game Gear games at that time, UK magazines reviewed whichever version came out first, which was often the Japanese version.

UK magazines were dated a month or two ahead of their actual publish date (so newagents didn't return them too early, most magazines were sold on a "sell or return" basis).

Anyway, you're correct that the Game Gear version released first, and was then ported to SMS for the European market. Strangely I have every single UK magazine which covered SMS from around this time, and not a single one reviewed it. French magazines did though;

Joystick Dec 91

Player One Dec 91

Console+ Feb 1992 1/2/3

So SMS version seems to have been released about a year after the (Japanese) GG version.
  View user's profile Send private message
  • Joined: 01 May 2011
  • Posts: 467
Reply with quote
Post Posted: Fri Oct 03, 2014 8:53 pm
Oh, I've just remembered, Game Gear released in UK on June 24, 1991 (it had been delayed several times). Dragon Crystal was a launch title for it. So yeah, Games-X review was of an import version, but it was the only weekly games magazine in the UK at the time, so the date on the cover was the actual publish date as opposed to the 1-2 month post-date on the monthly magazines.
  View user's profile Send private message
  • Joined: 04 Sep 2014
  • Posts: 37
Reply with quote
Post Posted: Fri Oct 03, 2014 11:48 pm
Ah, thanks so much BKK! Those must be prototype screenshots in those first two reviews- the HUD is different, it displays both HP and food!

I did notice that none of the Game Gear reviews mentioned the Master System version, which I thought they would have if it had come out earlier too. SMS Power! lists a very short snippet review in an unspecified article of Sega Pro magazine, but nothing else for the game. Very interesting that it was a Game Gear launch title- that must be why it received more attention.

Aha, look at this ad: https://archive.org/stream/Sega_Visions_Volume_01_Issue_04_1991-04_Sega_US#page/... It appears Dragon Crystal was either a launch title or a very early release in the US as well!

Hmm, Sega Retro lists the ones you have, but it also lists more reviews that I've yet found for the Game Gear version and lists reviews for Fatal Labyrinth.

Going by the issue numbers, it appears I can tentatively date the release order as Dragon Crystal GG, Fatal Labyrinth, then Dragon Crystal SMS. This is confounded by the fact that at least some of the magazines are reviewing imports, but Dragon Crystal SMS appears in both Joystick and Player One later than Fatal Labyrinth, and Dragon Crystal GG appears in Games-X, Joystick, and Sega Pro earlier than Fatal Labyrinth (only a week earlier in the case of Games-X!). That doesn't unfortunately help with the development order, but it's something to work with.

However, Fatal Labyrinth has an article in the same volume of Sega Visions as the Dragon Crystal ad that seems to point to DCGG being a launch title, so the US release of the two must have been very close together. I find it interesting that absolutely nothing seems to remark on the similarity between the two games so far.

Dragon Crystal GG:
ACE №47, p73
Games-X №5
Joystick №13, p101
Raze №11, p48
Sega Power №23, p61
Sega Pro №2, p45

Fatal Labyrinth:
Games-X №6
Joystick №16, p169
Mega Drive Advanced Gaming №5, p91
Mega №9, p20
MegaTech №1, p77
Player One №12, p77
Sega Power №19, p26/27
Sega Power №23, p53
Sega Power №25, p45
Sega Pro №18, p65

Dragon Crystal SMS:
Consoles + №6, p92/93/94
Joystick №22, p125
Player One №15, p94

According to Sega Retro, Sega Power's score for Fatal Labyrinth is 55, 40, and then 39 across its three mentions- perhaps they liked it less as they went on!

In disassembly news, I've extracted the 32 16x16 map chunks that are used to generate the level. I believe I've found where these are in RAM, but am still investigating that- there's a section of RAM where the low nybbles seem to be the same codes as I identified in the last post, but the high nybble is 8- I suspect this may relate to the map being uncovered, but need to look into it more.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8644
  • Location: Paris, France
Reply with quote
Post Posted: Sat Oct 04, 2014 9:54 am
The ROM chip for the games generally include production date which may be of help.

e.g the type of information that's here (but unfortunately not recorded for Dragon Crystal)
http://www.smspower.org/Development/ROMPartNumbers
  View user's profile Send private message Visit poster's website
  • Joined: 04 Sep 2014
  • Posts: 37
Reply with quote
Post Posted: Tue Oct 07, 2014 2:11 pm
Bock wrote
The ROM chip for the games generally include production date which may be of help.

e.g the type of information that's here (but unfortunately not recorded for Dragon Crystal)
http://www.smspower.org/Development/ROMPartNumbers


Once I get my hands on a physical copy of Dragon Crystal SMS I'll have to check then- I've been doing research into the Japanese version of Fatal Labyrinth, Shi no Meikyuu, and it appears that may have come first- it's actually radically different from Fatal Labyrinth, and it has a date in the rom header of October 1989. (The credits have a 1990 date, though.)

I am starting on an editor for Dragon Crystal in JRuby:



So far, I am able to display map blocks, but eventually they will be editable. Ignore the ugly colors, they are only temporary!

Other than that, more text extracted, and ValleyBell has kindly confirmed that the sound engine is not SMPS, but pre-SMPS.[/img]
jrea3a.png (13.79 KB)
Attachment fairy
jrea3a.png

  View user's profile Send private message Visit poster's website
  • Joined: 05 Jun 2010
  • Posts: 757
  • Location: Pennsylvania, USA
Reply with quote
Post Posted: Tue Oct 07, 2014 3:34 pm
This is a really cool project and you've alerted me of an SMS game I haven't checked out (I'm from the US and I was not into GameGear all that much). Great progress!
  View user's profile Send private message Visit poster's website
  • Joined: 04 Sep 2014
  • Posts: 37
Reply with quote
Post Posted: Mon Oct 13, 2014 8:05 pm
Hello everyone,

It's been a little while, but I have some updates.

ValleyBell has given me a disassembly of the sound driver that includes a ton of information about functions and data structures, so I have been porting all of this from the IDA disassembly format into my WLA DX disassembly. The function names are over, and so are most of the data tables- there is still a big blob of the actual sound tracks, though, which I've left as a .bin for now. I'm still deciding how best to organize that, I'll probably finish that up before moving on to the next area.

I'm starting to look at the graphics data. I've found a number of the graphics stored with Phantasy Star RLE compression using jmimu's Master Tile Converter, and I believe I've found the decompression routine here- it looks very similar to the decompression algorithm sample that comes with BMP2Tile at least.

I've done a little more with my map viewer as well, and extracted the map data from the Game Gear version. Here are both versions' map data side by side- SMS is on the top, and Game Gear on the bottom:



The Game Gear version is off by one row, and there are also more subtle differences between them. ICEKnight on pointed out on SonicRetro that there are many minor off-by-one differences on the markers that seem to join the corridors to the rooms too.

I'm not entirely sure what all of the markers are used for. Obviously the white is for corridors, dark teal for walls, and light teal for room space, but the green (which really needs more contrast with the room space!), orange, and gold are still up in the air. There are room functions that I believe must be associated with them- placement of the portal to the next level, hidden doors (which may only be to the left or right in this game, unlike Fatal Labyrinth), possibly boundaries that prevent some monsters from leaving the room, possibly the placement of items within the room. I had suspected the gold marks to be the next level portals based on the way they "hang out" of the rooms (the portal replaces a wall tile), but that doesn't explain their occurrence in the corridors.

(In related news, I have set up a thread for this project at Sonic Retro too.)

I have a little bit of text still to work out. Most of the remaining text- character classes/levels, the credits, the ending screen message, and the menus- appears to be in a slightly different format. It uses the table, but each character is padded with an $11, eg:

.db $59 $11 $68 $11 $68 $11 $6A $11 $5D $11 $66 $11 $6C $11 $61 $11 $5B $11


"A P P R E N T I C E"

Does anyone know the significance of the $11s? They do not display on the screen.

I've also done more research into Fatal Labyrinth, and the games diverge more than I would have thought. Playing it more, I suspect it uses an algorithm like this to generate rooms rather than map data- that would make more sense anyways as it would keep the download size down more than using map chunks like Dragon Crystal does.

I've discovered that there are in fact at least three versions of Fatal Labyrinth in existence too: the original downloadable Shi no Meikyuu, the version released overseas as Fatal Labyrinth (which has significant changes, like a real title screen and the town in the beginning), and the revised Fatal Labyrinth as released in the Game Kanzume collection of Sega Game Library games for Sega CD in 1994- this version has very nice CD audio versions of the opening and ending themes, but no music in-game!

Check out this video of Shi no Meikyuu. No village or skeleton dragon title screen, but we have a nice scrolling text prologue- here's a rough translation.

Quote
In a world of darkness, it is said that the holy goblet that gives light to the world lays sleeping in a certain labyrinth of death. Those who enter the labyrinth, seeking the light, never again return to the world outside. And thus today, another youth ascended the stairs of the labyrinth...


The game goes directly into the labyrinth when you press start, though the video doesn't show it.

So... Shi no Meikyuu is dated 1990 in its credits, but was part of the Sega Game Toshokan service which did not debut until an unspecified time in 1991. I suspect that Shi no Meikyuu came first, or was contemporaneous with Dragon Crystal GG, but they had different programming teams, as the credits suggest. Fatal Labyrinth's enhanced version probably came next, as I believe that was released Spring-Summer of 1991, and Dragon Crystal SMS last, in Summer-Fall of 1991. The Game Kanzume version came out much later, in 1994.

Perhaps most interestingly, though, is that there was a Japan-mobile-only sequel to Dragon Crystal, Dragon Crystal II. You can see screenshots and be disappointed along with me about its lack of release outside Japan here.

Sound, graphics, map, text, research... I think that's about all I've got for now. Onward!

Maraakate wrote
This is a really cool project and you've alerted me of an SMS game I haven't checked out (I'm from the US and I was not into GameGear all that much). Great progress!


Thanks! The game is worth a play, definitely.
flamebar2.png (42.79 KB)
flamebar2.png

  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14687
  • Location: London
Reply with quote
Post Posted: Mon Oct 13, 2014 10:08 pm
The text is stored as 16 bit tilemap entries, in little endian format, so $59 $11 is actually $1159. That selects tile $159 and sets the priority bit so it overlays sprites.
  View user's profile Send private message Visit poster's website
  • Joined: 04 Sep 2014
  • Posts: 37
Reply with quote
Post Posted: Mon Oct 13, 2014 11:43 pm
Last edited by trykaar on Mon Oct 20, 2014 3:53 pm; edited 1 time in total
One mystery is solved: the "I killed myself" message is used in the game, if the player is killed by recoil from using the Death Blade, a powerful sword which sometimes does damage back to the player.

I discovered this on a Japanese website about the game here. In the Japanese version, this sword is the "Harakiri blade" and the death message is "Defeated by committing seppuku."

Maxim wrote
The text is stored as 16 bit tilemap entries, in little endian format, so $59 $11 is actually $1159. That selects tile $159 and sets the priority bit so it overlays sprites.


I see- this makes sense, thank you Maxim! The Game Gear version stores all of its text this way, but the SMS version stores a lot without this- it seems like there must be a function that expands the text and "adds in" the tile selection and bitmask pieces... Ah, it looks like this might be the thing.

I've been looking into options with WLA DX to represent text data stored like this with .asciitable/.asc so it will be human-readable, but I'm not sure it's possible to do that and keep the $11s where they should be, short of the kludge of defining a character for $11 in the table, which loses all meaning from it... Possibly I could use some kind of macro or filter to inject them?

Edit: fixed link to possible text decompression routine
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14687
  • Location: London
Reply with quote
Post Posted: Tue Oct 14, 2014 7:30 am
WLA DX isn't very flexible in this respect, I don't know of a way to get 16-bit data from a string.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 08 Jul 2001
  • Posts: 8644
  • Location: Paris, France
Reply with quote
Post Posted: Tue Oct 14, 2014 7:45 am
I'd just write a little script given a block of $ byte constants that output the text so you can add it manually as comment.
Additionally you can find the text within the ROM easily if you look for patterns of $11.
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14687
  • Location: London
Reply with quote
Post Posted: Tue Oct 14, 2014 10:00 am
Yes, for a disassembly you don't need it to be so dynamic - but if you were hoping to make it possible to edit the text and compile to a working ROM, it will require a custom tool.
  View user's profile Send private message Visit poster's website
  • Joined: 24 May 2010
  • Posts: 127
  • Location: New York
Reply with quote
Post Posted: Tue Oct 14, 2014 10:24 pm
trykaar wrote
One mystery is solved: the "I killed myself" message is used in the game, if the player is killed by recoil from using the Death Blade, a powerful sword which sometimes does damage back to the player.

I discovered this on a Japanese website about the game here. In the Japanese version, this sword is the "Harakiri blade" and the death message is "Defeated by committing seppuku."


Heh, that's kind of funny. "One for you, one for me, one for you, one for me...oops, I guess that's one too many for me..."
  View user's profile Send private message
  • Joined: 17 Sep 2013
  • Posts: 140
  • Location: TC, MI
Reply with quote
Post Posted: Tue Oct 14, 2014 10:36 pm
trykaar wrote
One mystery is solved: the "I killed myself" message is used in the game, if the player is killed by recoil from using the Death Blade, a powerful sword which sometimes does damage back to the player.

I discovered this on a Japanese website about the game here. In the Japanese version, this sword is the "Harakiri blade" and the death message is "Defeated by committing seppuku."


Hahah, thats terrible. Not surprised they took out the cultural references.
  View user's profile Send private message Visit poster's website
  • Joined: 08 Dec 2005
  • Posts: 488
  • Location: Melbourne, Australia
Reply with quote
Post Posted: Wed Oct 15, 2014 1:11 am
trykaar wrote
I'm starting to look at the graphics data. I've found a number of the graphics stored with Phantasy Star RLE compression using jmimu's Master Tile Converter, and I believe I've found the decompression routine here- it looks very similar to the decompression algorithm sample that comes with BMP2Tile at least.

Your link is to _LABEL_7AA_ - this is indeed the core of the decompression routine, but note that it starts at _LABEL_793_. Each piece of compressed data begins with a single byte giving the number of data blocks to decompress and interleave.

There is another decompression routine at _LABEL_7D3_ (core at _LABEL_7EA_) which is very similar but which writes to memory rather than to the VDP.

It looks as though Master Tile Converter only finds compressed data which is deinterleaved into 4 blocks. It should be possible to find more (all of?) the compressed data by searching the disassembly for _LABEL_793_ and _LABEL_7D3_.
  View user's profile Send private message Visit poster's website
  • Joined: 04 Sep 2014
  • Posts: 37
Reply with quote
Post Posted: Wed Oct 15, 2014 10:13 pm
Thanks Bock and Maxim! I ended up just splitting them into .dw blocks with comments for what the text is- if I decide to have them editable, I'll write a tool for it later on. I think I'm getting close on the text, I thought I'd gotten all of it, but I suspect there's more in my unparsed data blocks- I don't have the credits yet, for one, though I've seen them in there.

The Harakiri blade actually isn't the only thing that was changed- I've been going through the item names. (I've set up a Google Site here to track things, but there's not a lot to it yet.)

Masamune in the Japanese version was Zantetsuken, the iron-cutting sword- this is after Goemon from Lupin III, and evidently Zantetsuken can cut anything (cars, planes, helicopters...) except konnyaku jelly- thus Dragon Crystal's Zantetsuken is pretty powerful, but no good against slimes/oozes.

Another sword was the Laconian Sword, from Phantasy Star, and another was Excalibur (which one would think would be an obviously understandable cultural reference for Western audiences?). Excalibur made it into Fatal Labyrinth, but the others did not make it there either.

Paul Baker wrote
Your link is to _LABEL_7AA_ - this is indeed the core of the decompression routine, but note that it starts at _LABEL_793_. Each piece of compressed data begins with a single byte giving the number of data blocks to decompress and interleave.

There is another decompression routine at _LABEL_7D3_ (core at _LABEL_7EA_) which is very similar but which writes to memory rather than to the VDP.

It looks as though Master Tile Converter only finds compressed data which is deinterleaved into 4 blocks. It should be possible to find more (all of?) the compressed data by searching the disassembly for _LABEL_793_ and _LABEL_7D3_.


Thanks! I did notice that the first routine started earlier at _LABEL_793_, but I had no idea about _LABEL_7D3_- I'll look into it!
  View user's profile Send private message Visit poster's website
  • Joined: 04 Sep 2014
  • Posts: 37
Reply with quote
Post Posted: Tue Oct 21, 2014 4:37 am
Nothing terribly exciting to report yet on the disassembly front- lots of tidying up, mostly. I've extracted a little more text and shuffled it around a bit, converted the pointer tables for item names, monster names, and game messages to use labels instead of absolute addresses, and disassembled some more code that had been left as data.

I've also been playing with the graphics- here's a palette alteration I hex edited in for the flower field tileset, with the ooze enemy replaced with the slime enemy from the Game Gear version also- both versions of the game use the same Phantasy Star RLE compression, so I was able to extract the data from one game and reinsert to the other with Master Tile Converter. This is just the enemy dropped right in- no palette changes were necessary on the sprites.



Alas, the reverse does not work quite so easily, as ooze's tiles take up more space than slime's tiles- the graphics became corrupted in the Game Gear version.

More updates, of course, as I have them...
proof-of-concept.png (42.07 KB)
proof-of-concept.png

  View user's profile Send private message Visit poster's website
  • Joined: 04 Sep 2014
  • Posts: 37
Reply with quote
Post Posted: Sun Oct 26, 2014 11:22 pm
Major progress, everyone!

I've located the statistics for weapons and armor and the logic for the scroll, rod, potion, and ring items! (Special effects of weapons, armor, and rings seem to be handled at the place they affect behavior, though, so for the rings most of the behavior is just displaying the correct message when the ring is equipped, and only armor statistics are here so far.)

This makes it very easy to edit items in the game to swap their behavior with other items or change weapon/armor statistics! I've added a "proof of concept" IPS patch with the following changes:

- The Leathersuit armor has been replaced with the "Ghost Mantle," which offers no defense bonus but a large bonus to evasion
- The typo "You dodger the attack!" has been corrected to "You dodge the attack!"
- The Minheal potion has been replaced with the "Boom Potion," which behaves as the thunder rod, damaging enemies in the room with you
- The slime enemy has been imported from the Game Gear version- different graphics and name changed to "Slime" instead of "Ooze" (I did not alter the higher level Ooze enemies' names, but their graphics should also have changed)
- New, less eye-searing palette for the flower field level, with yellow flowers instead of blue

The weapon and armor statistics are very simple tables that list the hit and power of each weapon and the evasion and armor class of each piece of armor. Just adjust the stats here, edit the name if you so wish in items/names, compile, and go!

To create the Ghost Mantle:

In items/behavior/armor_statistics.asm, simply change

.db $08 $02      ; Leathersuit

to

.db $20 $00      ; Leathersuit


and edit the name in items/names/armor.asm like so

LightArmorName2:
   .db $0B
   .asc "LEATHERSUIT   "

to

LightArmorName2:
   .db $0C
   .asc "GHOST MANTLE  "


(Note the change to the initial byte for length!)

The item behavior takes a little more explanation- the IDs of items as stored in your inventory in RAM are offsets into a table of item behavior for each item, and the item behaviors in this table for each item are themselves offsets into a jump table to select the right routine for each item.

Breaking it down a little...

These items are stored in the player's inventory in the following locations in memory:

$C910-$C917    Scrolls
$C918-$C91F    Rods
$C920-$C927    Potions
$C928-$C92F    Rings

Each item has an ID in the following range:

$20-$2F   Scrolls
$30-3F    Rods
$40-4F    Potions
$50-5F    Rings

For example, here are the scrolls:

$20    Blade Scroll
$21    Shield Scroll
$22    Norust Scroll
$23    Bless Scroll
$24    Map Scroll
$25    Shift Scroll
$26    Mad Scroll
$27    Magi Scroll
$28    Gas Scroll
$29    Ghost Scroll
$2A    Dragon Scroll
$2B    Summon Scroll
$2C    Blank Scroll
$2D    Potion Scroll
$2E    Unused
$2F    Unused

If you edit memory to place $20 into the location $C910, you will have a Blade Scroll in your first scroll inventory slot.

When you go to use a scroll, the game stores the item ID in $C931, the current item slot, and uses the item IDs (minus $20, as weapons occupy the range $00-0F and armor occupies the range $10-1F in IDs) as offsets into a behavior table:

; Scrolls
.db $00 ; Blade Scroll
.db $01 ; Shield Scroll
.db $02 ; Norust Scroll
.db $03 ; Bless Scroll
.db $05 ; Map Scroll
.db $06 ; Shift Scroll
.db $07 ; Mad Scroll
.db $0A ; Magi Scroll
.db $0B ; Gas Scroll
.db $0C ; Ghost Scroll
.db $0D ; Dragon Scroll
.db $09 ; Summon Scroll
.db $0E ; Blank Scroll
.db $30 ; Potion Scroll
.db $FF
.db $FF

These values are actually offsets into the jump table that governs item behavior, which I've labeled "ItemActionTable." It looks like this:

ItemActionTable:
   .dw BladeScrollAction     ShieldScrollAction   NorustScrollAction   BlessScrollAction
   .dw NothingHappenedAction MapScrollAction      ShiftScrollAction    MadScrollAction
   .dw FreezePotionAction    SummonScrollAction   MagiScrollAction     GasScrollAction
...

So, let's go through acquiring and using a Map Scroll:

1. Map Scroll is picked up and stored in the first item slot: $24 written to $C900
2. Map Scroll is used: $24 stored in $C931, the current item slot
3. Behavior lookup for Map Scroll: $24 - $20 = $04, fifth offset into the item behavior table, which yields behavior $05
4. Call routine for Map Scroll: Item Table starting point + $05 gives us the sixth entry of the Item Action Table, which is... MapScrollAction!

Switching object logic turns out to be rather simple. To change the "Minheal Potion" to the "Boom Potion":

In items/behavior/item_action_offsets.asm, simply change

.db $19      ; Minheal Potion

to

.db $11      ; Minheal Potion


(note $11 is the offset used for Thunder Rod!) and edit the name in items/names/potions_identified.asm like so

IdentifiedPotionName1:
   .db $0e
   .asc "MINHEAL POTION"

to

IdentifiedPotionName1:
   .db $0B
   .asc "BOOM POTION   "


(Note the change to the initial byte for length!)

I recommend Dammit9x' Dragon Crystal Shrine as a good reference for the standard stats and behavior of weapons and items. Have fun!
dc_edits.ips (309 B)

  View user's profile Send private message Visit poster's website
  • Joined: 08 Dec 2013
  • Posts: 200
Reply with quote
Post Posted: Mon Oct 27, 2014 6:20 am
You're doing some really great work, keep going! I'm following everything you do on GitHub :)
  View user's profile Send private message Visit poster's website
  • Joined: 04 Sep 2014
  • Posts: 37
Reply with quote
Post Posted: Mon Dec 01, 2014 7:20 pm
Ach, it's been a while since my last update! November was rather a difficult month so I didn't get a lot done, but I have made some progress. I'm chipping away at palette and graphics handling, working a little bit more on identifying some of the data blocks and jump tables, and

- Sword colors are split out here- different swords have different colors based on their item number, which roughly indicates the strength and special effect group of the sword (some swords are good against certain classes of monsters, for example)

- Monster palettes- the palette for each level is loaded piecemeal; there appear to be certain standard palettes for the player and dragon, including one that changes based on the sword equipped, and then this set of palettes that changes based on the monsters that appear on the floor

- Experience needed table listing how many experience points are needed on level up for each level

- Experience given table listing how many experience points each monster yields. This table is ordered by appearance of the monsters, which is likely how monster data will be ordered elsewhere too.

- Armor rusting mechanism- it turns out that not only will the Norust scroll prevent rusting and the Mystic Suit of armor never rust, the Lamellar will also never rust, and the Shield Ring (which raises AC by four points) also prevents rusting! This makes the Shield Ring even more useful than it was before.

- Unused dizziness-causing item- there is code for an item that causes dizziness that isn't used. It seems pretty much identical to the Daze Potion, but displays a different message.

- The jump table currently labeled "JumpTable6" uses an indirect indexing mechanism in the same way as items are handled- I'm not yet sure what it's used for, though. I suspected monsters at first, but the functions called don't match up with either monster movement or behavior, so it's still open at this point.

Current areas of focus:

- Splitting apart the blob of sound data, sound\sound_data.inc, into tracks- there are certainly other things than sound data in there, including the graphics for the dragon!
- Figuring out the best way to define labels for message text and items to make things easier to read
- Trying to figure out how to handle and split apart all of the graphics- what utilities are best for this? Ideally, I'd like to split the graphics out into small binary blobs for each tileset, eg each monster...

Kroc wrote
You're doing some really great work, keep going! I'm following everything you do on GitHub :)


I missed responding to this before, but thanks! It's very motivating knowing people are looking at my progress :)
  View user's profile Send private message Visit poster's website
  • Site Admin
  • Joined: 19 Oct 1999
  • Posts: 14687
  • Location: London
Reply with quote
Post Posted: Mon Dec 01, 2014 11:06 pm
Can you split the graphics into PNG files and have them converted and compressed as part of the build?
  View user's profile Send private message Visit poster's website
  • Joined: 01 Mar 2006
  • Posts: 84
  • Location: Essex, UK
Reply with quote
Post Posted: Mon Jul 25, 2022 1:42 am
trykaar wrote

- It appears the game is checking for particular input during startup:

   in a, ($DC)                         ; Read controller 1 input
   cpl                                 ; Invert so 1 means button pressed
   and $3F                             ; %00111111 Ignore bits used for Player 2 controller up and down input- not useful
   cp $05                              ; %00000101 Up and left pressed together? Cheat?
   jp nz, _LABEL_111_                  ; If not, go here
   ld a, $01                           ; If pressed, set $C0D6 to $01
   ld ($C0D6), a
   jp _LABEL_111_

I just found this yesterday evening, and haven't had time to follow it all out, but it appears to change something during the game setup process- I couldn't get anything to change when I tried it once last night. Do I have the code figured correctly there- is that up and left button pressed together?


Hold Up+Left at start up. Then at the title screen, hold Down+Right and press 1 or 2. You will be shown the ending.
  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!