I see this continues the gui spaghetti debugger trend
The Debugger code view seems to get confused easily
Attachment:
debug1.png [ 92.96 KiB | Viewed 3271 times ]
here the unknown block is
Code:
CPX #$50
BNE bC60B
RTS
pltXYtoPPU STX a00
STY a01
JMP plt_p00_toPPU
clearNMIFlags LDA #$00
STA NMIDoneFlag
STA NMIDoVRAMUpdates
Then latter you get to
Attachment:
debug2.png [ 115.26 KiB | Viewed 3271 times ]
Which is really
Code:
BNE bF82F
bF826 JSR sF383
LDX #$C0
LDY #$C0
BNE bF836
bF82F JSR sF383
LDX #$86
LDY #$86
bF836 JSR sF3D0
LDA #$00
STA aE4
JMP jF40F
bF840 LDY #$09
LDA #$EF
BNE bF826
fF846 .BYTE $0A
fF847 .BYTE $13
fF848 .BYTE $1C
fF849 .BYTE $25
fF84A .BYTE $2E
fF84B .BYTE $37
fF84C .BYTE $40
fF84D .BYTE $49
fF84E .BYTE $52,$5B,$07,$C3,$F8,$E2,$F8,$08
.BYTE $F9,$1B,$F9,$07,$2F,$F9,$60,$F9
.BYTE $A1,$F9,$CC,$F9,$07,$AF,$FA,$CA
.BYTE $FA,$E4,$FA,$F5,$FA,$07,$DA,$F9
The problem with having the auto magical code on the side is, when it gets confused there is nothing you can do. For example when you have inlined data with code ala
Attachment:
debug3.png [ 115.26 KiB | Viewed 3271 times ]
Code:
$CCA9: A5 31 sCCA9 LDA BirdEntFSMIndex
$CCAB: 20 5E C3 JSR jmpA
$CCAE: .WORD JustRTS,setupDogEnt,setDogAnimWalk,dogUpdWalk,setDogAnimSniff
$CCB8: .WORD updHoldFrame,setDogAnimShock,updHoldFrame,setDogAnimStartJump,dogUpdJump
$CCC2: .WORD dogSetupLaugh,updHoldFrame,dogSetupShowDucks,updHoldFrame,setupForNextDuck
$CCCC: .WORD aCE18,aCE2E,updHoldFrame,aCE40
$CCD4: A2 1F setupDogEnt LDX #$1F
$CCD6: BD 6E E7 bCCD6 LDA fE76E,X
$CCD9: 95 30 STA f30,X
$CCDB: CA DEX
$CCDC: 10 F8 BPL bCCD6
$CCDE: A9 03 LDA #$03
$CCE0: 85 BA STA NumShotsLeft
$CCE2: A9 01 LDA #$01
$CCE4: 85 BE STA RedrawBulletsFlag
$CCE6: 85 AD STA NeedUpdDuckShotRow
$CCE8: A9 02 LDA #$02 ;game palllete
$CCEA: 85 23 STA NextPallete
$CCEC: A5 25 LDA a25
$CCEE: C9 07 CMP #$07
$CCF0: D0 05 BNE bCCF7
$CCF2: A9 10 LDA #$10
$CCF4: 85 31 STA BirdEntFSMIndex
$CCF6: 60 RTS
Having a Monitor mode would really help with these issues and be nice in general(IMHO). That way I can D CCD4 and see the code I want. or doing the debug display in a live window so I can move up and down a few bytes and it disassembles from the address at the top of the screen.
If you have a monitor that lets you specify labels, breakpoints, watches then you can put a custom file on the the command line params, which then lets you open Mesen, add a bunch of labels, breakpoints etc from an external tool.
Having an option to open the debugger on BRK would be nice also, so I can add a BRK into code and then have the debugger fire on it from my code editor. Also assemblers will pad unused areas with 00, so if the code hits lala land it will stop.
CPU history command is the nectar of the gods. What it does is, it keeps a trace of the last N instructions the CPU performs, so if you code goes bad and you end up in lala land, you can type CHIS and it will show you exactly how it got to lala land - for example this is what it looks like
Code:
** Monitor 177 035
(C:$0c4f) chis
1431 A5 34 LDA $34 :A$16 X$02 Y$00 SP$f2 -
1433 10 01 BPL $1436 :A$02 X$02 Y$00 SP$f2 -
1436 A5 14 LDA $14 :A$02 X$02 Y$00 SP$f2 -
1438 29 08 AND #$08 :A$f7 X$02 Y$00 SP$f2 N -
143a F0 48 BEQ .mainGameHitDetect_C64VICTriggerSystem__checkRelease :A$00 X$02 Y$00 SP$f2 - Z
1484 A9 00 LDA #$00 :A$00 X$02 Y$00 SP$f2 - Z
1486 85 36 STA $36 :A$00 X$02 Y$00 SP$f2 - Z
1488 85 37 STA $37 :A$00 X$02 Y$00 SP$f2 - Z
148a 60 RTS :A$00 X$02 Y$00 SP$f2 - Z
091a 20 F1 12 JSR .HUD_updateCurrBird :A$00 X$02 Y$00 SP$f4 - Z
12f1 24 32 BIT $32 :A$00 X$02 Y$00 SP$f2 - Z
12f3 10 1C BPL .HUD_updateCurrBird__exit :A$00 X$02 Y$00 SP$f2 N - Z
12f5 24 23 BIT $23 :A$00 X$02 Y$00 SP$f2 N - Z
12f7 10 18 BPL .HUD_updateCurrBird__exit :A$00 X$02 Y$00 SP$f2 N - Z
12f9 E6 31 INC $31 :A$00 X$02 Y$00 SP$f2 N - Z
12fb A0 00 LDY #$00 :A$00 X$02 Y$00 SP$f2 -
12fd A5 31 LDA $31 :A$00 X$02 Y$00 SP$f2 - Z
12ff 29 0F AND #$0F :A$4b X$02 Y$00 SP$f2 -
1301 D0 0E BNE .HUD_updateCurrBird__exit :A$0b X$02 Y$00 SP$f2 -
1311 60 RTS :A$0b X$02 Y$00 SP$f2 -
091d 20 DF 09 JSR .GFSM_dispatchBirdFunction :A$0b X$02 Y$00 SP$f4 -
09df A6 24 LDX $24 :A$0b X$02 Y$00 SP$f2 -
09e1 BD F0 09 LDA .BirdFSMLUT_hi,X :A$0b X$01 Y$00 SP$f2 -
09e4 48 PHA :A$0a X$01 Y$00 SP$f2 -
09e5 BD EA 09 LDA .BirdFSMLUT_lo,X :A$0a X$01 Y$00 SP$f1 -
09e8 48 PHA :A$69 X$01 Y$00 SP$f1 -
09e9 60 RTS :A$69 X$01 Y$00 SP$f0 -
0a6a 20 53 0D JSR .bird_updateBirdAnim :A$69 X$01 Y$00 SP$f2 -
0d53 C6 1B DEC $1B :A$69 X$01 Y$00 SP$f0 -
0d55 30 01 BMI $0D58 :A$69 X$01 Y$00 SP$f0 - Z
0d57 60 RTS :A$69 X$01 Y$00 SP$f0 - Z
0a6d 20 8F 0D JSR .bird_updateBirdMovement :A$69 X$01 Y$00 SP$f2 - Z
0d8f A6 1C LDX $1C :A$69 X$01 Y$00 SP$f0 - Z
0d91 BD AD 33 LDA .BirdYXDeltas,X :A$69 X$09 Y$00 SP$f0 -
0d94 C9 AA CMP #$AA :A$ff X$09 Y$00 SP$f0 N -
0d96 D0 07 BNE $0D9F :A$ff X$09 Y$00 SP$f0 - C
0d9f 18 CLC :A$ff X$09 Y$00 SP$f0 - C
0da0 65 17 ADC $17 :A$ff X$09 Y$00 SP$f0 -
0da2 85 17 STA $17 :A$97 X$09 Y$00 SP$f0 N - C
0da4 E8 INX :A$97 X$09 Y$00 SP$f0 N - C
0da5 BD AD 33 LDA .BirdYXDeltas,X :A$97 X$0a Y$00 SP$f0 - C
0da8 F0 19 BEQ .bird_updateBirdMovement__endAdd :A$01 X$0a Y$00 SP$f0 - C
0daa 30 0C BMI .bird_updateBirdMovement__sub :A$01 X$0a Y$00 SP$f0 - C
0dac 18 CLC :A$01 X$0a Y$00 SP$f0 - C
0dad 65 15 ADC $15 :A$01 X$0a Y$00 SP$f0 -
0daf 85 15 STA $15 :A$50 X$0a Y$00 SP$f0 -
0db1 90 10 BCC .bird_updateBirdMovement__endAdd :A$50 X$0a Y$00 SP$f0 -
0dc3 E8 INX :A$50 X$0a Y$00 SP$f0 -
0dc4 86 1C STX $1C :A$50 X$0b Y$00 SP$f0 -
0dc6 60 RTS :A$50 X$0b Y$00 SP$f0 -
0a70 20 C7 0D JSR .bird_checkClipEntityXandY :A$50 X$0b Y$00 SP$f2 -
0dc7 A5 15 LDA $15 :A$50 X$0b Y$00 SP$f0 -
0dc9 A6 16 LDX $16 :A$50 X$0b Y$00 SP$f0 -
0dcb D0 06 BNE $0DD3 :A$50 X$00 Y$00 SP$f0 - Z
0dcd C9 18 CMP #$18 :A$50 X$00 Y$00 SP$f0 - Z
0dcf F0 23 BEQ .bird_checkClipEntityXandY__offLeftScreen :A$50 X$00 Y$00 SP$f0 - C
0dd1 D0 04 BNE .bird_checkClipEntityXandY__checkY :A$50 X$00 Y$00 SP$f0 - C
0dd7 A5 17 LDA $17 :A$50 X$00 Y$00 SP$f0 - C
0dd9 C9 19 CMP #$19 :A$97 X$00 Y$00 SP$f0 N - C
0ddb F0 05 BEQ .bird_checkClipEntityXandY__aboveTopY :A$97 X$00 Y$00 SP$f0 - C
0ddd C9 92 CMP #$92 :A$97 X$00 Y$00 SP$f0 - C
0ddf F0 07 BEQ .bird_checkClipEntityXandY__belowBottomY :A$97 X$00 Y$00 SP$f0 - C
0de1 60 RTS :A$97 X$00 Y$00 SP$f0 - C
0a73 20 4F 0C JSR .bird_setBirdXY :A$97 X$00 Y$00 SP$f2 - C
(C:$0c4f)
While you have the logger, you have to set it up and it starts to eat RAM and file space and then you have to wade through it all to get what you want, just having a last 64/128 commands on a single command is enough to save the day.
With the hex editor, showing Blue - execute, Green - Read, Red - Write, Yellow Read/Write and being able to turn off decay and then Mark the areas already highlighted. This way you can play game for bit, mark access, do new thing. Immediately see which bit of code was run when you did the thing and which memory locations it accessed to do it. Also handy for finding if code indexes over an array boundary.
Having HardReset/ColdBoot/ColdStart also reloading the ROM file would be worth its weight in gold. I.e see bug, change code, assemble, then ColdStart, where WarmStart just keeps the current code. FYI VICE has the terms RESET > HARD SOFT and its translated into a stupid number of languages so you could look at what they have. I think the way it gets away with it, is it has a parent menu Reset then then opens to options for Hard, Soft, Drive 8, Drive 9, Drive 10, Drive 11 so it doesn't have to translate or show Hard Reset, Soft Reset.
Uppercase opcodes is the CBM standard, mainly because the PET and other computers of the era that followed, TRS-80, Apple ][ only had uppercase character sets so the monitors and assmeblers of the day also did uppercase, once we got to the C64 era where we did have upper and lower case modes, it was such a standard and BASIC was done in all uppercase it just stuck. Although on a PC I type all my code lowercase.