vice-emu-commit Mailing List for VICE (Page 26)
Versatile Commodore Emulator
                
                Brought to you by:
                
                    blackystardust,
                    
                
                    gpz
                    
                
            
            
        
        
        
    You can subscribe to this list here.
| 2008 | Jan | Feb | Mar | Apr (38) | May (60) | Jun (122) | Jul (148) | Aug (178) | Sep (151) | Oct (131) | Nov (208) | Dec (129) | 
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2009 | Jan (193) | Feb (209) | Mar (221) | Apr (243) | May (165) | Jun (168) | Jul (198) | Aug (161) | Sep (103) | Oct (98) | Nov (168) | Dec (99) | 
| 2010 | Jan (263) | Feb (156) | Mar (57) | Apr (93) | May (85) | Jun (124) | Jul (57) | Aug (58) | Sep (113) | Oct (148) | Nov (114) | Dec (193) | 
| 2011 | Jan (200) | Feb (207) | Mar (91) | Apr (91) | May (142) | Jun (104) | Jul (115) | Aug (137) | Sep (266) | Oct (91) | Nov (85) | Dec (186) | 
| 2012 | Jan (98) | Feb (146) | Mar (160) | Apr (99) | May (59) | Jun (257) | Jul (84) | Aug (103) | Sep (169) | Oct (206) | Nov (90) | Dec (296) | 
| 2013 | Jan (294) | Feb (130) | Mar (36) | Apr (14) | May (51) | Jun (74) | Jul (180) | Aug (85) | Sep (26) | Oct (45) | Nov (29) | Dec (21) | 
| 2014 | Jan (56) | Feb (40) | Mar (57) | Apr (30) | May (31) | Jun (11) | Jul (107) | Aug (135) | Sep (142) | Oct (195) | Nov (139) | Dec (133) | 
| 2015 | Jan (293) | Feb (161) | Mar (146) | Apr (85) | May (139) | Jun (51) | Jul (21) | Aug (24) | Sep (29) | Oct (136) | Nov (212) | Dec (118) | 
| 2016 | Jan (119) | Feb (165) | Mar (229) | Apr (219) | May (134) | Jun (119) | Jul (134) | Aug (236) | Sep (203) | Oct (215) | Nov (300) | Dec (140) | 
| 2017 | Jan (188) | Feb (20) | Mar (147) | Apr (198) | May (26) | Jun (21) | Jul (67) | Aug (219) | Sep (209) | Oct (194) | Nov (144) | Dec (99) | 
| 2018 | Jan (139) | Feb (122) | Mar (116) | Apr (85) | May (232) | Jun (181) | Jul (190) | Aug (105) | Sep (92) | Oct (178) | Nov (105) | Dec (86) | 
| 2019 | Jan (119) | Feb (79) | Mar (74) | Apr (117) | May (115) | Jun (307) | Jul (107) | Aug (131) | Sep (103) | Oct (60) | Nov (118) | Dec (70) | 
| 2020 | Jan (114) | Feb (103) | Mar (77) | Apr (121) | May (193) | Jun (110) | Jul (214) | Aug (210) | Sep (179) | Oct (260) | Nov (237) | Dec (334) | 
| 2021 | Jan (163) | Feb (186) | Mar (58) | Apr (81) | May (108) | Jun (175) | Jul (154) | Aug (180) | Sep (217) | Oct (204) | Nov (232) | Dec (190) | 
| 2022 | Jan (253) | Feb (134) | Mar (229) | Apr (190) | May (125) | Jun (70) | Jul (8) | Aug (22) | Sep (19) | Oct (33) | Nov (94) | Dec (164) | 
| 2023 | Jan (158) | Feb (366) | Mar (272) | Apr (109) | May (198) | Jun (226) | Jul (200) | Aug (94) | Sep (108) | Oct (62) | Nov (175) | Dec (116) | 
| 2024 | Jan (35) | Feb (40) | Mar (51) | Apr (89) | May (24) | Jun (26) | Jul (53) | Aug (71) | Sep (23) | Oct (11) | Nov (22) | Dec (58) | 
| 2025 | Jan (26) | Feb (40) | Mar (107) | Apr (39) | May (35) | Jun (20) | Jul (11) | Aug (24) | Sep (35) | Oct (28) | Nov | Dec | 
| 
      
      
      From: <gp...@us...> - 2024-06-01 23:59:47
      
     | 
| Revision: 45180
          http://sourceforge.net/p/vice-emu/code/45180
Author:   gpz
Date:     2024-06-01 23:59:45 +0000 (Sat, 01 Jun 2024)
Log Message:
-----------
some log cosmetics
Modified Paths:
--------------
    trunk/vice/src/arch/gtk3/opengl_renderer_unix.c
    trunk/vice/src/arch/gtk3/uimachinewindow.c
    trunk/vice/src/arch/shared/mididrv/midi-unix-drv.c
    trunk/vice/src/main.c
    trunk/vice/src/resources.c
    trunk/vice/src/vic20/cart/vic20cart.c
Modified: trunk/vice/src/arch/gtk3/opengl_renderer_unix.c
===================================================================
--- trunk/vice/src/arch/gtk3/opengl_renderer_unix.c	2024-06-01 22:09:10 UTC (rev 45179)
+++ trunk/vice/src/arch/gtk3/opengl_renderer_unix.c	2024-06-01 23:59:45 UTC (rev 45180)
@@ -228,7 +228,7 @@
     /* Anything less than OpenGL 3.2 will use the legacy renderer */
     context->gl_context_is_legacy = major < 3 || (major == 3 && minor < 2);
 
-    log_message(LOG_DEFAULT, "Obtained OpenGL %d.%d context\n\t  Vendor: %s\n\tRenderer: %s\n\t Version: %s\n\t  Legacy: %s",
+    log_message(LOG_DEFAULT, "Obtained OpenGL %d.%d context\n Vendor:   %s\n Renderer: %s\n Version:  %s\n Legacy:   %s",
         major,
         minor,
         glGetString(GL_VENDOR),
Modified: trunk/vice/src/arch/gtk3/uimachinewindow.c
===================================================================
--- trunk/vice/src/arch/gtk3/uimachinewindow.c	2024-06-01 22:09:10 UTC (rev 45179)
+++ trunk/vice/src/arch/gtk3/uimachinewindow.c	2024-06-01 23:59:45 UTC (rev 45180)
@@ -702,15 +702,16 @@
 #if 1
     log_debug("chip_name: %s", canvas->videoconfig->chip_name);
     log_debug(" screen_size: %u x %u", canvas->geometry->screen_size.width, canvas->geometry->screen_size.height);
-    log_debug(" first/lastline: %u x %u", canvas->viewport->first_line, canvas->viewport->last_line);
+    /*log_debug(" first/lastline: %u x %u", canvas->viewport->first_line, canvas->viewport->last_line);*/
     log_debug(" gfx_size: %u x %u", canvas->geometry->gfx_size.width, canvas->geometry->gfx_size.height);
     log_debug(" gfx_position: %u x %u", canvas->geometry->gfx_position.x, canvas->geometry->gfx_position.y);
     log_debug(" first/last displayed line: %u x %u", canvas->geometry->first_displayed_line, canvas->geometry->last_displayed_line);
     log_debug(" extra offscreen border left/right: %u x %u", canvas->geometry->extra_offscreen_border_left, canvas->geometry->extra_offscreen_border_right);
-    log_debug(" screen_display_wh: %f x %f", (float)canvas->screen_display_w, (float)canvas->screen_display_h);
-    log_debug(" canvas_physical_wh: %u x %u", canvas->draw_buffer->canvas_physical_width, canvas->draw_buffer->canvas_physical_width);
-    log_debug(" scalexy: %d x %d", canvas->videoconfig->scalex, canvas->videoconfig->scaley);
-    log_debug(" sizexy: %u x %u", canvas->videoconfig->cap->single_mode.sizex, canvas->videoconfig->cap->single_mode.sizey);
+    /*log_debug(" screen_display_wh: %f x %f", (float)canvas->screen_display_w, (float)canvas->screen_display_h);*/
+    /*log_debug(" canvas_physical_wh: %u x %u", canvas->draw_buffer->canvas_physical_width, canvas->draw_buffer->canvas_physical_width);*/
+    log_debug(" scalexy: %d x %d sizexy: %u x %u",
+              canvas->videoconfig->scalex, canvas->videoconfig->scaley,
+              canvas->videoconfig->cap->single_mode.sizex, canvas->videoconfig->cap->single_mode.sizey);
     log_debug(" rmode: %u", canvas->videoconfig->cap->single_mode.rmode);
     log_debug(" aspect ratio: %f", (float)canvas->geometry->pixel_aspect_ratio);
 #endif
@@ -727,8 +728,7 @@
         /* vstretch = 1; */ /* HACK: for some reason that doesn't give the wanted result */
     }
 #if 1
-    log_debug(" hstretch: %u", hstretch);
-    log_debug(" vstretch: %u", vstretch);
+    log_debug(" hstretch: %u vstretch: %u", hstretch, vstretch);
 #endif
     /* calculate the initial size from the values we have
        WARNING: terrible hacks coming up
Modified: trunk/vice/src/arch/shared/mididrv/midi-unix-drv.c
===================================================================
--- trunk/vice/src/arch/shared/mididrv/midi-unix-drv.c	2024-06-01 22:09:10 UTC (rev 45179)
+++ trunk/vice/src/arch/shared/mididrv/midi-unix-drv.c	2024-06-01 23:59:45 UTC (rev 45180)
@@ -441,9 +441,12 @@
 /** a function to destroy ALSA MIDI objects */
 static void mididrv_alsa_shutdown(void)
 {
+#if 0
 #ifdef DEBUG_MIDI
     log_message(mididrv_log, "alsa_shutdown");
 #endif
+#endif
+    log_message(mididrv_log, "closed ALSA MIDI sequencer port '%s'", midi_name);
 
     if (fd_in >= 0) {
         mididrv_alsa_in_close();
@@ -499,7 +502,7 @@
         log_error(mididrv_log, "could not create ALSA sequencer port");
         return;
     }
-    log_message(mididrv_log, "opened ALSA sequencer port '%s'", midi_name);
+    log_message(mididrv_log, "opened ALSA MIDI sequencer port '%s'", midi_name);
 
     /* create event parser */
     if ((alsa_err = snd_midi_event_new(RINGBUFFER_SIZE, &midi_event_parser)) < 0) {
Modified: trunk/vice/src/main.c
===================================================================
--- trunk/vice/src/main.c	2024-06-01 22:09:10 UTC (rev 45179)
+++ trunk/vice/src/main.c	2024-06-01 23:59:45 UTC (rev 45180)
@@ -439,6 +439,7 @@
 
 void main_loop_forever(void)
 {
+    log_message(LOG_DEFAULT, "");
     log_message(LOG_DEFAULT, "Main CPU: starting at ($FFFC).");
 
     /* This doesn't return. The thread will directly exit when requested. */
Modified: trunk/vice/src/resources.c
===================================================================
--- trunk/vice/src/resources.c	2024-06-01 22:09:10 UTC (rev 45179)
+++ trunk/vice/src/resources.c	2024-06-01 23:59:45 UTC (rev 45180)
@@ -951,6 +951,9 @@
 {
     unsigned int i;
 
+    log_message(LOG_DEFAULT, "");
+    log_message(LOG_DEFAULT, "Initializing resources...");
+
     /* the cartridge system uses internal state variables so the default cartridge
        can be unset without changing the attached cartridge and/or attach another
        cartridge without changing the default. to completely restore the default,
@@ -1300,6 +1303,7 @@
         return RESERR_FILE_NOT_FOUND;
     }
 
+    log_message(LOG_DEFAULT, "");
     log_message(LOG_DEFAULT, "Reading configuration file `%s'.", fname);
 
     /* Find the start of the configuration section for this emulator.  */
Modified: trunk/vice/src/vic20/cart/vic20cart.c
===================================================================
--- trunk/vice/src/vic20/cart/vic20cart.c	2024-06-01 22:09:10 UTC (rev 45179)
+++ trunk/vice/src/vic20/cart/vic20cart.c	2024-06-01 23:59:45 UTC (rev 45180)
@@ -28,7 +28,7 @@
  *
  */
 
-#define DEBUGCART
+/* #define DEBUGCART */
 
 #include "vice.h"
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <gp...@us...> - 2024-06-01 22:09:12
      
     | 
| Revision: 45179
          http://sourceforge.net/p/vice-emu/code/45179
Author:   gpz
Date:     2024-06-01 22:09:10 +0000 (Sat, 01 Jun 2024)
Log Message:
-----------
snapshot support for c128 cartridge system
Modified Paths:
--------------
    trunk/vice/src/c128/cart/c128cart.c
    trunk/vice/src/c128/cart/comal80.c
    trunk/vice/src/c128/cart/comal80.h
    trunk/vice/src/c128/cart/generic.c
    trunk/vice/src/c128/cart/generic.h
    trunk/vice/src/c128/cart/gmod2c128.c
    trunk/vice/src/c128/cart/gmod2c128.h
    trunk/vice/src/c128/cart/magicdesk128.c
    trunk/vice/src/c128/cart/magicdesk128.h
    trunk/vice/src/c128/cart/partner128.c
    trunk/vice/src/c128/cart/partner128.h
    trunk/vice/src/c128/cart/warpspeed128.c
    trunk/vice/src/c128/cart/warpspeed128.h
    trunk/vice/src/c64/c64cart.h
    trunk/vice/src/c64/c64export.c
    trunk/vice/src/c64/cart/c64carthooks.c
    trunk/vice/src/cartridge.h
Modified: trunk/vice/src/c128/cart/c128cart.c
===================================================================
--- trunk/vice/src/c128/cart/c128cart.c	2024-06-01 18:54:33 UTC (rev 45178)
+++ trunk/vice/src/c128/cart/c128cart.c	2024-06-01 22:09:10 UTC (rev 45179)
@@ -547,6 +547,45 @@
     }
 }
 
+static int c128cartridge_snapshot_read(int type, snapshot_t *s)
+{
+    switch (type) {
+        case CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_GENERIC):
+            return c128generic_snapshot_read_module(s, type);
+        case CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_COMAL80):
+            return c128comal80_snapshot_read_module(s);
+        case CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_MAGICDESK128):
+            return magicdesk128_snapshot_read_module(s);
+        case CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_PARTNER128):
+            return partner128_snapshot_read_module(s);
+        case CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_WARPSPEED128):
+            return warpspeed128_snapshot_read_module(s);
+        case CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_GMOD2C128):
+            return c128gmod2_snapshot_read_module(s);
+    }
+    return -1;
+}
+
+static int c128cartridge_snapshot_write(int type, snapshot_t *s)
+{
+    DBG(("c128cartridge_snapshot_write\n"));
+    switch (type) {
+        case CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_GENERIC):
+            return c128generic_snapshot_write_module(s, type);
+        case CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_COMAL80):
+            return c128comal80_snapshot_write_module(s);
+        case CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_MAGICDESK128):
+            return magicdesk128_snapshot_write_module(s);
+        case CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_PARTNER128):
+            return partner128_snapshot_write_module(s);
+        case CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_WARPSPEED128):
+            return warpspeed128_snapshot_write_module(s);
+        case CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_GMOD2C128):
+            return c128gmod2_snapshot_write_module(s);
+    }
+    return -1;
+}
+
 void c128cartridge_setup_interface(void)
 {
     DBG(("c128cartridge_setup_interface\n"));
@@ -570,6 +609,8 @@
     c128interface.can_save_image = c128cartridge_can_save_image;
     c128interface.can_flush_secondary_image = c128cartridge_can_flush_secondary_image;
     c128interface.can_save_secondary_image = c128cartridge_can_save_secondary_image;
+    c128interface.snapshot_read = c128cartridge_snapshot_read;
+    c128interface.snapshot_write = c128cartridge_snapshot_write;
     c128cartridge = &c128interface;
 }
 
Modified: trunk/vice/src/c128/cart/comal80.c
===================================================================
--- trunk/vice/src/c128/cart/comal80.c	2024-06-01 18:54:33 UTC (rev 45178)
+++ trunk/vice/src/c128/cart/comal80.c	2024-06-01 22:09:10 UTC (rev 45179)
@@ -86,7 +86,7 @@
     c128comal80_io1_read,           /* read function */
     c128comal80_io1_peek,           /* peek function */
     c128comal80_dump,               /* device state information dump function */
-    CARTRIDGE_C128_COMAL80,         /* cartridge ID */
+    CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_COMAL80),         /* cartridge ID */
     IO_PRIO_NORMAL,                 /* normal priority, device read needs to be checked for collisions */
     0,                              /* insertion order, gets filled in by the registration function */
     IO_MIRROR_NONE                  /* NO mirroring */
@@ -103,7 +103,7 @@
     c128comal80_io2_read,           /* read function */
     c128comal80_io2_peek,           /* peek function */
     c128comal80_dump,               /* device state information dump function */
-    CARTRIDGE_C128_COMAL80,         /* cartridge ID */
+    CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_COMAL80),         /* cartridge ID */
     IO_PRIO_NORMAL,                 /* normal priority, device read needs to be checked for collisions */
     0,                              /* insertion order, gets filled in by the registration function */
     IO_MIRROR_NONE                  /* NO mirroring */
@@ -113,7 +113,7 @@
 static io_source_list_t *c128comal80_io2_list_item = NULL;
 
 static const export_resource_t export_res = {
-    CARTRIDGE_C128_NAME_COMAL80, 1, 1, &c128comal80_io1_device, &c128comal80_io2_device, CARTRIDGE_C128_COMAL80
+    CARTRIDGE_C128_NAME_COMAL80, 1, 1, &c128comal80_io1_device, &c128comal80_io2_device, CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_COMAL80)
 };
 
 /* ---------------------------------------------------------------------*/
@@ -264,3 +264,67 @@
     DBG(("c128comal80_reset\n"));
     external_function_rom_set_bank(0);
 }
+
+/* ---------------------------------------------------------------------*/
+
+/* COMAL80C128 snapshot module format:
+
+    FIXME
+ */
+
+static char snap_module_name[] = "COMAL80C128";
+#define SNAP_MAJOR   0
+#define SNAP_MINOR   1
+
+int c128comal80_snapshot_write_module(snapshot_t *s)
+{
+    snapshot_module_t *m;
+
+    m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR);
+
+    if (m == NULL) {
+        return -1;
+    }
+
+    if (0
+        || (SMW_B(m, (uint8_t)comal80_register) < 0)
+        || (SMW_BA(m, &ext_function_rom[0x4000], (0x8000 * 5) + 0x4000) < 0)) {
+        snapshot_module_close(m);
+        return -1;
+    }
+
+    return snapshot_module_close(m);
+}
+
+int c128comal80_snapshot_read_module(snapshot_t *s)
+{
+    uint8_t vmajor, vminor;
+    snapshot_module_t *m;
+
+    m = snapshot_module_open(s, snap_module_name, &vmajor, &vminor);
+
+    if (m == NULL) {
+        return -1;
+    }
+
+    /* Do not accept versions higher than current */
+    if (snapshot_version_is_bigger(vmajor, vminor, SNAP_MAJOR, SNAP_MINOR)) {
+        snapshot_set_error(SNAPSHOT_MODULE_HIGHER_VERSION);
+        goto fail;
+    }
+
+    if (0
+        || (SMR_B_INT(m, &comal80_register) < 0)
+        || (SMR_BA(m, &ext_function_rom[0x4000], (0x8000 * 5) + 0x4000) < 0)) {
+        goto fail;
+    }
+
+    snapshot_module_close(m);
+
+    return c128comal80_common_attach();
+
+fail:
+    snapshot_module_close(m);
+    return -1;
+}
+
Modified: trunk/vice/src/c128/cart/comal80.h
===================================================================
--- trunk/vice/src/c128/cart/comal80.h	2024-06-01 18:54:33 UTC (rev 45178)
+++ trunk/vice/src/c128/cart/comal80.h	2024-06-01 22:09:10 UTC (rev 45179)
@@ -35,4 +35,9 @@
 
 void c128comal80_config_setup(uint8_t *rawcart);
 
+struct snapshot_s;
+
+int c128comal80_snapshot_write_module(struct snapshot_s *s);
+int c128comal80_snapshot_read_module(struct snapshot_s *s);
+
 #endif
Modified: trunk/vice/src/c128/cart/generic.c
===================================================================
--- trunk/vice/src/c128/cart/generic.c	2024-06-01 18:54:33 UTC (rev 45178)
+++ trunk/vice/src/c128/cart/generic.c	2024-06-01 22:09:10 UTC (rev 45179)
@@ -51,7 +51,7 @@
 #endif
 
 static const export_resource_t export_res = {
-    CARTRIDGE_C128_NAME_GENERIC, 1, 1, NULL, NULL, CARTRIDGE_C128_GENERIC
+    CARTRIDGE_C128_NAME_GENERIC, 1, 1, NULL, NULL, CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_GENERIC)
 };
 
 void c128generic_config_setup(uint8_t *rawcart)
@@ -176,3 +176,64 @@
 {
     DBG(("c128generic_reset\n"));
 }
+
+/* ---------------------------------------------------------------------*/
+
+/* CART128GENERIC snapshot module format:
+
+    FIXME
+ */
+
+static char snap_module_name[] = "CART128GENERIC";
+#define SNAP_MAJOR   0
+#define SNAP_MINOR   1
+
+int c128generic_snapshot_write_module(snapshot_t *s, int type)
+{
+    snapshot_module_t *m;
+
+    m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR);
+
+    if (m == NULL) {
+        return -1;
+    }
+
+    if (0
+        || (SMW_BA(m, ext_function_rom, EXTERNAL_FUNCTION_ROM_SIZE) < 0)) {
+        snapshot_module_close(m);
+        return -1;
+    }
+
+    return snapshot_module_close(m);
+}
+
+int c128generic_snapshot_read_module(snapshot_t *s, int type)
+{
+    uint8_t vmajor, vminor;
+    snapshot_module_t *m;
+
+    m = snapshot_module_open(s, snap_module_name, &vmajor, &vminor);
+
+    if (m == NULL) {
+        return -1;
+    }
+
+    /* Do not accept versions higher than current */
+    if (snapshot_version_is_bigger(vmajor, vminor, SNAP_MAJOR, SNAP_MINOR)) {
+        snapshot_set_error(SNAPSHOT_MODULE_HIGHER_VERSION);
+        goto fail;
+    }
+
+    if (0
+        || (SMR_BA(m, ext_function_rom, EXTERNAL_FUNCTION_ROM_SIZE) < 0)) {
+        goto fail;
+    }
+
+    snapshot_module_close(m);
+
+    return c128generic_common_attach();
+
+fail:
+    snapshot_module_close(m);
+    return -1;
+}
Modified: trunk/vice/src/c128/cart/generic.h
===================================================================
--- trunk/vice/src/c128/cart/generic.h	2024-06-01 18:54:33 UTC (rev 45178)
+++ trunk/vice/src/c128/cart/generic.h	2024-06-01 22:09:10 UTC (rev 45179)
@@ -35,4 +35,9 @@
 
 void c128generic_config_setup(uint8_t *rawcart);
 
