8-Bit BTCS - 6502 Reverse Engineering Project

Any developer realated stuff
User avatar
Horpner
Posts: 224
Joined: Thu Jan 08, 2009 11:53 pm
Location: New England
Contact:

Post by Horpner »

How does the game know when the party steps on a special?
It seems to be a two-step process. There's the array of features that we already deciphered, which has a flag set if a "special" is on that square, and also tells where stairs, portals, treasure are. The game looks here so SOSI spell can warn players about specials. When a player actually walks on that square, it looks up the coordinates in the lists that I talked about above, and executes the correct code. There seem to be a handful of "standard" specials. The ones I found in The Cellars are text messages, spinners, teleporters, and the actual specials, like the statue of the spider god.

I don't know exactly how the spider god special works, but I know something about it now. The text for that special is not in memory, so it must find out where to look on disk from something that is in memory--probably the 8 bytes following the specials coordinates.

The "phantom" special on the third level of Harkyn's Castle is a case where there's a "special feature" flag set, but then the coordinates for that square are never found, so nothing happens. What's quite interesting to me is that this is probably a bug we can fix by meddling with the memory--I'm hopingthat the wrong coordinates are stored, so the two things never link up. I don't have my hopes up too high, though, since we proved there's no text stored on the disks that we haven't seen. It's possible that it's a special that simply got removed from the game, though.

After I learn as much more as I can, I'll put togther a document that explains it all as clearly as I can.
Death and drek? WTF?
User avatar
Horpner
Posts: 224
Joined: Thu Jan 08, 2009 11:53 pm
Location: New England
Contact:

Post by Horpner »

Darendor wrote:And are those locations on disk, or in memory?
They are in memory. I hope that the files on disk use the same relative layout, but I haven't looked yet.
Death and drek? WTF?
User avatar
Darendor
Posts: 1502
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

I'll scan the dungeon disk looking for "That was not a wise move!" (which is what the game says when we curiously decide to examine the spider god statue and report my findings.
User avatar
Darendor
Posts: 1502
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

Found the text code contained from disk locations 001ecb9 - 001ecd2:

Code: Select all

That was not a wise move!~
The tilde means "dc"; which we've determined means "end of text string". So disk location 001ecb9 is called when the player presses "S" for "Search it"...so we need to figure out where 001ecb9 is called from...
User avatar
Horpner
Posts: 224
Joined: Thu Jan 08, 2009 11:53 pm
Location: New England
Contact:

Post by Horpner »

Darendor wrote:Found the text code contained from disk locations 001ecb9 - 001ecd2:

Code: Select all

That was not a wise move!~
The tilde means "dc"; which we've determined means "end of text string". So disk location 001ecb9 is called when the player presses "S" for "Search it"...so we need to figure out where 001ecb9 is called from...
Try to find out what file name contains that text, if you can.
Death and drek? WTF?
User avatar
Horpner
Posts: 224
Joined: Thu Jan 08, 2009 11:53 pm
Location: New England
Contact:

Post by Horpner »

I studied the table of coordinates for the 3rd level of Harkyn's Castle, and there's no "orphaned" coordinates, or one that's close to the 17N, 4E that I was hoping to find. So it doesn't seem to be a typo.

Since the table of 8 spinners is the only one that's full (it contains the 8 spinners near the statue of the Mad God) I'm guessing that there was supposed to be a spinner at 17N, 4E, but he ran out of them.

It looks like reverse engineering won't solve this mystery. Maybe he deliberately created a "something special" that did nothing to mess with our heads.
Death and drek? WTF?
User avatar
Horpner
Posts: 224
Joined: Thu Jan 08, 2009 11:53 pm
Location: New England
Contact:

Post by Horpner »

I've found the memory location that determines if a level is shielded or not.

If there's a 01 at fc11, it's shielded. If there's a 00, it isn't shielded. I'm heading to Mangar's Tower right now to verify this with some fun-time cheating.

