py65
py65 copied to clipboard
Several enhancements: (b)atch and (c)continue commands; relative address ranges, ascii dump option; compact mpu status; doc updates
py65 has been super useful while taking apart an old atari game (see work in progress https://github.com/patricksurry/eastern-front-1941/)
This PR collects a number of small extensions and improvements I made to py65 as I went along:
-
(b)atchcommand: I had a bunch of setup commands for labels etc that I repeated on each launch. I initially didcat setup.cmd - | py65which sort of works but it doesn't echo the input lines making the input confusing. The batch command and command-line option reads a file to the existingcmd.cmdqueuebuffer and tracks whether to echo each command as it's executed, as if typed interactively. -
(c)ontinue: to continue from current PC to next breakpoint, also suggested in https://github.com/mnaberez/py65/issues/51 I prefercontinuetogobased on other debuggers andgofeeling too close togoto. Another option would be to supportgotowithout an address -
support for implied and relative address ranges. Omitting the start address in a range continues from the end of the last address range. Writing a range with a
/separator interprets the second value as a length rather than an absolute address. This works fordisassemble,fillandmemmaking it easier to step through chunks of code/memory. Hitting enter to repeat a last command liked /20will disassemble the next 20 bytes (aligning to the end of the last instruction).
.m 2100:2120
2100: a9 00 85 82 a9 04 85 83 a9 00 85 84 a9 06 85 85 a9 1c
2112: 85 80 a9 21 85 81 4c 23 20 00 14 22 03 00 af
6502: PC=0000 A=00 X=00 Y=00 SP=ff FLAGS=<N0 V0 B1 D0 I0 Z0 C0>
.m :2140
2121: 22 1b 21 00 00 04 45 58 49 54 2d 21 38 a5 84 e9 02 85
2133: 84 b0 02 c6 85 a0 00 b1 84 85 80 c8 b1 84
6502: PC=0000 A=00 X=00 Y=00 SP=ff FLAGS=<N0 V0 B1 D0 I0 Z0 C0>
.m 2140/20
2140: 84 85 81 4c 23 20 24 21 04 44 52 4f 50 4f 21 38 a5 82
2152: e9 02 85 82 b0 02 c6 83 4c 23 20 46 21 04
6502: PC=0000 A=00 X=00 Y=00 SP=ff FLAGS=<N0 V0 B1 D0 I0 Z0 C0>
.m /20
2160: 53 57 41 50 66 21 38 a5 82 e9 02 85 82 b0 02 c6 83 a0
2172: 00 b1 82 85 86 c8 b1 82 85 87 38 a5 82 e9
6502: PC=0000 A=00 X=00 Y=00 SP=ff FLAGS=<N0 V0 B1 D0 I0 Z0 C0>
.
2180: 02 85 82 b0 02 c6 83 a0 00 b1 82 85 88 c8 b1 82 85 89
2192: a0 00 a5 86 91 82 c8 a5 87 91 82 18 a5 82
6502: PC=0000 A=00 X=00 Y=00 SP=ff FLAGS=<N0 V0 B1 D0 I0 Z0 C0>
.
- optional
ascii|noasciioption for thememcommand to append an ascii representation of each line. This is useful for understanding string tables etc:
.m 2290:22c0 ascii
2290: 23 20 3a 22 06 44 4f 55 42 4c 45 00 20 c7 21 3e 22 2b # :".DOUBLE. G!>"+
22a2: 21 92 22 09 51 55 41 44 52 55 50 4c 45 00 20 9b 22 9b !.".QUADRUPLE. .".
22b4: 22 2b 21 a9 00 88 10 01 60 51 86 0a 69 "+!)....`Q..i
6502: PC=0000 A=00 X=00 Y=00 SP=ff FLAGS=<N0 V0 B1 D0 I0 Z0 C0>
-
updated doc including a note about
;-style comments I discovered but hadn't seen written anywhere. -
as a personal preference I compacted the MPU summary from two lines to one which imho makes it much easier to compare changes as you step thru code. This could also be a command-line switch I guess? Here's the before and after:
PC AC XR YR SP NV-BDIZC
6502: 0000 00 00 00 ff 00110000
6502: PC=0000 A=00 X=00 Y=00 SP=ff FLAGS=<N0 V0 B1 D0 I0 Z0 C0>
lmk if it'd be helpful to break this PR into smaller chunks, since it combines a number of small features which maybe have individual objections