News: 11 March 2016 - Forum Rules
Current Moderators - DarkSol, KingMike, MathOnNapkins, Azkadellia, Danke

Author Topic: Lets make Zelda2 for GB!  (Read 7185 times)

bailli

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Re: Lets make Zelda2 for GB!
« Reply #20 on: February 08, 2015, 08:59:56 am »
I basically already posted most of the info.

Rom bank 0xB starts with 139 pointers per language.
(string0 for all languages, string1, for all language, ... - NOT all pointers for one language and then the next language)
For English and French the pointer points to rom bank 0xB, for German to rom bank 0xD and for the last languages to rom bank 0xC.

The strings are encoded as a single control bit followed by a 6 or 8bit value. Control bit == 0 means a single 6bit letter follows; control bit == 1 means an 8bit index from the look-up table follows. The terminator is 0x2D.

Here are some more control codes from my python script (don't mind the 'c', 'b', 'd', 'e' they are just placeholders):
Code: [Select]
    0x01: 'c', # followed by 1 = HERO; by 2 = HEROINE
    0x2B: 'b', #clear box
    0x2C: 'c', #carriage return
    0x2D: 'd', #string end
    0x2E: 'e', #yes/no prompt or something similar?

RetroRain

  • Sr. Member
  • ****
  • Posts: 286
    • View Profile
Re: Lets make Zelda2 for GB!
« Reply #21 on: February 08, 2015, 10:12:05 am »
I think the idea of a Zelda 2 GameBoy version is really cool.  It's too bad Nintendo didn't make one back in the day.  But the screenshot that is shown in the first post gives a really good idea of how it could've been. :)

dACE

  • Sr. Member
  • ****
  • Posts: 348
    • View Profile
Re: Lets make Zelda2 for GB!
« Reply #22 on: February 08, 2015, 11:31:10 am »
Making progress...

bailli - Am I correct in my assumption that the sentences in each language are located in a single place within the rom-file, much like the look-up table was?

Can you help me with determine the ROM offsets to the first scentence, for each language?

EDIT:

OK - I read your post more carefully now.

So there are 139 pointers to sentences for each language that make up the script then?

So I would need 139 Rom-offsets for each language then - can they be easily determined?

/dACE
« Last Edit: February 08, 2015, 11:36:48 am by dACE »

bailli

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Re: Lets make Zelda2 for GB!
« Reply #23 on: February 08, 2015, 01:11:06 pm »
These 139*5=695 pointers are all right next to each other at the start of rom bank 0xB (as absolute offset 0x2C000) and as I said these pointers point to different rom banks depending on the language.

Just take a look at my python script - you should be able to understand the code since you know a programming language.

Also I am unsure if these are the only strings - because 139 (minus 15 for menu etc) seems very short... hence my question whether you have actually played through this game...

Here is a snippet form my script:
Code: [Select]
  for lang in range(0, 5):
    with codecs.open("strings"+str(lang)+".txt", "wb", 'utf-8') as out:
      for i in range(0, 139):
        rom.seek(0x2C000 + i * 5 * 2 + lang * 2)
        pointer = struct.unpack('H', rom.read(2))[0]
        if lang < 2:
          bank = 0x0B
        elif lang < 3:
          bank = 0x0D
        else:
          bank = 0x0C
        rom.seek(pointer + 0x4000 * (bank - 1))
       
       #read sentence

dACE

  • Sr. Member
  • ****
  • Posts: 348
    • View Profile
Re: Lets make Zelda2 for GB!
« Reply #24 on: February 08, 2015, 02:11:34 pm »
He he... I know a language or two yes...

I would say 139 strings sound right. I counted through a script-dump made from the NES version and reached a lower number (but the author had grouped some together as a conversation I think).

I am currently extrapolating from the first English sentence (The one found in my very first post actually).
I have located 30 or so and hopefully I will be able to find them all this way.

Thanks again bailli - for the help in decoding the bits properly (that was my main problem).

/dACE

dACE

  • Sr. Member
  • ****
  • Posts: 348
    • View Profile
Re: Lets make Zelda2 for GB!
« Reply #25 on: March 12, 2015, 01:26:27 pm »
Need some help...again....*sigh*...

Almost done with the script-editor and I have already remade some sprites for the adaptation:

- Link's sprites are done (but not set in stone)
- All items have been converted into familiar replacements
- Item equipment screen have been altered (to better highlight the new items)
- The HUD is modified
- Half of the enemy sprites are done (but not set in stone)

But when I started looking into adapting the map-screen - I hit another brick wall  :banghead:

Here is the map-screen:



It consists of 31 x 29 = 899 tiles.
When they are loaded into memory - they look like this in Visual-Boy's debugger:



This would mean that the tiles loaded into memory are arranged like this:



But - how is this information stored in the rom??

My first, and so far, only guess is that they are stored similar to the script, from the top-left corner:

5 bits to denote how many times a tile is painted (31 being the highest number = an entire row) +
6 bits to denote the tile to paint (3F being the highest number > 2A)

I have made some searches based of variants on the above assumption, for example - by adding a bit-flag to denote a series of tiles, but I have had no success.

I simply can't figure out how the information for the world map is stored in the rom-file.

Bailli (or someone else) - can you rescue this project one more time?

/dACE
« Last Edit: March 12, 2015, 04:20:58 pm by dACE »

bailli

  • Jr. Member
  • **
  • Posts: 58
    • View Profile
Re: Lets make Zelda2 for GB!
« Reply #26 on: March 12, 2015, 06:22:30 pm »
The map data is at 0x6047 in rom bank 6 (=> absolute offset 0x1A047).

If byte > 0x80 then repeat tile = (byte - 0x80) as many times as the following byte states.
Otherwise (byte < 0x80) it is just the tile number.

The map data is stored column wise from the top left corner!

I haven't really checked this...

dACE

  • Sr. Member
  • ****
  • Posts: 348
    • View Profile
Re: Lets make Zelda2 for GB!
« Reply #27 on: March 12, 2015, 06:36:45 pm »
Stored column-wise...that was unexpected.

As before - thanks a billion bailli!  :woot!:

I'll probably make some sort of 'map designer' as a .NET application, so I can toy around with some different designs.

Maybe it is time for a proper project-page with some screens of the progress made? Anybody interested in this?

/dACE

dACE

  • Sr. Member
  • ****
  • Posts: 348
    • View Profile
Re: Lets make Zelda2 for GB!
« Reply #28 on: March 29, 2015, 01:57:52 pm »
Finally!

The new map is inserted - I went with a mashup of the map in Link's awakening and the original one:



The above image is taken from the debugger-tool in VisualBoy Advanced - so the sprite-layer (the towns) are not visible.
Had some serious issues with the pointers - but managed to get it sorted.

Here is the 'translation' of locations I have been tinkering with:

Arcadia - Ordon (Houses & Trees)
Attica - Ruto (Houses, Beach & Cliffs)
Argolis - Eldin (Caves & Beach)
Peloponnesus - Faron (Woods)
Laconia - Mido (Pillars & Beach)
Phthia - Darunia (Mountain & Waterfall)
Crete - Ikana (Beach & Dungeon)
Phrygia - Tantari (Beach & Dungeon)
Tartarus - Dragmire

Have some pretty nice replacements for the location-icons, they will be inserted next.

/dACE
« Last Edit: March 31, 2015, 03:56:26 pm by dACE »