Tutorial · Chapter 23 of 23

Diagnose a program on the C64

Start with the result you expected and pick the smallest observation that can explain the difference.

Jump to a section

Check behavior before reading assembly

Boot the survey and replay the Space, Return, and Q sequence. Check the selected sector and visit count after each action. If a value is wrong, first locate where it changes. The screen shows the last value drawn, and a monitor breakpoint lets you inspect the live value before the renderer uses it.

For the REU map, compare one edited sector and one untouched sector after the flush. For the DLL, test both the present and missing payload. A successful call returning a Boolean false is still a result. An optional with no value says the loader could not make the export available.

Read the artifact that answers your question

QuestionArtifact or observation
Where did the compiler put my code or data?The map lists regions, sections, and placements.
Where should I break to inspect a function?The labels file gives the assembled addresses.
What did an assembly wrapper preserve?The generated assembly shows its pushes and pulls.
Did the DLL file make it onto the disk?List the disk, extract the entry, and compare it to the payload from the same build.

When a program works, keep a short reproduction sequence and the expected result. Change one value, memory claim, or load policy at a time. See Inspect, test, and compare for monitor and build workflows.

Tell a disk read from a cache activation

Reuse the shared-window disk. Find the addresses of the dependency load and activation labels in the survey's labels file. Set a VICE tracepoint on each of those four addresses. A tracepoint records each visit and lets the program continue. A breakpoint at the end of the main routine pauses so you can read the trace and inspect the screen.

Look for two visits to the disk paths, then the three activations Terrain, FixedMath, Terrain. The final Terrain activation repeats the first activation address. It does not revisit Terrain's disk path. The COST 05 BONUS 07 COST 06 screen confirms that all three calls returned their expected values.

The labels come from the compiler's generated assembly. Using your build's addresses keeps the trace valid when code moves. If the trace stops before all three calls, check the disk entries first, then compare the window and cache addresses with the compiler's map.

Continue from the feature you need next

Use the Tic-Tac-Toe case study for a complete input and drawing loop. Use the score updater when you need REU data and disk-loaded code in the same application. The guide contents lists the remaining chapters by topic.