Machine code monitor fixes#704
Open
chrisgleissner wants to merge 6 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Updates the monitor/disassembler to correctly treat only rel-specified opcodes as branches (fixing BIT being misinterpreted), switches UI/help text and docs from ESC to RUN/STOP, and hardens ROM cache buffers against unaligned 32-bit writes on Nios2.
Changes:
- Adjust 6502 opcode templates/operand formatting so branch behavior is driven by an explicit
reloperand spec (and add tests for additional opcodes/ASM edit behavior). - Update monitor help text, tests, and documentation to use
RUN/STOPas the cancel/exit key instead ofESC. - Align ROM cache buffers to 4 bytes to prevent unaligned 32-bit store traps in the flash read path.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| software/test/monitor/machine_monitor_test_support.cc | Updates test UI stub signature to match new string_edit interface. |
| software/test/monitor/machine_monitor_test.cc | Adds disassembler/ASM edit tests and updates help text expectations for RUN/STOP. |
| software/monitor/u64_memory_backend.cc | Forces 4-byte alignment for ROM cache buffers to avoid unaligned word stores. |
| software/monitor/machine_monitor.cc | Switches branch detection to rel parsing and updates UI strings to RSTOP. |
| software/monitor/disassembler_6502.cc | Makes branch operand handling template-driven (rel), adjusts templates, removes $nn,S handling. |
| doc/machine_code_monitor.md | Documents RUN/STOP replacing ESC for cancel/exit flows. |
Comments suppressed due to low confidence (1)
software/monitor/disassembler_6502.cc:1
- Support for the
$nn,Soperand spec was removed from bothoperand_length()andformat_operand(). If any remaining opcode templates still include$nn,S, those opcodes will now likely get an incorrect operand length and/or blank/misformatted operands. Either ensure no templates use$nn,Sanymore (and consider adding a targeted test for any opcode that previously relied on it), or keep$nn,Shandling in these helpers.
#include "disassembler_6502.h"
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- asm_is_branch(): reuse the decoder's operand_spec() helper instead of a hard-coded "templ + 4" offset, so branch classification stays consistent with disassembly. operand_spec() is given external linkage (moved out of the anonymous namespace, declared in the header). - u64_memory_backend: use the standard C++ alignas(4) instead of the GCC-specific __attribute__((aligned(4))) for the ROM cache buffers, keeping the same 4-byte alignment guarantee. - disassembler tests: assert the remaining relative branches (BPL/BMI/BVC/ BVS/BNE) so a missing or wrong "rel" operand spec is caught by tests.
Round-trip a known memory pattern through the monitor's S(ave) and L(oad) commands to two targets under the /Temp RAM disk: a plain top-level PRG file and a PRG inside a freshly created D64 image. The file picker is driven over telnet and the data is verified through the REST memory API.
… template updates
Contributor
Author
|
Hi @GideonZ , Thanks for reviewing and hopefully merging. Best wishes |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
This PR contains bug fixes as well as test improvements for the machine code monitor.
Bug Fixes
BITopcode, as well as for a few illegal opcodesRUN/STOPinstead ofESCin monitor help, header text, docs, and testsRelated PRs
Documentation for the machine code monitor was added to GideonZ/1541u-documentation#27
Test improvements
Tests
All E2E tests for the monitor, as well as for the recently added REST API for injecting keyboard and joystick events were successfully run after deploying this firmware to my Ultimate 64 Elite I via JTAG.
Machine Code Monitor
python3 tools/developer/machine-code-monitor/monitor_test.py --host u64 --port 23 --rest-host u64Result:
monitor_test: OK (23 checks)Input REST API
python3 tools/api/input_test.py -H u64 -r u64Result:
input_test: OK (44 checks)