Chapter 7 of 9
Find the first wrong result
Suppose a game awards one point for a correct answer. You start with seven points, answer once, and finish with nine. Which part needs fixing? The score might have gone up twice, or the game might have printed the wrong number. You can settle that question before changing a line.
Stop before the score is printed
Use a separate BASIC draft for this exercise. Save any work you want to keep in the editor and on the guest. Share the practice draft with review-and-run access. Ask ChatGPT to propose the following listing exactly, including the deliberate scoring mistake.
10 S=7
20 S=S+2
30 PRINT "SCORE";S
40 END
- Review the four lines in VCC Plus and choose Apply Edit. In the BASIC editor, click the gutter beside line 30 to set a breakpoint. Open Variables and Watches and add the watch
S. - Start the reviewed program with Run in its assistant panel. When line 30 is highlighted, lines 10 and 20 have executed. The
PRINTat line 30 is still ahead of you. - Read
Sin the native workspace. Ask ChatGPT to make its own observation.
Use the current BASIC run and get_debug_snapshot. Which numbered line has the guest reached? What value does my watch S show? Wait for me before proposing a change.
The expected stop is line 30 with S = 9. The guest already holds the wrong number before it draws the score. Continue in VCC Plus lets the pending statement print it. Wait for the guest to return to its BASIC prompt.
The rule is one point per correct answer. Use the current revision to propose the smallest change that fixes the measured error. Keep the starting score and the display line.
The repair you want to see is 20 S=S+1. Check the line in the native review. Apply it, confirm the breakpoint and watch are still set, then start a new reviewed run. The watch should now show eight at line 30. Continue and compare that value with the score printed in the guest. Save the corrected draft if you want to keep it. You have tested both places where the error could have appeared.
Choose a repair the evidence supports
A compiler diagnostic can identify a name that the compiler cannot resolve. It cannot tell you that a game should award one point. In the C version of this exercise, an expression such as score += 2; builds successfully. A request for a diagnostic-backed C line repair would have no diagnostic to attach.
For a scoring mistake in a shared C or assembly project, ask for the source statement responsible and a project edit. Even a project edit can touch just one file. Read the before and after text in VCC Plus. Does the change correct the arithmetic, or does it merely print the number you hoped to see?
My rule is one point per correct answer. The watch shows the wrong score before printing. Read the current project and propose one change to the calculation. Tell me which input will distinguish that repair from printing a fixed number.
When you apply a project repair, ask for a build of its new revision. Start the resulting program locally and replay the same input. A second run with a different starting value will test whether the repair generalizes.
Read the stop you actually reached
For an ordinary C project, add a watch in the C workspace before starting the shared build. Choose Run C Build… → Inspect at main when you want to pause at the first verified statement in main. Choose Play in CoCo to run an interactive program. Play records the entry stop and then continues. A watch from that stop describes entry even if the game is now showing its fifth question.
Here is a recorded observation from a two-file C project in installed build 29. Build 30 retains these debugger tools. The project defined the unsigned integer beaconWord. A reader trying a different project will see different addresses and names.
| Observation | What ChatGPT read through MCP |
|---|---|
| Verified source stop | main.c, line 8 |
| Program counter (PC) | $2E71 |
| Configured watch | beaconWord = 19754 |
| Readable code in the snapshot | $2E6D through $2E97 |
| Three bytes at the PC | 17 00 16 in hexadecimal |
Try this with a watch that belongs to your project.
Read the run I started. From get_debug_snapshot, report the source stop, PC and available watches. If three bytes starting at the PC fit inside one reported range, use this run and snapshot to read them. Say which values you observed.
get_run identifies the launch. get_debug_snapshot supplies the snapshot ID and the ranges captured at the stop. read_debug_memory uses both IDs. The dollar sign in $2E71 marks a hexadecimal address. The three bytes in this example came from that address in the captured program. A watch marked unavailable is worth reporting as such. Select a mapped executable statement and an in-scope variable for your next native debugging session.
For assembly, a useful place to stop is the final RTS after a calculation and a store. Set the source breakpoint on the return instruction before choosing Run Shared Build…. At that stop the store has executed and the register used by the calculation still holds its value. In a tested MC6809 routine, A and the byte at $0400 both contained $29 (41). Check the readable ranges before asking for that byte in another program.
Compare the two processors
For a C project, Allow Disposable Playtests in its Assistant panel grants isolated runs of its built disk. A fresh connection can start a 512 KB MC6809 (the default) or HD6309. Ask the assistant to discover its current tools first. Changing the Mac's processor architecture does not change the emulated CoCo CPU.
Build the current compatible project once. Start one disposable MC6809 run, stop at a verified function, and record the artifact, registers, available globals and framebuffer. Stop and retain its disk. Start a separate HD6309 run of that same artifact and repeat the observation. Report actual processor, execution mode, MD and any unavailable evidence. Use ordinary guest input.
The 6309 resets into emulation mode. Only a guest instruction changes it to native mode. Its debugger also exposes E, F, W, V and MD; a 6809 has no such registers. Selecting a 6309 does not rebuild your code or supply missing C metadata. A cold restart keeps the selected CPU and writable test disk; choose a new run to change processors. An early startup reply names the requested CPU; wait for a ready receipt before claiming the observed mode.
Both input plans and audio capture release physical keys when they finish. Audio capture also releases keys before recording its following bounded interval. A sound clip taken after a movement plan does not prove that the movement keys remained held throughout that clip.
Repeat one observation after a change
If you edit the draft while ChatGPT is preparing a repair, stop there. Have it read the current revision, compare it with the intended change, and submit a fresh proposal if the repair still belongs there. A new build can move a statement to another address. A reset, a different mounted medium or a new launch can invalidate an earlier run. If the app reports a stale run or snapshot, obtain the identifiers for the matching launch and stop again before reading memory.
For a last pass, choose one behavior the repair should preserve. With the four-line BASIC exercise, try a starting value of zero in your practice copy. Predict the score, rerun, and inspect the same watch before the same print. A result of one shows that the program adds a point to its starting score. Simply replacing the output with a literal eight would have failed this second check.
Recorded check. On both the MC6809 and HD6309 guests in the build 30 emulator core, line 30 stopped with S equal to 9, 8 and 1 in the three versions. After Continue, each guest printed that same score and returned to OK.