This page details bugs of Destiny of an Emperor.
Fixed in Rev.A#
All fixes from Rev.A are also included in the US version, and there's no other revisional differences.
Multiplication errors#
The multiply function's loop didn't handle carry properly, and in rare cases would give incorrect results: when the first byte's addition result has carry, it increments the second byte then clears carry, causing the next carry to be lost if the second byte incremented to 00.
One known example is Huo Hu using Hong Shui, which calculates 175 * 1500 (INT * tactic power) and should do 1026 average damage (0401.64 + 1), but instead does 2 damage (0001.64 + 1).
Fixed by, well, simply letting the carry flag do its thing:
Japan |
Japan Rev.A / US |
|---|---|
|
|
Lu Bu Gemsword crash - "Kindness is really overrated"#
When you use the Gemsword on Lu Bu and he asks "Is that the Gemsword?" with a Yes/No prompt, answering No makes him say "Kindness is overrated", ends the turn then enemies get a free turn. However the code ran an extra PLA instruction there, which will cause the game to crash or glitch out once you finish the battle and return to the map.
Zhao Yun softlock - Pirate Force reads the Zhou Letr#
Using the Zhou Letr first checks you're in front of Zhao Yun at Guang Zong and facing him, then runs message 2AB, in which Zhao Yun asks to join with the usual prompt. However the "joining general" variable is unchanged from the last NPC index you've talked to, which may be wrong if you last talked to some random NPC in town instead of Zhao Yun himself, and in this case a "Pirate Force" or previously seen NPC will join, while Zhao Yun still stands there and you don't have the Zhou Letr anymore, making it impossible to progress.
As a side effect, having a NPC character in your party will overflow the Formation menu's buffer (long name) and overwrite the party slot numbers to reorder, resulting in a completely broken party.
Fixed by setting the "joining general" to the first NPC (always Zhao Yun) on item use.
Dead Wood softlock - "Thanks for the wood, by the way you'll need more of it"#
When the "Jian An canal" event flag isn't set, talking to the old man in Jian An will first remove the Dead Wood if you have it, then (if so) remove the Saltpeter if you have it, then (if both) set the flag, and then say "Do you want to know how to clog the canal?". In case you had the Dead Wood but no Saltpeter, the Dead Wood is still gone and you can't progress past Jian An.
Fixed by first checking you have the Dead Wood, then (if so) remove the Saltpeter if you have it, then (if both) remove the Dead Wood and set the flag.
Fixed in the US version#
Gullwing without a destination#
At the beginning, if you buy a Gullwing in Qing Zhou and use it without ever visiting Xu Zhou, there will be no available destinations to pick from and you get a broken menu, which will then search the selected index in the list of possible destinations and warp out of bounds (or crash).
Fixed in the US version by first checking you've visited Xu Zhou, and aborting if not.
|
Japan |
US |
|---|---|
|
|
|
Xu Zhe softlock - "I don't want you Xu Zhe, ever"#
Talking to Xu Zhe in Ji Zhou's cave will run message 175, in which he asks "May I travel with you?" then runs code that sets event flag 1C and runs the usual prompt to accept/cancel a general join. Then whenever you enter the cave again, the event flag will despawn the Xu Zhe NPC, even if you said no and left, in which case he's gone forever and you can't get through Ji Zhou or progress to Shu.
Fixed by calling the join prompt directly so the event flag never gets set (now unused), and the NPC automatically disappears anyway once Xu Zhe has joined.
Dead leader's portrait#
When the first party character in battle is dead, the next one alive gets the full menu. If you use Report at that time to see an enemy's status (which then loads that enemy's portrait into VRAM over the current one), returning to battle will load the first character's portrait even when he's dead.
Fixed by keeping/restoring the current party character to load the portrait from.
Level 51 and beyond#
The intended maximum level is 50, but this is never actually checked in the Japanese version and there's no EXP cap. Level 51 is reached at 999999 EXP (not too far past 50), then 52 is at a whole 8940165, and finally 53 at 9999999 before reading out of bounds into code. Each level past 50 adds 2000 soldiers to each growing general and works fine for a while, until 56 when the list of learned tactics goes far enough out of range to have non-zero values again and overwrite your tactics with garbage, and going all the way to 255 will get stuck in an infinite loop.
The US version skips the level up check (and won't show EXP to next when saving) if you're already at 50 or higher, but 51 is still possible if you reach 50 first then get the free level up in Ji Zhou.
"Super Rebels" corner#
Past Shu's entrance just before Liu Kui's battle, the 2 bottom rows of ground tiles are on a lower map screen with encounter zone 0 instead of the valid one for Shu (6). This zone only has generic forces with very high amounts of soldiers, very low STR, and a very high EXP/gold multiplier:
Zone |
Soldiers |
||||
|---|---|---|---|---|---|
1 |
Xu Zhou |
100 |
100 |
120 |
140 |
2 |
Dong Zhuo |
120 |
120 |
150 |
180 |
3 |
Yuan Shu |
200 |
220 |
230 |
250 |
4 |
Ji Zhou |
230 |
250 |
270 |
300 |
5 |
Jing Zhou |
300 |
320 |
350 |
380 |
6 |
Shu |
700 |
850 |
900 |
1000 |
7 |
Wu |
1000 |
1100 |
1200 |
1300 |
8 |
Wei |
1500 |
1650 |
1800 |
1900 |
0 |
53448 |
42737 |
41986 |
24579 |
|
F |
6400 |
13094 |
6400 |
38 |
|
Zone 0 and F were also reachable by going out of bounds with the gullwing bug (9 to E aren't set anywhere), but this occurence of zone 0 is actually in bounds and becomes an extremely powerful leveling spot. This also makes it much faster to reach the broken levels past 50.
The US version set this spot to the proper zone, as well as several unwalkable screens near there just to be really sure: the full southern border of Shu and western border of Wu were extended by 1 screen, almost entirely mountains and partly out of bounds.
Introduced in the US version#
"5th, 7th, and 152nd general, learned the tactic"#
On each level up after the army increases, it checks whether each party member learns a tactic, and if so it will write the tactician's name, then once done (if any) will say they learned the tactic and maximum TP went up.
For each tactician learning a tactic, the US version additionally checks whether a later party member also learns the tactic, in which case it adds a comma after the tactician's name. But it doesn't verify it wasn't already the last party member, and the comma check also updates the later member's tactics, so it will run a full loop out of range and potentially overwrite other variables, specifically the opened chests and hidden items (causing despawns or respawns, and possible softlocks). This can be seen in game when the last tactician name (7th in party order) has a trailing comma.
In both versions#
NMI crash#
A major bug that's at least fairly rare, since it doesn't happen everywhere and needs very precise timing.
The game often runs code in RAM, with calls like this:
jsr RunCodeInRAM
... ;switch to another bank, etc.
jsr ReturnFromRAM
.word *+1
... ;not RAM code
RunCodeInRAM copies the next 255 bytes to RAM and jumps there, then ReturnFromRAM pulls the return address from stack, reads it again above stack, and reads the word value there to push as return address. If NMI happens between the pull and re-read, the first return address will be overwritten and ReturnFromRAM will jump to a garbage address (usually a crash):
ReturnFromRAM:
...
tsx
pla ;A = return address low
pla ;A = return address high
;if NMI happens here, the pulled values are overwritten
lda $0101,x ;read 2 above new stack position (was return address low)
sta tempF3+0
lda $0102,x ;read 1 above (was return address high)
sta tempF3+1
ldy #2 ;push word value from return address, as new return address
lda (tempF3),y
pha
dey
lda (tempF3),y
pha
...
The fix would be to use the pulls themselves:
pla ;A = return address low
sta tempF3+0 ;not lost if NMI happens here
pla ;A = return address high
sta tempF3+1
First general cancel - Yellow Scarves extermination#
In battle when pressing B to cancel the previous character's action, that character's TP use is reset to 0 (to regain TP spent on a tactic). However if you press B from the first character's menu (the one with a 2nd column), it will underflow to index 255 and set general 12's status byte to 0, effectively deleting Guo Ji from the game if you haven't captured him.
And it gets better:
: dec m_btlActChar ;00 -> FF
jsr ClearActCharTPUse ;index FF is Guo Ji's status
jsr GetActCharIndex ;Y = party order, or for m_btlActChar >= 5 (enemies) return +2
lda s_partyStatusA,y ;now Y=01, loop if the 2nd party member isn't alive
bpl :-
If you do this while the first 2 party members are dead (Guan Yu and Zhang Fei at the beginning), it will keep looping and underflow the "party status" index (into "max enemy soldiers" variables) until it hits a byte in the 80-FF range, and by then it will most likely have deleted all generals from 00 to 12:
- Brigand NPC in Qing Zhou cave, but generic forces are unaffected
- Cheng Yuan Zhi, but the "capture Han Zhong now" event brings him back
- Song Ren, Song Yong, Zhang Jao, Zhang Bao, Zhang Liang, Ma Yuan Yi
- Li Su, Guo Ji, Wang Gui, Zhou Chao
"And you get a Qing Long, and you get a Qing Long, and you get a Qing Long"#
When you defeat the Pirates near Jin Du then go back to a NPC there, you're rewarded with one of the legendary swords, the Qing Long. This runs event code that first checks a flag isn't set, attempts to insert the Qing Long in your inventory, and (if successful) sets the flag.
If your inventory is full, you're prompted to drop an item to make space then given the Qing Long, but (due to multiple RAM code calls and returning to overwritten code) the flag doesn't get set and the event can be repeated, allowing unlimited Qing Longs.
All dead party#
When Lu Bu leaves to serve Yuan Shao, or when Xu Zhe leaves, no one else gets revived in case the leaving member was the only one alive. You end up with an empty active party, can't use any items, and entering a battle will let enemies go first and move once before you lose (usually attacking themselves but sometimes an index out of range), then Guan Yu and Zhang Fei are revived.
On the next battle, the life bars are blank as well, as the scale tends to update 1 battle late based on highest maximum soldiers in your party.