+struct snapshot_s;
+
+int c128generic_snapshot_write_module(struct snapshot_s *s, int type);
+int c128generic_snapshot_read_module(struct snapshot_s *s, int type);
+
 #endif
Modified: trunk/vice/src/c128/cart/gmod2c128.c
===================================================================
--- trunk/vice/src/c128/cart/gmod2c128.c	2024-06-01 18:54:33 UTC (rev 45178)
+++ trunk/vice/src/c128/cart/gmod2c128.c	2024-06-01 22:09:10 UTC (rev 45179)
@@ -117,7 +117,7 @@
     c128gmod2_io1_read,             /* read function */
     c128gmod2_io1_peek,             /* peek function */
     c128gmod2_dump,                 /* device state information dump function */
-    CARTRIDGE_C128_GMOD2C128,       /* cartridge ID */
+    CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_GMOD2C128),       /* cartridge ID */
     IO_PRIO_NORMAL,                 /* normal priority, device read needs to be checked for collisions */
     0,                              /* insertion order, gets filled in by the registration function */
     IO_MIRROR_NONE                  /* NO mirroring */
@@ -126,7 +126,7 @@
 static io_source_list_t *c128gmod2_io1_list_item = NULL;
 
 static const export_resource_t export_res = {
-    CARTRIDGE_C128_NAME_GMOD2C128, 0, 0, &c128gmod2_io1_device, NULL, CARTRIDGE_C128_GMOD2C128
+    CARTRIDGE_C128_NAME_GMOD2C128, 0, 0, &c128gmod2_io1_device, NULL, CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_GMOD2C128)
 };
 
 /* ---------------------------------------------------------------------*/
Modified: trunk/vice/src/c128/cart/gmod2c128.h
===================================================================
--- trunk/vice/src/c128/cart/gmod2c128.h	2024-06-01 18:54:33 UTC (rev 45178)
+++ trunk/vice/src/c128/cart/gmod2c128.h	2024-06-01 22:09:10 UTC (rev 45179)
@@ -55,7 +55,6 @@
 int c128gmod2_resources_init(void);
 void c128gmod2_resources_shutdown(void);
 
-/* FIXME: snapshot stuff is not implemented yet */
 int c128gmod2_snapshot_write_module(struct snapshot_s *s);
 int c128gmod2_snapshot_read_module(struct snapshot_s *s);
 
Modified: trunk/vice/src/c128/cart/magicdesk128.c
===================================================================
--- trunk/vice/src/c128/cart/magicdesk128.c	2024-06-01 18:54:33 UTC (rev 45178)
+++ trunk/vice/src/c128/cart/magicdesk128.c	2024-06-01 22:09:10 UTC (rev 45179)
@@ -98,7 +98,7 @@
     magicdesk128_io1_read,        /* read function */
     magicdesk128_io1_peek,        /* peek function */
     magicdesk128_dump,            /* device state information dump function */
-    CARTRIDGE_C128_MAGICDESK128,  /* cartridge ID */
+    CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_MAGICDESK128),  /* cartridge ID */
     IO_PRIO_NORMAL,               /* normal priority, device read needs to be checked for collisions */
     0,                            /* insertion order, gets filled in by the registration function */
     IO_MIRROR_NONE                /* NO mirroring */
@@ -107,7 +107,7 @@
 static io_source_list_t *magicdesk128_io1_list_item = NULL;
 
 static const export_resource_t export_res = {
-    CARTRIDGE_C128_NAME_MAGICDESK128, 1, 1, &magicdesk128_io1_device, NULL, CARTRIDGE_C128_MAGICDESK128
+    CARTRIDGE_C128_NAME_MAGICDESK128, 1, 1, &magicdesk128_io1_device, NULL, CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_MAGICDESK128)
 };
 
 /* ---------------------------------------------------------------------*/
@@ -252,3 +252,57 @@
     rombank = 0;
     external_function_rom_set_bank(0);
 }
+
+/* ---------------------------------------------------------------------*/
+
+/* MAGICDESK128 snapshot module format:
+
+    FIXME
+ */
+
+static char snap_module_name[] = "MAGICDESK128";
+#define SNAP_MAJOR   0
+#define SNAP_MINOR   0
+
+int magicdesk128_snapshot_write_module(snapshot_t *s)
+{
+    snapshot_module_t *m;
+
+    m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR);
+
+    if (m == NULL) {
+        return -1;
+    }
+
+    /* FIXME */
+
+    return snapshot_module_close(m);
+}
+
+int magicdesk128_snapshot_read_module(snapshot_t *s)
+{
+    uint8_t vmajor, vminor;
+    snapshot_module_t *m;
+
+    m = snapshot_module_open(s, snap_module_name, &vmajor, &vminor);
+
+    if (m == NULL) {
+        return -1;
+    }
+
+    /* Do not accept versions higher than current */
+    if (snapshot_version_is_bigger(vmajor, vminor, SNAP_MAJOR, SNAP_MINOR)) {
+        snapshot_set_error(SNAPSHOT_MODULE_HIGHER_VERSION);
+        goto fail;
+    }
+
+    /* FIXME */
+
+    snapshot_module_close(m);
+
+    return magicdesk128_common_attach();
+
+fail:
+    snapshot_module_close(m);
+    return -1;
+}
Modified: trunk/vice/src/c128/cart/magicdesk128.h
===================================================================
--- trunk/vice/src/c128/cart/magicdesk128.h	2024-06-01 18:54:33 UTC (rev 45178)
+++ trunk/vice/src/c128/cart/magicdesk128.h	2024-06-01 22:09:10 UTC (rev 45179)
@@ -35,4 +35,9 @@
 
 void magicdesk128_config_setup(uint8_t *rawcart);
 
+struct snapshot_s;
+
+int magicdesk128_snapshot_write_module(struct snapshot_s *s);
+int magicdesk128_snapshot_read_module(struct snapshot_s *s);
+
 #endif
Modified: trunk/vice/src/c128/cart/partner128.c
===================================================================
--- trunk/vice/src/c128/cart/partner128.c	2024-06-01 18:54:33 UTC (rev 45178)
+++ trunk/vice/src/c128/cart/partner128.c	2024-06-01 22:09:10 UTC (rev 45179)
@@ -117,7 +117,7 @@
     partner128_io1_read,            /* read function */
     partner128_io1_peek,            /* peek function */
     partner128_dump,                /* device state information dump function */
-    CARTRIDGE_C128_PARTNER128,      /* cartridge ID */
+    CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_PARTNER128),      /* cartridge ID */
     IO_PRIO_NORMAL,                 /* normal priority, device read needs to be checked for collisions */
     0,                              /* insertion order, gets filled in by the registration function */
     IO_MIRROR_NONE                  /* NO mirroring */
@@ -135,7 +135,7 @@
     NULL,                           /* NO read function */
     partner128_iod6_peek,           /* peek function */
     partner128_dump,                /* device state information dump function */
-    CARTRIDGE_C128_PARTNER128,      /* cartridge ID */
+    CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_PARTNER128),      /* cartridge ID */
     IO_PRIO_NORMAL,                 /* normal priority, device read needs to be checked for collisions */
     0,                              /* insertion order, gets filled in by the registration function */
     IO_MIRROR_NONE                  /* NO mirroring */
@@ -143,7 +143,7 @@
 static io_source_list_t *partner128_iod6_list_item = NULL;
 
 static const export_resource_t export_res = {
-    CARTRIDGE_C128_NAME_PARTNER128, 1, 1, &partner128_io1_device, NULL, CARTRIDGE_C128_PARTNER128
+    CARTRIDGE_C128_NAME_PARTNER128, 1, 1, &partner128_io1_device, NULL, CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_PARTNER128)
 };
 
 /* ---------------------------------------------------------------------*/
@@ -352,3 +352,57 @@
     nmivector_restore();
     memset(rambanks, 0xff, PARTNER_RAM_SIZE);
 }
+
+/* ---------------------------------------------------------------------*/
+
+/* PARTNER128 snapshot module format:
+
+    FIXME
+ */
+
+static char snap_module_name[] = "PARTNER128";
+#define SNAP_MAJOR   0
+#define SNAP_MINOR   0
+
+int partner128_snapshot_write_module(snapshot_t *s)
+{
+    snapshot_module_t *m;
+
+    m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR);
+
+    if (m == NULL) {
+        return -1;
+    }
+
+    /* FIXME */
+
+    return snapshot_module_close(m);
+}
+
+int partner128_snapshot_read_module(snapshot_t *s)
+{
+    uint8_t vmajor, vminor;
+    snapshot_module_t *m;
+
+    m = snapshot_module_open(s, snap_module_name, &vmajor, &vminor);
+
+    if (m == NULL) {
+        return -1;
+    }
+
+    /* Do not accept versions higher than current */
+    if (snapshot_version_is_bigger(vmajor, vminor, SNAP_MAJOR, SNAP_MINOR)) {
+        snapshot_set_error(SNAPSHOT_MODULE_HIGHER_VERSION);
+        goto fail;
+    }
+
+    /* FIXME */
+
+    snapshot_module_close(m);
+
+    return partner128_common_attach();
+
+fail:
+    snapshot_module_close(m);
+    return -1;
+}
Modified: trunk/vice/src/c128/cart/partner128.h
===================================================================
--- trunk/vice/src/c128/cart/partner128.h	2024-06-01 18:54:33 UTC (rev 45178)
+++ trunk/vice/src/c128/cart/partner128.h	2024-06-01 22:09:10 UTC (rev 45179)
@@ -36,4 +36,9 @@
 
 void partner128_config_setup(uint8_t *rawcart);
 
+struct snapshot_s;
+
+int partner128_snapshot_write_module(struct snapshot_s *s);
+int partner128_snapshot_read_module(struct snapshot_s *s);
+
 #endif
Modified: trunk/vice/src/c128/cart/warpspeed128.c
===================================================================
--- trunk/vice/src/c128/cart/warpspeed128.c	2024-06-01 18:54:33 UTC (rev 45178)
+++ trunk/vice/src/c128/cart/warpspeed128.c	2024-06-01 22:09:10 UTC (rev 45179)
@@ -98,7 +98,7 @@
     warpspeed128_io2_read,        /* read function */
     warpspeed128_io2_peek,        /* peek function */
     warpspeed128_dump,            /* device state information dump function */
-    CARTRIDGE_C128_WARPSPEED128,  /* cartridge ID */
+    CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_WARPSPEED128),  /* cartridge ID */
     IO_PRIO_NORMAL,               /* normal priority, device read needs to be checked for collisions */
     0,                            /* insertion order, gets filled in by the registration function */
     IO_MIRROR_NONE                /* NO mirroring */
@@ -108,7 +108,7 @@
 static io_source_list_t *warpspeed128_io2_list_item = NULL;
 
 static const export_resource_t export_res = {
-    CARTRIDGE_C128_NAME_WARPSPEED128, 1, 1, &warpspeed128_io1_device, &warpspeed128_io2_device, CARTRIDGE_C128_WARPSPEED128
+    CARTRIDGE_C128_NAME_WARPSPEED128, 1, 1, &warpspeed128_io1_device, &warpspeed128_io2_device, CARTRIDGE_C128_MAKEID(CARTRIDGE_C128_WARPSPEED128)
 };
 
 /* ---------------------------------------------------------------------*/
@@ -225,3 +225,65 @@
 {
     DBG(("warpspeed128_reset\n"));
 }
+
+/* ---------------------------------------------------------------------*/
+
+/* WARPSPEED128 snapshot module format:
+
+    FIXME
+ */
+
+static char snap_module_name[] = "WARPSPEED128";
+#define SNAP_MAJOR   0
+#define SNAP_MINOR   1
+
+int warpspeed128_snapshot_write_module(snapshot_t *s)
+{
+    snapshot_module_t *m;
+
+    m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR);
+
+    if (m == NULL) {
+        return -1;
+    }
+
+    if (0
+        || (SMW_BA(m, ext_function_rom, WARPSPEED_ROM_SIZE) < 0)) {
+        snapshot_module_close(m);
+        return -1;
+    }
+
+    return snapshot_module_close(m);
+}
+
+int warpspeed128_snapshot_read_module(snapshot_t *s)
+{
+    uint8_t vmajor, vminor;
+    snapshot_module_t *m;
+
+    m = snapshot_module_open(s, snap_module_name, &vmajor, &vminor);
+
+    if (m == NULL) {
+        return -1;
+    }
+
+    /* Do not accept versions higher than current */
+    if (snapshot_version_is_bigger(vmajor, vminor, SNAP_MAJOR, SNAP_MINOR)) {
+        snapshot_set_error(SNAPSHOT_MODULE_HIGHER_VERSION);
+        goto fail;
+    }
+
+    if (0
+        || (SMR_BA(m, ext_function_rom, WARPSPEED_ROM_SIZE) < 0)) {
+        goto fail;
+    }
+
+    snapshot_module_close(m);
+
+    return warpspeed128_common_attach();
+
+fail:
+    snapshot_module_close(m);
+    return -1;
+}
+
Modified: trunk/vice/src/c128/cart/warpspeed128.h
===================================================================
--- trunk/vice/src/c128/cart/warpspeed128.h	2024-06-01 18:54:33 UTC (rev 45178)
+++ trunk/vice/src/c128/cart/warpspeed128.h	2024-06-01 22:09:10 UTC (rev 45179)
@@ -34,4 +34,9 @@
 
 void warpspeed128_config_setup(uint8_t *rawcart);
 
+struct snapshot_s;
+
+int warpspeed128_snapshot_write_module(struct snapshot_s *s);
+int warpspeed128_snapshot_read_module(struct snapshot_s *s);
+
 #endif
Modified: trunk/vice/src/c64/c64cart.h
===================================================================
--- trunk/vice/src/c64/c64cart.h	2024-06-01 18:54:33 UTC (rev 45178)
+++ trunk/vice/src/c64/c64cart.h	2024-06-01 22:09:10 UTC (rev 45179)
@@ -92,6 +92,8 @@
 #include <stdio.h>
 #include "cartridge.h"
 
+#include "snapshot.h"
+
 struct c128cartridge_interface_s {
     int (*attach_crt)(int type, FILE *fd, const char *filename, uint8_t *rawcart);
     int (*bin_attach)(int type, const char *filename, uint8_t *rawcart);
@@ -112,6 +114,8 @@
     int (*can_flush_secondary_image)(int type);
     int (*can_save_image)(int type);
     int (*can_save_secondary_image)(int type);
+    int (*snapshot_read)(int type, snapshot_t *s);
+    int (*snapshot_write)(int type, snapshot_t *s);
 };
 typedef struct c128cartridge_interface_s c128cartridge_interface_t;
 
Modified: trunk/vice/src/c64/c64export.c
===================================================================
--- trunk/vice/src/c64/c64export.c	2024-06-01 18:54:33 UTC (rev 45178)
+++ trunk/vice/src/c64/c64export.c	2024-06-01 22:09:10 UTC (rev 45179)
@@ -63,6 +63,7 @@
     export_list_t *current = NULL;
     io_source_t *io;
     int cartid;
+    int is128 = (machine_class == VICE_MACHINE_C128);
 
     current = export_query_list(current);
 
