News:

11 March 2016 - Forum Rules

Main Menu

abcde: Atlas + Cartographer + A Whole Lot More

Started by abw, March 11, 2018, 09:20:15 AM

Previous topic - Next topic

abw

In a word (or in this case two): embedded pointers.

If you compare running e.g. "perl ..\..\..\abcde.pl -cm abcde::Cartographer::NES::Battle_of_Olympus "Battle of Olympus, The (U) [!].nes" Cartographer.txt Cartographer_out -s" (~90KB) vs. "perl ..\..\..\abcde.pl -cm abcde::Cartographer "Battle of Olympus, The (U) [!].nes" Cartographer.txt Cartographer_out2 -s" (~30KB), you'll find that the 30KB version says
Quote//POINTER #0 @ $158F2 - STRING #0 @ $15E48
#W16($158F2)

[NPC:][Old bald man with white beard and staff]
[if flag X is not set, skip Y bytes][flag: Zeus met][bytes: $16]
[Dialogue:]
[HERO],[LINE]
don't be discouraged!
// current address: $15E62

//POINTER #1 @ $158F4 - STRING #1 @ $15E90
#W16($158F4)

[NPC:][Bearded man in green tunic]
[Dialogue:]
Search for the Spirit[LINE]
of the Forest[LINE]
in Peloponnesus.[PAGE]
It holds the[LINE]
strongest sword.
// current address: $15ECE
(notice the gap between  $15E62 and $15E90) while the 90KB version says
Quote//POINTER #0 @ $158F2 - STRING #0 @ $15E48
#W16($158F2)

[NPC:][Old bald man with white beard and staff]
[if flag X is not set, skip Y bytes][flag: Zeus met][bytes: $16]
#SKIP(-1)
#EMBTYPE("POINTER_RELATIVE", 8, $0)
#EMBSET(0)

[Dialogue:]
<$09>
#ACTIVETBL(upper)
[HERO],[LINE]
don't be discouraged!
// current address: $15E62

//EMBEDDED POINTER #0 @ $15E4C - SUB-STRING #0 @ $15E62
#EMBWRITE(0)

[Dialogue:]
<$09>
#ACTIVETBL(upper)
[HERO], first you must[LINE]
go to the Temple of[LINE]
Arcadia to meet Zeus.
// current address: $15E90

//POINTER #1 @ $158F4 - STRING #1 @ $15E90
#W16($158F4)

[NPC:][Bearded man in green tunic]
[Dialogue:]
<$09>
#ACTIVETBL(upper)
Search for the Spirit[LINE]
of the Forest[LINE]
in Peloponnesus.[PAGE]
It holds the[LINE]
strongest sword.
// current address: $15ECE

Basically, Cartographer (both the original program and my re-implementation as abcde::Cartographer) doesn't support dumping embedded pointers on its own, so it doesn't dump them and the resulting script contains only a fraction of the game's total text. That's where the abcde::Cartographer::NES::Battle_of_Olympus module comes in, supplying the necessary logic for dumping the embedded pointers and generating the corresponding Atlas commands for re-inserting them correctly (there's also setup for optimizing inserts by using Atlas' PASCAL commands for determining the length of Pascal strings rather than running repeated graph searches to get the correct length).

As mentioned in abcde's readme, dealing with embedded pointers is one of the places where you'll need to extend abcde by writing your own code (using Notepad if that's what you like ;)); the abcde::Cartographer::NES::Battle_of_Olympus module is merely a potentially-helpful example/starting point for writing that code.

RedScorpion

Hi abw,

thanks for you feedback. I already thought its own code work in case for Emb Pointers.

I have another problem. My pointers are not in blocks, they are mixed with other event codes and after different amount of bytes the next pointer occurs. Is there any way to implement the option to read a txt file with a pointer list?

thanks

chris

abw

That's certainly something that could be implemented; alas, I lack the free time required to do so.

It's not exactly an elegant workaround, but if you already have the list of pointers to dump, one approach would be to generate a separate Cartographer block for each pointer using e.g. Excel, which would likely only take a matter of minutes.