Skip to content
This repository was archived by the owner on Sep 24, 2025. It is now read-only.

Commit 58cfa81

Browse files
committed
Merge branch 'main' of github.com:LouDnl/Vice-USBSID
2 parents 70c55a3 + 389e3b6 commit 58cfa81

28 files changed

+922
-70
lines changed

vice/data/hotkeys/hotkeys-cartridge.vhk

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,13 @@
66
!if !MACOS
77
cart-attach <Alt>c
88
cart-detach <Alt><Shift>c
9-
!if C64 || C64SC || SCPU64 || C128 || VIC20
9+
!if C64 || C64SC || SCPU64 || C128 || VIC20 || PLUS4
1010
cart-freeze <Alt>z
1111
!endif
1212
!else
1313
cart-attach <Command>c
1414
cart-detach <Command><Shift>c
15-
!if C64 || C64SC || SCPU64 || C128 || VIC20
15+
!if C64 || C64SC || SCPU64 || C128 || VIC20 || PLUS4
1616
cart-freeze <Command>z
1717
!endif
1818
!endif

vice/doc/vice.texi

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15769,6 +15769,8 @@ The following cartridge types are valid:
1576915769
2: Plus4 multi cart
1577015770
@item
1577115771
3: 1MB Cartridge
15772+
@item
15773+
4: "Speedy" freezer cartridge
1577215774
@end itemize
1577315775

1577415776
@vindex CartridgeFile
@@ -15824,6 +15826,10 @@ Attach a 128kiB/256kiB/512kiB/1MiB/2MiB "c264 magic cart" image
1582415826
Attach a 1MiB/2MiB "Plus4 multi cart" image. The binary should contain all c1lo
1582515827
banks first, then all c1hi banks.
1582615828

15829+
@findex -cartspeedy
15830+
@item -cartspeedy <name>
15831+
Attach a 8kiB "Speedy" image
15832+
1582715833
@end table
1582815834

1582915835
@c @node FIXME
@@ -23917,6 +23923,8 @@ Generic 4KiB/8KiB/16KiB C2HI cartridge
2391723923
c264 magic cart
2391823924
@item multi
2391923925
Plus4 multi cart
23926+
@item speedy
23927+
"Speedy" freezer cart
2392023928
@end table
2392123929

2392223930
@b{CBM2 cartridges:}
@@ -35600,6 +35608,8 @@ from starting.
3560035608
@tab Plus4 multi cart
3560135609
@item 3
3560235610
@tab 1MB Cartridge
35611+
@item 4
35612+
@tab "Speedy" freezer cartridge
3560335613
@end multitable
3560435614

3560535615
For all Plus4 binary formats (non .crt) the convention is to store all banks of
@@ -35713,6 +35723,31 @@ This cartridge has one banking register at $fda0.
3571335723

3571435724
This cartridge has one banking register at $fe00.
3571535725

35726+
@c @node FIXME
35727+
@subsubsection 4 - Speedy
35728+
35729+
@multitable @columnfractions .3 .7
35730+
@item Size
35731+
@tab 8KiB
35732+
@item Load address
35733+
@tab $8000-$BFFF (mirrored twice) (C1LO)
35734+
@end multitable
35735+
35736+
@example
35737+
00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F ASCII
35738+
----------------------------------------------- ----------------
35739+
0000: 50 4c 55 53 34 20 43 41 52 54 52 49 44 47 45 20 PLUS4 CARTRIDGE
35740+
0010: 00 00 00 40 02 00 00 04 00 00 00 00 00 00 00 00 ...@............
35741+
0020: 53 70 65 65 64 79 00 00 00 00 00 00 00 00 00 00 Speedy..........
35742+
0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
35743+
0040: 43 48 49 50 00 00 20 10 00 00 00 00 80 00 20 00 CHIP.. ....... .
35744+
0050: 4c 0a 80 42 4f 50 02 43 42 4d a2 00 bd 26 80 9d L..BOP.CBM...&..
35745+
@dots{}
35746+
2030: 20 20 20 20 20 20 20 20 00 84 00 a4 00 06 00 ef ................
35747+
2040: 12 ff fd ff fd ff ff ff ff ff df ff ff ff ff ff ................
35748+
@end example
35749+
35750+
3571635751
@c @node FIXME
3571735752
@subsection CBM2 Cartridge Specifics
3571835753

vice/src/arch/gtk3/uimachinemenu.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ static const ui_menu_item_t file_menu_tape_xpet[] = {
387387
/* {{{ file_menu_cart_freeze */
388388
/** \brief 'File' menu - cartridge section for C64/C128
389389
*
390-
* VIC20, C64, SCPU64 and C128, containing "Cartridge freeze".
390+
* C64, SCPU64, C128, VIC20 and Plus4 containing "Cartridge freeze".
391391
*/
392392
static const ui_menu_item_t file_menu_cart_freeze[] = {
393393
{ .label = "Attach cartridge image...",
@@ -411,7 +411,7 @@ static const ui_menu_item_t file_menu_cart_freeze[] = {
411411
/* {{{ file_menu_cart_no_freeze */
412412
/** \brief 'File' menu - cartridge section for Plus/4, VIC-20 and CBM-II
413413
*
414-
* Plus/4, VIC-20, CBM-II, not containing "Cartridge freeze".
414+
* CBM-II, not containing "Cartridge freeze".
415415
*/
416416
static const ui_menu_item_t file_menu_cart_no_freeze[] = {
417417
{ .label = "Attach cartridge image...",
@@ -1074,11 +1074,14 @@ GtkWidget *ui_machine_menu_bar_create(gint window_id)
10741074
break;
10751075

10761076
case VICE_MACHINE_C64DTV:
1077+
/* no cart section */
1078+
/* no tape section */
10771079
file_menu_printer_section = file_menu_printer_no_userport;
10781080
settings_menu_joy_section = settings_menu_joy_swap;
10791081
break;
10801082

10811083
case VICE_MACHINE_SCPU64:
1084+
/* no tape section */
10821085
file_menu_cart_section = file_menu_cart_freeze;
10831086
file_menu_printer_section = file_menu_printer;
10841087
settings_menu_joy_section = settings_menu_joy_swap;
@@ -1099,7 +1102,7 @@ GtkWidget *ui_machine_menu_bar_create(gint window_id)
10991102

11001103
case VICE_MACHINE_PLUS4:
11011104
file_menu_tape_section = file_menu_tape;
1102-
file_menu_cart_section = file_menu_cart_no_freeze;
1105+
file_menu_cart_section = file_menu_cart_freeze;
11031106
file_menu_printer_section = file_menu_printer_no_userport;
11041107
settings_menu_joy_section = settings_menu_joy_swap;
11051108
break;
@@ -1119,6 +1122,7 @@ GtkWidget *ui_machine_menu_bar_create(gint window_id)
11191122

11201123
case VICE_MACHINE_PET:
11211124
file_menu_tape_section = file_menu_tape_xpet;
1125+
/* no cart section */
11221126
file_menu_printer_section = file_menu_printer;
11231127
break;
11241128

vice/src/arch/gtk3/uimachinewindow.c

Lines changed: 35 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050

5151
#ifdef WINDOWS_COMPILE
5252
#include "directx_renderer.h"
53+
#include "directx_renderer_impl.h"
5354
#else
5455
#include "opengl_renderer.h"
5556
#endif
@@ -294,6 +295,7 @@ static gboolean event_box_motion_cb(GtkWidget *widget,
294295

295296
#elif defined(WINDOWS_COMPILE)
296297

298+
/* scale is a uniform scaling applied to eg high dpi widgets by gtk */
297299
int scale = gtk_widget_get_scale_factor(widget);
298300
POINT pt;
299301
/* mouse_host_moved(motion->x_root * scale, motion->y_root * scale); */
@@ -308,6 +310,7 @@ static gboolean event_box_motion_cb(GtkWidget *widget,
308310

309311
#else /* Xlib, warp is relative to window */
310312

313+
/* scale is a uniform scaling applied to eg high dpi widgets by gtk */
311314
int scale = gtk_widget_get_scale_factor(widget);
312315
mouse_host_moved(
313316
(widget_x + motion->x) * scale,
@@ -322,8 +325,35 @@ static gboolean event_box_motion_cb(GtkWidget *widget,
322325
/*
323326
* Mouse isn't captured, so we update the pen position.
324327
*/
325-
328+
#if 0
329+
/* FIXME: this value is wrong in (at least) xvic, it is always the full
330+
width of produced video, not just the width of the shown window */
326331
double render_w = canvas->geometry->screen_size.width;
332+
#else
333+
/* get width from render context instead */
334+
#ifdef WINDOWS_COMPILE
335+
vice_directx_renderer_context_t *context = (vice_directx_renderer_context_t *)canvas->renderer_context;
336+
double render_w = context->bitmap_width;
337+
if (canvas->videoconfig->double_size_enabled) {
338+
render_w /= 2.0f;
339+
}
340+
#else
341+
vice_opengl_renderer_context_t *context = (vice_opengl_renderer_context_t *)canvas->renderer_context;
342+
double render_w = context->current_frame_width;
343+
if (canvas->videoconfig->double_size_enabled) {
344+
render_w /= 2.0f;
345+
}
346+
#endif
347+
/* sanity check */
348+
if (render_w != canvas->geometry->screen_size.width) {
349+
static int once = 0;
350+
if (!once) {
351+
log_warning(LOG_DEFAULT, "geometry->screen_size.width (%u) does not match actual rendered width (%f)",
352+
canvas->geometry->screen_size.width, render_w);
353+
once++;
354+
}
355+
}
356+
#endif
327357
double render_h = canvas->geometry->last_displayed_line - canvas->geometry->first_displayed_line + 1;
328358

329359
/* There might be some sweet off-by-0.5 bugs here */
@@ -370,10 +400,10 @@ static gboolean event_box_mouse_button_cb(GtkWidget *widget, GdkEvent *event, gp
370400
pthread_mutex_lock(&canvas->lock);
371401
if (button == 1) {
372402
/* Left mouse button */
373-
canvas->pen_buttons |= LP_HOST_BUTTON_1;
403+
canvas->pen_buttons |= LP_HOST_BUTTON_LEFT;
374404
} else if (button == 3) {
375405
/* Right mouse button */
376-
canvas->pen_buttons |= LP_HOST_BUTTON_2;
406+
canvas->pen_buttons |= LP_HOST_BUTTON_RIGHT;
377407
}
378408
pthread_mutex_unlock(&canvas->lock);
379409

@@ -387,10 +417,10 @@ static gboolean event_box_mouse_button_cb(GtkWidget *widget, GdkEvent *event, gp
387417
pthread_mutex_lock(&canvas->lock);
388418
if (button == 1) {
389419
/* Left mouse button */
390-
canvas->pen_buttons &= ~LP_HOST_BUTTON_1;
420+
canvas->pen_buttons &= ~LP_HOST_BUTTON_LEFT;
391421
} else if (button == 3) {
392422
/* Right mouse button */
393-
canvas->pen_buttons &= ~LP_HOST_BUTTON_2;
423+
canvas->pen_buttons &= ~LP_HOST_BUTTON_RIGHT;
394424
}
395425
pthread_mutex_unlock(&canvas->lock);
396426

vice/src/arch/sdl/actions-cartridge.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,10 @@ static const ui_action_map_t cartridge_actions_plus4[] = {
164164
.handler = sdl_ui_activate_item_action,
165165
.dialog = true
166166
},
167+
{ .action = ACTION_CART_ATTACH_RAW_SPEEDY,
168+
.handler = sdl_ui_activate_item_action,
169+
.dialog = true
170+
},
167171
{ .action = ACTION_CART_ATTACH_RAW_C1_FULL,
168172
.handler = sdl_ui_activate_item_action,
169173
.dialog = true
@@ -191,6 +195,9 @@ static const ui_action_map_t cartridge_actions_plus4[] = {
191195
{ .action = ACTION_CART_DETACH,
192196
.handler = cart_detach_action
193197
},
198+
{ .action = ACTION_CART_FREEZE,
199+
.handler = cart_freeze_action
200+
},
194201
UI_ACTION_MAP_TERMINATOR
195202
};
196203

vice/src/arch/sdl/lightpendrv.c

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,17 @@
3232
#include "machine.h"
3333
#include "lightpen.h"
3434
#include "lightpendrv.h"
35+
#include "log.h"
3536
#include "videoarch.h"
3637

38+
/* #define DEBUG_LIGHTPEN */
39+
40+
#ifdef DEBUG_LIGHTPEN
41+
#define DBG(x) log_printf x
42+
#else
43+
#define DBG(x)
44+
#endif
45+
3746
/* ------------------------------------------------------------------ */
3847
/* External interface */
3948

@@ -51,9 +60,7 @@ void sdl_lightpen_update(void)
5160
buttons = 0;
5261
}
5362

54-
#ifdef SDL_DEBUG
55-
fprintf(stderr, "%s : x = %i, y = %i, buttons = %02x\n", __func__, x, y, buttons);
56-
#endif
63+
DBG(("%s : x = %i, y = %i, buttons = %02x", __func__, x, y, buttons));
5764

5865
screen_num = sdl_active_canvas_num;
5966

vice/src/arch/sdl/menu_plus4cart.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ static UI_MENU_CALLBACK(attach_cart_callback)
7373
case CARTRIDGE_PLUS4_JACINT1MB:
7474
action = ACTION_CART_ATTACH_RAW_JACINT1MB;
7575
break;
76+
case CARTRIDGE_PLUS4_SPEEDY:
77+
action = ACTION_CART_ATTACH_RAW_SPEEDY;
78+
break;
7679
case CARTRIDGE_PLUS4_GENERIC_C1:
7780
action = ACTION_CART_ATTACH_RAW_C1_FULL;
7881
break;
@@ -170,6 +173,12 @@ const ui_menu_entry_t plus4cart_menu[] = {
170173
.callback = attach_cart_callback,
171174
.data = (ui_callback_data_t)CARTRIDGE_PLUS4_JACINT1MB
172175
},
176+
{ .action = ACTION_CART_ATTACH_RAW_SPEEDY,
177+
.string = "Attach raw " CARTRIDGE_PLUS4_NAME_SPEEDY " image",
178+
.type = MENU_ENTRY_DIALOG,
179+
.callback = attach_cart_callback,
180+
.data = (ui_callback_data_t)CARTRIDGE_PLUS4_SPEEDY
181+
},
173182
SDL_MENU_ITEM_SEPARATOR,
174183

175184
{ .action = ACTION_CART_ATTACH_RAW_C1_FULL,

vice/src/arch/shared/uiactions.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -212,7 +212,7 @@ static const ui_action_info_private_t action_info_list[] = {
212212
{ ACTION_CART_ATTACH_RAW_C2_HIGH, "cart-attach-raw-c2-high", "Attach high C2 cartridge image", VICE_MACHINE_PLUS4 },
213213
{ ACTION_CART_DETACH, "cart-detach", "Detach cartridge", (VICE_MACHINE_C64|VICE_MACHINE_C64SC|VICE_MACHINE_SCPU64|VICE_MACHINE_C128|
214214
VICE_MACHINE_VIC20|VICE_MACHINE_PLUS4|VICE_MACHINE_CBM6x0) },
215-
{ ACTION_CART_FREEZE, "cart-freeze", "Press cartridge freeze button", (VICE_MACHINE_C64|VICE_MACHINE_C64SC|VICE_MACHINE_SCPU64|VICE_MACHINE_C128|VICE_MACHINE_VIC20) },
215+
{ ACTION_CART_FREEZE, "cart-freeze", "Press cartridge freeze button", (VICE_MACHINE_C64|VICE_MACHINE_C64SC|VICE_MACHINE_SCPU64|VICE_MACHINE_C128|VICE_MACHINE_VIC20|VICE_MACHINE_PLUS4) },
216216
{ ACTION_CART_DETACH_1000, "cart-detach-1000", "Detach cartridge image at $1000", VICE_MACHINE_CBM6x0 },
217217
{ ACTION_CART_DETACH_2000, "cart-detach-2000", "Detach cartridge image at $2000", VICE_MACHINE_CBM6x0 },
218218
{ ACTION_CART_DETACH_4000, "cart-detach-4000", "Detach cartridge image at $4000", VICE_MACHINE_CBM6x0 },

vice/src/arch/shared/uiactions.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ enum {
127127
ACTION_CART_ATTACH_RAW_JACINT1MB, /* Plus/4 */
128128
ACTION_CART_ATTACH_RAW_MAGIC, /* Plus/4 */
129129
ACTION_CART_ATTACH_RAW_MULTI, /* Plus/4 */
130+
ACTION_CART_ATTACH_RAW_SPEEDY, /* Plus/4 */
130131
ACTION_CART_ATTACH_RAW_C1_FULL, /* Plus/4 */
131132
ACTION_CART_ATTACH_RAW_C1_LOW, /* Plus/4 */
132133
ACTION_CART_ATTACH_RAW_C1_HIGH, /* Plus/4 */

vice/src/c64/c64mem.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,7 @@ int c64_mem_ui_init(void);
8282
void c64_mem_ui_shutdown(void);
8383

8484
uint8_t vsid_io_read(uint16_t addr);
85+
uint8_t vsid_io_peek(uint16_t addr);
8586
void vsid_io_store(uint16_t addr, uint8_t val);
8687

8788
#endif

0 commit comments

Comments
 (0)