Are you, in fact, a pregnant lady who lives in the apartment next door to Superdeath's parents? - Commodore

Create an account  

 
Disassembly questions

Quote:Dumb question, but could you update the loader to point in the right place after you change the files?
Well I guess you could, in theory, update the header to point to the correct places, but you would still need to manually adjust all jumps and calls inside that segment as well as those from the outside pointing to it. I think that would be like, 10x more amount of work as well as being that much harder and with more chance to mess up too.

Quote:When you say segment, do you mean in the same address in memory? How large is a segment?

Okay, I think you need to first find a book or online information about how the 8086 processors address memory.
A segment is a max of 64k bytes in terms of memory addressing, but actual code segments and data segments are as long as needed for the code to fit. The only restriction is max 64kbytes, and have to be divisible by 16.

Quote:Very interesting. How do you calculate the number of bytes that you've saved?
Well, you locate the code you want to remove in the hex editor, overwrite it with zeroes or 90s whichever you prefer, and it's that many bytes, you see on the screen, as simple as that.

Quote:Did you mention far calls? Would they be able to access space in other sections?
Yes, but don't do it. It's extremely complicated. I've only ever used it once, and to a very severe bug that couldn't have been fixed in any other way, in particular the bug that autosave was called halfway through the end of turn not when it was actually finished.

Quote:I was interested in looking at the part that deals with how many spells you can pick from common, uncommon and rare. Mainly though I was wanting to know roughly how modding the game works at all and what limitations there are for future changes.
I've only found that part for the AI yet.

Quote:How do you go about finding a piece of code in game if it isn't found already?
You search for
-references of a related variable or data structure, in this case the table where the number of picks are stored could be a good plan. Spells in current wizard data would be another. (wizard profiles are DS:6900h in magic.exe, format is identical to what you see in tweaker.)
-references of a text constant related to it, in this case probably "Common" "Uncommon" "Rare" "Very Rare" can help
-reference of an offset related to what you need, for example Sawmill is 34h in the city data (it isn't just inserting a random number) then you search for the value "34h" in the file. There will be a few hundred results, but one of them will be what you need. Of course this only really works for bigger numbers, stuff like 0, 1 or pretty much anything below 20 are far too common.
Word values are pretty easy to find, like 6475h would only get a few results, if any.
-You can also look at a code part you already found which is related, and go through procedures it calls. Like if you know "End_of_Turn" then you can find anything that's done at end of turn, but you do have to look through hundreds of calls. In other cases the relation is closer and it's easier to find for example "casting a combat spell" and "AI selecting a spell to cast".
Reply



Messages In This Thread
Disassembly questions - by MrBiscuits - October 26th, 2015, 09:04
RE: Disassembly questions - by MrBiscuits - October 26th, 2015, 09:05
RE: Disassembly questions - by MrBiscuits - October 26th, 2015, 09:14
RE: Disassembly questions - by Seravy - October 26th, 2015, 09:56
RE: Disassembly questions - by I like Serena - October 26th, 2015, 14:00
RE: Disassembly questions - by Seravy - October 26th, 2015, 14:50
RE: Disassembly questions - by Seravy - October 26th, 2015, 14:54
RE: Disassembly questions - by I like Serena - October 26th, 2015, 14:59
RE: Disassembly questions - by Seravy - October 26th, 2015, 15:02
RE: Disassembly questions - by Bogus - May 29th, 2016, 08:01
RE: Disassembly questions - by Seravy - May 29th, 2016, 10:28
RE: Disassembly questions - by Bogus - May 29th, 2016, 11:07
RE: Disassembly questions - by Seravy - May 29th, 2016, 16:27
RE: Disassembly questions - by Bogus - May 29th, 2016, 16:46
RE: Disassembly questions - by Seravy - May 30th, 2016, 03:27
RE: Disassembly questions - by Bogus - May 30th, 2016, 07:21

Forum Jump: