Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
117 commits
Select commit Hold shift + click to select a range
6c78b0f
Added hex viewer
chrisgleissner Jul 4, 2023
1e1e778
Reduced memory use of hex viewer and using Editor inheritance hierarchy
chrisgleissner Jul 4, 2023
541af31
Support new editor keyboard shortcuts to better navigate across large…
chrisgleissner Jul 4, 2023
b1ccf72
Peek and poke
chrisgleissner Jul 8, 2023
af617ad
Added hex monitor for entire C64 RAM
chrisgleissner Jul 8, 2023
257e20e
Fixed monitor for U64 in 'Freeze' UI mode
chrisgleissner Jul 9, 2023
bf47964
Fix peek to work in both freeze and HDMI overlay modes
chrisgleissner Jul 9, 2023
c0d8f95
Merge remote-tracking branch 'origin/master' into feature/151-machine…
chrisgleissner Apr 26, 2026
7cc22c2
Merge branch 'master' into feature/151-machine-code-monitor
chrisgleissner Apr 26, 2026
0a3ba0e
Add machine code monitor
chrisgleissner Apr 28, 2026
6fb642a
Removed machine code monitor buffering and fixed borders
chrisgleissner Apr 28, 2026
607c5ed
Fix scrolling in disassembly mode
chrisgleissner Apr 28, 2026
484fcbe
Implement freeze mode support in machine monitor and memory backend
chrisgleissner Apr 28, 2026
70ecddf
Fix U2+ build
chrisgleissner Apr 28, 2026
5f22ff4
Refactor machine monitor and add assembler functionality
chrisgleissner Apr 29, 2026
142a61e
Refactor DEL key handling in MachineMonitor for unified behavior acro…
chrisgleissner Apr 29, 2026
22ca9e8
Add binary view and file I/O support to Machine Monitor
chrisgleissner Apr 29, 2026
9f6bf74
Move machine code monitor source to dedicated subfolder
chrisgleissner Apr 29, 2026
fb5d9d7
Remove unused build date and version macros from system_info.cc
chrisgleissner Apr 29, 2026
1b49b75
Refactor U64Machine to streamline CPU port access and improve memory …
chrisgleissner Apr 29, 2026
7c7a57e
Fix monitor edge cases
chrisgleissner Apr 29, 2026
68594db
Refactor Machine Monitor: Update CPU and VIC bank status handling. Im…
chrisgleissner Apr 30, 2026
23e82be
Add live VIC bank management and improve memory backend handling for …
chrisgleissner Apr 30, 2026
b106db9
Allow for concurrent use of multiple machine code monitors, both dire…
chrisgleissner Apr 30, 2026
1d1328d
Update key definitions to support user interface overlay/freeze mode …
chrisgleissner Apr 30, 2026
15e6286
Implement number picker functionality in Machine Monitor: add preview…
chrisgleissner Apr 30, 2026
ccb3535
Refactor machine monitor commands and improve popup handling
chrisgleissner Apr 30, 2026
428c617
Add opcode candidate collection with deterministic ordering and impro…
chrisgleissner Apr 30, 2026
710af6d
Refactor frozen byte write logic
chrisgleissner Apr 30, 2026
e795ac5
Enhance Machine Monitor number picker functionality for assembly view
chrisgleissner Apr 30, 2026
3d81fba
Simplify machine monitor codebase
chrisgleissner Apr 30, 2026
691fc27
Integrate and harden the machine code monitor
chrisgleissner May 1, 2026
9a4c22e
Reintroduce poke functionality
chrisgleissner May 1, 2026
c598b46
Refactor machine monitor to reduce code changes
chrisgleissner May 1, 2026
a406a2e
Enhance TreeBrowser and related classes with synthetic picker entry f…
chrisgleissner May 1, 2026
f71e9a3
Enhance machine monitor functionality with go command handling and co…
chrisgleissner May 1, 2026
c7a7570
Relocated machine code monitor to software/monitor and software/test/…
chrisgleissner May 1, 2026
c5eb37b
Reduce formatting churn in current branch
chrisgleissner May 1, 2026
3f165aa
Reduce formatting churn in current branch
chrisgleissner May 1, 2026
9f44142
Add machine code monitor initialization
chrisgleissner May 1, 2026
ef11326
Add context manager for test checks and enhance monitor tests
chrisgleissner May 1, 2026
99c3c35
Add support for U2
chrisgleissner May 1, 2026
0caa5df
Refactor conditional compilation for monitor initialization and task …
chrisgleissner May 1, 2026
9b62686
Add monitor bookmarks and polling
chrisgleissner May 2, 2026
cc46d0b
Add monitor bookmarks and polling
chrisgleissner May 2, 2026
51222e0
Improved binary rendering and bookmark shortcuts
chrisgleissner May 2, 2026
4c4804b
Remove test binaries
chrisgleissner May 2, 2026
8c99668
Merge branch 'master' into feature/151-machine-code-monitor
chrisgleissner May 4, 2026
b1fad9f
feat: visual path picker for Copy/Move destination
Jondalar Mar 10, 2026
4619d50
Integrate monitor with shared path picker
chrisgleissner May 4, 2026
46bc3ed
Limit path picker import to shared sources
chrisgleissner May 4, 2026
e4ea6a6
Refactor machine monitor to incorporate PR comments
chrisgleissner May 4, 2026
37e7dd0
fix: correct comment for synthetic save-mode browser entry
chrisgleissner May 4, 2026
f192e60
Unified file/path picker based on TreeBrowser
chrisgleissner May 4, 2026
8759b70
Fixed consolidated TreeBrowser-based path picker and verified to work…
chrisgleissner May 5, 2026
4374583
Merge branch 'GideonZ:master' into feature/151-machine-code-monitor
chrisgleissner May 8, 2026
3fe625a
Merge branch 'GideonZ:master' into feature/151-machine-code-monitor
chrisgleissner May 11, 2026
56996eb
Extend monitor widths and support width cycling. Added machine monito…
chrisgleissner May 11, 2026
8c1ba1e
Update machine monitor docs. Simplify bookmark storage. Allow at most…
chrisgleissner May 11, 2026
4b1184b
Add machine monitor documentation
chrisgleissner May 12, 2026
6f9625a
Improved ASCII and screen views
chrisgleissner May 12, 2026
72903b8
Refine ASCII and Screen Views documentation
chrisgleissner May 12, 2026
6b787a7
Enhance paging and 0000/FFFF boundary handling
chrisgleissner May 12, 2026
6a152ab
Enhance documentation for machine monitor
chrisgleissner May 12, 2026
1e536f4
Rename to Machine Code Monitor and enhance instructions
chrisgleissner May 12, 2026
33e5b74
Rename machine_monitor.md to machine_code_monitor.md
chrisgleissner May 12, 2026
efb8157
Align view chapter order with view overview table order
chrisgleissner May 12, 2026
a56de3a
Refine Machine Code Monitor documentation
chrisgleissner May 12, 2026
fd3ed00
Add calculator. Add follow/return in Assembly view.
chrisgleissner May 14, 2026
4648aeb
Merge remote-tracking branch 'origin/master' into feature/151-machine…
chrisgleissner May 14, 2026
c821e38
Improve hex prefix consistency in number format tool by permitting on…
chrisgleissner May 14, 2026
6bdc3c0
Added monitor debugger
chrisgleissner May 23, 2026
2836fcc
Implement live stepping for U64 Debug session with BRK handling
chrisgleissner May 23, 2026
904236d
Enhance keyboard input handling and update debug session flow
chrisgleissner May 23, 2026
812fdd3
Fix debugging 'over' step
chrisgleissner May 23, 2026
56a0c9f
Implement CTRL+X reset functionality in Debug mode
chrisgleissner May 23, 2026
473bd44
Refactor memory block copy logic to improve overlap handling in U64Ma…
chrisgleissner May 23, 2026
2b3e252
Add comprehensive tests for flag control flow and edge cases in debug…
chrisgleissner May 23, 2026
2102ec0
Add tests for page-crossing branches and 6502 indirect-JMP behavior
chrisgleissner May 23, 2026
b68069e
Enhance monitor debug help and add soak test for U64 Machine Code Mon…
chrisgleissner May 23, 2026
63828b1
Add U2 Debug Session Implementation
chrisgleissner May 23, 2026
6c6bf57
Refactor Machine Code Monitor documentation for clarity and structure
chrisgleissner May 23, 2026
5b1342a
Refine Machine Code Monitor documentation for clarity and detail in v…
chrisgleissner May 23, 2026
08150ae
Clarify Debug command descriptions in documentation
chrisgleissner May 23, 2026
a6f2aed
Remove patch safety section from documentation
chrisgleissner May 23, 2026
62f19c9
Enhance Machine Code Monitor with breakpoint popup functionality and …
chrisgleissner May 23, 2026
084eb73
Improved ROM shadowing for BASIC/KERNAL execution.
chrisgleissner May 23, 2026
2569782
Fix debug stepping in overlay mode. Improve help.
chrisgleissner May 23, 2026
d188168
Update breakpoint popup layout and help text in Machine Code Monitor
chrisgleissner May 23, 2026
1af0de7
Fix machin monitor debug step over for both UI Overlay and UI Freeze …
chrisgleissner May 26, 2026
a002749
Enhance machine monitor with reset handling and context management fo…
chrisgleissner May 26, 2026
6c920b9
Refactor machine monitor color handling and enhance debug session byt…
chrisgleissner May 27, 2026
e5b23c1
Add tests for KERNAL and BASIC ROM stepping in machine code monitor
chrisgleissner May 27, 2026
9d7749a
Improve the machine code debugger by fixing memory reads, shortcut ha…
chrisgleissner May 28, 2026
6340c59
Enhance machine code monitor with improved breakpoint handling and vi…
chrisgleissner May 28, 2026
a6e2d29
Add ASM functionality and tests for KERNAL disassembly and navigation
chrisgleissner May 28, 2026
c63f4a1
Add "Run to Cursor" feature in debug mode. Add CPU flag highlighting.
chrisgleissner May 29, 2026
62b85fb
Update debug help screen commands and add test for K Cursor behavior …
chrisgleissner May 29, 2026
4a95978
Update help screen command for K Cursor to improve clarity
chrisgleissner May 29, 2026
79ef3f3
Display inferred RTS address. Fix disassembly for some opcodes.
chrisgleissner May 29, 2026
edff65f
Enhance machine code monitor with observed PC tracking and improved R…
chrisgleissner May 29, 2026
b852b63
Refactor NMI redirection to include CPU port handling. Limit breakpoi…
chrisgleissner May 29, 2026
e78b7ef
Refactor debug footer to remove redundant SP highlight. Update tests …
chrisgleissner May 29, 2026
980710c
Enhance debug ownership tests to cover local ownership scenarios and …
chrisgleissner May 29, 2026
57de07c
Refactor entry routine handling in soak test: clear breakpoints and e…
chrisgleissner May 29, 2026
9e2dbd2
Enhance machine code monitor tests: add test group selection and list…
chrisgleissner May 29, 2026
6b5cde5
Merge branch 'GideonZ:master' into feature/151-machine-code-monitor-d…
chrisgleissner May 29, 2026
9b843e6
Support debug stepping for RAM under ROM
chrisgleissner May 31, 2026
3eac2c4
Fix debugging under ROM in UI Freeze mode. Implement staged NMI handl…
chrisgleissner Jun 1, 2026
be26eef
Increase test coverage. Improve RAM under ROM debug stepping.
chrisgleissner Jun 3, 2026
9e3ddb1
Add global reset cancel function to machine monitor interface
chrisgleissner Jun 3, 2026
200a8b2
Enhance monitor debug session handling and testing framework
chrisgleissner Jun 4, 2026
27cfa4a
Enhance ROM breakpoint handling with sustained settle logic in debug …
chrisgleissner Jun 5, 2026
eac5bf2
Model relaunch-backstop captures in visible-ROM step tests
chrisgleissner Jun 6, 2026
f7cf851
Fix visible-ROM single-step regression: settle only on breakpoint re-…
chrisgleissner Jun 6, 2026
099d524
Add visible ROM step coherency measurement harness
chrisgleissner Jun 6, 2026
7304ce8
Reverted last commit since only relevant for debugging and needs spec…
chrisgleissner Jun 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
756 changes: 756 additions & 0 deletions doc/machine_code_monitor.md

Large diffs are not rendered by default.

14 changes: 14 additions & 0 deletions software/components/indexed_list.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,20 @@ class IndexedList
LEAVE_SAFE_SECTION
// printf("ed. El=%d. Size=%d\n", elements, size);
}

void prepend(T el) {
ENTER_SAFE_SECTION
if(elements == size)
expand();
for(int i=elements; i>0; i--) {
element_array[i] = element_array[i-1];
removal[i] = removal[i-1];
}
element_array[0] = el;
removal[0] = 0;
elements++;
LEAVE_SAFE_SECTION
}

int remove(T el) {
ENTER_SAFE_SECTION
Expand Down
1 change: 1 addition & 0 deletions software/infra/host.h
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ class HostClient
virtual ~HostClient() { }

virtual void release_host() { }
virtual bool request_reset_reentry_after_c64_reset() { return false; }
};

#endif
183 changes: 183 additions & 0 deletions software/io/c64/c64.cc
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,68 @@
#include "u64_machine.h"
#endif

#if U64
// Pristine FPGA ROM-image snapshot + dirty flag. The machine-code monitor's debug
// engine steps RAM-under-ROM and KERNAL/BASIC ROM by patching BRK traps directly
// into the FPGA ROM-image buffers (U64_*_BASE). If such a patch is not restored
// before a reset (e.g. a REST reset fired while the debug CPU is parked), the
// stale byte stays in the KERNAL image and the next C64 reset executes it during
// early boot, wedging the machine (blank screen, no READY, frozen jiffy) with no
// recovery short of a JTAG ROM reload. To make every reset self-healing we capture
// the authoritative ROM image once it is loaded (init_system_roms) and re-apply it
// on reset whenever the monitor has flagged the image dirty.
namespace {
uint8_t s_pristine_kernal[8192];
uint8_t s_pristine_basic[8192];
bool s_pristine_rom_valid = false;
}
extern "C" volatile bool g_u64_rom_image_dirty = false;
extern "C" void u64_mark_rom_image_dirty(void) { g_u64_rom_image_dirty = true; }

// The FPGA ROM-image apertures must be copied byte-by-byte through volatile
// pointers (block memcpy reads back zeros here), matching the snapshot path in
// u64_memory_backend.cc.
static void copy_rom_aperture_in(uint8_t *dst, volatile uint8_t *src, unsigned len)
{
for (unsigned i = 0; i < len; i++) dst[i] = src[i];
}
static void copy_rom_aperture_out(volatile uint8_t *dst, const uint8_t *src, unsigned len)
{
for (unsigned i = 0; i < len; i++) dst[i] = src[i];
}
static bool buffer_all_zero(const uint8_t *p, unsigned len)
{
for (unsigned i = 0; i < len; i++) if (p[i]) return false;
return true;
}

static void capture_pristine_rom_image(void)
{
// Only BASIC and KERNAL are healed: a stale debug BRK in those is executed
// during boot and wedges the machine. The CHAR ROM is never executed, so a
// leaked CHAR patch is at worst a cosmetic glyph and is left to the normal
// per-session restore; we deliberately do NOT snapshot/rewrite the CHAR
// aperture on reset (its base differs and a bad snapshot would render every
// glyph as garbage).
copy_rom_aperture_in(s_pristine_basic, (volatile uint8_t *)U64_BASIC_BASE, sizeof(s_pristine_basic));
copy_rom_aperture_in(s_pristine_kernal, (volatile uint8_t *)U64_KERNAL_BASE, sizeof(s_pristine_kernal));
// Only trust the snapshot if the KERNAL image actually read back (guards
// against a bad capture ever being restored as a zeroed, unbootable ROM).
s_pristine_rom_valid = !buffer_all_zero(s_pristine_kernal, sizeof(s_pristine_kernal));
g_u64_rom_image_dirty = false;
}

static void restore_pristine_rom_image(void)
{
if (!s_pristine_rom_valid) {
return;
}
copy_rom_aperture_out((volatile uint8_t *)U64_BASIC_BASE, s_pristine_basic, sizeof(s_pristine_basic));
copy_rom_aperture_out((volatile uint8_t *)U64_KERNAL_BASE, s_pristine_kernal, sizeof(s_pristine_kernal));
g_u64_rom_image_dirty = false;
}
#endif

#ifndef CMD_IF_SLOT_BASE
#define CMD_IF_SLOT_BASE *((volatile uint8_t *)(CMD_IF_BASE + 0x0))
#define CMD_IF_SLOT_ENABLE *((volatile uint8_t *)(CMD_IF_BASE + 0x1))
Expand Down Expand Up @@ -147,6 +209,7 @@ C64::C64()
C64_STOP_MODE = STOP_COND_FORCE;
C64_MODE = MODE_NORMAL;
isFrozen = false;
frozen_mode = MODE_NORMAL;
backupIsValid = false;
buttonPushSeen = false;
client = 0;
Expand Down Expand Up @@ -584,6 +647,14 @@ void C64::resume(void)

void C64::reset(void)
{
#if U64
// Heal any debug BRK patch the monitor left in the FPGA ROM image before the
// CPU starts executing the reset/boot code, so a leaked KERNAL/BASIC byte can
// never wedge the boot. The dirty flag is still maintained for diagnostics,
// but reset is the recovery chokepoint and must be robust even if a stale
// patch path failed to mark the image dirty.
restore_pristine_rom_image();
#endif
C64_MODE = MODE_NORMAL;
C64_MODE = C64_MODE_RESET;
ioWrite8(ITU_TIMER, 20);
Expand All @@ -597,6 +668,107 @@ bool C64::is_in_reset(void)
return (C64_MODE & C64_MODE_RESET);
}