@@ -70,16 +71,31 @@
         mon_out("No expansion port devices.\n");
     } else {
                /*- -----    -     - --------- --------- ------------------------ */
+        if (is128) {
+                   /*12345*/
+            mon_out("     ");
+        }
         mon_out("  CRTID GAME EXROM IO1-usage IO2-usage Name\n");
         while (current != NULL) {
+            int c128cart = CARTRIDGE_C128_ISID(current->device->cartid);
             if (cart_is_slotmain(current->device->cartid)) {
                 mon_out("* ");
             } else {
                 mon_out("  ");
             }
+            if (is128) {
+                if (c128cart) {
+                           /*12345*/
+                    mon_out("C128:");
+                } else {
+                    mon_out(" C64:");
+                }
+            }
             cartid = ((int)current->device->cartid);
             if (cartid < 0) {
                 mon_out("0/%d  ", cartid);
+            } else if (is128 && c128cart) {
+                mon_out("%5d ", CARTRIDGE_C128_CRTID(cartid));
             } else {
                 mon_out("%5d ", cartid);
             }
@@ -99,7 +115,7 @@
             }
             /* show (inactive) in front of the name when no PLA lines nor
                I/O resources are used, this should not happen in normal
-               operation and usually indicates a bug */
+               operation and usually indicates a bug UNLESS this is a C128 :) */
             if ((!current->device->game) &&
                 (!current->device->exrom) &&
                 (!current->device->io1) &&
Modified: trunk/vice/src/c64/cart/c64carthooks.c
===================================================================
--- trunk/vice/src/c64/cart/c64carthooks.c	2024-06-01 18:54:33 UTC (rev 45178)
+++ trunk/vice/src/c64/cart/c64carthooks.c	2024-06-01 22:09:10 UTC (rev 45179)
@@ -3153,7 +3153,7 @@
     uint8_t i;
     uint8_t number_of_carts = 0;
     int cart_ids[C64CART_DUMP_MAX_CARTS];
-    int last_cart = 0;
+    int last_cart = CARTRIDGE_NONE;
 
     memset(cart_ids, 0, sizeof(cart_ids));
 
@@ -3234,489 +3234,498 @@
 
     /* Save individual cart data */
     for (i = 0; i < number_of_carts; i++) {
-        switch (cart_ids[i]) {
-            /* "Slot 0" */
-            case CARTRIDGE_CPM:
-                if (cpmcart_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_IEEE488:
-                if (tpi_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_RAMLINK:
-                if (ramlink_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_IEEEFLASH64:
-                if (ieeeflash64_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_MAGIC_VOICE:
-                if (magicvoice_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_MMC64:
-                if (mmc64_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
 
-            /* "Slot 1" */
-            case CARTRIDGE_DQBB:
-                if (dqbb_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_EXPERT:
-                if (expert_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_ISEPIC:
-                if (isepic_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_RAMCART:
-                if (ramcart_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
+        if ((machine_class == VICE_MACHINE_C128) && CARTRIDGE_C128_ISID(cart_ids[i])) {
+            if (c128cartridge->snapshot_write(cart_ids[i], s) < 0) {
+                return -1;
+            }
+            break;
+        } else {
 
-            /* "Main Slot" */
-            case CARTRIDGE_ACTION_REPLAY:
-                if (actionreplay_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_ACTION_REPLAY2:
-                if (actionreplay2_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_ACTION_REPLAY3:
-                if (actionreplay3_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_ACTION_REPLAY4:
-                if (actionreplay4_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_ATOMIC_POWER:
-                if (atomicpower_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_BISPLUS:
-                if (bisplus_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_BLACKBOX3:
-                if (blackbox3_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_BLACKBOX4:
-                if (blackbox4_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_BLACKBOX8:
-                if (blackbox8_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_CAPTURE:
-                if (capture_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_COMAL80:
-                if (comal80_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_DELA_EP64:
-                if (delaep64_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_DELA_EP7x8:
-                if (delaep7x8_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_DELA_EP256:
-                if (delaep256_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_DIASHOW_MAKER:
-                if (dsm_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_DINAMIC:
-                if (dinamic_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_DREAN:
-                if (drean_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_EASYCALC:
-                if (easycalc_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_EASYFLASH:
-                if (easyflash_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_EPYX_FASTLOAD:
-                if (epyxfastload_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_EXOS:
-                if (exos_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_FINAL_I:
-                if (final_v1_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_FINAL_III:
-                if (final_v3_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_FINAL_PLUS:
-                if (final_plus_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_FORMEL64:
-                if (formel64_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_FREEZE_FRAME:
-                if (freezeframe_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_FREEZE_FRAME_MK2:
-                if (freezeframe2_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_FREEZE_MACHINE:
-                if (freezemachine_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_FUNPLAY:
-                if (funplay_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_GAME_KILLER:
-                if (gamekiller_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_GENERIC_16KB:
-            case CARTRIDGE_GENERIC_8KB:
-            case CARTRIDGE_ULTIMAX:
-                if (generic_snapshot_write_module(s, cart_ids[i]) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_GMOD2:
-                if (gmod2_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_GMOD3:
-                if (gmod3_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_GS:
-                if (gs_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_HYPERBASIC:
-                if (hyperbasic_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_IDE64:
-                if (ide64_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_KCS_POWER:
-                if (kcs_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_KINGSOFT:
-                if (kingsoft_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_LT_KERNAL:
-                if (ltkernal_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_MACH5:
-                if (mach5_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_MAGIC_DESK:
-                if (magicdesk_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_MAGIC_FORMEL:
-                if (magicformel_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_MAX_BASIC:
-                if (maxbasic_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_MIKRO_ASSEMBLER:
-                if (mikroass_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_MMC_REPLAY:
-                if (mmcreplay_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_MULTIMAX:
-                if (multimax_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_OCEAN:
-                if (ocean_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_P64:
-                if (p64_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_PAGEFOX:
-                if (pagefox_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_PARTNER64:
-                if (partner64_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_RETRO_REPLAY:
-                if (retroreplay_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_REX:
-                if (rex_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_REX_EP256:
-                if (rexep256_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_REX_RAMFLOPPY:
-                if (rexramfloppy_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_RGCD:
-                if (rgcd_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
+            switch (cart_ids[i]) {
+                /* "Slot 0" */
+                case CARTRIDGE_CPM:
+                    if (cpmcart_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_IEEE488:
+                    if (tpi_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_RAMLINK:
+                    if (ramlink_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_IEEEFLASH64:
+                    if (ieeeflash64_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_MAGIC_VOICE:
+                    if (magicvoice_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_MMC64:
+                    if (mmc64_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+
+                /* "Slot 1" */
+                case CARTRIDGE_DQBB:
+                    if (dqbb_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_EXPERT:
+                    if (expert_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_ISEPIC:
+                    if (isepic_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_RAMCART:
+                    if (ramcart_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+
+                /* "Main Slot" */
+                case CARTRIDGE_ACTION_REPLAY:
+                    if (actionreplay_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_ACTION_REPLAY2:
+                    if (actionreplay2_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_ACTION_REPLAY3:
+                    if (actionreplay3_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_ACTION_REPLAY4:
+                    if (actionreplay4_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_ATOMIC_POWER:
+                    if (atomicpower_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_BISPLUS:
+                    if (bisplus_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_BLACKBOX3:
+                    if (blackbox3_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_BLACKBOX4:
+                    if (blackbox4_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_BLACKBOX8:
+                    if (blackbox8_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_CAPTURE:
+                    if (capture_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_COMAL80:
+                    if (comal80_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_DELA_EP64:
+                    if (delaep64_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_DELA_EP7x8:
+                    if (delaep7x8_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_DELA_EP256:
+                    if (delaep256_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_DIASHOW_MAKER:
+                    if (dsm_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_DINAMIC:
+                    if (dinamic_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_DREAN:
+                    if (drean_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_EASYCALC:
+                    if (easycalc_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_EASYFLASH:
+                    if (easyflash_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_EPYX_FASTLOAD:
+                    if (epyxfastload_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_EXOS:
+                    if (exos_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_FINAL_I:
+                    if (final_v1_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_FINAL_III:
+                    if (final_v3_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_FINAL_PLUS:
+                    if (final_plus_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_FORMEL64:
+                    if (formel64_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_FREEZE_FRAME:
+                    if (freezeframe_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_FREEZE_FRAME_MK2:
+                    if (freezeframe2_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_FREEZE_MACHINE:
+                    if (freezemachine_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_FUNPLAY:
+                    if (funplay_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_GAME_KILLER:
+                    if (gamekiller_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_GENERIC_16KB:
+                case CARTRIDGE_GENERIC_8KB:
+                case CARTRIDGE_ULTIMAX:
+                    if (generic_snapshot_write_module(s, cart_ids[i]) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_GMOD2:
+                    if (gmod2_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_GMOD3:
+                    if (gmod3_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_GS:
+                    if (gs_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_HYPERBASIC:
+                    if (hyperbasic_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_IDE64:
+                    if (ide64_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_KCS_POWER:
+                    if (kcs_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_KINGSOFT:
+                    if (kingsoft_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_LT_KERNAL:
+                    if (ltkernal_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_MACH5:
+                    if (mach5_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_MAGIC_DESK:
+                    if (magicdesk_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_MAGIC_FORMEL:
+                    if (magicformel_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_MAX_BASIC:
+                    if (maxbasic_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_MIKRO_ASSEMBLER:
+                    if (mikroass_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_MMC_REPLAY:
+                    if (mmcreplay_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_MULTIMAX:
+                    if (multimax_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_OCEAN:
+                    if (ocean_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_P64:
+                    if (p64_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_PAGEFOX:
+                    if (pagefox_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_PARTNER64:
+                    if (partner64_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_RETRO_REPLAY:
+                    if (retroreplay_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_REX:
+                    if (rex_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_REX_EP256:
+                    if (rexep256_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_REX_RAMFLOPPY:
+                    if (rexramfloppy_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_RGCD:
+                    if (rgcd_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
 #ifdef HAVE_RAWNET
-            case CARTRIDGE_RRNETMK3:
-                if (rrnetmk3_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
+                case CARTRIDGE_RRNETMK3:
+                    if (rrnetmk3_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
 #endif
-            case CARTRIDGE_ROSS:
-                if (ross_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_SDBOX:
-                if (sdbox_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_SILVERROCK_128:
-                if (silverrock128_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_SIMONS_BASIC:
-                if (simon_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_SNAPSHOT64:
-                if (snapshot64_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_STARDOS:
-                if (stardos_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_STRUCTURED_BASIC:
-                if (stb_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_SUPER_EXPLODE_V5:
-                if (se5_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_SUPER_GAMES:
-                if (supergames_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_SUPER_SNAPSHOT:
-                if (supersnapshot_v4_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_SUPER_SNAPSHOT_V5:
-                if (supersnapshot_v5_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_TURTLE_GRAPHICS_II:
-                if (turtlegraphics_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_WARPSPEED:
-                if (warpspeed_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_WESTERMANN:
-                if (westermann_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_ZAXXON:
-                if (zaxxon_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_ZIPPCODE48:
-                if (zippcode48_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
+                case CARTRIDGE_ROSS:
+                    if (ross_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_SDBOX:
+                    if (sdbox_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_SILVERROCK_128:
+                    if (silverrock128_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_SIMONS_BASIC:
+                    if (simon_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_SNAPSHOT64:
+                    if (snapshot64_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_STARDOS:
+                    if (stardos_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_STRUCTURED_BASIC:
+                    if (stb_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_SUPER_EXPLODE_V5:
+                    if (se5_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_SUPER_GAMES:
+                    if (supergames_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_SUPER_SNAPSHOT:
+                    if (supersnapshot_v4_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_SUPER_SNAPSHOT_V5:
+                    if (supersnapshot_v5_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_TURTLE_GRAPHICS_II:
+                    if (turtlegraphics_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_WARPSPEED:
+                    if (warpspeed_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_WESTERMANN:
+                    if (westermann_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_ZAXXON:
+                    if (zaxxon_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_ZIPPCODE48:
+                    if (zippcode48_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
 
-            /* "IO Slot" */
-            case CARTRIDGE_DIGIMAX:
-                if (digimax_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_DS12C887RTC:
-                if (ds12c887rtc_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_GEORAM:
-                if (georam_write_snapshot_module(s) < 0) {
-                    return -1;
-                }
-                break;
+                /* "IO Slot" */
+                case CARTRIDGE_DIGIMAX:
+                    if (digimax_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_DS12C887RTC:
+                    if (ds12c887rtc_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_GEORAM:
+                    if (georam_write_snapshot_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
 #ifdef HAVE_MIDI
-            case CARTRIDGE_MIDI_PASSPORT:
-            case CARTRIDGE_MIDI_DATEL:
-            case CARTRIDGE_MIDI_SEQUENTIAL:
-            case CARTRIDGE_MIDI_NAMESOFT:
-            case CARTRIDGE_MIDI_MAPLIN:
-                if (c64_midi_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
+                case CARTRIDGE_MIDI_PASSPORT:
+                case CARTRIDGE_MIDI_DATEL:
+                case CARTRIDGE_MIDI_SEQUENTIAL:
+                case CARTRIDGE_MIDI_NAMESOFT:
+                case CARTRIDGE_MIDI_MAPLIN:
+                    if (c64_midi_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
 #endif
-            case CARTRIDGE_REU:
-                if (reu_write_snapshot_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_SFX_SOUND_EXPANDER:
-                if (sfx_soundexpander_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
-            case CARTRIDGE_SFX_SOUND_SAMPLER:
-                if (sfx_soundsampler_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
+                case CARTRIDGE_REU:
+                    if (reu_write_snapshot_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_SFX_SOUND_EXPANDER:
+                    if (sfx_soundexpander_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
+                case CARTRIDGE_SFX_SOUND_SAMPLER:
+                    if (sfx_soundsampler_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
 #ifdef HAVE_RAWNET
-            case CARTRIDGE_TFE:
-                if (ethernetcart_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
+                case CARTRIDGE_TFE:
+                    if (ethernetcart_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
 #endif
 #if defined(HAVE_RS232DEV) || defined(HAVE_RS232NET)
-            case CARTRIDGE_TURBO232:
-                if (aciacart_snapshot_write_module(s) < 0) {
-                    return -1;
-                }
-                break;
+                case CARTRIDGE_TURBO232:
+                    if (aciacart_snapshot_write_module(s) < 0) {
+                        return -1;
+                    }
+                    break;
 #endif
 
-            default:
-                /* If the cart cannot be saved, we obviously can't load it either.
-          ...
 
[truncated message content] | 
| 
      
      
      From: <gp...@us...> - 2024-06-01 18:54:35
      
     | 
| Revision: 45178
          http://sourceforge.net/p/vice-emu/code/45178
Author:   gpz
Date:     2024-06-01 18:54:33 +0000 (Sat, 01 Jun 2024)
Log Message:
-----------
1 = power cycle
Modified Paths:
--------------
    trunk/vice/src/monitor/mon_command.c
Modified: trunk/vice/src/monitor/mon_command.c
===================================================================
--- trunk/vice/src/monitor/mon_command.c	2024-06-01 18:40:24 UTC (rev 45177)
+++ trunk/vice/src/monitor/mon_command.c	2024-06-01 18:54:33 UTC (rev 45178)
@@ -267,7 +267,7 @@
 
     { "reset", "",
       "[<Type>]",
-      "Reset the machine or drive. Type: 0 = soft, 1 = hard, 8-11 = drive.",
+      "Reset the machine or drive. Type: 0 = reset, 1 = power cycle, 8-11 = reset drive.",
       NO_FILENAME_ARG
     },
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <gp...@us...> - 2024-06-01 18:40:26
      
     | 
| Revision: 45177
          http://sourceforge.net/p/vice-emu/code/45177
Author:   gpz
Date:     2024-06-01 18:40:24 +0000 (Sat, 01 Jun 2024)
Log Message:
-----------
hopefully fix initial startup initialization, please test :)
Modified Paths:
--------------
    trunk/vice/src/c64/c64-resources.c
    trunk/vice/src/machine.c
    trunk/vice/src/ram.c
Modified: trunk/vice/src/c64/c64-resources.c
===================================================================
--- trunk/vice/src/c64/c64-resources.c	2024-05-31 21:35:53 UTC (rev 45176)
+++ trunk/vice/src/c64/c64-resources.c	2024-06-01 18:40:24 UTC (rev 45177)
@@ -56,10 +56,10 @@
    `MACHINE_SYNC_PAL', the same as PAL machines.  If equal to
    `MACHINE_SYNC_NTSC', the same as NTSC machines.  The sync factor is
    calculated as 65536 * drive_clk / clk_[main machine] */
-static int sync_factor;
+static int sync_factor = -1;
 
 /* Frequency of the power grid in Hz */
-static int power_freq = 1;
+static int power_freq = -1;
 
 /* Name of the character ROM.  */
 static char *chargen_rom_name = NULL;
@@ -90,7 +90,11 @@
 
 static int set_kernal_rom_name(const char *val, void *param)
 {
-    int ret, changed = 1;
+    int ret;
+    /* CAUTION: make sure to only trigger a power cycle when the name changed
+                AND it was not null before (in that case we are setting the
+                default value) */
+    int changed = 0;
     log_verbose("set_kernal_rom_name val:%s.", val);
     if ((val != NULL) && (kernal_rom_name != NULL)) {
         changed = (strcmp(val, kernal_rom_name) != 0);
@@ -108,7 +112,11 @@
 
 static int set_basic_rom_name(const char *val, void *param)
 {
-    int ret, changed = 1;
+    int ret;
+    /* CAUTION: make sure to only trigger a power cycle when the name changed
+                AND it was not null before (in that case we are setting the
+                default value) */
+    int changed = 0;
     if ((val != NULL) && (basic_rom_name != NULL)) {
         changed = (strcmp(val, basic_rom_name) != 0);
     }
Modified: trunk/vice/src/machine.c
===================================================================
--- trunk/vice/src/machine.c	2024-05-31 21:35:53 UTC (rev 45176)
+++ trunk/vice/src/machine.c	2024-06-01 18:40:24 UTC (rev 45177)
@@ -174,8 +174,14 @@
 
 void machine_powerup(void)
 {
-    static CLOCK powerup_clk = CLOCK_MAX;
+    /* HACK: using 0 as the initial compare value allows us to skip the multiple
+       calls to this function that happen at startup, due to the default values
+       for resources being initialized. The actual first reset, which also
+       triggers a powerup call, will happen at clock value 6, so this is safe */
+    static CLOCK powerup_clk = 0;
 
+    DBG(("machine_powerup clk:%08x %s\n", maincpu_clk, (maincpu_clk == powerup_clk) ? "(skip mem init)":"init memory" ));
+
     machine_specific_powerup();
 
     /* some functions we can omit, if the cpu did not run since last call */
@@ -188,6 +194,8 @@
 
 static void machine_trigger_reset_internal(const unsigned int mode)
 {
+    DBG(("machine_trigger_reset_internal (%s)\n", mode == MACHINE_RESET_MODE_POWER_CYCLE ? "power cycle":"reset"));
+
     is_jammed = false;
 
     if (jam_reason) {
@@ -261,9 +269,12 @@
 
     vsync_reset_hook();
 
-    /* If this is the first machine reset, kick off any requested autostart */
+    /* Handle the first machine reset */
     if (is_first_reset) {
         is_first_reset = false;
+        /* extra power-up initialization */
+        machine_powerup();
+        /* kick off any requested autostart */
         initcmdline_check_attach();
     }
 }
Modified: trunk/vice/src/ram.c
===================================================================
--- trunk/vice/src/ram.c	2024-05-31 21:35:53 UTC (rev 45176)
+++ trunk/vice/src/ram.c	2024-06-01 18:40:24 UTC (rev 45177)
@@ -38,6 +38,14 @@
 #include "resources.h"
 #include "types.h"
 
+/* #define DEBUG_RAMINIT */
+
+#ifdef DEBUG_RAMINIT
+#define DBG(x) printf x
+#else
+#define DBG(x)
+#endif
+
 static RAMINITPARAM mainramparam = {
     .start_value = 255,         /* RAMInitStartValue - first value of the base pattern (byte value) */
     .value_invert = 128,        /* RAMInitValueInvert - number of bytes until start value is inverted */
@@ -256,6 +264,8 @@
     double log_1mp = -INFINITY;
     unsigned int random_next = UINT_MAX;
 
+    DBG(("ram_init_with_pattern ramsize:%08x\n", ramsize));
+
     if (ramparam->random_chance <= 0) {
         /* flipping no bits */
         random_method = RANDOM_METHOD_NONE;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <gp...@us...> - 2024-05-31 21:35:56
      
     | 
| Revision: 45176
          http://sourceforge.net/p/vice-emu/code/45176
Author:   gpz
Date:     2024-05-31 21:35:53 +0000 (Fri, 31 May 2024)
Log Message:
-----------
make an explicit machine_powerup function and call this explicitly from machine_trigger_reset, instead of doing the related init indirectly in machine_reset. makes machine_reset more worm 'as expected'. should fix #2036
Modified Paths:
--------------
    trunk/vice/src/autostart.c
    trunk/vice/src/c64/cart/turbomaster.c
    trunk/vice/src/cbm2/cbm2-cmdline-options.c
    trunk/vice/src/machine.c
    trunk/vice/src/machine.h
    trunk/vice/src/main65816cpu.c
    trunk/vice/src/mainc64cpu.c
    trunk/vice/src/maincpu.c
    trunk/vice/src/mainviccpu.c
    trunk/vice/src/pet/6809.c
Modified: trunk/vice/src/autostart.c
===================================================================
--- trunk/vice/src/autostart.c	2024-05-31 17:59:57 UTC (rev 45175)
+++ trunk/vice/src/autostart.c	2024-05-31 21:35:53 UTC (rev 45176)
@@ -1519,7 +1519,7 @@
         lib_free(temp_name);
     }
 
-    mem_powerup();
+    /* mem_powerup(); */ /* power cycle takes care of this */
 
     autostart_ignore_reset = 1;
     deallocate_program_name();
Modified: trunk/vice/src/c64/cart/turbomaster.c
===================================================================
--- trunk/vice/src/c64/cart/turbomaster.c	2024-05-31 17:59:57 UTC (rev 45175)
+++ trunk/vice/src/c64/cart/turbomaster.c	2024-05-31 21:35:53 UTC (rev 45176)
@@ -908,7 +908,7 @@
                 DO_INTERRUPT(IK_RESET);                               \
                 break;                                                \
             case JAM_POWER_CYCLE:                                     \
-                mem_powerup();                                        \
+                machine_powerup();                                    \
                 DO_INTERRUPT(IK_RESET);                               \
                 break;                                                \
             case JAM_MONITOR:                                         \
Modified: trunk/vice/src/cbm2/cbm2-cmdline-options.c
===================================================================
--- trunk/vice/src/cbm2/cbm2-cmdline-options.c	2024-05-31 17:59:57 UTC (rev 45175)
+++ trunk/vice/src/cbm2/cbm2-cmdline-options.c	2024-05-31 21:35:53 UTC (rev 45176)
@@ -82,10 +82,14 @@
         if (!cbm2_init_ok) {
             return 0;
         }
-
+#if 0
         mem_powerup();
         mem_load();
         machine_trigger_reset(MACHINE_RESET_MODE_RESET_CPU);
+#else
+        machine_trigger_reset(MACHINE_RESET_MODE_POWER_CYCLE);
+        mem_load();
+#endif
         return 0;
     }
     return -1;
Modified: trunk/vice/src/machine.c
===================================================================
--- trunk/vice/src/machine.c	2024-05-31 17:59:57 UTC (rev 45175)
+++ trunk/vice/src/machine.c	2024-05-31 21:35:53 UTC (rev 45176)
@@ -90,7 +90,6 @@
 #endif
 
 static int machine_init_was_called = 0;
-static int mem_initialized = 0;
 static bool is_jammed = false;
 static char *jam_reason = NULL;
 static int jam_action = MACHINE_JAM_ACTION_DIALOG;
@@ -173,6 +172,20 @@
     return jam_reason;
 }
 
+void machine_powerup(void)
+{
+    static CLOCK powerup_clk = CLOCK_MAX;
+
+    machine_specific_powerup();
+
+    /* some functions we can omit, if the cpu did not run since last call */
+    if (maincpu_clk != powerup_clk) {
+        mem_powerup();
+    }
+
+    powerup_clk = maincpu_clk;
+}
+
 static void machine_trigger_reset_internal(const unsigned int mode)
 {
     is_jammed = false;
@@ -184,8 +197,7 @@
 
     switch (mode) {
         case MACHINE_RESET_MODE_POWER_CYCLE:
-            mem_initialized = 0; /* force memory initialization */
-            machine_specific_powerup();
+            machine_powerup();
         /* Fall through.  */
         case MACHINE_RESET_MODE_RESET_CPU:
             maincpu_trigger_reset();
@@ -214,6 +226,14 @@
     machine_trigger_reset_internal(((unsigned int*)data)[0]);
 }
 
+/* called via cpu_reset() */
+/* CAUTION: this function is only called when the CPU core is "clocked" (ie the
+   emulated machine is running). In particular that means that multiple calls
+   to the machine_trigger_reset() function will not result in multiple calls
+   to this function (if the cpu core is not running). */
+/* NOTE: To make sure things work "as expected", really only deal with "reset"
+   in the function below - anything related to "powerup" should go into
+   machine_powerup() instead */
 void machine_reset(void)
 {
     log_message(LOG_DEFAULT, "Main CPU: RESET.");
@@ -226,11 +246,6 @@
     }
 
     /* Do machine-specific initialization.  */
-    if (!mem_initialized) {
-        mem_powerup();
-        mem_initialized = 1;
-    }
-
     machine_specific_reset();
 
     kbdbuf_abort();
Modified: trunk/vice/src/machine.h
===================================================================
--- trunk/vice/src/machine.h	2024-05-31 17:59:57 UTC (rev 45175)
+++ trunk/vice/src/machine.h	2024-05-31 21:35:53 UTC (rev 45176)
@@ -116,6 +116,7 @@
 void machine_reset_event_playback(CLOCK offset, void *data);
 
 /* Power-up the machine.  */
+void machine_powerup(void);
 void machine_specific_powerup(void);
 
 /* Shutdown the emachine.  */
Modified: trunk/vice/src/main65816cpu.c
===================================================================
--- trunk/vice/src/main65816cpu.c	2024-05-31 17:59:57 UTC (rev 45175)
+++ trunk/vice/src/main65816cpu.c	2024-05-31 21:35:53 UTC (rev 45176)
@@ -326,7 +326,7 @@
                 DO_INTERRUPT(IK_RESET);                               \
                 break;                                                \
             case JAM_POWER_CYCLE:                                     \
-                mem_powerup();                                        \
+                machine_powerup();                                    \
                 DO_INTERRUPT(IK_RESET);                               \
                 break;                                                \
             case JAM_MONITOR:                                         \
Modified: trunk/vice/src/mainc64cpu.c
===================================================================
--- trunk/vice/src/mainc64cpu.c	2024-05-31 17:59:57 UTC (rev 45175)
+++ trunk/vice/src/mainc64cpu.c	2024-05-31 21:35:53 UTC (rev 45176)
@@ -724,7 +724,7 @@
                 DO_INTERRUPT(IK_RESET);                               \
                 break;                                                \
             case JAM_POWER_CYCLE:                                     \
-                mem_powerup();                                        \
+                machine_powerup();                                    \
                 DO_INTERRUPT(IK_RESET);                               \
                 break;                                                \
             case JAM_MONITOR:                                         \
Modified: trunk/vice/src/maincpu.c
===================================================================
--- trunk/vice/src/maincpu.c	2024-05-31 17:59:57 UTC (rev 45175)
+++ trunk/vice/src/maincpu.c	2024-05-31 21:35:53 UTC (rev 45176)
@@ -551,7 +551,7 @@
                 DO_INTERRUPT(IK_RESET);                               \
                 break;                                                \
             case JAM_POWER_CYCLE:                                     \
-                mem_powerup();                                        \
+                machine_powerup();                                    \
                 DO_INTERRUPT(IK_RESET);                               \
                 break;                                                \
             case JAM_MONITOR:                                         \
Modified: trunk/vice/src/mainviccpu.c
===================================================================
--- trunk/vice/src/mainviccpu.c	2024-05-31 17:59:57 UTC (rev 45175)
+++ trunk/vice/src/mainviccpu.c	2024-05-31 21:35:53 UTC (rev 45176)
@@ -551,7 +551,7 @@
                 DO_INTERRUPT(IK_RESET);                               \
                 break;                                                \
             case JAM_POWER_CYCLE:                                     \
-                mem_powerup();                                        \
+                machine_powerup();                                    \
                 DO_INTERRUPT(IK_RESET);                               \
                 break;                                                \
             case JAM_MONITOR:                                         \
Modified: trunk/vice/src/pet/6809.c
===================================================================
--- trunk/vice/src/pet/6809.c	2024-05-31 17:59:57 UTC (rev 45175)
+++ trunk/vice/src/pet/6809.c	2024-05-31 21:35:53 UTC (rev 45176)
@@ -169,7 +169,7 @@
                 DO_INTERRUPT(IK_RESET);                          \
                 break;                                           \
             case JAM_POWER_CYCLE:                                \
-                mem_powerup();                                   \
+                machine_powerup();                               \
                 DO_INTERRUPT(IK_RESET);                          \
                 break;                                           \
             case JAM_MONITOR:                                    \
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <gp...@us...> - 2024-05-31 17:59:59
      
     | 
| Revision: 45175
          http://sourceforge.net/p/vice-emu/code/45175
Author:   gpz
Date:     2024-05-31 17:59:57 +0000 (Fri, 31 May 2024)
Log Message:
-----------
tweak resid dac leakage. patch by leandro nini
Modified Paths:
--------------
    trunk/vice/src/resid/dac.cc
Modified: trunk/vice/src/resid/dac.cc
===================================================================
--- trunk/vice/src/resid/dac.cc	2024-05-28 16:17:41 UTC (rev 45174)
+++ trunk/vice/src/resid/dac.cc	2024-05-31 17:59:57 UTC (rev 45175)
@@ -40,6 +40,12 @@
 namespace reSID
 {
 
+// "Even in standard transistors a small amount of current leaks
+//  even when they are technically switched off."
+// https://en.wikipedia.org/wiki/Subthreshold_conduction
+static const double MOSFET_LEAKAGE_6581 = 0.0075;
+static const double MOSFET_LEAKAGE_8580 = 0.0035;
+
 // ----------------------------------------------------------------------------
 // Calculation of lookup tables for SID DACs.
 // ----------------------------------------------------------------------------
@@ -73,6 +79,8 @@
   // double vbit[bits];
   double vbit[12];
 
+  const double leakage = term ? MOSFET_LEAKAGE_8580 : MOSFET_LEAKAGE_6581;
+
   // Calculate voltage contribution by each individual bit in the R-2R ladder.
   for (int set_bit = 0; set_bit < bits; set_bit++) {
     int bit;
@@ -119,10 +127,7 @@
     int x = i;
     double Vo = 0;
     for (int j = 0; j < bits; j++) {
-      // "Even in standard transistors a small amount of current leaks
-      //  even when they are technically switched off."
-      // https://en.wikipedia.org/wiki/Subthreshold_conduction
-      Vo += ((x & 0x1) ? 1. : 0.01)*vbit[j];
+      Vo += ((x & 0x1) ? 1. : leakage)*vbit[j];
       x >>= 1;
     }
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <co...@us...> - 2024-05-28 16:17:43
      
     | 
| Revision: 45174
          http://sourceforge.net/p/vice-emu/code/45174
Author:   compyx
Date:     2024-05-28 16:17:41 +0000 (Tue, 28 May 2024)
Log Message:
-----------
Gtk3: cart base dialogs: add comments on signal handlers
Modified Paths:
--------------
    trunk/vice/src/arch/gtk3/widgets/base/carthelpers.c
    trunk/vice/src/arch/gtk3/widgets/base/cartridgewidgets.c
Modified: trunk/vice/src/arch/gtk3/widgets/base/carthelpers.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/base/carthelpers.c	2024-05-28 16:13:57 UTC (rev 45173)
+++ trunk/vice/src/arch/gtk3/widgets/base/carthelpers.c	2024-05-28 16:17:41 UTC (rev 45174)
@@ -110,6 +110,7 @@
     gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(check),
                                  (gboolean)cartridge_type_enabled(cart_id));
 
+    /* cannot connect unlocked: the signal handler sets a resource */
     handler_id = g_signal_connect(check,
                                   "toggled",
                                   G_CALLBACK(on_cart_enable_check_button_toggled),
Modified: trunk/vice/src/arch/gtk3/widgets/base/cartridgewidgets.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/base/cartridgewidgets.c	2024-05-28 16:13:57 UTC (rev 45173)
+++ trunk/vice/src/arch/gtk3/widgets/base/cartridgewidgets.c	2024-05-28 16:17:41 UTC (rev 45174)
@@ -535,7 +535,8 @@
         gtk_entry_set_text(GTK_ENTRY(entry), path);
     }
 
-    /* set up signal handlers */
+    /* set up signal handlers (all of these can set resources and thus cannot
+     * be connected unlocked) */
     g_signal_connect(G_OBJECT(entry),
                      "focus-out-event",
                      G_CALLBACK(on_filename_focus_out_event),
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <co...@us...> - 2024-05-28 16:13:59
      
     | 
| Revision: 45173
          http://sourceforge.net/p/vice-emu/code/45173
Author:   compyx
Date:     2024-05-28 16:13:57 +0000 (Tue, 28 May 2024)
Log Message:
-----------
Gtk3: base dialogs: update signal handler connecting
Connect "destroy" signal handlers unlocked, add comments about why the other
signal handles cannot be connected unlocked.
Modified Paths:
--------------
    trunk/vice/src/arch/gtk3/widgets/base/basedialogs.c
Modified: trunk/vice/src/arch/gtk3/widgets/base/basedialogs.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/base/basedialogs.c	2024-05-28 16:05:07 UTC (rev 45172)
+++ trunk/vice/src/arch/gtk3/widgets/base/basedialogs.c	2024-05-28 16:13:57 UTC (rev 45173)
@@ -159,8 +159,10 @@
 
     /* set up signal handler to destroy the temporary parent window */
     if (no_parent) {
-        g_signal_connect_unlocked(dialog, "destroy", G_CALLBACK(on_dialog_destroy),
-                (gpointer)parent);
+        g_signal_connect_unlocked(G_OBJECT(dialog),
+                                  "destroy",
+                                  G_CALLBACK(on_dialog_destroy),
+                                  (gpointer)parent);
     }
 
     return dialog;
@@ -257,6 +259,8 @@
     } else {
         gtk_window_set_position(GTK_WINDOW(dialog), GTK_WIN_POS_CENTER);
     }
+
+    /* cannot connect unlocked: the user's callback might set a resource */
     g_signal_connect(G_OBJECT(dialog),
                      "response",
                      G_CALLBACK(on_response_confirm),
@@ -360,10 +364,10 @@
  */
 static gboolean on_integer_key_press_event(GtkEntry *entry,
                                            GdkEvent *event,
-                                           gpointer data)
+                                           gpointer  data)
 {
-    GtkWidget *dialog = data;
-    GdkEventKey *keyev = (GdkEventKey *)event;
+    GtkWidget   *dialog = data;
+    GdkEventKey *keyev  = (GdkEventKey *)event;
 
     if (keyev->type == GDK_KEY_PRESS && keyev->keyval == GDK_KEY_Return) {
         /* got Enter */
@@ -447,10 +451,17 @@
     gtk_widget_show_all(grid);
     gtk_box_pack_start(GTK_BOX(content), grid, TRUE, TRUE, 8);
 
-    g_signal_connect(dialog, "key-press-event",
-            G_CALLBACK(on_integer_key_press_event), (gpointer)dialog);
-    g_signal_connect(dialog, "response", G_CALLBACK(on_response_integer),
-            (gpointer)entry);
+    /* cannot connect unlocked: this handler emits the "accept" signal of the
+     * dialog and the callback could set a resource */
+    g_signal_connect(G_OBJECT(dialog),
+                     "key-press-event",
+                     G_CALLBACK(on_integer_key_press_event),
+                     (gpointer)dialog);
+    /* cannot connect unlocked either */
+    g_signal_connect(G_OBJECT(dialog),
+                     "response",
+                     G_CALLBACK(on_response_integer),
+                     (gpointer)entry);
     gtk_widget_show(dialog);
     return dialog;
 }
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <co...@us...> - 2024-05-28 16:05:09
      
     | 
| Revision: 45172
          http://sourceforge.net/p/vice-emu/code/45172
Author:   compyx
Date:     2024-05-28 16:05:07 +0000 (Tue, 28 May 2024)
Log Message:
-----------
Gtk3: Cart attach dialog: connect more signal handlers unlocked
Modified Paths:
--------------
    trunk/vice/src/arch/gtk3/uicart.c
    trunk/vice/src/arch/gtk3/widgets/crtpreviewwidget.c
Modified: trunk/vice/src/arch/gtk3/uicart.c
===================================================================
--- trunk/vice/src/arch/gtk3/uicart.c	2024-05-28 15:53:12 UTC (rev 45171)
+++ trunk/vice/src/arch/gtk3/uicart.c	2024-05-28 16:05:07 UTC (rev 45172)
@@ -1003,7 +1003,7 @@
  *
  * \return  GtkGrid
  */
-static void  update_preview(GtkFileChooser *file_chooser, gpointer data)
+static void update_preview(GtkFileChooser *file_chooser, gpointer data)
 {
     gchar *path = NULL;
 
@@ -1086,11 +1086,20 @@
     }
 
     extra_attach_callback = callback;
-    cart_dialog = dialog;
+    cart_dialog           = dialog;
 
-    g_signal_connect(dialog, "response", G_CALLBACK(on_response), NULL);
-    g_signal_connect(dialog, "update-preview", G_CALLBACK(update_preview), NULL);
-    g_signal_connect(dialog, "destroy", G_CALLBACK(on_destroy), NULL);
+    g_signal_connect(G_OBJECT(dialog),
+                     "response",
+                     G_CALLBACK(on_response),
+                     NULL);
+    g_signal_connect_unlocked(G_OBJECT(dialog),
+                              "update-preview",
+                              G_CALLBACK(update_preview),
+                              NULL);
+    g_signal_connect_unlocked(G_OBJECT(dialog),
+                     "destroy",
+                     G_CALLBACK(on_destroy),
+                     NULL);
 
     /* those should be hidden by default */
     if (cart_id_label) {
Modified: trunk/vice/src/arch/gtk3/widgets/crtpreviewwidget.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/crtpreviewwidget.c	2024-05-28 15:53:12 UTC (rev 45171)
+++ trunk/vice/src/arch/gtk3/widgets/crtpreviewwidget.c	2024-05-28 16:05:07 UTC (rev 45172)
@@ -327,7 +327,9 @@
 
     fd = crt_open(path, &header);
     if (fd == NULL) {
+#if 0
         debug_gtk3("failed to open crt image");
+#endif
         gtk_label_set_text(GTK_LABEL(crtid_label), "<unknown>");
         gtk_label_set_text(GTK_LABEL(crtrevision_label), "<unknown>");
         gtk_label_set_text(GTK_LABEL(crtname_label), "<unknown>");
@@ -371,13 +373,15 @@
 
 
     while (1) {
-        long pos;
+        long     pos;
         uint32_t skip;
 #if 0
         debug_gtk3("reading packet #%d.", packets++);
 #endif
         if (crt_read_chip_header(&chip, fd) != 0) {
+#if 0
             debug_gtk3("couldn't read further CHIP packets, exiting.");
+#endif
             break;
         }
         skip = chip.size;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <gp...@us...> - 2024-05-21 00:22:19
      
     | 
| Revision: 45166
          http://sourceforge.net/p/vice-emu/code/45166
Author:   gpz
Date:     2024-05-21 00:22:17 +0000 (Tue, 21 May 2024)
Log Message:
-----------
removed some casts. Addded some comments. still no idea about #2030
Modified Paths:
--------------
    trunk/vice/src/plus4/ted-badline.c
    trunk/vice/src/plus4/ted-irq.c
    trunk/vice/src/plus4/ted-mem.c
    trunk/vice/src/plus4/ted-snapshot.c
    trunk/vice/src/plus4/ted-timer.c
    trunk/vice/src/plus4/ted.c
    trunk/vice/src/plus4/tedtypes.h
Modified: trunk/vice/src/plus4/ted-badline.c
===================================================================
--- trunk/vice/src/plus4/ted-badline.c	2024-05-20 08:37:05 UTC (rev 45165)
+++ trunk/vice/src/plus4/ted-badline.c	2024-05-21 00:22:17 UTC (rev 45166)
@@ -50,8 +50,7 @@
     if (cycle > 0) {
         ted.raster.draw_idle_state = ted.idle_state = 0;
         ted.idle_data_location = IDLE_NONE;
-        if (cycle > TED_FETCH_CYCLE + 2
-            && !ted.ycounter_reset_checked) {
+        if ((cycle > (TED_FETCH_CYCLE + 2)) && !ted.ycounter_reset_checked) {
             /*ted.raster.ycounter = 0;*/
             ted.ycounter_reset_checked = 1;
         }
Modified: trunk/vice/src/plus4/ted-irq.c
===================================================================
--- trunk/vice/src/plus4/ted-irq.c	2024-05-20 08:37:05 UTC (rev 45165)
+++ trunk/vice/src/plus4/ted-irq.c	2024-05-21 00:22:17 UTC (rev 45166)
@@ -107,11 +107,12 @@
 
 void ted_irq_set_raster_line(unsigned int line)
 {
-    if (line == ted.raster_irq_line && ted.raster_irq_clk != CLOCK_MAX) {
+    if ((line == ted.raster_irq_line) &&
+        (ted.raster_irq_clk != CLOCK_MAX)) {
         return;
     }
 
-    if (line < (unsigned int)ted.screen_height) {
+    if (line < ted.screen_height) {
         unsigned int current_line = TED_RASTER_Y(maincpu_clk);
 
         ted.raster_irq_clk = (TED_LINE_START_CLK(maincpu_clk)
@@ -188,15 +189,18 @@
 
         if (maincpu_rmw_flag) {
             if (high) {
-                if (TED_RASTER_CYCLE(maincpu_clk) == 0
-                    && (line & 0xff) == 0) {
+                if ((TED_RASTER_CYCLE(maincpu_clk) == 0) && ((line & 0xff) == 0)) {
                     unsigned int previous_line = TED_PREVIOUS_LINE(line);
 
-                    if (previous_line != old_raster_irq_line && ((old_raster_irq_line & 0xff) == (previous_line & 0xff))) {
+                    if ((previous_line != old_raster_irq_line) &&
+                        ((previous_line & 0xff) == (old_raster_irq_line & 0xff))) {
+                        /* MSB changed */
                         trigger_irq = 1;
                     }
                 } else {
-                    if (line != old_raster_irq_line && (old_raster_irq_line & 0xff) == (line & 0xff)) {
+                    if ((line != old_raster_irq_line) &&
+                        ((line & 0xff) == (old_raster_irq_line & 0xff))) {
+                        /* MSB changed */
                         trigger_irq = 1;
                     }
                 }
@@ -204,12 +208,15 @@
                 if (TED_RASTER_CYCLE(maincpu_clk) == 0) {
                     unsigned int previous_line = TED_PREVIOUS_LINE(line);
 
-                    if (previous_line != old_raster_irq_line
-                        && ((old_raster_irq_line & 0x100) == (previous_line & 0x100))) {
+                    if ((previous_line != old_raster_irq_line) &&
+                        ((previous_line & 0x100) == (old_raster_irq_line & 0x100))) {
+                        /* bit0-7 changed */
                         trigger_irq = 1;
                     }
                 } else {
-                    if (line != old_raster_irq_line && (old_raster_irq_line & 0x100) == (line & 0x100)) {
+                    if ((line != old_raster_irq_line) &&
+                        ((line & 0x100) == (old_raster_irq_line & 0x100))) {
+                        /* bit0-7 changed */
                         trigger_irq = 1;
                     }
                 }
@@ -216,7 +223,8 @@
             }
         }
 
-        if (ted.raster_irq_line == line && line != old_raster_irq_line) {
+        if ((ted.raster_irq_line == line) &&
+            (line != old_raster_irq_line)) {
             trigger_irq = 1;
         }
 
Modified: trunk/vice/src/plus4/ted-mem.c
===================================================================
--- trunk/vice/src/plus4/ted-mem.c	2024-05-20 08:37:05 UTC (rev 45165)
+++ trunk/vice/src/plus4/ted-mem.c	2024-05-21 00:22:17 UTC (rev 45166)
@@ -259,10 +259,10 @@
                24-line (upmost) border because the border flip flop has
                already been turned off.  */
             if (!ted.raster.blank && line == ted.row_25_start_line
-                && cycle > 0) {
+                && (cycle > 0)) {
                 ted.raster.blank_enabled = 0;
             } else {
-                if (line == ted.row_25_stop_line && cycle > 0) {
+                if ((line == ted.row_25_stop_line) && (cycle > 0)) {
                     ted.raster.blank_enabled = 1;
                 }
             }
@@ -450,19 +450,32 @@
     ted.kbdval = val;
 }
 
+/* IRQ Status
+
+   write bits = 1 to ACK IRQ
+
+   bit 0
+   bit 1    raster compare irq
+   bit 2
+   bit 3    timer 1
+   bit 4    timer 2
+   bit 5
+   bit 6    timer 3
+   bit 7    any IRQ triggered
+ */
 inline static void ted09_store(const uint8_t value)
 {
     /* Emulates Read-Modify-Write behaviour. */
     if (maincpu_rmw_flag) {
         ted.irq_status &= ~((ted.last_read & 0x5e) | 0x80);
-        if (maincpu_clk - 1 > ted.raster_irq_clk
-            && ted.raster_irq_line < (unsigned int)ted.screen_height) {
+        if (((maincpu_clk - 1) > (ted.raster_irq_clk)) &&
+            (ted.raster_irq_line < ted.screen_height)) {
             ted_irq_next_frame();
         }
     }
 
-    if ((value & 2) && maincpu_clk > ted.raster_irq_clk
-        && ted.raster_irq_line < (unsigned int)ted.screen_height) {
+    if ((value & 2) && (maincpu_clk > ted.raster_irq_clk)
+        && (ted.raster_irq_line < ted.screen_height)) {
         ted_irq_next_frame();
     }
 
@@ -472,6 +485,17 @@
     TED_DEBUG_REGISTER(("IRQ flag register: $%02X", ted.irq_status));
 }
 
+/* IRQ Mask
+
+   bit 0    bit 8 of raster irq compare value
+   bit 1    raster compare irq
+   bit 2
+   bit 3    timer 1
+   bit 4    timer 2
+   bit 5
+   bit 6    timer 3
+   bit 7    0: clear mask 1: set mask
+ */
 inline static void ted0a_store(uint8_t value)
 {
     ted.regs[0x0a] = value & 0x5f;
@@ -483,6 +507,7 @@
     TED_DEBUG_REGISTER(("IRQ mask register: $%02X", ted.regs[0x0a]));
 }
 
+/* bit 0-7: bit 0-7 of raster irq compare value */
 inline static void ted0b_store(uint8_t value)
 {
     TED_DEBUG_REGISTER(("Raster compare register: $%02X", value));
@@ -700,7 +725,7 @@
         alarm_set(ted.raster_fetch_alarm, ted.fetch_clk);
     }
 
-    if (ted.raster_irq_line < (unsigned int)ted.screen_height) {
+    if (ted.raster_irq_line < ted.screen_height) {
         ted.raster_irq_clk = (TED_LINE_START_CLK(maincpu_clk)
                               + TED_RASTER_IRQ_DELAY - INTERRUPT_DELAY
                               + (ted.cycles_per_line
@@ -895,6 +920,17 @@
     return ted.kbdval;
 }
 
+/* IRQ Status
+
+   bit 0
+   bit 1    raster compare irq
+   bit 2
+   bit 3    timer 1
+   bit 4    timer 2
+   bit 5
+   bit 6    timer 3
+   bit 7    any IRQ triggered
+ */
 inline static uint8_t ted09_read(void)
 {
     /* Manually set raster IRQ flag if the opcode reading $09 has crossed
@@ -914,6 +950,17 @@
     return ted.last_read;
 }
 
+/* IRQ Mask
+
+   bit 0
+   bit 1    raster compare irq
+   bit 2
+   bit 3    timer 1
+   bit 4    timer 2
+   bit 5
+   bit 6    timer 3
+   bit 7
+ */
 inline static uint8_t ted0a_read(void)
 {
     return (ted.regs[0x0a] & 0x5f) | 0xa0;
Modified: trunk/vice/src/plus4/ted-snapshot.c
===================================================================
--- trunk/vice/src/plus4/ted-snapshot.c	2024-05-20 08:37:05 UTC (rev 45165)
+++ trunk/vice/src/plus4/ted-snapshot.c	2024-05-21 00:22:17 UTC (rev 45166)
@@ -262,7 +262,7 @@
 
     if (RasterCycle != (uint8_t)TED_RASTER_CYCLE(maincpu_clk)) {
         log_error(ted.log,
-                  "Not matching raster cycle (%d) in snapshot; should be %u.",
+                  "Not matching raster cycle (%d) in snapshot; should be %lu.",
                   RasterCycle, TED_RASTER_CYCLE(maincpu_clk));
         goto fail;
     }
Modified: trunk/vice/src/plus4/ted-timer.c
===================================================================
--- trunk/vice/src/plus4/ted-timer.c	2024-05-20 08:37:05 UTC (rev 45165)
+++ trunk/vice/src/plus4/ted-timer.c	2024-05-21 00:22:17 UTC (rev 45166)
@@ -59,7 +59,7 @@
 
 /*-----------------------------------------------------------------------*/
 
-static void ted_t1(CLOCK offset, void *data)
+static void ted_t1_alarm_handler(CLOCK offset, void *data)
 {
     alarm_set(ted_t1_alarm, maincpu_clk
               + (ted.t1_start == 0 ? 65536 : ted.t1_start) * 2 - offset);
@@ -71,7 +71,7 @@
     t1_last_restart = maincpu_clk - offset;
 }
 
-static void ted_t2(CLOCK offset, void *data)
+static void ted_t2_alarm_handler(CLOCK offset, void *data)
 {
     alarm_set(ted_t2_alarm, maincpu_clk + 65536 * 2 - offset);
     t2_start = 0;
@@ -83,7 +83,7 @@
     t2_last_restart = maincpu_clk - offset;
 }
 
-static void ted_t3(CLOCK offset, void *data)
+static void ted_t3_alarm_handler(CLOCK offset, void *data)
 {
     alarm_set(ted_t3_alarm, maincpu_clk + 65536 * 2 - offset);
     t3_start = 0;
@@ -275,9 +275,9 @@
 void ted_timer_init(void)
 {
     ted.t1_start = 0;
-    ted_t1_alarm = alarm_new(maincpu_alarm_context, "TED T1", ted_t1, NULL);
-    ted_t2_alarm = alarm_new(maincpu_alarm_context, "TED T2", ted_t2, NULL);
-    ted_t3_alarm = alarm_new(maincpu_alarm_context, "TED T3", ted_t3, NULL);
+    ted_t1_alarm = alarm_new(maincpu_alarm_context, "TED T1", ted_t1_alarm_handler, NULL);
+    ted_t2_alarm = alarm_new(maincpu_alarm_context, "TED T2", ted_t2_alarm_handler, NULL);
+    ted_t3_alarm = alarm_new(maincpu_alarm_context, "TED T3", ted_t3_alarm_handler, NULL);
 }
 
 void ted_timer_reset(void)
Modified: trunk/vice/src/plus4/ted.c
===================================================================
--- trunk/vice/src/plus4/ted.c	2024-05-20 08:37:05 UTC (rev 45165)
+++ trunk/vice/src/plus4/ted.c	2024-05-21 00:22:17 UTC (rev 45166)
@@ -193,7 +193,7 @@
         do {
             f = 0;
             if (maincpu_clk >= ted.draw_clk) {
-                ted_raster_draw_alarm_handler((CLOCK)(maincpu_clk - ted.draw_clk), NULL);
+                ted_raster_draw_alarm_handler(maincpu_clk - ted.draw_clk, NULL);
                 f = 1;
             }
             if (maincpu_clk > ted.fetch_clk + 1) {
@@ -765,7 +765,8 @@
 
     /* DO VSYNC if the raster_counter in the TED reached the VSYNC signal */
     /* Also do VSYNC if oversized screen reached a certain threashold, this will result in rolling screen just like on the real thing */
-    if (((signed int)(ted.tv_current_line - ted.screen_height) > 40) || (ted.ted_raster_counter == ted.vsync_line )) {
+    if (((signed int)(ted.tv_current_line - ted.screen_height) > 40) ||
+        (ted.ted_raster_counter == ted.vsync_line )) {
         if (ted.tv_current_line < ted.screen_height) {
             ted.raster.current_line = 0;
             raster_canvas_handle_end_of_frame(&ted.raster);
@@ -818,8 +819,8 @@
     if (ted.ted_raster_counter == ted.first_dma_line) {
         ted.allow_bad_lines = !ted.raster.blank;
     }
-    if (ted.allow_bad_lines
-        && (ted.ted_raster_counter & 7) == (unsigned int)((ted.raster.ysmooth + 1) & 7)) {
+    if (ted.allow_bad_lines &&
+        ((ted.ted_raster_counter & 7) == ((ted.raster.ysmooth + 1) & 7))) {
         memcpy(ted.cbuf, ted.cbuf_tmp, ted.mem_counter_inc);
     }
     /* FIXME */
@@ -879,6 +880,8 @@
 
     int video_mode, m_mcm, m_bmm, m_ecm;
     unsigned int cgen, bmap , vram;
+    int rasterx;
+    int i;
 
     video_mode = ((ted.regs[0x06] & 0x60) | (ted.regs[0x07] & 0x10)) >> 4;
 
@@ -886,28 +889,41 @@
     m_bmm = (video_mode & 2) >> 1;  /* 0 text, 1 bitmap */
     m_mcm = video_mode & 1;         /* 0 hires, 1 multi */
 
-    int i;
-
-    i = ((int)TED_RASTER_CYCLE(maincpu_clk) - 16) * 4;  /* x raster position */
-    if (i < 0) {
-        i = ted.cycles_per_line * 4 + i;
+    rasterx = ((int)TED_RASTER_CYCLE(maincpu_clk) - 16) * 4;  /* x raster position */
+    if (rasterx < 0) {
+        rasterx = ted.cycles_per_line * 4 + rasterx;
     }
 
-    mon_out("Timer 1 IRQ: %s  running: %s \n",((ted.regs[0x0a] >> 3) & 0x01)? "on" : "off", (ted.timer_running[0]) ? "yes" : "no");
+    mon_out("Timer 1 IRQ: enabled: %s  pending: %s  running: %s \n",
+            ((ted.regs[0x0a] >> 3) & 0x01)? "yes" : "no",
+            ((ted.irq_status >> 3) & 0x01)? "yes" : "no",
+            (ted.timer_running[0]) ? "yes" : "no");
     mon_out("Timer 1: $%04x (latched $%04"PRIx64")\n", (unsigned int)((ted_timer_read(0x01) << 8) | ted_timer_read(0x00)), ted.t1_start);
-    mon_out("Timer 2 IRQ: %s  running: %s \n",((ted.regs[0x0a] >> 4) & 0x01)? "on" : "off", (ted.timer_running[1]) ? "yes" : "no");
+    mon_out("Timer 2 IRQ: enabled: %s  pending: %s  running: %s \n",
+            ((ted.regs[0x0a] >> 4) & 0x01)? "yes" : "no",
+            ((ted.irq_status >> 4) & 0x01)? "yes" : "no",
+            (ted.timer_running[1]) ? "yes" : "no");
     mon_out("Timer 2: $%04x\n", (unsigned int)((ted_timer_read(0x03) << 8) | ted_timer_read(0x02)));
-    mon_out("Timer 3 IRQ: %s  running: %s \n",((ted.regs[0x0a] >> 6) & 0x01)? "on" : "off", (ted.timer_running[2]) ? "yes" : "no");
+    mon_out("Timer 3 IRQ: enabled: %s  pending: %s  running: %s \n",
+            ((ted.regs[0x0a] >> 6) & 0x01)? "yes" : "no",
+            ((ted.irq_status >> 6) & 0x01)? "yes" : "no",
+            (ted.timer_running[2]) ? "yes" : "no");
     mon_out("Timer 3: $%04x\n\n", (unsigned int)((ted_timer_read(0x05) << 8) | ted_timer_read(0x04)));
-    mon_out("Raster X/Y: %u/%u\t IRQ: %u\n", (unsigned int)i, TED_RASTER_Y(maincpu_clk),(unsigned int)(ted.regs[0x0b] | ((ted.regs[0x0a] & 1) << 8)));
+
+    mon_out("Raster IRQ line: %u  enabled: %s  pending: %s\n",
+            (unsigned int)(ted.regs[0x0b] | ((ted.regs[0x0a] & 1) << 8)),
+            ((ted.regs[0x0a] >> 1) & 0x01)? "yes" : "no",
+            ((ted.irq_status >> 1) & 0x01)? "yes" : "no");
+    mon_out("Raster X/Y: %u/%u\n\n", (unsigned int)rasterx, TED_RASTER_Y(maincpu_clk));
+
     mon_out("Mode: %s (ECM/BMM/MCM=%d/%d/%d)\n", mode_name[video_mode], m_ecm, m_bmm, m_mcm);
-    mon_out("Colors: Border: %02x BG: %02x\n", ted.regs[0x19], ted.regs[0x15]);
+    mon_out("Colors: Border: $%02x BG: $%02x\n", ted.regs[0x19], ted.regs[0x15]);
     mon_out("Scroll X/Y: %d/%d, RC %u,", ted.regs[0x07] & 0x07, ted.regs[0x06] & 0x07, ted.raster.ycounter);
     mon_out(" %dx%d\n",38 + ((ted.regs[0x07] >> 2) & 2), 24 + ((ted.regs[0x06] >> 3) & 1));
     mon_out("Cursor X/Y: ");
     i = ((ted.regs[0x0c] & 0x03) << 8) | ted.regs[0x0d];
     if (i < 1000){
-        mon_out("%d/%d ", i % 40, (int) (i/40));
+        mon_out("%d/%d ", i % 40, (int) (i / 40));
     } else {
         mon_out("-/- ");
     }
Modified: trunk/vice/src/plus4/tedtypes.h
===================================================================
--- trunk/vice/src/plus4/tedtypes.h	2024-05-20 08:37:05 UTC (rev 45165)
+++ trunk/vice/src/plus4/tedtypes.h	2024-05-21 00:22:17 UTC (rev 45166)
@@ -126,14 +126,17 @@
    guaranteed to be always correct. */
 #define TED_RASTER_Y(clk)           ((unsigned int)((ted.ted_raster_counter \
                                                      + (((clk) - ted.last_emulate_line_clk) \
-                                                        >= 114 ? (ted.ted_raster_counter == ted.screen_height - 1 \
+                                                        >= 114 ? (ted.ted_raster_counter == (ted.screen_height - 1) \
                                                                   ? 1 - ted.screen_height : 1) : 0)) & 0x1ff))
 
 /* Cycle # within the current line.  */
-#define TED_RASTER_CYCLE(clk)       ((unsigned int)((clk) - ted.last_emulate_line_clk - (((clk) - ted.last_emulate_line_clk) >= 114 ? 114 : 0)))
+/*#define TED_RASTER_CYCLE(clk)       ((unsigned int)((clk) - ted.last_emulate_line_clk - (((clk) - ted.last_emulate_line_clk) >= 114 ? 114 : 0)))*/
+#define TED_RASTER_CYCLE(clk)       ((clk) - ted.last_emulate_line_clk - (((clk) - ted.last_emulate_line_clk) >= 114 ? 114 : 0))
 
 /* `clk' value for the beginning of the current line.  */
-#define TED_LINE_START_CLK(clk)     ((unsigned int)(ted.last_emulate_line_clk + (((clk) - ted.last_emulate_line_clk) >= 114 ? 114 : 0)))
+/* FIXME: assigned to (CLOCK)ted.raster_irq_clk in ted-irq.c:ted_irq_set_raster_line() */
+/* FIXME: assigned to (CLOCK)ted.raster_irq_clk in ted-mem.c:ted1c1d_store() */
+#define TED_LINE_START_CLK(clk)     ((unsigned int)(ted.last_emulate_line_clk + (((clk) - ted.last_emulate_line_clk) >= 114UL ? 114UL : 0UL)))
 
 /* # of the previous and next raster line.  Handles wrap over.  */
 /* FIXME not always true, previous line can be 511 */
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <co...@us...> - 2024-05-20 08:37:06
      
     | 
| Revision: 45165
          http://sourceforge.net/p/vice-emu/code/45165
Author:   compyx
Date:     2024-05-20 08:37:05 +0000 (Mon, 20 May 2024)
Log Message:
-----------
Build system: configure: add `AC_TYPE_SSIZE_T`
Invoke `AC_TYPE_SSIZE_T` to provide a suitable typedef for `ssize_t` in case
the system doesn't define it (MVSC?).
Modified Paths:
--------------
    trunk/vice/configure.ac
Modified: trunk/vice/configure.ac
===================================================================
--- trunk/vice/configure.ac	2024-05-16 17:15:24 UTC (rev 45164)
+++ trunk/vice/configure.ac	2024-05-20 08:37:05 UTC (rev 45165)
@@ -423,7 +423,9 @@
 
 dnl Other build environment checks
 AC_SYS_LARGEFILE
+AC_TYPE_SSIZE_T
 
+
 AC_CONFIG_HEADERS([src/config.h])
 
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <gp...@us...> - 2024-05-16 17:15:26
      
     | 
| Revision: 45164
          http://sourceforge.net/p/vice-emu/code/45164
Author:   gpz
Date:     2024-05-16 17:15:24 +0000 (Thu, 16 May 2024)
Log Message:
-----------
always enclose filename in single quotes
Modified Paths:
--------------
    trunk/vice/src/monitor/mon_file.c
Modified: trunk/vice/src/monitor/mon_file.c
===================================================================
--- trunk/vice/src/monitor/mon_file.c	2024-05-15 06:33:59 UTC (rev 45163)
+++ trunk/vice/src/monitor/mon_file.c	2024-05-16 17:15:24 UTC (rev 45164)
@@ -37,6 +37,7 @@
 #include "cartridge.h"
 #include "charset.h"
 #include "lib.h"
+#include "log.h"
 #include "machine.h"
 #include "mem.h"
 #include "montypes.h"
@@ -51,7 +52,14 @@
 
 #include "mon_file.h"
 
+/* #define DEBUG_MONITOR */
 
+#ifdef DEBUG_MONITOR
+#define DBG(x)  log_debug   x
+#else
+#define DBG(x)
+#endif
+
 #define ADDR_LIMIT(x) ((uint16_t)(addr_mask(x)))
 
 #define curbank (mon_interfaces[mem]->current_bank)
@@ -74,6 +82,9 @@
 
     fp = NULL;
 
+    DBG(("mon_file_open(filename:%s, secondary:%u, device:%d\n",
+         filename, secondary, device));
+
     switch (device) {
         case 0:
             fp = fopen(filename, (secondary == 0) ? MODE_READ : MODE_WRITE);
@@ -179,7 +190,7 @@
     int origbank = 0;
 
     if (mon_file_open(filename, 0, device) < 0) {
-        mon_out("Cannot open %s.\n", filename);
+        mon_out("Cannot open '%s'.\n", filename);
         return;
     }
 
@@ -209,7 +220,7 @@
         mem = addr_memspace(start_addr);
     }
 
-    mon_out("Loading %s from %04X ", filename, adr);
+    mon_out("Loading '%s' from %04X ", filename, adr);
 
     if (machine_class == VICE_MACHINE_C64DTV) {
         origbank = curbank;
@@ -282,7 +293,7 @@
     }
 
     if (mon_file_open(filename, 1, device) < 0) {
-        mon_out("Cannot open %s.\n", filename);
+        mon_out("Cannot open '%s'.\n", filename);
         return;
     }
 
@@ -289,7 +300,7 @@
     if (is_bsave == FALSE) {
         if (mon_file_write((uint8_t)(adr & 0xff), 1, device) < 0
             || mon_file_write((uint8_t)((adr >> 8) & 0xff), 1, device) < 0) {
-            mon_out("Saving for `%s' failed.\n", filename);
+            mon_out("Saving for '%s' failed.\n", filename);
             mon_file_close(1, device);
             return;
         }
@@ -300,7 +311,7 @@
 
         save_byte = mon_get_mem_val(mem, (uint16_t)(adr + ch));
         if (mon_file_write(save_byte, 1, device) < 0) {
-            mon_out("Saving for `%s' failed.\n", filename);
+            mon_out("Saving for '%s' failed.\n", filename);
             mon_file_close(1, device);
             return;
         }
@@ -307,7 +318,7 @@
         ch++;
     } while ((adr + ch) <= end);
 
-    mon_out("Saving file `%s' from $%04x to $%04x\n",
+    mon_out("Saving file '%s' from $%04x to $%04x\n",
             filename, addr_location(start_addr), addr_location(end_addr));
 
 
@@ -324,7 +335,7 @@
     int diffcount = 0;
 
     if (mon_file_open(filename, 0, device) < 0) {
-        mon_out("Cannot open %s.\n", filename);
+        mon_out("Cannot open '%s'.\n", filename);
         return;
     }
 
@@ -351,7 +362,7 @@
     adr = addr_location(start_addr);
     mem = addr_memspace(start_addr);
 
-    mon_out("Verifying %s from %04X ", filename, adr);
+    mon_out("Verifying '%s' from %04X ", filename, adr);
 
     if (machine_class == VICE_MACHINE_C64DTV) {
         origbank = curbank;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <co...@us...> - 2024-05-15 06:34:01
      
     | 
| Revision: 45163
          http://sourceforge.net/p/vice-emu/code/45163
Author:   compyx
Date:     2024-05-15 06:33:59 +0000 (Wed, 15 May 2024)
Log Message:
-----------
Gtk3: Fix UI actions calling `printer_formfeed()`
Use indexes, not device numbers, when calling `printer_formfeed()`.
Should fix bug #2035.
Modified Paths:
--------------
    trunk/vice/src/arch/gtk3/actions-printer.c
Modified: trunk/vice/src/arch/gtk3/actions-printer.c
===================================================================
--- trunk/vice/src/arch/gtk3/actions-printer.c	2024-05-14 20:57:52 UTC (rev 45162)
+++ trunk/vice/src/arch/gtk3/actions-printer.c	2024-05-15 06:33:59 UTC (rev 45163)
@@ -47,19 +47,19 @@
 static const ui_action_map_t printer_actions[] = {
     {   .action  = ACTION_PRINTER_FORMFEED_4,
         .handler = printer_formfeed_action,
-        .data    = vice_int_to_ptr(4)
+        .data    = vice_int_to_ptr(PRINTER_IEC_4)
     },
     {   .action  = ACTION_PRINTER_FORMFEED_5,
         .handler = printer_formfeed_action,
-        .data   = vice_int_to_ptr(5)
+        .data    = vice_int_to_ptr(PRINTER_IEC_5)
     },
     {   .action  = ACTION_PRINTER_FORMFEED_6,
         .handler = printer_formfeed_action,
-        .data    = vice_int_to_ptr(6)
+        .data    = vice_int_to_ptr(PRINTER_IEC_6)
     },
     {   .action  = ACTION_PRINTER_FORMFEED_USERPORT,
         .handler = printer_formfeed_action,
-        .data    = vice_int_to_ptr(3)
+        .data    = vice_int_to_ptr(PRINTER_USERPORT)
     },
 
     UI_ACTION_MAP_TERMINATOR
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <rh...@us...> - 2024-05-14 20:57:54
      
     | 
| Revision: 45162
          http://sourceforge.net/p/vice-emu/code/45162
Author:   rhialto
Date:     2024-05-14 20:57:52 +0000 (Tue, 14 May 2024)
Log Message:
-----------
Initialize opc[], and use post-byte with submode in the same cases as asm_addr_mode_get_size() does.
Modified Paths:
--------------
    trunk/vice/src/monitor/mon_assemble6809.c
Modified: trunk/vice/src/monitor/mon_assemble6809.c
===================================================================
--- trunk/vice/src/monitor/mon_assemble6809.c	2024-05-14 17:48:50 UTC (rev 45161)
+++ trunk/vice/src/monitor/mon_assemble6809.c	2024-05-14 20:57:52 UTC (rev 45162)
@@ -68,7 +68,7 @@
     MEMSPACE mem;
     uint16_t loc;
     int const prefix[3] = { -1, 0x10, 0x11 };
-    uint8_t opc[5];
+    uint8_t opc[5] = { 0 };
     int opc_offset;
     int prefixlen;
 
@@ -229,7 +229,8 @@
         opc[opc_offset++] = prefix[j];
     }
     opc[opc_offset++] = opcode;
-    if (operand_mode == ASM_ADDR_MODE_INDEXED) {
+    if (operand_mode == ASM_ADDR_MODE_INDEXED ||
+        operand_mode == ASM_ADDR_MODE_H6309_INDEXED) {
         opc[opc_offset++] = (uint8_t)operand_submode;
     }
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <gp...@us...> - 2024-05-14 17:48:52
      
     | 
| Revision: 45161
          http://sourceforge.net/p/vice-emu/code/45161
Author:   gpz
Date:     2024-05-14 17:48:50 +0000 (Tue, 14 May 2024)
Log Message:
-----------
make GTK monitor window larger by default, requested by count0 :)
Modified Paths:
--------------
    trunk/vice/src/arch/gtk3/uimon.c
    trunk/vice/src/monitor/monitor.c
Modified: trunk/vice/src/arch/gtk3/uimon.c
===================================================================
--- trunk/vice/src/arch/gtk3/uimon.c	2024-05-13 19:50:32 UTC (rev 45160)
+++ trunk/vice/src/arch/gtk3/uimon.c	2024-05-14 17:48:50 UTC (rev 45161)
@@ -102,7 +102,10 @@
     size_t output_buffer_used_size;
 } fixed;
 
-static console_t vte_console = { 40, 25, 0, 1, NULL }; /* bare minimum */
+#define DEFAULT_COLUMNS     80
+#define DEFAULT_ROWS        50
+
+static console_t vte_console = { DEFAULT_COLUMNS, DEFAULT_ROWS, 0, 1, NULL }; /* bare minimum */
 static linenoiseCompletions command_lc = {0, NULL};
 static linenoiseCompletions need_filename_lc = {0, NULL};
 
@@ -547,7 +550,7 @@
     if(t->term) {
         return (int)vte_terminal_get_column_count(VTE_TERMINAL(t->term));
     }
-    return 80;
+    return DEFAULT_COLUMNS;
 }
 
 static char* append_char_to_input_buffer(char *old_input_buffer, char new_char)
@@ -1319,6 +1322,8 @@
                                      GDK_HINT_USER_POS |
                                      GDK_HINT_USER_SIZE);
 
+        vte_terminal_set_size(VTE_TERMINAL(fixed.term), DEFAULT_COLUMNS, DEFAULT_ROWS);
+
         scrollbar = gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL,
                 gtk_scrollable_get_vadjustment(GTK_SCROLLABLE(fixed.term)));
 
Modified: trunk/vice/src/monitor/monitor.c
===================================================================
--- trunk/vice/src/monitor/monitor.c	2024-05-13 19:50:32 UTC (rev 45160)
+++ trunk/vice/src/monitor/monitor.c	2024-05-14 17:48:50 UTC (rev 45161)
@@ -1796,7 +1796,7 @@
     { "MonitorChisLines", 8192, RES_EVENT_NO, NULL,
       &monitorchislines, set_monitor_chis_lines, NULL },
 #endif
-    { "MonitorScrollbackLines", 4096, RES_EVENT_NO, NULL,
+    { "MonitorScrollbackLines", 8192, RES_EVENT_NO, NULL,
       &monitorscrollbacklines, set_monitor_scrollback_lines, NULL },
     RESOURCE_INT_LIST_END
 };
@@ -3013,6 +3013,9 @@
     mon_stop_output = 1;
 }
 
+#define TTY_COLUMNS 80
+#define TTY_ROWS    25
+
 static void monitor_open(void)
 {
     supported_cpu_type_list_t *slist, *slist_next;
@@ -3025,10 +3028,10 @@
 
     if (console_mode) {
         /* Shitty hack. We should support the console size etc. */
-        static console_t console_log_console = { 80, 25, 0, 0, NULL };
+        static console_t console_log_console = { TTY_COLUMNS, TTY_ROWS, 0, 0, NULL };
         console_log = &console_log_console;
     } else if (monitor_is_remote() || monitor_is_binary()) {
-        static console_t console_log_remote = { 80, 25, 0, 0, NULL };
+        static console_t console_log_remote = { TTY_COLUMNS, TTY_ROWS, 0, 0, NULL };
         console_log = &console_log_remote;
     } else {
         if (console_log) {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <gp...@us...> - 2024-05-13 19:50:34
      
     | 
| Revision: 45160
          http://sourceforge.net/p/vice-emu/code/45160
Author:   gpz
Date:     2024-05-13 19:50:32 +0000 (Mon, 13 May 2024)
Log Message:
-----------
some more debug output, some refactoring, only create printer.dump for the userport printer when it is enabled. should fix bug #2032
Modified Paths:
--------------
    trunk/vice/src/cbm2/cbm5x0-stubs.c
    trunk/vice/src/printerdrv/driver-select.c
    trunk/vice/src/printerdrv/driver-select.h
    trunk/vice/src/printerdrv/drv-ascii.c
    trunk/vice/src/printerdrv/drv-mps803.c
    trunk/vice/src/printerdrv/drv-nl10.c
    trunk/vice/src/printerdrv/drv-raw.c
    trunk/vice/src/printerdrv/interface-userport.c
    trunk/vice/src/printerdrv/output-graphics.c
    trunk/vice/src/printerdrv/output-select.c
    trunk/vice/src/printerdrv/output-text.c
    trunk/vice/src/printerdrv/printer.h
    trunk/vice/src/userport/userport.c
    trunk/vice/src/userport/userport.h
Modified: trunk/vice/src/cbm2/cbm5x0-stubs.c
===================================================================
--- trunk/vice/src/cbm2/cbm5x0-stubs.c	2024-05-13 19:40:17 UTC (rev 45159)
+++ trunk/vice/src/cbm2/cbm5x0-stubs.c	2024-05-13 19:50:32 UTC (rev 45160)
@@ -76,6 +76,11 @@
     return -1;
 }
 
+int userport_get_device(void)
+{
+    return -1;
+}
+
 #ifdef HAVE_LIBCURL
 const tzones_t *userport_wic64_get_timezones(size_t *num_zones)
 {
Modified: trunk/vice/src/printerdrv/driver-select.c
===================================================================
--- trunk/vice/src/printerdrv/driver-select.c	2024-05-13 19:40:17 UTC (rev 45159)
+++ trunk/vice/src/printerdrv/driver-select.c	2024-05-13 19:50:32 UTC (rev 45160)
@@ -47,7 +47,7 @@
 static log_t driver_select_log = LOG_ERR;
 
 /* Currently used printer driver.  */
-static driver_select_t driver_select[NUM_DRIVER_SELECT];
+static driver_select_t driver[NUM_DRIVER_SELECT];
 
 /* Pointer to registered printer driver.  */
 static driver_select_list_t *driver_select_list = NULL;
@@ -226,13 +226,16 @@
 
     do {
         if (!strcmp(list->driver_select.drv_name, name)) {
-            memcpy(&(driver_select[prnr]), &(list->driver_select), sizeof(driver_select_t));
-            if(driver_select[prnr].drv_select) {
+            memcpy(&(driver[prnr]), &(list->driver_select), sizeof(driver_select_t));
+            if(driver[prnr].drv_select) {
 #ifdef DEBUG_PRINTER
-                log_debug(driver_select_log, "driver_select[%d].drv_select != NULL", prnr);
+                log_message(driver_select_log, "driver[%d].drv_select != NULL", prnr);
 #endif
-                driver_select[prnr].drv_select(prnr);
+                return driver[prnr].drv_select(prnr);
             }
+#ifdef DEBUG_PRINTER
+            log_message(driver_select_log, "driver[%d].drv_select == NULL", prnr);
+#endif
             return 0;
         }
         list = list->next;
@@ -243,17 +246,17 @@
 
 static const resource_string_t resources_string[] = {
     { "Printer4Driver", "mps803", RES_EVENT_NO, NULL,
-      (char **)&driver_select[0].drv_name, set_printer_driver, (void *)0 },
+      (char **)&driver[0].drv_name, set_printer_driver, (void *)0 },
     { "Printer5Driver", "ascii", RES_EVENT_NO, NULL,
-      (char **)&driver_select[1].drv_name, set_printer_driver, (void *)1 },
+      (char **)&driver[1].drv_name, set_printer_driver, (void *)1 },
     { "Printer6Driver", "1520", RES_EVENT_NO, NULL,
-      (char **)&driver_select[2].drv_name, set_printer_driver, (void *)2 },
+      (char **)&driver[2].drv_name, set_printer_driver, (void *)2 },
     RESOURCE_STRING_LIST_END
 };
 
 static const resource_string_t resources_string_userport[] = {
     { "PrinterUserportDriver", "ascii", RES_EVENT_NO, NULL,
-      (char **)&driver_select[3].drv_name, set_printer_driver, (void *)3 },
+      (char **)&driver[3].drv_name, set_printer_driver, (void *)3 },
     RESOURCE_STRING_LIST_END
 };
 
@@ -343,39 +346,53 @@
 
 /* ------------------------------------------------------------------------- */
 
+int driver_select(unsigned int prnr)
+{
+    if(driver[prnr].drv_select) {
+#ifdef DEBUG_PRINTER
+        log_message(driver_select_log, "driver[%d].drv_select != NULL", prnr);
+#endif
+        return driver[prnr].drv_select(prnr);
+    }
+#ifdef DEBUG_PRINTER
+    log_message(driver_select_log, "driver[%d].drv_select == NULL", prnr);
+#endif
+    return 0;
+}
+
 int driver_select_open(unsigned int prnr, unsigned int secondary)
 {
 #ifdef DEBUG_PRINTER
-    log_message(driver_select_log, "Open device #%i secondary %i.", prnr + 4, secondary);
+    log_message(driver_select_log, "Open prnr:%u device #%u secondary %u.", prnr, prnr + 4, secondary);
 #endif
-    return driver_select[prnr].drv_open(prnr, secondary);
+    return driver[prnr].drv_open(prnr, secondary);
 }
 
 void driver_select_close(unsigned int prnr, unsigned int secondary)
 {
 #ifdef DEBUG_PRINTER
-    log_message(driver_select_log, "Close device #%i secondary %i.", prnr + 4, secondary);
+    log_message(driver_select_log, "Close prnr:%u device #%u secondary %u.", prnr, prnr + 4, secondary);
 #endif
-    driver_select[prnr].drv_close(prnr, secondary);
+    driver[prnr].drv_close(prnr, secondary);
 }
 
 int driver_select_putc(unsigned int prnr, unsigned int secondary, uint8_t b)
 {
-    return driver_select[prnr].drv_putc(prnr, secondary, b);
+    return driver[prnr].drv_putc(prnr, secondary, b);
 }
 
 int driver_select_getc(unsigned int prnr, unsigned int secondary, uint8_t *b)
 {
-    return driver_select[prnr].drv_getc(prnr, secondary, b);
+    return driver[prnr].drv_getc(prnr, secondary, b);
 }
 
 int driver_select_flush(unsigned int prnr, unsigned int secondary)
 {
 #ifdef DEBUG_PRINTER
-    log_message(driver_select_log, "Flush device #%u secondary %u.",
-            prnr + 4, secondary);
+    log_message(driver_select_log, "Flush prnr:%udevice #%u secondary %u.",
+            prnr, prnr + 4, secondary);
 #endif
-    return driver_select[prnr].drv_flush(prnr, secondary);
+    return driver[prnr].drv_flush(prnr, secondary);
 }
 
 /* called by printer.c:printer_formfeed() */
@@ -384,8 +401,8 @@
 #ifdef DEBUG_PRINTER
     log_message(driver_select_log, "Formfeed device #%u", prnr + 4);
 #endif
-    if (driver_select[prnr].drv_formfeed) {
-        return driver_select[prnr].drv_formfeed(prnr);
+    if (driver[prnr].drv_formfeed) {
+        return driver[prnr].drv_formfeed(prnr);
     }
     return 0;
 }
Modified: trunk/vice/src/printerdrv/driver-select.h
===================================================================
--- trunk/vice/src/printerdrv/driver-select.h	2024-05-13 19:40:17 UTC (rev 45159)
+++ trunk/vice/src/printerdrv/driver-select.h	2024-05-13 19:50:32 UTC (rev 45160)
@@ -72,6 +72,7 @@
 
 void driver_select_register(driver_select_t *driver_select);
 
+int driver_select(unsigned int prnr);
 int driver_select_open(unsigned int prnr, unsigned int secondary);
 void driver_select_close(unsigned int prnr, unsigned int secondary);
 int driver_select_putc(unsigned int prnr, unsigned int secondary, uint8_t b);
Modified: trunk/vice/src/printerdrv/drv-ascii.c
===================================================================
--- trunk/vice/src/printerdrv/drv-ascii.c	2024-05-13 19:40:17 UTC (rev 45159)
+++ trunk/vice/src/printerdrv/drv-ascii.c	2024-05-13 19:50:32 UTC (rev 45160)
@@ -33,6 +33,7 @@
 #include "driver-select.h"
 #include "drv-ascii.h"
 #include "log.h"
+#include "userport.h"
 #include "output-select.h"
 #include "output.h"
 #include "palette.h"
@@ -146,12 +147,14 @@
 
 static int drv_ascii_open(unsigned int prnr, unsigned int secondary)
 {
-    DBG(("drv_ascii_open device:%u", 4 + prnr));
     if (secondary == 7) {
+        DBG(("drv_ascii_open(prnr:%u secondary:%u) device:%u", prnr, secondary, 4 + prnr));
         print_char(&drv_ascii[prnr], prnr, 17);
     } else if (secondary == DRIVER_FIRST_OPEN) {
         output_parameter_t output_parameter;
 
+        DBG(("drv_ascii_open(prnr:%u secondary: DRIVER_FIRST_OPEN) device:%u", prnr, 4 + prnr));
+
         /* these are unused for non gfx output */
         output_parameter.maxcol = 480;
         output_parameter.maxrow = 66 * 9;
@@ -166,7 +169,7 @@
 
 static void drv_ascii_close(unsigned int prnr, unsigned int secondary)
 {
-    DBG(("drv_ascii_close device:%u", 4 + prnr));
+    DBG(("drv_ascii_close(prnr:%u secondary:%u) device:%u", prnr, secondary, 4 + prnr));
     if (secondary == DRIVER_LAST_CLOSE) {
         output_select_close(prnr);
     }
@@ -194,7 +197,7 @@
 static int drv_ascii_flush(unsigned int prnr, unsigned int secondary)
 {
 #ifdef DEBUG_PRINTER
-    log_message(drv_ascii_log, "drv_ascii_flush device #%u secondary %u.", prnr + 4, secondary);
+    log_message(drv_ascii_log, "drv_ascii_flush(prnr:%u secondary:%u) device #%u", prnr, secondary, prnr + 4);
 #endif
     return output_select_flush(prnr);
 }
@@ -202,7 +205,7 @@
 static int drv_ascii_formfeed(unsigned int prnr)
 {
 #ifdef DEBUG_PRINTER
-    log_message(drv_ascii_log, "drv_ascii_formfeed device #%u.", prnr + 4);
+    log_message(drv_ascii_log, "drv_ascii_formfeed(prnr:%u) device #%u", prnr, prnr + 4);
 #endif
     return output_select_formfeed(prnr);
 }
@@ -209,8 +212,8 @@
 
 static int drv_ascii_select(unsigned int prnr)
 {
-    DBG(("drv_ascii_select device:%u", 4 + prnr));
-    if (prnr == PRINTER_USERPORT) {
+    DBG(("drv_ascii_select(prnr:%u) device:%u", prnr, 4 + prnr));
+    if ((prnr == PRINTER_USERPORT) && (userport_get_device() == USERPORT_DEVICE_PRINTER)) {
         return drv_ascii_open(prnr, DRIVER_FIRST_OPEN);
     }
     return 0;
Modified: trunk/vice/src/printerdrv/drv-mps803.c
===================================================================
--- trunk/vice/src/printerdrv/drv-mps803.c	2024-05-13 19:40:17 UTC (rev 45159)
+++ trunk/vice/src/printerdrv/drv-mps803.c	2024-05-13 19:50:32 UTC (rev 45160)
@@ -1057,7 +1057,7 @@
     if (secondary == DRIVER_FIRST_OPEN) {
         output_parameter_t output_parameter;
 
-        DBG(("drv_2022_open(%u,DRIVER_FIRST_OPEN)", prnr));
+        DBG(("drv_2022_open(prnr:%u, secondary:DRIVER_FIRST_OPEN)", prnr));
         output_parameter.maxcol = 80 * 6;
         output_parameter.maxrow = 66 * 7;
         output_parameter.dpi_x = 72;
@@ -1082,6 +1082,7 @@
         drv_mps803[prnr].lookup_method = 2;
         return output_select_open(prnr, &output_parameter);
     }
+    DBG(("drv_2022_open(prnr:%u, secondary:%u)", prnr, secondary));
     return drv_common_open(prnr, secondary);
 }
 
@@ -1096,7 +1097,7 @@
 {
     if (secondary == DRIVER_FIRST_OPEN) {
         output_parameter_t output_parameter;
-        DBG(("drv_4023_open(%u,DRIVER_FIRST_OPEN)", prnr));
+        DBG(("drv_4023_open(prnr:%u, secondary:DRIVER_FIRST_OPEN)", prnr));
 
         output_parameter.maxcol = 80 * 8;
         output_parameter.maxrow = 66 * 8;
@@ -1123,6 +1124,7 @@
         drv_mps803[prnr].lookup_method = 1;
         return output_select_open(prnr, &output_parameter);
     }
+    DBG(("drv_4023_open(prnr:%u, secondary:%u)", prnr, secondary));
     return drv_common_open(prnr, secondary);
 }
 
@@ -1137,7 +1139,7 @@
 {
     if (secondary == DRIVER_FIRST_OPEN) {
         output_parameter_t output_parameter;
-        DBG(("drv_8023_open(%u,DRIVER_FIRST_OPEN)", prnr));
+        DBG(("drv_8023_open(prnr:%u, secondary:DRIVER_FIRST_OPEN)", prnr));
 
         output_parameter.maxcol = 136 * 6;
         output_parameter.maxrow = 66 * 7;
@@ -1164,6 +1166,7 @@
         drv_mps803[prnr].lookup_method = 1;
         return output_select_open(prnr, &output_parameter);
     }
+    DBG(("drv_8023_open(prnr:%u, secondary:%u)", prnr, secondary));
     return drv_common_open(prnr, secondary);
 }
 
@@ -1178,7 +1181,7 @@
 {
     if (secondary == DRIVER_FIRST_OPEN) {
         output_parameter_t output_parameter;
-        DBG(("drv_mps801_open(%u,DRIVER_FIRST_OPEN)", prnr));
+        DBG(("drv_mps801_open(prnr:%u, secondary:DRIVER_FIRST_OPEN)", prnr));
 
         output_parameter.maxcol = 80 * 6;
         output_parameter.maxrow = 66 * 7;
@@ -1206,6 +1209,7 @@
         drv_mps803[prnr].lookup_method = 0;
         return output_select_open(prnr, &output_parameter);
     }
+    DBG(("drv_mps801_open(prnr:%u, secondary:%u)", prnr, secondary));
     return drv_common_open(prnr, secondary);
 }
 
@@ -1220,7 +1224,7 @@
 {
     if (secondary == DRIVER_FIRST_OPEN) {
         output_parameter_t output_parameter;
-        DBG(("drv_mps802_open(%u,DRIVER_FIRST_OPEN)", prnr));
+        DBG(("drv_mps802_open(prnr:%u, secondary:DRIVER_FIRST_OPEN)", prnr));
 
         output_parameter.maxcol = 80 * 8;
         output_parameter.maxrow = 66 * 8;
@@ -1246,6 +1250,7 @@
         drv_mps803[prnr].lookup_method = 1;
         return output_select_open(prnr, &output_parameter);
     }
+    DBG(("drv_mps802_open(prnr:%u, secondary:%u)", prnr, secondary));
     return drv_common_open(prnr, secondary);
 }
 
@@ -1261,7 +1266,7 @@
     if (secondary == DRIVER_FIRST_OPEN) {
         output_parameter_t output_parameter;
 
-        DBG(("drv_mps803_open(%u,DRIVER_FIRST_OPEN)", prnr));
+        DBG(("drv_mps803_open(prnr:%u, secondary:DRIVER_FIRST_OPEN)", prnr));
         output_parameter.maxcol = MPS803_PAGE_WIDTH_DOTS;
         output_parameter.maxrow = MPS803_PAGE_HEIGHT_DOTS;
         output_parameter.dpi_x = 60;    /* mps803 has different horizontal & vertical dpi - see pg 49 of the manual part H. */
@@ -1287,6 +1292,7 @@
         drv_mps803[prnr].lookup_method = 0;
         return output_select_open(prnr, &output_parameter);
     }
+    DBG(("drv_mps803_open(prnr:%u, secondary:%u)", prnr, secondary));
     return drv_common_open(prnr, secondary);
 }
 
Modified: trunk/vice/src/printerdrv/drv-nl10.c
===================================================================
--- trunk/vice/src/printerdrv/drv-nl10.c	2024-05-13 19:40:17 UTC (rev 45159)
+++ trunk/vice/src/printerdrv/drv-nl10.c	2024-05-13 19:50:32 UTC (rev 45160)
@@ -43,6 +43,7 @@
 #include "sysfile.h"
 #include "types.h"
 #include "lib.h"
+#include "userport.h"
 
 #ifdef DEBUG_PRINTER
 #define DBG(x)  log_debug x
@@ -1931,8 +1932,8 @@
 {
     nl10_t *nl10 = &(drv_nl10[prnr]);
 
-    DBG(("drv_nl10_open:%u DRIVER_FIRST_OPEN", 4 + prnr));
     if (secondary == DRIVER_FIRST_OPEN) {
+        DBG(("drv_nl10_open(prnr:%u secondary:DRIVER_FIRST_OPEN) device:%u", prnr, 4 + prnr));
         output_parameter_t output_parameter;
 
         output_parameter.maxcol = MAX_COL;
@@ -1947,7 +1948,7 @@
 
         return output_select_open(prnr, &output_parameter);
     }
-    DBG(("drv_nl10_open:%u", 4+ prnr));
+    DBG(("drv_nl10_open(prnr:%u secondary:%u) device:%u", prnr, secondary, 4 + prnr));
 
     if (secondary == 7) {
         set_mode(nl10, NL10_CBMTEXT);
@@ -1962,7 +1963,7 @@
 
 static void drv_nl10_close(unsigned int prnr, unsigned int secondary)
 {
-    DBG(("drv_nl10_close:%u", 4 + prnr));
+    DBG(("drv_nl10_close(prnr:%u secondary:%u) device:%u", prnr, secondary, 4 + prnr));
     /* cannot call output_select_close() here since it would eject the
        current page, which is not what "close"ing a channel to a real
        printer does */
@@ -1986,13 +1987,13 @@
 
 static int drv_nl10_flush(unsigned int prnr, unsigned int secondary)
 {
-    DBG(("drv_nl10_flush:%u", 4 + prnr));
+    DBG(("drv_nl10_flush(prnr:%u secondary:%u) device:%u", prnr, secondary, 4 + prnr));
     return 0;
 }
 
 static int drv_nl10_formfeed(unsigned int prnr)
 {
-    DBG(("drv_nl10_formfeed:%u", 4 + prnr));
+    DBG(("drv_nl10_formfeed(prnr:%u) device:%u", prnr, 4 + prnr));
     nl10_t *nl10 = &(drv_nl10[prnr]);
     if (nl10->isopen) {
         formfeed(nl10, prnr);
@@ -2002,8 +2003,8 @@
 
 static int drv_nl10_select(unsigned int prnr)
 {
-    DBG(("drv_nl10_select device:%u", 4 + prnr));
-    if (prnr == PRINTER_USERPORT) {
+    DBG(("drv_nl10_select(prnr:%u) device:%u", prnr, 4 + prnr));
+    if ((prnr == PRINTER_USERPORT) && (userport_get_device() == USERPORT_DEVICE_PRINTER)) {
         return drv_nl10_open(prnr, DRIVER_FIRST_OPEN);
     }
     return 0;
Modified: trunk/vice/src/printerdrv/drv-raw.c
===================================================================
--- trunk/vice/src/printerdrv/drv-raw.c	2024-05-13 19:40:17 UTC (rev 45159)
+++ trunk/vice/src/printerdrv/drv-raw.c	2024-05-13 19:50:32 UTC (rev 45160)
@@ -36,6 +36,7 @@
 #include "output.h"
 #include "printer.h"
 #include "types.h"
+#include "userport.h"
 
 #ifdef DEBUG_PRINTER
 #define DBG(x) log_debug x
@@ -45,8 +46,8 @@
 
 static int drv_raw_open(unsigned int prnr, unsigned int secondary)
 {
-    DBG(("drv_raw_open device:%u", 4 + prnr));
     if (secondary == DRIVER_FIRST_OPEN) {
+        DBG(("drv_raw_open(prnr:%u secondary:DRIVER_FIRST_OPEN) device:%u", prnr, 4 + prnr));
         output_parameter_t output_parameter;
         /* these are unused for non gfx output */
         output_parameter.maxcol = 480;
@@ -56,7 +57,7 @@
 
         return output_select_open(prnr, &output_parameter);
     }
-
+    DBG(("drv_raw_open(prnr:%u secondary:%u) device:%u", prnr, secondary, 4 + prnr));
     return 0;
 }
 
@@ -85,7 +86,7 @@
 
 static int drv_raw_flush(unsigned int prnr, unsigned int secondary)
 {
-    DBG(("drv_raw_flush device #%u secondary %u.", prnr + 4, secondary));
+    DBG(("drv_raw_flush(prnr:%u) device #%u secondary %u.", prnr, prnr + 4, secondary));
 
     return output_select_flush(prnr);
 }
@@ -92,7 +93,7 @@
 
 static int drv_raw_formfeed(unsigned int prnr)
 {
-    DBG(("drv_raw_formfeed device #%u.", prnr + 4));
+    DBG(("drv_raw_formfeed(prnr:%u) device #%u.", prnr, prnr + 4));
 
     return output_select_formfeed(prnr);
 }
@@ -99,8 +100,8 @@
 
 static int drv_raw_select(unsigned int prnr)
 {
-    DBG(("drv_raw_select device:%u", 4 + prnr));
-    if (prnr == PRINTER_USERPORT) {
+    DBG(("drv_raw_select(prnr:%u) device:%u", prnr, 4 + prnr));
+    if ((prnr == PRINTER_USERPORT) && (userport_get_device() == USERPORT_DEVICE_PRINTER)) {
         return drv_raw_open(prnr, DRIVER_FIRST_OPEN);
     }
     return 0;
Modified: trunk/vice/src/printerdrv/interface-userport.c
===================================================================
--- trunk/vice/src/printerdrv/interface-userport.c	2024-05-13 19:40:17 UTC (rev 45159)
+++ trunk/vice/src/printerdrv/interface-userport.c	2024-05-13 19:50:32 UTC (rev 45160)
@@ -33,6 +33,7 @@
 #include "cmdline.h"
 #include "driver-select.h"
 #include "interface-userport.h"
+#include "log.h"
 #include "output-select.h"
 #include "printer.h"
 #include "resources.h"
@@ -41,6 +42,14 @@
 #include "joyport.h"
 #include "userport.h"
 
+/* #define DEBUG_PRINTER */
+
+#ifdef DEBUG_PRINTER
+#define DBG(x)  log_debug x
+#else
+#define DBG(x)
+#endif
+
 /*
 C64/C128 | CBM2 | PET | VIC20 | CENTRONICS  | NOTES
 ---------------------------------------------------
@@ -97,10 +106,14 @@
 {
     int newval = val ? 1 : 0;
 
+    DBG(("userport_printer_enable(val:%d)", val));
+
     if (newval && !userport_printer_enabled) {
         /* Switch printer on.  */
-        if (driver_select_open(USERPORT_OUTPUT, 4) >= 0) {
-            userport_printer_enabled = 1;
+        if (driver_select_open(USERPORT_OUTPUT, DRIVER_FIRST_OPEN) >= 0) {
+            if (driver_select_open(USERPORT_OUTPUT, 4) >= 0) {
+                userport_printer_enabled = 1;
+            }
         }
     }
     if (userport_printer_enabled && !newval) {
@@ -113,6 +126,7 @@
 
 int interface_userport_init_resources(void)
 {
+    DBG(("interface_userport_init_resources()"));
     return userport_device_register(USERPORT_DEVICE_PRINTER, &printer_device);
 }
 
Modified: trunk/vice/src/printerdrv/output-graphics.c
===================================================================
--- trunk/vice/src/printerdrv/output-graphics.c	2024-05-13 19:40:17 UTC (rev 45159)
+++ trunk/vice/src/printerdrv/output-graphics.c	2024-05-13 19:50:32 UTC (rev 45160)
@@ -226,7 +226,7 @@
 
 static void output_graphics_close(unsigned int prnr)
 {
-    DBG(("output_graphics_close(%d) isopen:%d\n", prnr, output_gfx[prnr].isopen));
+    DBG(("output_graphics_close(%u) isopen:%u", prnr, output_gfx[prnr].isopen));
     /* The layer that calls us does that for each CLOSE on the bus, this is not
        very useful */
 #if 0
@@ -303,7 +303,7 @@
 
 static int output_graphics_flush(unsigned int prnr)
 {
-    DBG(("output_graphics_flush:%d", prnr));
+    DBG(("output_graphics_flush(prnr:%u) device:%u", prnr, prnr + 4));
     /* We can't really update the output partially, so we do nothing and rely on
        the rest of the code doing it as needed */
     return 0;
@@ -312,7 +312,7 @@
 static int output_graphics_formfeed(unsigned int prnr)
 {
     output_gfx_t *o = &(output_gfx[prnr]);
-    DBG(("output_graphics_formfeed:%d", prnr));
+    DBG(("output_graphics_formfeed(prnr:%u) device:%u", prnr, prnr + 4));
 #if 0
     /*
      * Will finish writing current file, and leaves open
Modified: trunk/vice/src/printerdrv/output-select.c
===================================================================
--- trunk/vice/src/printerdrv/output-select.c	2024-05-13 19:40:17 UTC (rev 45159)
+++ trunk/vice/src/printerdrv/output-select.c	2024-05-13 19:50:32 UTC (rev 45160)
@@ -243,13 +243,13 @@
 int output_select_open(unsigned int prnr,
                        struct output_parameter_s *output_parameter)
 {
-    DBG(("output_select_open:%u", prnr));
+    DBG(("output_select_open(prnr:%u) device:%u", prnr, prnr + 4));
     return output_select[prnr].output_open(prnr, output_parameter);
 }
 
 void output_select_close(unsigned int prnr)
 {
-    DBG(("output_select_close:%u", prnr));
+    DBG(("output_select_close(prnr:%u) device:%u", prnr, prnr + 4));
     output_select[prnr].output_close(prnr);
 }
 
@@ -265,12 +265,12 @@
 
 int output_select_flush(unsigned int prnr)
 {
-    DBG(("output_select_flush:%u", prnr));
+    DBG(("output_select_flush(prnr:%u) device:%u", prnr, prnr + 4));
     return output_select[prnr].output_flush(prnr);
 }
 
 int output_select_formfeed(unsigned int prnr)
 {
-    DBG(("output_select_formfeed:%ud", prnr));
+    DBG(("output_select_formfeed(prnr:%u) device:%u", prnr, prnr + 4));
     return output_select[prnr].output_formfeed(prnr);
 }
Modified: trunk/vice/src/printerdrv/output-text.c
===================================================================
--- trunk/vice/src/printerdrv/output-text.c	2024-05-13 19:40:17 UTC (rev 45159)
+++ trunk/vice/src/printerdrv/output-text.c	2024-05-13 19:50:32 UTC (rev 45160)
@@ -174,11 +174,13 @@
 static int output_text_open(unsigned int prnr,
                             output_parameter_t *output_parameter)
 {
+    DBG(("output_text_open(prnr:%u) device:%u", prnr, prnr + 4));
     switch (printer_device[prnr]) {
         case 0:
         case 1:
         case 2:
             if (PrinterDev[printer_device[prnr]] == NULL) {
+                DBG(("output_text_open PrinterDev == NULL"));
                 return -1;
             }
 
@@ -186,6 +188,7 @@
                 FILE *fd;
                 vice_pid_t pid;
                 output_pid[printer_device[prnr]] = 0;
+                DBG(("output_text_open PrinterDev:%s", PrinterDev[printer_device[prnr]]));
                 fd = fopen_or_pipe(PrinterDev[printer_device[prnr]], &pid);
                 if (fd == NULL) {
                     return -1;
@@ -201,6 +204,7 @@
 
 static void output_text_close(unsigned int prnr)
 {
+    DBG(("output_text_close(prnr:%u) device:%u", prnr, prnr + 4));
     if (output_fd[printer_device[prnr]] != NULL) {
         fclose(output_fd[printer_device[prnr]]);
     }
@@ -233,7 +237,7 @@
 
 static int output_text_flush(unsigned int prnr)
 {
-    DBG(("output_text_flush:%u", prnr));
+    DBG(("output_text_flush(prnr:%u) device:%u", prnr, prnr + 4));
     if (output_fd[printer_device[prnr]] == NULL) {
         return -1;
     }
@@ -244,7 +248,7 @@
 
 static int output_text_formfeed(unsigned int prnr)
 {
-    DBG(("output_text_formfeed:%u", prnr));
+    DBG(("output_text_formfeed(prnr:%u) device:%u", prnr, prnr + 4));
     return output_text_flush(prnr);
 }
 
Modified: trunk/vice/src/printerdrv/printer.h
===================================================================
--- trunk/vice/src/printerdrv/printer.h	2024-05-13 19:40:17 UTC (rev 45159)
+++ trunk/vice/src/printerdrv/printer.h	2024-05-13 19:50:32 UTC (rev 45160)
@@ -51,9 +51,9 @@
 #define PRINTER_TEXT_DEVICE_2   1
 #define PRINTER_TEXT_DEVICE_3   2
 
-#define PRINTER_IEC_4    0
-#define PRINTER_IEC_5    1
-#define PRINTER_IEC_6    2
+#define PRINTER_IEC_4    0  /* CBM devnr 4 */
+#define PRINTER_IEC_5    1  /* CBM devnr 5 */
+#define PRINTER_IEC_6    2  /* CBM devnr 6 */
 #define PRINTER_USERPORT 3
 
 int printer_serial_init_resources(void);
Modified: trunk/vice/src/userport/userport.c
===================================================================
--- trunk/vice/src/userport/userport.c	2024-05-13 19:40:17 UTC (rev 45159)
+++ trunk/vice/src/userport/userport.c	2024-05-13 19:50:32 UTC (rev 45160)
@@ -251,6 +251,10 @@
 
 static int userport_reset_started = 0;
 
+int userport_get_device(void)
+{
+    return userport_current_device;
+}
 
 /* attach device 'id' to the userport */
 static int userport_set_device(int id)
Modified: trunk/vice/src/userport/userport.h
===================================================================
--- trunk/vice/src/userport/userport.h	2024-05-13 19:40:17 UTC (rev 45159)
+++ trunk/vice/src/userport/userport.h	2024-05-13 19:50:32 UTC (rev 45160)
@@ -337,6 +337,8 @@
 void userport_port_register(userport_port_props_t *props);
 int userport_device_register(int id, userport_device_t *device);
 
+int userport_get_device(void);
+
 uint8_t read_userport_pbx(uint8_t orig);
 void store_userport_pbx(uint8_t val, int pulse);
 uint8_t read_userport_pa2(uint8_t orig);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <gp...@us...> - 2024-05-13 19:40:18
      
     | 
| Revision: 45159
          http://sourceforge.net/p/vice-emu/code/45159
Author:   gpz
Date:     2024-05-13 19:40:17 +0000 (Mon, 13 May 2024)
Log Message:
-----------
disable debug stuff
Modified Paths:
--------------
    trunk/vice/src/c64/cart/c64cart.c
Modified: trunk/vice/src/c64/cart/c64cart.c
===================================================================
--- trunk/vice/src/c64/cart/c64cart.c	2024-05-13 16:37:21 UTC (rev 45158)
+++ trunk/vice/src/c64/cart/c64cart.c	2024-05-13 19:40:17 UTC (rev 45159)
@@ -139,7 +139,7 @@
 #include "zippcode48.h"
 #undef CARTRIDGE_INCLUDE_PRIVATE_API
 
-#define DEBUGCART
+/* #define DEBUGCART */
 
 #ifdef DEBUGCART
 #define DBG(x)  printf x; fflush(stdout);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <gp...@us...> - 2024-05-13 16:37:22
      
     | 
| Revision: 45158
          http://sourceforge.net/p/vice-emu/code/45158
Author:   gpz
Date:     2024-05-13 16:37:21 +0000 (Mon, 13 May 2024)
Log Message:
-----------
scale and clip volume by an arbitrary factor, makes 6581/8580 nearly the same volume. patch #369 by Leandro Nini
Modified Paths:
--------------
    trunk/vice/src/resid/filter8580new.cc
    trunk/vice/src/resid/sid.cc
    trunk/vice/src/resid/sid.h
Modified: trunk/vice/src/resid/filter8580new.cc
===================================================================
--- trunk/vice/src/resid/filter8580new.cc	2024-05-13 08:52:23 UTC (rev 45157)
+++ trunk/vice/src/resid/filter8580new.cc	2024-05-13 16:37:21 UTC (rev 45158)
@@ -204,7 +204,7 @@
     opamp_voltage_8580,
     sizeof(opamp_voltage_8580)/sizeof(*opamp_voltage_8580),
     // FIXME: Measure for the 8580.
-    0.30,
+    0.24,
     // FIXME: Measure for the 8580.
     4.84,
     // Capacitor value.
Modified: trunk/vice/src/resid/sid.cc
===================================================================
--- trunk/vice/src/resid/sid.cc	2024-05-13 08:52:23 UTC (rev 45157)
+++ trunk/vice/src/resid/sid.cc	2024-05-13 16:37:21 UTC (rev 45158)
@@ -50,6 +50,11 @@
     return (short)input;
 }
 
+inline short amplify(int input, int scaleFactor)
+{
+    return clip((scaleFactor * input) / 2);
+}
+
 // ----------------------------------------------------------------------------
 // Constructor.
 // ----------------------------------------------------------------------------
@@ -77,6 +82,8 @@
 
   databus_ttl = 0;
 
+  scaleFactor = 3;
+
   raw_debug_output = false;
 }
 
@@ -110,6 +117,8 @@
    */
   databus_ttl = sid_model == MOS8580 ? 0xa2000 : 0x1d00;
 
+  scaleFactor = sid_model == MOS8580 ? 5 : 3;
+
   for (int i = 0; i < 3; i++) {
     voice[i].set_chip_model(model);
   }
@@ -872,7 +881,7 @@
     }
 
     sample_offset = (next_sample_offset & FIXP_MASK) - (1 << (FIXP_SHIFT - 1));
-    buf[s*interleave] = output();
+    buf[s*interleave] = amplify(output(), scaleFactor);
   }
 
   return s;
@@ -904,7 +913,7 @@
       clock();
       if (unlikely(i <= 2)) {
         sample_prev = sample_now;
-        sample_now = output();
+        sample_now = clip(output());
       }
     }
 
@@ -915,8 +924,10 @@
 
     sample_offset = next_sample_offset & FIXP_MASK;
 
-    buf[s*interleave] =
-      sample_prev + (sample_offset*(sample_now - sample_prev) >> FIXP_SHIFT);
+    buf[s*interleave] = amplify(
+      sample_prev + (sample_offset*(sample_now - sample_prev) >> FIXP_SHIFT),
+      scaleFactor
+    );
   }
 
   return s;
@@ -1016,7 +1027,7 @@
 
     v >>= FIR_SHIFT;
 
-    buf[s*interleave] = clip(v);
+    buf[s*interleave] = amplify(v, scaleFactor);
   }
 
   return s;
@@ -1040,7 +1051,7 @@
 
     for (int i = 0; i < delta_t_sample; i++) {
       clock();
-      sample[sample_index] = sample[sample_index + RINGSIZE] = output();
+      sample[sample_index] = sample[sample_index + RINGSIZE] = clip(output());
       ++sample_index &= RINGMASK;
     }
 
@@ -1063,7 +1074,7 @@
 
     v >>= FIR_SHIFT;
 
-    buf[s*interleave] = clip(v);
+    buf[s*interleave] = amplify(v, scaleFactor);
   }
 
   return s;
Modified: trunk/vice/src/resid/sid.h
===================================================================
--- trunk/vice/src/resid/sid.h	2024-05-13 08:52:23 UTC (rev 45157)
+++ trunk/vice/src/resid/sid.h	2024-05-13 16:37:21 UTC (rev 45158)
@@ -130,6 +130,9 @@
 
   double clock_frequency;
 
+  // Used to amplify the output by scaleFactor/2 to get an adequate playback volume
+  int scaleFactor;
+
   enum {
     // Resampling constants.
     // The error in interpolated lookup is bounded by 1.234/L^2,
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <co...@us...> - 2024-05-13 08:52:25
      
     | 
| Revision: 45157
          http://sourceforge.net/p/vice-emu/code/45157
Author:   compyx
Date:     2024-05-13 08:52:23 +0000 (Mon, 13 May 2024)
Log Message:
-----------
GHA: work around build issue in libieee1284
GCC 14.1 warns about incompatible pointer types in some debug code in
libieee1284 and exits with a fatal error because of this. Since this is debug
code VICE doesn't use, we disable the warning, allowing libieee1284 to build
and install.
Modified Paths:
--------------
    trunk/.github/workflows/build-main-on-push.yml
    trunk/.github/workflows/make-release.yml
    trunk/vice/doc/building/Windows-MinGW-GTK3-Howto.txt
Modified: trunk/.github/workflows/build-main-on-push.yml
===================================================================
--- trunk/.github/workflows/build-main-on-push.yml	2024-05-11 16:13:22 UTC (rev 45156)
+++ trunk/.github/workflows/build-main-on-push.yml	2024-05-13 08:52:23 UTC (rev 45157)
@@ -323,7 +323,7 @@
           export XML_CATALOG_FILES="/${{ matrix.arch.prefix }}/etc/xml/catalog"
           ./bootstrap
           ./configure --without-python
-          make
+          make CFLAGS="-Wno-incompatible-pointer-types"
           make install
           cd "$OLDDIR"
 
Modified: trunk/.github/workflows/make-release.yml
===================================================================
--- trunk/.github/workflows/make-release.yml	2024-05-11 16:13:22 UTC (rev 45156)
+++ trunk/.github/workflows/make-release.yml	2024-05-13 08:52:23 UTC (rev 45157)
@@ -286,7 +286,7 @@
           export XML_CATALOG_FILES="/${{ matrix.arch.prefix }}/etc/xml/catalog"
           ./bootstrap
           ./configure --without-python
-          make
+          make CFLAGS="-Wno-incompatible-pointer-types"
           make install
           cd "$OLDDIR"
 
Modified: trunk/vice/doc/building/Windows-MinGW-GTK3-Howto.txt
===================================================================
--- trunk/vice/doc/building/Windows-MinGW-GTK3-Howto.txt	2024-05-11 16:13:22 UTC (rev 45156)
+++ trunk/vice/doc/building/Windows-MinGW-GTK3-Howto.txt	2024-05-13 08:52:23 UTC (rev 45157)
@@ -212,7 +212,9 @@
 
 $ mkdir ~/work && cd ~/work
 $ git clone https://github.com/twaugh/libieee1284 .
-$ ./bootstrap && ./configure --without-python && make -s && make -s install
+$ ./bootstrap
+$ ./configure --without-python
+$ make CFLAGS="-Wno-incompatible-pointer-types" -s && make -s install
 $ cd .. && rm -rf work
 
 reconfigure with --enable-parsid --enable-libieee1284
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <co...@us...> - 2024-05-11 16:13:24
      
     | 
| Revision: 45156
          http://sourceforge.net/p/vice-emu/code/45156
Author:   compyx
Date:     2024-05-11 16:13:22 +0000 (Sat, 11 May 2024)
Log Message:
-----------
Fix GCC 14.1 array index warning
GCC 14.1 warns about using -1 as an array index, but the function in question
will never actually return -1. Better safe than sorry: return 0 on error and
log a debug message. 
Modified Paths:
--------------
    trunk/vice/src/arch/gtk3/widgets/settings_printer.c
Modified: trunk/vice/src/arch/gtk3/widgets/settings_printer.c
===================================================================
--- trunk/vice/src/arch/gtk3/widgets/settings_printer.c	2024-05-11 13:39:17 UTC (rev 45155)
+++ trunk/vice/src/arch/gtk3/widgets/settings_printer.c	2024-05-11 16:13:22 UTC (rev 45156)
@@ -175,7 +175,8 @@
             return (int)index;
         }
     }
-    return -1;
+    debug_gtk3("shouldn't get here: didn't find index for device %d", device);
+    return 0;
 }
 
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <co...@us...> - 2024-05-11 13:39:19
      
     | 
| Revision: 45155
          http://sourceforge.net/p/vice-emu/code/45155
Author:   compyx
Date:     2024-05-11 13:39:17 +0000 (Sat, 11 May 2024)
Log Message:
-----------
Gtk3: cart attach dialog: connect cart type signal handler unlocked
Modified Paths:
--------------
    trunk/vice/src/arch/gtk3/uicart.c
Modified: trunk/vice/src/arch/gtk3/uicart.c
===================================================================
--- trunk/vice/src/arch/gtk3/uicart.c	2024-05-09 18:32:52 UTC (rev 45154)
+++ trunk/vice/src/arch/gtk3/uicart.c	2024-05-11 13:39:17 UTC (rev 45155)
@@ -815,7 +815,10 @@
 
     gtk_combo_box_set_active(GTK_COMBO_BOX(combo), 0);
 
-    g_signal_connect(combo, "changed", G_CALLBACK(on_cart_type_changed), NULL);
+    g_signal_connect_unlocked(G_OBJECT(combo),
+                              "changed",
+                              G_CALLBACK(on_cart_type_changed),
+                              NULL);
     return combo;
 }
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <co...@us...> - 2024-05-09 18:32:54
      
     | 
| Revision: 45154
          http://sourceforge.net/p/vice-emu/code/45154
Author:   compyx
Date:     2024-05-09 18:32:52 +0000 (Thu, 09 May 2024)
Log Message:
-----------
Buildsystem: make configure bail if pkg-config isn't found
Modified Paths:
--------------
    trunk/vice/configure.ac
Modified: trunk/vice/configure.ac
===================================================================
--- trunk/vice/configure.ac	2024-05-08 14:31:57 UTC (rev 45153)
+++ trunk/vice/configure.ac	2024-05-09 18:32:52 UTC (rev 45154)
@@ -541,7 +541,11 @@
 
 user_cflags=$CFLAGS
 
+dnl Make sure we have pkg-config >- 0.9.0
 PKG_PROG_PKG_CONFIG
+if test -z "$PKG_CONFIG"; then
+  AC_MSG_ERROR([Could not locate pkg-config, please install pkg-config])
+fi
 
 SOUND_DRIVERS=""
 
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <gp...@us...> - 2024-05-08 14:32:00
      
     | 
| Revision: 45153
          http://sourceforge.net/p/vice-emu/code/45153
Author:   gpz
Date:     2024-05-08 14:31:57 +0000 (Wed, 08 May 2024)
Log Message:
-----------
call driver_select_open with DRIVER_FIRST_OPEN when a userport printer driver is selected. patch adapted from the patch posted in #2023
Modified Paths:
--------------
    trunk/vice/src/printerdrv/driver-select.c
    trunk/vice/src/printerdrv/drv-ascii.c
    trunk/vice/src/printerdrv/drv-nl10.c
    trunk/vice/src/printerdrv/drv-raw.c
    trunk/vice/src/printerdrv/printer.c
Modified: trunk/vice/src/printerdrv/driver-select.c
===================================================================
--- trunk/vice/src/printerdrv/driver-select.c	2024-05-08 13:29:11 UTC (rev 45152)
+++ trunk/vice/src/printerdrv/driver-select.c	2024-05-08 14:31:57 UTC (rev 45153)
@@ -384,8 +384,8 @@
 #ifdef DEBUG_PRINTER
     log_message(driver_select_log, "Formfeed device #%u", prnr + 4);
 #endif
-    if (driver_select[prnr].drv_formfeed)
+    if (driver_select[prnr].drv_formfeed) {
         return driver_select[prnr].drv_formfeed(prnr);
-    else
-        return 0;
+    }
+    return 0;
 }
Modified: trunk/vice/src/printerdrv/drv-ascii.c
===================================================================
--- trunk/vice/src/printerdrv/drv-ascii.c	2024-05-08 13:29:11 UTC (rev 45152)
+++ trunk/vice/src/printerdrv/drv-ascii.c	2024-05-08 14:31:57 UTC (rev 45153)
@@ -36,6 +36,7 @@
 #include "output-select.h"
 #include "output.h"
 #include "palette.h"
+#include "printer.h"
 #include "types.h"
 
 /* #define DEBUG_PRINTER */
@@ -209,6 +210,9 @@
 static int drv_ascii_select(unsigned int prnr)
 {
     DBG(("drv_ascii_select device:%u", 4 + prnr));
+    if (prnr == PRINTER_USERPORT) {
+        return drv_ascii_open(prnr, DRIVER_FIRST_OPEN);
+    }
     return 0;
 }
 
Modified: trunk/vice/src/printerdrv/drv-nl10.c
===================================================================
--- trunk/vice/src/printerdrv/drv-nl10.c	2024-05-08 13:29:11 UTC (rev 45152)
+++ trunk/vice/src/printerdrv/drv-nl10.c	2024-05-08 14:31:57 UTC (rev 45153)
@@ -2003,6 +2003,9 @@
 static int drv_nl10_select(unsigned int prnr)
 {
     DBG(("drv_nl10_select device:%u", 4 + prnr));
+    if (prnr == PRINTER_USERPORT) {
+        return drv_nl10_open(prnr, DRIVER_FIRST_OPEN);
+    }
     return 0;
 }
 
Modified: trunk/vice/src/printerdrv/drv-raw.c
===================================================================
--- trunk/vice/src/printerdrv/drv-raw.c	2024-05-08 13:29:11 UTC (rev 45152)
+++ trunk/vice/src/printerdrv/drv-raw.c	2024-05-08 14:31:57 UTC (rev 45153)
@@ -34,6 +34,7 @@
 #include "log.h"
 #include "output-select.h"
 #include "output.h"
+#include "printer.h"
 #include "types.h"
 
 #ifdef DEBUG_PRINTER
@@ -99,6 +100,9 @@
 static int drv_raw_select(unsigned int prnr)
 {
     DBG(("drv_raw_select device:%u", 4 + prnr));
+    if (prnr == PRINTER_USERPORT) {
+        return drv_raw_open(prnr, DRIVER_FIRST_OPEN);
+    }
     return 0;
 }
 
Modified: trunk/vice/src/printerdrv/printer.c
===================================================================
--- trunk/vice/src/printerdrv/printer.c	2024-05-08 13:29:11 UTC (rev 45152)
+++ trunk/vice/src/printerdrv/printer.c	2024-05-08 14:31:57 UTC (rev 45153)
@@ -68,8 +68,8 @@
 
 int printer_userport_resources_init(void)
 {
-    if (driver_select_userport_init_resources() < 0
-        || output_select_userport_init_resources() < 0) {
+    if (output_select_userport_init_resources() < 0
+        || driver_select_userport_init_resources() < 0) {
         return -1;
     }
     return 0;
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <gp...@us...> - 2024-05-08 13:29:14
      
     | 
| Revision: 45152
          http://sourceforge.net/p/vice-emu/code/45152
Author:   gpz
Date:     2024-05-08 13:29:11 +0000 (Wed, 08 May 2024)
Log Message:
-----------
WOJ Adapter bits where inverted, fixes bug #2026
Modified Paths:
--------------
    trunk/vice/src/userport/userport_woj_joystick.c
Modified: trunk/vice/src/userport/userport_woj_joystick.c
===================================================================
--- trunk/vice/src/userport/userport_woj_joystick.c	2024-05-05 16:27:44 UTC (rev 45151)
+++ trunk/vice/src/userport/userport_woj_joystick.c	2024-05-08 13:29:11 UTC (rev 45152)
@@ -126,7 +126,7 @@
 
 static uint8_t userport_joystick_woj_read_pbx(uint8_t orig)
 {
-    return ~read_joyport_dig(JOYPORT_3 + userport_joystick_woj_select);
+    return read_joyport_dig(JOYPORT_3 + userport_joystick_woj_select);
 }
 
 static void userport_joystick_woj_store_pbx(uint8_t value, int pulse)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 | 
| 
      
      
      From: <gp...@us...> - 2024-05-05 16:27:46
      
     | 
| Revision: 45151
          http://sourceforge.net/p/vice-emu/code/45151
Author:   gpz
Date:     2024-05-05 16:27:44 +0000 (Sun, 05 May 2024)
Log Message:
-----------
Remove the wierd delayed 'importing' of registers that were changed in the monitor. Instead explicitly export before, and import after, each invokation of any function that may 'break' into the monitor (and thus lets the user change the registers by the R or G command). It is not clear what exactly the intend of this delayed importing was, and following the code seems to indicate that what it is done now should indeed work as expected. Some brief testing indicates that this fixes the problem described in bug #2025, plus at least 2 of the described problems in bug #2024. Some further testing needs to be done, in particular to check if everything still works as intended and no new bug was introduced. Please test - if this patch proves to work as intended, it is strongly recommended, for everyone who uses the monitor for debugging, to update to this version - as simply entering and exiting the monitor potentially screws up registers and/or executes the last instruction twice, which obviously can lead to all kind of unexpected behaviour. THIS BUG EXISTS IN ALL VICE RELEASES PRIOR TO THIS COMMIT. You have been warned :)
Modified Paths:
--------------
    trunk/vice/src/6510core.c
    trunk/vice/src/6510dtvcore.c
    trunk/vice/src/65816core.c
    trunk/vice/src/65c02core.c
    trunk/vice/src/monitor/mon_register6502.c
    trunk/vice/src/monitor/mon_register6502dtv.c
    trunk/vice/src/monitor/mon_register65816.c
    trunk/vice/src/monitor/mon_register6809.c
    trunk/vice/src/monitor/mon_registerR65C02.c
    trunk/vice/src/monitor/mon_registerz80.c
    trunk/vice/src/monitor/monitor.c
    trunk/vice/src/monitor/montypes.h
    trunk/vice/src/monitor.h
    trunk/vice/src/pet/6809.c
    trunk/vice/src/z80core.c
Modified: trunk/vice/src/6510core.c
===================================================================
--- trunk/vice/src/6510core.c	2024-05-05 15:25:14 UTC (rev 45150)
+++ trunk/vice/src/6510core.c	2024-05-05 16:27:44 UTC (rev 45151)
@@ -493,23 +493,20 @@
         }                                                                                      \
         if (ik & (IK_MONITOR | IK_DMA)) {                                                      \
             if (ik & IK_MONITOR) {                                                             \
-                if (monitor_force_import(CALLER)) {                                            \
-                    IMPORT_REGISTERS();                                                        \
-                }                                                                              \
-                if (monitor_mask[CALLER]) {                                                    \
+                if (monitor_mask[CALLER] & (MI_STEP)) {                                        \
                     EXPORT_REGISTERS();                                                        \
-                }                                                                              \
-                if (monitor_mask[CALLER] & (MI_STEP)) {                                        \
                     monitor_check_icount((uint16_t)reg_pc);                                    \
                     IMPORT_REGISTERS();                                                        \
                 }                                                                              \
                 if (monitor_mask[CALLER] & (MI_BREAK)) {                                       \
+                    EXPORT_REGISTERS();                                                        \
                     if (monitor_check_breakpoints(CALLER, (uint16_t)reg_pc)) {                 \
                         monitor_startup(CALLER);                                               \
-                        IMPORT_REGISTERS();                                                    \
                     }                                                                          \
+                    IMPORT_REGISTERS();                                                        \
                 }                                                                              \
                 if (monitor_mask[CALLER] & (MI_WATCH)) {                                       \
+                    EXPORT_REGISTERS();                                                        \
                     monitor_check_watchpoints(LAST_OPCODE_ADDR, (uint16_t)reg_pc);             \
                     IMPORT_REGISTERS();                                                        \
                 }                                                                              \
Modified: trunk/vice/src/6510dtvcore.c
===================================================================
--- trunk/vice/src/6510dtvcore.c	2024-05-05 15:25:14 UTC (rev 45150)
+++ trunk/vice/src/6510dtvcore.c	2024-05-05 16:27:44 UTC (rev 45151)
@@ -420,23 +420,20 @@
         }                                                                      \
         if (ik & (IK_MONITOR | IK_DMA)) {                                      \
             if (ik & IK_MONITOR) {                                             \
-                if (monitor_force_import(CALLER)) {                            \
-                    IMPORT_REGISTERS();                                        \
-                }                                                              \
-                if (monitor_mask[CALLER]) {                                    \
+                if (monitor_mask[CALLER] & (MI_STEP)) {                        \
                     EXPORT_REGISTERS();                                        \
-                }                                                              \
-                if (monitor_mask[CALLER] & (MI_STEP)) {                        \
                     monitor_check_icount((uint16_t)reg_pc);                    \
                     IMPORT_REGISTERS();                                        \
                 }                                                              \
                 if (monitor_mask[CALLER] & (MI_BREAK)) {                       \
+                    EXPORT_REGISTERS();                                        \
                     if (monitor_check_breakpoints(CALLER, (uint16_t)reg_pc)) { \
                         monitor_startup(CALLER);                               \
-                        IMPORT_REGISTERS();                                    \
                     }                                                          \
+                    IMPORT_REGISTERS();                                        \
                 }                                                              \
                 if (monitor_mask[CALLER] & (MI_WATCH)) {                       \
+                    EXPORT_REGISTERS();                                        \
                     monitor_check_watchpoints(LAST_OPCODE_ADDR, (uint16_t)reg_pc); \
                     IMPORT_REGISTERS();                                        \
                 }                                                              \
Modified: trunk/vice/src/65816core.c
===================================================================
--- trunk/vice/src/65816core.c	2024-05-05 15:25:14 UTC (rev 45150)
+++ trunk/vice/src/65816core.c	2024-05-05 16:27:44 UTC (rev 45151)
@@ -351,28 +351,25 @@
         if (ik & (IK_TRAP | IK_MONITOR | IK_DMA)) {                            \
             if (ik & IK_TRAP) {                                                \
                 EXPORT_REGISTERS();                                            \
-                interrupt_do_trap(CPU_INT_STATUS, (uint16_t)reg_pc);               \
+                interrupt_do_trap(CPU_INT_STATUS, (uint16_t)reg_pc);           \
                 IMPORT_REGISTERS();                                            \
                 interrupt65816 &= ~IK_TRAP;                                    \
             }                                                                  \
             if (ik & IK_MONITOR) {                                             \
-                if (monitor_force_import(CALLER)) {                            \
-                    IMPORT_REGISTERS();                                        \
-                }                                                              \
-                if (monitor_mask[CALLER]) {                                    \
+                if (monitor_mask[CALLER] & (MI_STEP)) {                        \
                     EXPORT_REGISTERS();                                        \
-                }                                                              \
-                if (monitor_mask[CALLER] & (MI_STEP)) {                        \
-                    monitor_check_icount((uint16_t)reg_pc);                        \
+                    monitor_check_icount((uint16_t)reg_pc);                    \
                     IMPORT_REGISTERS();                                        \
                 }                                                              \
                 if (monitor_mask[CALLER] & (MI_BREAK)) {                       \
-                    if (monitor_check_breakpoints(CALLER, (uint16_t)reg_pc)) {     \
+                    EXPORT_REGISTERS();                                        \
+                    if (monitor_check_breakpoints(CALLER, (uint16_t)reg_pc)) { \
                         monitor_startup(CALLER);                               \
-                        IMPORT_REGISTERS();                                    \
                     }                                                          \
+                    IMPORT_REGISTERS();                                        \
                 }                                                              \
                 if (monitor_mask[CALLER] & (MI_WATCH)) {                       \
+                    EXPORT_REGISTERS();                                        \
                     monitor_check_watchpoints(LAST_OPCODE_ADDR, (uint16_t)reg_pc); \
                     IMPORT_REGISTERS();                                        \
                 }                                                              \
Modified: trunk/vice/src/65c02core.c
===================================================================
--- trunk/vice/src/65c02core.c	2024-05-05 15:25:14 UTC (rev 45150)
+++ trunk/vice/src/65c02core.c	2024-05-05 16:27:44 UTC (rev 45151)
@@ -353,7 +353,7 @@
         if (ik & (IK_TRAP | IK_RESET)) {                                                                      \
             if (ik & IK_TRAP) {                                                                               \
                 EXPORT_REGISTERS();                                                                           \
-                interrupt_do_trap(CPU_INT_STATUS, (uint16_t)reg_pc);                                              \
+                interrupt_do_trap(CPU_INT_STATUS, (uint16_t)reg_pc);                                          \
                 IMPORT_REGISTERS();                                                                           \
                 if (CPU_INT_STATUS->global_pending_int & IK_RESET) {                                          \
                     ik |= IK_RESET;                                                                           \
@@ -370,24 +370,21 @@
         }                                                                                                     \
         if (ik & (IK_MONITOR | IK_DMA)) {                                                                     \
             if (ik & IK_MONITOR) {                                                                            \
-                if (monitor_force_import(CALLER)) {                                                           \
-                    IMPORT_REGISTERS();                                                                       \
-                }                                                                                             \
-                if (monitor_mask[CALLER]) {                                                                   \
+                if (monitor_mask[CALLER] & (MI_STEP)) {                                                       \
                     EXPORT_REGISTERS();                                                                       \
-                }                                                                                             \
-                if (monitor_mask[CALLER] & (MI_STEP)) {                                                       \
-                    monitor_check_icount((uint16_t)reg_pc);                                                       \
+                    monitor_check_icount((uint16_t)reg_pc);                                                   \
                     IMPORT_REGISTERS();                                                                       \
                 }                                                                                             \
                 if (monitor_mask[CALLER] & (MI_BREAK)) {                                                      \
-                    if (monitor_check_breakpoints(CALLER, (uint16_t)reg_pc)) {                                    \
+                    EXPORT_REGISTERS();                                                                       \
+                    if (monitor_check_breakpoints(CALLER, (uint16_t)reg_pc)) {                                \
                         monitor_startup(CALLER);                                                              \
-                        IMPORT_REGISTERS();                                                                   \
                     }                                                                                         \
+                    IMPORT_REGISTERS();                                                                       \
                 }                                                                                             \
                 if (monitor_mask[CALLER] & (MI_WATCH)) {                                                      \
-                    monitor_check_watchpoints(LAST_OPCODE_ADDR, (uint16_t)reg_pc);                                \
+                    EXPORT_REGISTERS();                                                                       \
+                    monitor_check_watchpoints(LAST_OPCODE_ADDR, (uint16_t)reg_pc);                            \
                     IMPORT_REGISTERS();                                                                       \
                 }                                                                                             \
             }                                                                                                 \
Modified: trunk/vice/src/monitor/mon_register6502.c
===================================================================
--- trunk/vice/src/monitor/mon_register6502.c	2024-05-05 15:25:14 UTC (rev 45150)
+++ trunk/vice/src/monitor/mon_register6502.c	2024-05-05 16:27:44 UTC (rev 45151)
@@ -136,6 +136,7 @@
     return 0;
 }
 
+/* assinged to mon_register_set_val() in the monitor interface struct */
 static void mon_register_set_val(int mem, int reg_id, uint16_t val)
 {
     mos6510_regs_t *reg_ptr;
@@ -175,7 +176,6 @@
             log_error(LOG_ERR, "Unknown register!");
             return;
     }
-    force_array[mem] = 1;
 }
 
 /* TODO: should use mon_register_list_get */
Modified: trunk/vice/src/monitor/mon_register6502dtv.c
===================================================================
--- trunk/vice/src/monitor/mon_register6502dtv.c	2024-05-05 15:25:14 UTC (rev 45150)
+++ trunk/vice/src/monitor/mon_register6502dtv.c	2024-05-05 16:27:44 UTC (rev 45151)
@@ -248,7 +248,6 @@
             log_error(LOG_ERR, "Unknown register!");
             return;
     }
-    force_array[mem] = 1;
 }
 
 /* TODO: should use mon_register_list_get */
Modified: trunk/vice/src/monitor/mon_register65816.c
===================================================================
--- trunk/vice/src/monitor/mon_register65816.c	2024-05-05 15:25:14 UTC (rev 45150)
+++ trunk/vice/src/monitor/mon_register65816.c	2024-05-05 16:27:44 UTC (rev 45151)
@@ -189,7 +189,6 @@
             log_error(LOG_ERR, "Unknown register!");
             return;
     }
-    force_array[mem] = 1;
 }
 
 /* TODO: should use mon_register_list_get */
Modified: trunk/vice/src/monitor/mon_register6809.c
===================================================================
--- trunk/vice/src/monitor/mon_register6809.c	2024-05-05 15:25:14 UTC (rev 45150)
+++ trunk/vice/src/monitor/mon_register6809.c	2024-05-05 16:27:44 UTC (rev 45151)
@@ -214,7 +214,6 @@
             log_error(LOG_ERR, "Unknown register!");
             return;
     }
-    force_array[mem] = 1;
 }
 
 /* TODO: should use mon_register_list_get */
Modified: trunk/vice/src/monitor/mon_registerR65C02.c
===================================================================
--- trunk/vice/src/monitor/mon_registerR65C02.c	2024-05-05 15:25:14 UTC (rev 45150)
+++ trunk/vice/src/monitor/mon_registerR65C02.c	2024-05-05 16:27:44 UTC (rev 45151)
@@ -153,7 +153,6 @@
             log_error(LOG_ERR, "Unknown register!");
             return;
     }
-    force_array[mem] = 1;
 }
 
 /* TODO: should use mon_register_list_get */
Modified: trunk/vice/src/monitor/mon_registerz80.c
===================================================================
--- trunk/vice/src/monitor/mon_registerz80.c	2024-05-05 15:25:14 UTC (rev 45150)
+++ trunk/vice/src/monitor/mon_registerz80.c	2024-05-05 16:27:44 UTC (rev 45151)
@@ -265,7 +265,6 @@
             log_error(LOG_ERR, "Unknown register!");
             return;
     }
-    force_array[mem] = 1;
 }
 
 /* TODO: should use mon_register_list_get */
Modified: trunk/vice/src/monitor/monitor.c
===================================================================
--- trunk/vice/src/monitor/monitor.c	2024-05-05 15:25:14 UTC (rev 45150)
+++ trunk/vice/src/monitor/monitor.c	2024-05-05 16:27:44 UTC (rev 45151)
@@ -187,7 +187,6 @@
 static unsigned int watch_store_count[NUM_MEMSPACES];
 static symbol_table_t monitor_labels[NUM_MEMSPACES];
 static CLOCK stopwatch_start_time[NUM_MEMSPACES];
-bool force_array[NUM_MEMSPACES];
 monitor_interface_t *mon_interfaces[NUM_MEMSPACES];
 
 MON_ADDR dot_addr[NUM_MEMSPACES];
@@ -2854,17 +2853,6 @@
 
 /* *** CPU INTERFACES *** */
 
-
-int monitor_force_import(MEMSPACE mem)
-{
-    bool result;
-
-    result = force_array[mem];
-    force_array[mem] = false;
-
-    return result;
-}
-
 /* called by cpu core */
 void monitor_check_icount(uint16_t pc)
 {
Modified: trunk/vice/src/monitor/montypes.h
===================================================================
--- trunk/vice/src/monitor/montypes.h	2024-05-05 15:25:14 UTC (rev 45150)
+++ trunk/vice/src/monitor/montypes.h	2024-05-05 16:27:44 UTC (rev 45151)
@@ -248,7 +248,6 @@
 extern const char * const mon_memspace_string[];
 extern int mon_stop_output;
 extern monitor_interface_t *mon_interfaces[NUM_MEMSPACES];
-extern bool force_array[NUM_MEMSPACES];
 extern unsigned char data_buf[256];
 extern unsigned char data_mask_buf[256];
 extern unsigned int data_buf_len;
Modified: trunk/vice/src/monitor.h
===================================================================
--- trunk/vice/src/monitor.h	2024-05-05 15:25:14 UTC (rev 45150)
+++ trunk/vice/src/monitor.h	2024-05-05 16:27:44 UTC (rev 45151)
@@ -181,7 +181,6 @@
 
 void monitor_abort(void);
 
-int monitor_force_import(MEMSPACE mem);
 void monitor_check_icount(uint16_t a);
 void monitor_check_icount_interrupt(void);
 void monitor_check_watchpoints(unsigned int lastpc, unsigned int pc);
Modified: trunk/vice/src/pet/6809.c
===================================================================
--- trunk/vice/src/pet/6809.c	2024-05-05 15:25:14 UTC (rev 45150)
+++ trunk/vice/src/pet/6809.c	2024-05-05 16:27:44 UTC (rev 45151)
@@ -107,11 +107,11 @@
 
 #define DO_INTERRUPT(int_kind)                                             \
   do {                                                                     \
-        uint8_t ik = (int_kind);                                              \
+        uint8_t ik = (int_kind);                                           \
         if (ik & (IK_TRAP | IK_RESET)) {                                   \
             if (ik & IK_TRAP) {                                            \
                 EXPORT_REGISTERS();                                        \
-                interrupt_do_trap(CPU_INT_STATUS, (uint16_t)PC);               \
+                interrupt_do_trap(CPU_INT_STATUS, (uint16_t)PC);           \
                 IMPORT_REGISTERS();                                        \
                 if (CPU_INT_STATUS->global_pending_int & IK_RESET) {       \
                     ik |= IK_RESET;                                        \
@@ -125,23 +125,20 @@
         }                                                                  \
         if (ik & (IK_MONITOR | IK_DMA)) {                                  \
             if (ik & IK_MONITOR) {                                         \
-                if (monitor_force_import(CALLER)) {                        \
-                    IMPORT_REGISTERS();                                    \
-                }                                                          \
-                if (monitor_mask[CALLER]) {                                \
+                if (monitor_mask[CALLER] & (MI_STEP)) {                    \
                     EXPORT_REGISTERS();                                    \
-                }                                                          \
-                if (monitor_mask[CALLER] & (MI_STEP)) {                    \
-                    monitor_check_icount((uint16_t)PC);                        \
+                    monitor_check_icount((uint16_t)PC);                    \
                     IMPORT_REGISTERS();                                    \
                 }                                                          \
                 if (monitor_mask[CALLER] & (MI_BREAK)) {                   \
-                    if (monitor_check_breakpoints(CALLER, (uint16_t)PC)) {     \
+                    EXPORT_REGISTERS();                                    \
+                    if (monitor_check_breakpoints(CALLER, (uint16_t)PC)) { \
                         monitor_startup(CALLER);                           \
-                        IMPORT_REGISTERS();                                \
                     }                                                      \
+                    IMPORT_REGISTERS();                                    \
                 }                                                          \
                 if (monitor_mask[CALLER] & (MI_WATCH)) {                   \
+                    EXPORT_REGISTERS();                                    \
                     monitor_check_watchpoints(LAST_OPCODE_ADDR, (uint16_t)PC); \
                     IMPORT_REGISTERS();                                    \
                 }                                                          \
Modified: trunk/vice/src/z80core.c
===================================================================
--- trunk/vice/src/z80core.c	2024-05-05 15:25:14 UTC (rev 45150)
+++ trunk/vice/src/z80core.c	2024-05-05 16:27:44 UTC (rev 45151)
@@ -757,22 +757,22 @@
             }                                                                             \
         }                                                                                 \
         if (ik & (IK_MONITOR)) {                                                          \
-            if (monitor_force_import(e_comp_space)) {                                     \
+            if (monitor_mask[e_comp_space] & (MI_STEP)) {                                 \
+                export_registers();                                                       \
+                monitor_check_icount((uint16_t)z80_reg_pc);                               \
                 import_registers();                                                       \
             }                                                                             \
-            if (monitor_mask[e_comp_space]) {                                             \
+            if (monitor_mask[e_comp_space] & (MI_BREAK)) {                                \
                 export_registers();                                                       \
-            }                                                                             \
-            if (monitor_mask[e_comp_space] & (MI_STEP)) {                                 \
-                monitor_check_icount((uint16_t)z80_reg_pc);                                   \
-            }                                                                             \
-            if (monitor_mask[e_comp_space] & (MI_BREAK)) {                                \
-                if (monitor_check_breakpoints(e_comp_space, (uint16_t)z80_reg_pc)) {          \
+                if (monitor_check_breakpoints(e_comp_space, (uint16_t)z80_reg_pc)) {      \
                     monitor_startup(e_comp_space);                                        \
                 }                                                                         \
+                import_registers();                                                       \
             }                                                                             \
             if (monitor_mask[e_comp_space] & (MI_WATCH)) {                                \
-                monitor_check_watchpoints(LAST_OPCODE_ADDR, (uint16_t)z80_reg_pc);            \
+                export_registers();                                                       \
+                monitor_check_watchpoints(LAST_OPCODE_ADDR, (uint16_t)z80_reg_pc);        \
+                import_registers();                                                       \
             }                                                                             \
         }                                                                                 \
     } while (0)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
 |