Segment 000[ | ]
This is the main code segment of the game. This page will hold links or descriptions about any of the interesting code segments found within segment 000.
Code Locations[ | ]
- 10B6 - Start of Code
- Battle choices
- 23A6 - R)un command
- 240B - U)se command
- 236F - H)ire command
- 2078 - E)vade command
- 20C1 - A)ttack command
- 234E - W)eapon command
- 23E2 - L)oad/unjam command
- Menu choices (along bottom of screen during gameplay)
- 3A80 - U)se command
- 1CE7 - E)ncounter command
- 2AE0 - O)rder command
- 5E77 - D)isband command
- 60A8 - V)iew command
- A290 - S)ave command
- 5260 - R)adio command
- Action nibble processing
- NOTE: Several of these have preprocessing before they jump to these subs
- 00 - 6563
- 01 - 6CD0
- 02 - 3EC9
- 03 - 6563
- 04 - 2750
- 05 - 5280
- 06 - 2C70
- 07 - 6563
- 08 - 5160
- 09 - 4410
- 0A - 6A10
- 0B - 6563
- 0C - 2BD0
- 0D - 6563
- 0E - 6563
- 0F - 6563
MSQ Block Support[ | ]
- Sub_1A10 - Save Data to disk
- It is called twice when entering a new map. Once to save Character data and once to save the current map.
- Inputs: DX=Start of Data CX=Length of data
- This routine does the following
- 1. Generate a checksum over data area by subtraction. (i.e. a negative checksum)
- 2. Encrypt the data with XOR process.
- 3. Check the disk
- 4. Write into disk file to replace current section within the file.
- 5. Decrypt the data area with a reverse of the XOR process.
- When used to save Character data: DX=0x7131 CX=0x0800
- When used to save the Main map: DX=0x0000 CX=0x1C61
- Note: When saving a Map, only the Map Data and Info Data are saved. Not the String area.
- Sub_1A59 - Decrypt New MSQ Block
- It is called once when entering a new map to decrypt the MSQ information that has been read in.
- Inputs: DX=0x0000 Start of Data (ds:0000)
- This routine does the following
- 1. Get the saved checksum from file read process (ds:9176)
- 2. Get map size (ds:46B0) and add 2 to include String offset bytes
- 3. Decrypt Map Data and String offset bytes with XOR process
- 4. Save String offset bytes
- 5. Calculate size of Map Info area: (CX = String Offset - Map size)
- 6. Add to Index (SI) to position past String offset bytes and adjust size (CX)
- 7. Decrypt Map Info area data with XOR process
- 8. Verify checksum over Map Data and Map Info area with checksum from MSQ header
Note: The checksum is made from the two bytes following the msqx header for the block in the gamex file.