The full debugger source has been commented, a total of just over 2500 lines of code and comments. Of course there are other things that could be done, such as making the code position independent (as it probably was originally), so that it could be linked at arbitrary addresses. However, let's be honest, it is unlikely anyone is actually going to use the results, so it is probably a wasted effort. What I will do is to write all my findings up as a document. I hope that, with the blessing of the Blue Sky Rangers, this will include the full, commented source code.
In the mean time, here are the contents of the debugger's workspace RAM as a taster:
; ------------------------------------------------------------------------------ ; Debugger workspace RAM L_D279: DECLE 0 ; $d279 - Keystroke debounce count DECLE 0 ; $d27a - Last right controller input DECLE 0 ; $d27b - Last left controller input DECLE 0 ; $d27c - Last valid controller cmd DECLE 0 ; $d27d - SDBD flag BIDECLE 0 ; $d27e - cached R0 register BIDECLE 0 ; $d280 - cached R1 register BIDECLE 0 ; $d282 - cached R2 register BIDECLE 0 ; $d284 - cached R3 register BIDECLE 0 ; $d286 - cached R4 register BIDECLE 0 ; $d288 - cached R5 register BIDECLE 0 ; $d28a - cached R6 register (SP) BIDECLE 0 ; $d28c - cached R7 register (PC) BIDECLE 0 ; $d28e - cached Sign flag BIDECLE 0 ; $d290 - cached Zerp flag BIDECLE 0 ; $d292 - cached Overflow flag BIDECLE 0 ; $d294 - cached Carry flag BIDECLE 0 ; $d296 - breakpoint A active BIDECLE 0 ; $d298 - breakpoint B active BIDECLE 0 ; $d29a - breakpoint C active BIDECLE 0 ; $d29c - breakpoint D active BIDECLE 0 ; $d29e - breakpoint E active BIDECLE 0 ; $d2a0 - breakpoint F active BIDECLE 0 ; $d2a2 - breakpoint G active BIDECLE 0 ; $d2a4 - breakpoint H active BIDECLE $5000 ; $d2a6 - memory inspector 1 address BIDECLE $6000 ; $d2a8 - memory inspector 2 address DECLE 0 ; $d2aa - focussed field / breakpoint DECLE 0 ; $d2ab - subroutine register DECLE 0 ; $d2ac - breakpoints active ; L_D2AD: ; DECLE 0, 0, 0, 0, 0, 0, 0 ; $d2ad - instruction cache DECLE 0 ; $d2b4 - instruction running flag BIDECLE 0 ; $d2b5 - subroutine R6 (SP) DECLE 0 ; $d2b7 - debugger mode ; - 0 = single step ; - 1 = trace ; - 2 = trace to user instruction ; - 3 = trace to subroutine exit ; REPEAT 30 ; screen BACKTAB cache BIDECLE 0, 0, 0, 0 ; ENDR ;
Speaking of findings, the only other snippet I discovered going through the last of the source is that instructions prefixed with SDBD are treated as a single compound opcode, rather than two distinct instructions. The existence of the compound SDBD instruction is then highlighted in the disassembly by doubling the # or @ symbol at the start of the operand. Again, a nice usability tweak.
In the absence of any advice from Rick or the other BSRs, it does seem as though the two memory inspectors behave the same. There is no great mystery there after all, apparently.
So, looking back at the questions we set at the beginning of this RetroChallenge, I think we now have the answers...
- Is Rick's debugger in WCB? - Yes
- Is it complete? - Yes, it seems to be
- Can it be isolated, reverse-engineered and tinkered with? - Hell yes!
Well that is perhaps one for the next post...
Comments
Post a Comment