Did some digging. Decided to key off of the 62-bomb count, looking for a basic cmp #$3e
throughout the code (might as well start simple). Gut feeling told me it was probably in the last PRG bank, which is hard-wired in UNROM. Sure enough, we find this beauty in the last PRG bank:
__c6b0: lda $0528 ; $c6b0: ad 28 05
cmp #$05 ; $c6b3: c9 05
bne __c6e1 ; $c6b5: d0 2a
lda $01b9 ; $c6b7: ad b9 01
beq __c6e1 ; $c6ba: f0 25
lda $0f ; $c6bc: a5 0f
cmp #$0a ; $c6be: c9 0a
bne __c6e1 ; $c6c0: d0 1f
lda $01c6 ; $c6c2: ad c6 01
cmp #$ff ; $c6c5: c9 ff
bne __c6e1 ; $c6c7: d0 18
lda $01c7 ; $c6c9: ad c7 01
cmp #$0f ; $c6cc: c9 0f
bne __c6e1 ; $c6ce: d0 11
lda $78 ; $c6d0: a5 78
cmp #$02 ; $c6d2: c9 02
bne __c6e1 ; $c6d4: d0 0b
lda $4c ; $c6d6: a5 4c
cmp #$3e ; $c6d8: c9 3e
bne __c6e1 ; $c6da: d0 05
lda #$01 ; $c6dc: a9 01
sta $01ed ; $c6de: 8d ed 01
__c6e1: rts ; $c6e1: 60
More REing was required: what were all the ZP/RAM locations for? Attempting to use terms from the actual game manual:
$000e = Controller 1 input; $80=A, $40=B, $20=Select, $10=Start, $08=up, $04=down, $02=left, $01=right
$000f = Controller 2 input (see above)
$0011 = Bitwise NOT of $000e (probably used as a mask somewhere)
$004c = Current bomb count
$0078 = Currently-facing player direction; $03=up, $02=down, $01=left, $00=right
$01b9 = Unknown (see below)
$01c6 = Energy metre (8-tick); $ff=full, $7f=1 missing, $3f=2 missing, $1f=3 missing, $0f=4 missing, $07=5 missing, etc.
$01c7 = "Life pods" (tanks next to the left of the energy metre); $0f=4, $07=3, $03=2, $01=1
$01ed = Debug mode (unlimited items); $01 or higher=enabled, $00=disabled
$0528 = Last enemy killed; $08=Amoeba (not sure of type), $05=Lurcher, $04=Triangle-like enemy (unsure of name), $03=Mecha-bird, $02=Grunt, $01=Skraug
I should note that $0528 refers to the last enemy killed by bombs or gun; unsure about other methods (there are several).
Controller input is actually stored in a couple places at once depending on what "context" you're in (main game vs. inventory menu vs. demonstration mode), but I didn't denote all the locations (there are a couple).
I haven't dug deep enough to figure out what $01b9 is yet. It starts out as $00, but after "some degree of time" (even if you just start the game and don't touch anything) it becomes $01. Forcing it to a particular value ($00 or $01) doesn't have any effect on the inventory or anything else that's immediately obvious to me. I couldn't find any direct references to $01b9 in the rest of the PRG bank, so I'd need to debug it in real-time.
Only two places that write to $01ed: the code run out of the RESET vector (setting $01ed=$00), and the above routine.
There are several subroutines that read $01ed. I found the main one ($c37e) which is what calls jsr $c6b0
, but also handles checking the controller 1 check for Select+Up+Left (for Level Select). Another one is $cbde which handles the controller 1 input check for Select+B (walk over all terrain). Those two routines require $01ed to be non-zero for the tricks to take effect.
Routines I haven't analysed, but I bet they have something to do with collision detection (gut feeling):
$dda5 (something's special about $99 (ends up in X) and $4d,x)
$e087 (skips a check against $9b and $4c, if debug is enabled)
$e128 (decrements $4c, but only if debug is *disabled*)
$e845 (tinkers with $70 and $99, if debug is enabled)
I did not find any code that would toggle or disable debug mode -- once it's on, it's on.
Anyway, my analysis obviously isn't fully definitive, but given the $c6b0 routine above, I would say the nuances/checks/etc. are deliberate. Meaning, I lean towards "yes, this really *is* what you have to do to enable debug mode". But at least you don't need a megaton bomb, from the look of the code... :-)