Skip to content

Several enhancements: (b)atch and (c)continue commands; relative address ranges, ascii dump option; compact mpu status; doc updates #69

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 7 commits into
base: main
Choose a base branch
from

Conversation

patricksurry
Copy link

@patricksurry patricksurry commented Sep 30, 2022

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)atch command: I had a bunch of setup commands for labels etc that I repeated on each launch. I initially did cat setup.cmd - | py65 which 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 existing cmd.cmdqueue buffer 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 Feature Request: a "continue" command #51 I prefer continue to go based on other debuggers and go feeling too close to goto. Another option would be to support goto without 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 for disassemble, fill and mem making it easier to step through chunks of code/memory. Hitting enter to repeat a last command like d /20 will 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|noascii option for the mem command 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>

@patricksurry patricksurry changed the title Adds (i)nput and (c)ontinue commands; compact version of mpu state Adds (i)nput, (c)ontinue, and (b)atch commands; ascii dump option; relative address ranges; compact mpu status Jul 26, 2023
@patricksurry patricksurry changed the title Adds (i)nput, (c)ontinue, and (b)atch commands; ascii dump option; relative address ranges; compact mpu status Several enhancements: (b)atch and (c)continue commands; relative address ranges, ascii dump option; compact mpu status; doc updates Jul 26, 2023
@patricksurry
Copy link
Author

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant