Page 1 of 1

Code Talk: Return of Heracles

PostPosted: 26 Sep 2006, 20:20
by doctorclu
Would like to talk about the code of Return of Heracles and what is going on at key parts of the code.

First off the code looks good. You think it could be changed and re-compiled?

I have a real reason to want to do this. Maybe add more, but at LEAST work around a problem with the Sphinx part of the game. I have noticed that if the game is loaded from MyIde the game works fine, but the keyboard will not let you type anything but garbage, which gets you in trouble with the Sphinx of course.

So would like to work around that.

And I thought it interest to see the stats on the Sphinx....

498C aSphinx:.BYTE 'SPHINX'
4992 .BYTE $14

Now how do you read hexadecimal again? Need to find my hexadecimal calculator again. Anyway, I've beaten the Sphinx many times in combat, usually costs about 6 guys, and promptly crashes when you beat it. :)

PostPosted: 26 Sep 2006, 22:21
by xot
Hexadecimal is a base-16 number system. That means each digit to the left is 16 times the power of the one on it's right. Works just like normal base-10, but uses 16 as a "base" instead of 10.

In base-10:
14 = 1 * 10 + 4

In base-16:
$14 = 1 * 16 + 4

Each digit has a multiplier of 16^n, or 16 to the nth power, where n is the position of the digit. The first digit on the right, or least significant digit, is zero.

$4992 = 4 * (16^3) + 9 * (16^2) + 9 * (16^1) + 2 * (16^0)
$4992 = 4 * 4096 + 9 * 256 + 9 * 16 + 2 * 1
$4992 = 18834

Since base-10 doesn't have a single numeral to represent numbers over 9, we use letters to represent these numerals when writing in base-16:
Code: Select all
Base-10: 0  1  2  3  4  5  6  7  8  9  10  11  12  13  14  15
Base-16: 0  1  2  3  4  5  6  7  8  9   A   B   C   D   E   F


$498C = 4 * 4096 + 9 * 256 + 8 * 16 + 12 = 18828

I use Analog-X's PCalc for most of my handy dandy programmer calculations:
http://www.analogx.com/contents/downloa ... /pcalc.htm

As a side note, the old-school $ notation has been replaced with the modern-day 0x notation.

$498C = 0x498c

PostPosted: 27 Sep 2006, 23:09
by Kroah
The way the keyboard is handled by the game prevent some machine to use it at the riddle... I usually hit 'Y' on the loading screen, i think it corrects this bug, i don't remember.

The code I decompile is not aimed to be recompiled, and when i want to modify some codes, i poke directly the memory. But it's possible to use the disassembled code to do a remake of the game in C for example.

You can see the stats of the sphinx on the website:
Code: Select all
SPHINX
Cursed Beast
 
Very Full of Power [63/31]
Masterfully Dextrous [24]
Very Slow [0]
 
Carrying 200 Drachmae
 
Zeus Blessed Melee Weapon [11]
Skilled Wrestler with Zeus Blessed Close Combat [15]
Fire Toughened Skin [15]

Hidden Attributes:
Regenerate No
Cursed No
Random No
Unique No



Regards,
Kroah