If you want to play along, using Vice, you can clear the APAR and PHDO shielding from any dungeon level by entering the dungeon, pressing Alt-M, and entering the command

>fc11 00

Close the monitor, and then do all the cheating you always wanted to!

OK, I tried it out, and clearing that bit does allow teleportation, but not phasedoor.
Death and drek? WTF?
User avatar
Darendor
Posts: 1502
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

Horpner wrote:
Darendor wrote:Found the text code contained from disk locations 001ecb9 - 001ecd2:

Code: Select all

That was not a wise move!~
The tilde means "dc"; which we've determined means "end of text string". So disk location 001ecb9 is called when the player presses "S" for "Search it"...so we need to figure out where 001ecb9 is called from...
Try to find out what file name contains that text, if you can.
Not sure about the filename, but the text string in question resides on the disk at Track 25, Sector 2, from position 185 to 210.

Does that help?
User avatar
Darendor
Posts: 1502
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

Horpner wrote:OK, I tried it out, and clearing that bit does allow teleportation, but not phasedoor.
Perhaps there's two bytes - one for PHDO and one for APAR. :?
User avatar
Horpner
Posts: 224
Joined: Thu Jan 08, 2009 11:53 pm
Location: New England
Contact:

Post by Horpner »

OK, what I wrote above was true for the third level of Mangar's Tower. Clearing fc11 allowed APAR only. But on the fourth level, APAR wouldn't work, but PHDO would. This is confusing.

By the way, going up the portal from the level in which you aren't supposed to be able to takes you to the fifth level of Mangar's tower. :twisted:
Death and drek? WTF?
User avatar
Darendor
Posts: 1502
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

Horpner wrote:I've found the memory location that determines if a level is shielded or not.

If there's a 01 at fc11, it's shielded. If there's a 00, it isn't shielded. I'm heading to Mangar's Tower right now to verify this with some fun-time cheating.

If you want to play along, using Vice, you can clear the APAR and PHDO shielding from any dungeon level by entering the dungeon, pressing Alt-M, and entering the command

>fc11 00

Close the monitor, and then do all the cheating you always wanted to!

OK, I tried it out, and clearing that bit does allow teleportation, but not phasedoor.
You got it backwards, clearing the bit allows PHDO but not teleportation.
User avatar
Darendor
Posts: 1502
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

Horpner wrote:OK, what I wrote above was true for the third level of Mangar's Tower. Clearing fc11 allowed APAR only. But on the fourth level, APAR wouldn't work, but PHDO would. This is confusing.

By the way, going up the portal from the level in which you aren't supposed to be able to takes you to the fifth level of Mangar's tower. :twisted:
Err...the third level allows teleporting in the first place...:?
User avatar
Horpner
Posts: 224
Joined: Thu Jan 08, 2009 11:53 pm
Location: New England
Contact:

Post by Horpner »

The fifth level acts the same. I can activate PHDO, but no APAR on this level.

I'd hate to think that APAR always worked on level three, and I just never tried it.
Death and drek? WTF?
User avatar
Darendor
Posts: 1502
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

Horpner wrote:The fifth level acts the same. I can activate PHDO, but no APAR on this level.

I'd hate to think that APAR always worked on level three, and I just never tried it.
Guess what? APAR always worked on level three.

In the future, if you wanna find your way quickly to level of Mangar's, APAR from the entry stairs to 4N, 10E, 2UP, enter the 7, then APAR +5, -7, then go up the stairs.
User avatar
Darendor
Posts: 1502
Joined: Wed Jan 14, 2009 1:53 am
Location: Red Deer, Alberta, Canada

Post by Darendor »

I just compared memory location fc11 on three levels of Mangar's Tower: 3, 4, and 5.

Code: Select all

LEVEL 3
fc11: 01 03 ff ff    03 d4 e8 e5
LEVEL 4
fc11: 01 03 ff ff    03 d4 e8 e5
LEVEL 5
fc11: 01 03 ff ff    03 d4 e8 e5
They're identical. :?
Post Reply