The style is very sloppy, this was put together in a rush very late to debug the chip. I may improve it later on as it did prove helpful. The assembly version written at https://garakutaen.sakura.ne.jp/ is excellent, however my assembly knowledge is not strong enough to make some of the changes I needed so it was easier to write in C.
The current values configured are for the AT050TN22 V.1 but are not confirmed to be correct.
You can use this program at your own risk. If you have any questions leave a comment.
UPDATE 2020/07/18: I have found some of the original OEM tools for debugging so the need for these custom programs for debugging may be no longer. I am going to maintain a page of all the tools I can find HERE.