uint8_t C64::peek(uint16_t address)
{
bool stopped_it = false;
volatile uint8_t *ram = (volatile uint8_t *)C64_MEMORY_BASE;
uint8_t saved_mode = 0;
bool restore_mode = false;
uint8_t value;

if (!is_stopped()) {
stop(false);
stopped_it = true;
}

if (isFrozen && address >= 0x0400 && address < 0x0800) {
value = ((uint8_t *)screen_backup)[address - 0x0400];
} else if (isFrozen && address >= 0x0800 && address < 0x1000) {
value = ((uint8_t *)ram_backup)[address - 0x0800];
} else if (isFrozen && address >= 0xD800 && address < 0xDC00) {
value = ((uint8_t *)color_backup)[address - 0xD800];
} else {
if (isFrozen && address >= 0x8000 && (address < 0xD000 || address >= 0xE000)) {
saved_mode = C64_MODE;
if ((saved_mode & C64_MODE_ULTIMAX) && (saved_mode != frozen_mode)) {
C64_MODE = frozen_mode;
restore_mode = true;
}
}
value = ram[address];
if (restore_mode) {
C64_MODE = saved_mode;
}
}

if (stopped_it) {
resume();
}
return value;
}

void C64::poke(uint16_t address, uint8_t value)
{
bool stopped_it = false;
volatile uint8_t *ram = (volatile uint8_t *)C64_MEMORY_BASE;
uint8_t saved_mode = 0;
bool restore_mode = false;

if (!is_stopped()) {
stop(false);
stopped_it = true;
}

if (isFrozen && address >= 0x0400 && address < 0x0800) {
((uint8_t *)screen_backup)[address - 0x0400] = value;
} else if (isFrozen && address >= 0x0800 && address < 0x1000) {
((uint8_t *)ram_backup)[address - 0x0800] = value;
} else if (isFrozen && address >= 0xD800 && address < 0xDC00) {
((uint8_t *)color_backup)[address - 0xD800] = value;
} else {
if (isFrozen && address >= 0x8000 && (address < 0xD000 || address >= 0xE000)) {
saved_mode = C64_MODE;
if ((saved_mode & C64_MODE_ULTIMAX) && (saved_mode != frozen_mode)) {
C64_MODE = frozen_mode;
restore_mode = true;
}
}
ram[address] = value;
if (restore_mode) {
C64_MODE = saved_mode;
}
}

if (stopped_it) {
resume();
}
}

