A little something I've gathered together while getting ready for some in-depth DKC1/2/3 hacking.
This is a pretty hefty document that I had to manually convert from *.hlp to *.chm since Windows 10/11 do not support the old help file format that was used back in the XP days.
I tried to give original credits but I might be wrong about who wrote the original documentation.
This was essentially dug up from a very old ASM tutorial on Aclmm's Board -- way back then, I found the document to be indispensable in hacking both SMW and DKC. I am sure I've captured the original usefulness.
I had to manually readjust the mono-spaced text and create links for all of the pages, which took a considerable amount of work. I hope you enjoy.
It works fine for me with xCHM. I had it installed already for perusing some other chm file a while back, so I was quite surprised when you mentioned it. The only thing is that in xCHM it seems to use a non-mono font for everything by default which borks the formatting. Changing the regular font to a monospaced font seem to resolve that though. Wine has a 'hh' utility for reading chm files (and 'winhelp' for hlp), and the formatting appears fine there.
The Windows thing might be due to it being an untrusted file, which seems excessive for a known format that doesn't contain any executable components (as far as I know). The fix appears to be to right click on the file, choose Properties and look for an "Unblock" button. That seems to be the advice for Windows XP to 7, but it probably hasn't changed too much for later versions. It's also interesting if an untrusted attribute could be applied to a file extracted from an untrusted zip file, but that's probably a good thing. As for the zip file being untrusted, well I'd blame the plain http connection first but who knows.
—
Back when I was learning all of this, getting used to the different mnemonics was the biggest issue for me. There was a long retired site with a page that had a concise list of instructions and grouped similar ones which made it easy to follow. The "Opcode List" page in this file is a bit similar. The best resource for this stuff is the Eyes/Lichty book; "Programming the 65816" which has been distributed freely online by WDC in the past.
The MVP/MVN page here has a few issues:
Spoiler!
The Accumulator should be loaded with the number of bytes to copy.
Should be "number of bytes plus 1". If A is 0, it will transfer one byte, if A is 1 it will transfer 2, etc.
The difference between MVP and MVN instructions is the direction in which the data is transferred.
This on its own isn't wrong per se, but it's a bit vague.
do { *(destbank|Y++) = *(srcbank|X++); } while (A--); // MVN do { *(destbank|Y--) = *(srcbank|X--); } while (A--); // MVP
This means at the beginning of the transfer, X and Y point to the start of the source and destination for MVN and increment on each iteration, whereas for MVP X and Y start at the end and decrement instead. Banks don't get crossed either, but that's a whole other set of problems. The idea is that data can be moved even if source and destination overlap, a bit like memmove.
There are a few ops that store their arguments backwards when assembled, so MVN $80 $90 would end up as $54 $90 $80. I imagine most disassemblers would make an effort to hide that fact from users though.
Another quirk of MVN and MVP is that they replace the DB register with the destination bank register which isn't mentioned here. I am aware of precisely one game that can crash if emulators don't implement this.....DKC3! It only happens when you reach the first signpost in Krack Shot Kroc. Strange, huh?
Haven't really noticed anything else wrong. It may have benefited from a brief summary of flags, internal registers (i.e. those used in phb or phd), addressing modes, etc, but it does a good job at providing a summary of all the available opcodes. Probably not worth the effort it would take to fix anything, but chm should be a bit more accessible to Windows users at least.
I've added registers, flags, addressing modes, and memory mappings to the document, along with several error fixes along with the MVP/MVN instruction details Kingizor provided.