bool C64::begin_stopped_session(void)
{
bool wasStopped = is_stopped();
if (!wasStopped) {
stop(false);
}
return !wasStopped;
}

bool C64::begin_stopped_session(bool raster)
{
bool wasStopped = is_stopped();
if (!wasStopped) {
stop(raster);
}
return !wasStopped;
}

void C64::end_stopped_session(bool stopped_it)
{
if (stopped_it) {
resume();
}
}

/*
-------------------------------------------------------------------------------
freeze (split in subfunctions)
Expand Down Expand Up @@ -719,6 +891,7 @@ void C64::freeze(void)
if (!phi2_present())
return;

frozen_mode = C64_MODE;
stop(true);
backup_io();
init_io();
Expand Down Expand Up @@ -818,6 +991,10 @@ void C64::init_system_roms(void)
memcpy((void *)U64_CHARROM_BASE, (void *)_default_chars_bin_start, 4096);
}

// The ROM image is now authoritative (freshly loaded from config). Snapshot it
// so reset() can heal any debug BRK patch left in the FPGA ROM image.
capture_pristine_rom_image();

#else
uint8_t *temp = new uint8_t[8192];
FRESULT fres = FileManager :: getFileManager()->load_file(ROMS_DIRECTORY, cfg->get_string(CFG_C64_KERNFILE), temp, 8192, NULL);
Expand Down Expand Up @@ -849,6 +1026,12 @@ void C64::unfreeze()
isFrozen = false;
}

void C64::refreeze(void)
{
if (!isFrozen)
freeze();
}

void C64 :: start_cartridge(void *vdef)
{
cart_def *def = (cart_def *) vdef;
Expand Down
25 changes: 24 additions & 1 deletion software/io/c64/c64.h
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
#define MENU_MEASURE_TIMING_API 0x6413
#define MENU_C64_POWERCYCLE 0x6414
#define MENU_C64_CLEARMEM 0x6415
#define MENU_C64_MONITOR 0x6416

#define C64_DMA_LOAD 0x6464
#define C64_DRIVE_LOAD 0x6465
Expand Down Expand Up @@ -292,6 +293,7 @@ class C64 : public GenericHost, ConfigurableObject
uint8_t vic_irq;
uint8_t vic_d011;
uint8_t vic_d012;
uint8_t frozen_mode;
bool backupIsValid;

volatile bool buttonPushSeen;
Expand Down Expand Up @@ -377,17 +379,38 @@ class C64 : public GenericHost, ConfigurableObject
if (!cfg) return 0;
return cfg->get_value(id);
}


const char *get_cfg_string(uint8_t id)
{
if (!cfg) return "";
return cfg->get_string(id);
}

/* C64 specifics */
void resetConfigInFlash(int page);
void unfreeze(void);
void refreeze(void);
void start_cartridge(void *def);
void enable_kernal(uint8_t *rom);
void set_rom_config(uint8_t idx, const char *fname);
void init_cartridge(void);
void reset(void);
void start(void);
bool is_in_reset(void);
virtual uint8_t peek(uint16_t address);
virtual void poke(uint16_t address, uint8_t value);

// Atomic stopped-region helpers. Used by the machine code monitor to
// bracket multi-byte vector / trampoline installs so the live C64 sees a
// single consistent transition. Default forwards to stop()/resume().
virtual bool begin_stopped_session(void);
// Variant that, when it actually stops a running machine, uses a raster-synced
// stop (do_raster=true) instead of the forced DMA stop. The matching resume()
// then re-clocks the VIC/CPU the way the freeze path does, which the monitor
// debugger needs so freshly armed high-memory BRKs are reliably observed by
// the live 6510 fetch on release. No-ops the stop if already stopped.
virtual bool begin_stopped_session(bool raster);
virtual void end_stopped_session(bool stopped_it);

static void clear_cart_definition(cart_def *def) {
def->custom_addr = 0;
Expand Down
24 changes: 18 additions & 6 deletions software/io/c64/c64_subsys.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "u64.h"
#include "c1541.h"
#include "endianness.h"
#include "monitor_init.h"
#if U64 == 2
#include "wifi.h"
#endif
Expand Down Expand Up @@ -105,6 +106,9 @@ void C64_Subsys :: create_task_items(void)
myActions.savemp3c = new Action("Save MP3 Drv C", SUBSYSID_C64, MENU_C64_SAVE_MP3_DRV_C);
myActions.savemp3d = new Action("Save MP3 Drv D", SUBSYSID_C64, MENU_C64_SAVE_MP3_DRV_D);
myActions.measure = new Action("Measure Cart Bus", SUBSYSID_C64, MENU_MEASURE_TIMING);
#if !U64
myActions.monitor = register_c64_machine_monitor_task ? register_c64_machine_monitor_task(MENU_C64_MONITOR) : NULL;
#endif

taskCategory->append(myActions.reset);
taskCategory->append(myActions.reboot);
Expand Down Expand Up @@ -207,11 +211,14 @@ SubsysResultCode_e C64_Subsys::executeCommand(SubsysCommand *cmd)
}
c64->unfreeze();
break;
case MENU_C64_RESET:
if (c64->client) { // we can't execute this yet
c64->client->release_host(); // disconnect from user interface
c64->client = 0;
}
case MENU_C64_RESET:
if (machine_monitor_request_global_reset_cancel) {
machine_monitor_request_global_reset_cancel();
}
if (c64->client) { // we can't execute this yet
c64->client->release_host(); // disconnect from user interface
c64->client = 0;
}
c64->unfreeze();
c64->reset();
break;
Expand Down Expand Up @@ -636,7 +643,9 @@ int C64_Subsys :: dma_load(File *f, const uint8_t *buffer, const int bufferSize,
if (run_code & RUNCODE_JUMP_BIT) {
C64_POKE(C64_BOOTCRT_JUMPADDR, buffer[0]);
C64_POKE(C64_BOOTCRT_JUMPADDR+1, buffer[1]);
load_buffer_dma(buffer+2, bufferSize-2, 0);
if (bufferSize > 2) {
load_buffer_dma(buffer+2, bufferSize-2, 0);
}
} else {
load_buffer_dma(buffer, bufferSize, 0);
}
Expand Down Expand Up @@ -724,6 +733,9 @@ int C64_Subsys :: load_file_dma(File *f, uint16_t reloc)

int C64_Subsys :: load_buffer_dma(const uint8_t *buffer, const int bufferSize, uint16_t reloc)
{
if (!buffer || bufferSize < 2) {
return 0;
}
uint16_t load_address = 0;

load_address = (uint16_t)buffer[0] | ((uint16_t)buffer[1]) << 8;
Expand Down
4 changes: 2 additions & 2 deletions software/io/c64/c64_subsys.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,11 +39,11 @@ class C64_Subsys : public SubSystem, ObjectWithMenu
Action *savemp3c;
Action *savemp3d;
Action *measure;
Action *monitor;
} myActions;

static void poll(void *a);

/* Subsystem */
/* Subsystem */
const char *identify(void) { return "C64 Machine"; }
SubsysResultCode_e executeCommand(SubsysCommand *cmd);

Expand Down
Loading
Loading