vice-emu-commit Mailing List for VICE (Page 5)
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
(15) |
Nov
|
Dec
|
From: <gp...@us...> - 2025-06-10 19:47:46
|
Revision: 45695 http://sourceforge.net/p/vice-emu/code/45695 Author: gpz Date: 2025-06-10 19:47:44 +0000 (Tue, 10 Jun 2025) Log Message: ----------- added support for "Magic Desk 16" cartridge (Patch by Crystalct). Note that the correct CRTID is 85, not 79 like in the original patch. Modified Paths: -------------- trunk/vice/doc/vice.texi trunk/vice/src/c64/c64cart.h trunk/vice/src/c64/cart/Makefile.am trunk/vice/src/c64/cart/c64cart.c trunk/vice/src/c64/cart/c64carthooks.c trunk/vice/src/cartridge.h trunk/vice/src/tools/cartconv/c64-cartridges.c Added Paths: ----------- trunk/vice/src/c64/cart/magicdesk16.c trunk/vice/src/c64/cart/magicdesk16.h Modified: trunk/vice/doc/vice.texi =================================================================== --- trunk/vice/doc/vice.texi 2025-06-05 20:46:21 UTC (rev 45694) +++ trunk/vice/doc/vice.texi 2025-06-10 19:47:44 UTC (rev 45695) @@ -9763,6 +9763,8 @@ @item Magic Desk @item +Magic Desk 16 +@item Magic Formel @item MAX Basic @@ -10200,6 +10202,8 @@ 83: BMP Data Turbo @item 84: Profi-DOS +@item +85: Magic Desk 16 @end itemize @vindex CartridgeFile @@ -11160,6 +11164,10 @@ @item -cartmd <name> Attach raw 32/64/128KiB Magic Desk cartridge image. +@findex -cartmd16 +@item -cartmd16 <name> +Attach raw up to 2048KiB Magic Desk 16K cartridge image. + @findex -cartmf @item -cartmf <name> Attach raw Magic Formel cartridge image. @@ -23782,6 +23790,8 @@ MACH 5 .crt file @item md Magic Desk .crt file +@item md16 +Magic Desk 16 .crt file @item mf Magic Formel .crt file @item max @@ -34926,6 +34936,47 @@ Any access (read or write) to IO2 ($dfxx) will disable the cartridge again. @c @node FIXME +@subsubsection 85 - Magic Desk 16 + +@multitable @columnfractions .3 .7 +@item Size +@tab 32KiB, 64KiB ... up to 2048KiB sizes (4 to 128 banks of 16KiB each) +@item EXROM +@tab active (lo) (0) +@item GAME +@tab active (hi) (0) +@item Startup mode +@tab 16KiB Game +@item Load address +@tab (banks 0-127) - $8000-BFFF +@end multitable + +@example + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F ASCII + ----------------------------------------------- ---------------- +000000: 43 36 34 20 43 41 52 54 52 49 44 47 45 20 20 20 C64 CARTRIDGE +000010: 00 00 00 40 01 00 00 55 00 00 00 00 00 00 00 00 ...@...U........ +000020: 4d 61 67 69 63 20 44 65 73 6b 20 31 36 4b 00 00 Magic Desk 16K.. +000030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +000040: 43 48 49 50 00 00 40 10 00 00 00 00 80 00 40 00 CHIP..@.......@. +000050: 09 80 09 80 c3 c2 cd 38 30 78 a2 ff 9a d8 a9 08 .......80x...... +.. +200820: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ +200830: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + +@end example + +Very similar to the classic "Magic Desk" cartridge, except that it uses +16KiB banks instead and operates in "16k Game" mode. + +Bank switching is done by writing the bank number to $DE00. +Bit 7 is cleared for selecting one of the ROM banks. If bit +7 is set ($DE00 = $80), the GAME/EXROM lines are disabled, turning on +RAM at $8000-B9FFF instead of ROM. + +used by "SNK vs CAPCOM - Stronger Edition" + +@c @node FIXME @subsection C128 Cartridge Specifics Note: Cartridges that work on both C64 and C128 get "C64 Cartridge" type and get a Modified: trunk/vice/src/c64/c64cart.h =================================================================== --- trunk/vice/src/c64/c64cart.h 2025-06-05 20:46:21 UTC (rev 45694) +++ trunk/vice/src/c64/c64cart.h 2025-06-10 19:47:44 UTC (rev 45695) @@ -29,8 +29,8 @@ #include "types.h" -/* Cartridge ROM limit = 1MB (EasyFlash) */ -#define C64CART_ROM_LIMIT (1024 * 1024) +/* Cartridge ROM limit = 2MB (Magic Desk 2 - 16K config) */ +#define C64CART_ROM_LIMIT (2 * 1024 * 1024) /* Cartridge RAM limit = 32kB (IDE64, ...) */ #define C64CART_RAM_LIMIT (32 * 1024) /* maximum size of a full "all inclusive" cartridge image (16MB for REU) */ Modified: trunk/vice/src/c64/cart/Makefile.am =================================================================== --- trunk/vice/src/c64/cart/Makefile.am 2025-06-05 20:46:21 UTC (rev 45694) +++ trunk/vice/src/c64/cart/Makefile.am 2025-06-10 19:47:44 UTC (rev 45695) @@ -141,6 +141,7 @@ mach5.c \ mach5.h \ magicdesk.c \ + magicdesk16.c \ magicdesk.h \ magicformel.c \ magicformel.h \ Modified: trunk/vice/src/c64/cart/c64cart.c =================================================================== --- trunk/vice/src/c64/cart/c64cart.c 2025-06-05 20:46:21 UTC (rev 45694) +++ trunk/vice/src/c64/cart/c64cart.c 2025-06-10 19:47:44 UTC (rev 45695) @@ -104,6 +104,7 @@ #include "ltkernal.h" #include "mach5.h" #include "magicdesk.h" +#include "magicdesk16.h" #include "magicformel.h" #include "magicvoice.h" #include "maxbasic.h" @@ -474,6 +475,7 @@ case CARTRIDGE_KCS_POWER: case CARTRIDGE_MACH5: case CARTRIDGE_MAGIC_DESK: + case CARTRIDGE_MAGIC_DESK_16: case CARTRIDGE_MAGIC_FORMEL: case CARTRIDGE_MAGIC_VOICE: case CARTRIDGE_MAX_BASIC: @@ -910,6 +912,9 @@ case CARTRIDGE_MAGIC_DESK: rc = magicdesk_crt_attach(fd, rawcart); break; + case CARTRIDGE_MAGIC_DESK_16: + rc = magicdesk16_crt_attach(fd, rawcart); + break; case CARTRIDGE_MAGIC_FORMEL: rc = magicformel_crt_attach(fd, rawcart); break; Modified: trunk/vice/src/c64/cart/c64carthooks.c =================================================================== --- trunk/vice/src/c64/cart/c64carthooks.c 2025-06-05 20:46:21 UTC (rev 45694) +++ trunk/vice/src/c64/cart/c64carthooks.c 2025-06-10 19:47:44 UTC (rev 45695) @@ -113,6 +113,7 @@ #include "mach5.h" #include "machine.h" #include "magicdesk.h" +#include "magicdesk16.h" #include "magicformel.h" #include "magicvoice.h" #include "maxbasic.h" @@ -369,6 +370,9 @@ { "-cartmd", CALL_FUNCTION, CMDLINE_ATTRIB_NEED_ARGS, cart_attach_cmdline, (void *)CARTRIDGE_MAGIC_DESK, NULL, NULL, "<Name>", "Attach raw 32/64/128KiB Magic Desk cartridge image" }, + { "-cartmd16", CALL_FUNCTION, CMDLINE_ATTRIB_NEED_ARGS, + cart_attach_cmdline, (void *)CARTRIDGE_MAGIC_DESK_16, NULL, NULL, + "<Name>", "Attach raw up to 2048KiB Magic Desk 16K cartridge image" }, { "-cartmf", CALL_FUNCTION, CMDLINE_ATTRIB_NEED_ARGS, cart_attach_cmdline, (void *)CARTRIDGE_MAGIC_FORMEL, NULL, NULL, "<Name>", "Attach raw Magic Formel cartridge image" }, @@ -1011,6 +1015,8 @@ return mach5_bin_attach(filename, rawcart); case CARTRIDGE_MAGIC_DESK: return magicdesk_bin_attach(filename, rawcart); + case CARTRIDGE_MAGIC_DESK_16: + return magicdesk16_bin_attach(filename, rawcart); case CARTRIDGE_MAGIC_FORMEL: return magicformel_bin_attach(filename, rawcart); case CARTRIDGE_MAX_BASIC: @@ -1276,6 +1282,9 @@ case CARTRIDGE_MAGIC_DESK: magicdesk_config_setup(rawcart); break; + case CARTRIDGE_MAGIC_DESK_16: + magicdesk16_config_setup(rawcart); + break; case CARTRIDGE_MAGIC_FORMEL: magicformel_config_setup(rawcart); break; @@ -1888,6 +1897,9 @@ case CARTRIDGE_MAGIC_DESK: magicdesk_detach(); break; + case CARTRIDGE_MAGIC_DESK_16: + magicdesk16_detach(); + break; case CARTRIDGE_MAGIC_FORMEL: magicformel_detach(); break; @@ -2196,6 +2208,9 @@ case CARTRIDGE_MAGIC_DESK: magicdesk_config_init(); break; + case CARTRIDGE_MAGIC_DESK_16: + magicdesk16_config_init(); + break; case CARTRIDGE_MAGIC_FORMEL: magicformel_config_init(); break; @@ -3605,6 +3620,11 @@ return -1; } break; + case CARTRIDGE_MAGIC_DESK_16: + if (magicdesk16_snapshot_write_module(s) < 0) { + return -1; + } + break; case CARTRIDGE_MAGIC_FORMEL: if (magicformel_snapshot_write_module(s) < 0) { return -1; @@ -4220,6 +4240,11 @@ goto fail2; } break; + case CARTRIDGE_MAGIC_DESK_16: + if (magicdesk16_snapshot_read_module(s) < 0) { + goto fail2; + } + break; case CARTRIDGE_MAGIC_FORMEL: if (magicformel_snapshot_read_module(s) < 0) { goto fail2; Added: trunk/vice/src/c64/cart/magicdesk16.c =================================================================== --- trunk/vice/src/c64/cart/magicdesk16.c (rev 0) +++ trunk/vice/src/c64/cart/magicdesk16.c 2025-06-10 19:47:44 UTC (rev 45695) @@ -0,0 +1,298 @@ +/* + * magicdesk16.c - Cartridge handling, Magic Desk 16K cart. + * + * Original magicdesk.c Written by + * Marco van den Heuvel <bla...@ya...> + + * 16K Mod Written by + * Salvo Cristaldi <cr...@un...> + * + * This file is part of VICE, the Versatile Commodore Emulator. + * See README for copyright notice. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307 USA. + * + */ + +/* #define MAGICDESK16_DEBUG */ + +#include "vice.h" + +#include <stdio.h> +#include <string.h> + +#define CARTRIDGE_INCLUDE_SLOTMAIN_API +#include "c64cartsystem.h" +#undef CARTRIDGE_INCLUDE_SLOTMAIN_API +#include "c64mem.h" +#include "cartio.h" +#include "cartridge.h" +#include "export.h" +#include "magicdesk16.h" +#include "monitor.h" +#include "snapshot.h" +#include "types.h" +#include "util.h" +#include "crt.h" + +#ifdef MAGICDESK16_DEBUG +#define DBG(x) printf x +#else +#define DBG(x) +#endif + +/* + "Magic Desk 16K" Cartridge + + - supports all "Magic Desk Clone" homebrew cart with 16k game config, up to 2 MB + + - ROM is always mapped in at $8000-$BFFF (16k game). + + - 1 register at io1 / de00: + + bit 0-6 bank number + bit 7 exrom (1 = cart disabled) +*/ + +#define MAXBANKS 128 + +static uint8_t regval = 0; +static uint8_t bankmask = 0x7f; + +static void magicdesk16_io1_store(uint16_t addr, uint8_t value) +{ + regval = value & (0x80 | bankmask); + cart_romhbank_set_slotmain(value & bankmask); + cart_romlbank_set_slotmain(value & bankmask); + cart_set_port_game_slotmain(0); + if (value & 0x80) { + /* turn off cart ROM */ + cart_set_port_exrom_slotmain(0); + cart_set_port_game_slotmain(0); + } else { + cart_set_port_exrom_slotmain(1); + cart_set_port_game_slotmain(1); + } + cart_port_config_changed_slotmain(); + DBG(("MAGICDESK16: Reg: %02x (Bank: %d of %d, %s)\n", regval, (regval & bankmask), bankmask + 1, (regval & 0x80) ? "disabled" : "enabled")); +} + +static uint8_t magicdesk16_io1_peek(uint16_t addr) +{ + return regval; +} + +static int magicdesk16_dump(void) +{ + mon_out("Reg: %02x (Bank: %d of %d, %s)\n", regval, (regval & bankmask), bankmask + 1, (regval & 0x80) ? "disabled" : "enabled"); + return 0; +} + + +/* ---------------------------------------------------------------------*/ + +static io_source_t magicdesk16_device = { + CARTRIDGE_NAME_MAGIC_DESK_16, /* name of the device */ + IO_DETACH_CART, /* use cartridge ID to detach the device when involved in a read-collision */ + IO_DETACH_NO_RESOURCE, /* does not use a resource for detach */ + 0xde00, 0xdeff, 0xff, /* range for the device, address is ignored, reg:$de00, mirrors:$de01-$deff */ + 0, /* read is never valid, reg is write only */ + magicdesk16_io1_store, /* store function */ + NULL, /* NO poke function */ + NULL, /* read function */ + magicdesk16_io1_peek, /* peek function */ + magicdesk16_dump, /* device state information dump function */ + CARTRIDGE_MAGIC_DESK_16, /* 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 */ +}; + +static io_source_list_t *magicdesk16_list_item = NULL; + +static const export_resource_t export_res = { + CARTRIDGE_NAME_MAGIC_DESK_16, 1, 1, &magicdesk16_device, NULL, CARTRIDGE_MAGIC_DESK_16 +}; + +/* ---------------------------------------------------------------------*/ + +void magicdesk16_config_init(void) +{ + magicdesk16_io1_store((uint16_t)0xde00, 0); +} + +void magicdesk16_config_setup(uint8_t *rawcart) +{ + for (int i=0; i< MAXBANKS; i++) { + memcpy(&roml_banks[i*0x2000], &rawcart[i*0x4000], 0x2000); + memcpy(&romh_banks[i*0x2000], &rawcart[0x2000 + i*0x4000], 0x2000); + } + +} + +/* ---------------------------------------------------------------------*/ + +static int magicdesk16_common_attach(void) +{ + if (export_add(&export_res) < 0) { + return -1; + } + magicdesk16_list_item = io_source_register(&magicdesk16_device); + return 0; +} + +int magicdesk16_bin_attach(const char *filename, uint8_t *rawcart) +{ + bankmask = 0x7f; + if (util_file_load(filename, rawcart, 0x200000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { + bankmask = 0x3f; + if (util_file_load(filename, rawcart, 0x100000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { + bankmask = 0x1f; + if (util_file_load(filename, rawcart, 0x80000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { + bankmask = 0x0f; + if (util_file_load(filename, rawcart, 0x40000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { + bankmask = 0x07; + if (util_file_load(filename, rawcart, 0x20000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { + bankmask = 0x03; + if (util_file_load(filename, rawcart, 0x10000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { + bankmask = 0x01; + if (util_file_load(filename, rawcart, 0x8000, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { + return -1; + } + } + } + } + } + } + } + return magicdesk16_common_attach(); +} + +int magicdesk16_crt_attach(FILE *fd, uint8_t *rawcart) +{ + crt_chip_header_t chip; + int lastbank = 0; + while (1) { + if (crt_read_chip_header(&chip, fd)) { + break; + } + if ((chip.bank >= MAXBANKS) || ((chip.start != 0x8000) && (chip.start != 0xa000)) || (chip.size != 0x4000)) { + return -1; + } + if (crt_read_chip(rawcart, chip.bank << 14, &chip, fd)) { + return -1; + } + if (chip.bank > lastbank) { + lastbank = chip.bank; + } + } + if (lastbank >= MAXBANKS) { + /* more than 128 banks does not work */ + return -1; + } else if (lastbank >= 64) { + /* min 65, max 128 banks */ + bankmask = 0x7f; + } else if (lastbank >= 32) { + /* min 33, max 64 banks */ + bankmask = 0x3f; + } else if (lastbank >= 16) { + /* min 17, max 32 banks */ + bankmask = 0x1f; + } else if (lastbank >= 8) { + /* min 9, max 16 banks */ + bankmask = 0x0f; + } else if (lastbank >= 4) { + /* min 5, max 8 banks */ + bankmask = 0x07; + } else if (lastbank >= 2) { + /* min 3, max 4 banks */ + bankmask = 0x03; + } else { + /* max 2 banks */ + bankmask = 0x01; + } + + return magicdesk16_common_attach(); +} + +void magicdesk16_detach(void) +{ + export_remove(&export_res); + io_source_unregister(magicdesk16_list_item); + magicdesk16_list_item = NULL; +} + +/* ---------------------------------------------------------------------*/ + +#define CART_DUMP_VER_MAJOR 0 +#define CART_DUMP_VER_MINOR 2 +#define SNAP_MODULE_NAME "CARTMD16" + +int magicdesk16_snapshot_write_module(snapshot_t *s) +{ + snapshot_module_t *m; + + m = snapshot_module_create(s, SNAP_MODULE_NAME, + CART_DUMP_VER_MAJOR, CART_DUMP_VER_MINOR); + if (m == NULL) { + return -1; + } + + if (0 + || (SMW_B(m, (uint8_t)regval) < 0) + || (SMW_B(m, (uint8_t)bankmask) < 0) + || (SMW_BA(m, roml_banks, 0x2000 * MAXBANKS) < 0) + || (SMW_BA(m, romh_banks, 0x2000 * MAXBANKS) < 0)) { + snapshot_module_close(m); + return -1; + } + + snapshot_module_close(m); + return 0; +} + +int magicdesk16_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; + } + + if ((vmajor != CART_DUMP_VER_MAJOR) || (vminor != CART_DUMP_VER_MINOR)) { + snapshot_module_close(m); + return -1; + } + + if (0 + || (SMR_B(m, ®val) < 0) + || (SMR_B(m, &bankmask) < 0) + || (SMR_BA(m, roml_banks, 0x2000 * MAXBANKS) < 0) + || (SMR_BA(m, romh_banks, 0x2000 * MAXBANKS) < 0)) { + snapshot_module_close(m); + return -1; + } + + snapshot_module_close(m); + + if (magicdesk16_common_attach() == -1) { + return -1; + } + magicdesk16_io1_store(0xde00, regval); + return 0; +} Added: trunk/vice/src/c64/cart/magicdesk16.h =================================================================== --- trunk/vice/src/c64/cart/magicdesk16.h (rev 0) +++ trunk/vice/src/c64/cart/magicdesk16.h 2025-06-10 19:47:44 UTC (rev 45695) @@ -0,0 +1,45 @@ +/* + * magicdesk16.h - Cartridge handling, Magic Desk 16 cart. + * + * Written by + * Salvo Cristaldi <cr...@un...> + * + * This file is part of VICE, the Versatile Commodore Emulator. + * See README for copyright notice. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307 USA. + * + */ + +#ifndef VICE_MAGICDESK16_H +#define VICE_MAGICDESK16_H + +#include <stdio.h> + +#include "types.h" + +void magicdesk16_config_init(void); +void magicdesk16_config_setup(uint8_t *rawcart); +int magicdesk16_bin_attach(const char *filename, uint8_t *rawcart); +int magicdesk16_crt_attach(FILE *fd, uint8_t *rawcart); +void magicdesk16_detach(void); + +struct snapshot_s; + +int magicdesk16_snapshot_write_module(struct snapshot_s *s); +int magicdesk16_snapshot_read_module(struct snapshot_s *s); + +#endif Modified: trunk/vice/src/cartridge.h =================================================================== --- trunk/vice/src/cartridge.h 2025-06-05 20:46:21 UTC (rev 45694) +++ trunk/vice/src/cartridge.h 2025-06-10 19:47:44 UTC (rev 45695) @@ -273,7 +273,8 @@ #define CARTRIDGE_UC2 82 /* uc2.c */ #define CARTRIDGE_BMPDATATURBO 83 /* bmpdataturbo.c */ #define CARTRIDGE_PROFIDOS 84 /* profidos.c */ -#define CARTRIDGE_LAST 84 /* cartconv: last cartridge in list */ +#define CARTRIDGE_MAGIC_DESK_16 85 /* magicdesk16.c */ +#define CARTRIDGE_LAST 85 /* cartconv: last cartridge in list */ /* list of canonical names for the c64 cartridges: note: often it is hard to determine "the" official name, let alone the way it @@ -346,6 +347,7 @@ #define CARTRIDGE_NAME_LT_KERNAL "Lt. Kernal Host Adaptor" #define CARTRIDGE_NAME_MACH5 "MACH 5" /* http://rr.pokefinder.org/wiki/MACH_5 */ #define CARTRIDGE_NAME_MAGIC_DESK "Magic Desk" /* also: "Domark, Hes Australia" */ +#define CARTRIDGE_NAME_MAGIC_DESK_16 "Magic Desk 16K" /* https://github.com/crystalct/MagicDesk2 */ #define CARTRIDGE_NAME_MAGIC_FORMEL "Magic Formel" /* http://rr.pokefinder.org/wiki/Magic_Formel */ #define CARTRIDGE_NAME_MAGIC_VOICE "Magic Voice" /* all lowercase on cart ? */ #define CARTRIDGE_NAME_MIDI_MAPLIN "Maplin MIDI" Modified: trunk/vice/src/tools/cartconv/c64-cartridges.c =================================================================== --- trunk/vice/src/tools/cartconv/c64-cartridges.c 2025-06-05 20:46:21 UTC (rev 45694) +++ trunk/vice/src/tools/cartconv/c64-cartridges.c 2025-06-10 19:47:44 UTC (rev 45695) @@ -152,6 +152,13 @@ CARTRIDGE_SIZE_512KB, 0x4000, 0x8000, 0, 2, CARTRIDGE_NAME_UC2, "uc2", save_regular_crt}, {0, 0, CARTRIDGE_SIZE_16KB, 0x4000, 0x8000, 1, 0, CARTRIDGE_NAME_BMPDATATURBO, "bdt", save_regular_crt}, {1, 0, CARTRIDGE_SIZE_16KB, 0x2000, 0xe000, 2, 0, CARTRIDGE_NAME_PROFIDOS, "pd", save_regular_crt}, + {0, 0, CARTRIDGE_SIZE_32KB | + CARTRIDGE_SIZE_64KB | + CARTRIDGE_SIZE_128KB | + CARTRIDGE_SIZE_256KB | + CARTRIDGE_SIZE_512KB | + CARTRIDGE_SIZE_1024KB | + CARTRIDGE_SIZE_2048KB, 0x4000, 0x8000, 0, 0, CARTRIDGE_NAME_MAGIC_DESK_16, "md16", save_regular_crt}, {0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL} }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rh...@us...> - 2025-06-05 20:46:27
|
Revision: 45694 http://sourceforge.net/p/vice-emu/code/45694 Author: rhialto Date: 2025-06-05 20:46:21 +0000 (Thu, 05 Jun 2025) Log Message: ----------- PET 8296 $Axxxx video ram treatment. On the PET 8296, when writing to $Axxxx which writes through to RAM, treat this as video ram, so we can do beam racing with it like the $8xxx memory. Modified Paths: -------------- trunk/vice/src/crtc/crtc.c trunk/vice/src/crtc/crtc.h trunk/vice/src/pet/petmem.c Modified: trunk/vice/src/crtc/crtc.c =================================================================== --- trunk/vice/src/crtc/crtc.c 2025-06-02 00:07:01 UTC (rev 45693) +++ trunk/vice/src/crtc/crtc.c 2025-06-05 20:46:21 UTC (rev 45694) @@ -730,7 +730,9 @@ /* Set the retrace/vertical blank alarm, to cause an IRQ, * at the end/rhs of the visible text area. * Non-crtc timings are fixed so we might as well use the - * more efficient expression to check for the bottom line. */ + * more efficient expression to check for the bottom line. + * The screen takes 200 lines, then 20 lines bottom border, + * 20 lines retrace time, and 20 lines top border. */ alarm_set(crtc.adjusted_retrace_alarm, crtc.rl_start + crtc.rl_visible); } @@ -783,7 +785,9 @@ /* Set the retrace/vertical blank alarm, to end the IRQ, * at the rhs of the visible text area but 1 line above it. * Non-crtc timings are fixed so we might as well use the - * more efficient expression to check for the top line. */ + * more efficient expression to check for the top line. + * End the retrace time 60 line times after starting it, + * at the same horizontal position (40 chars). */ alarm_set(crtc.adjusted_retrace_alarm, crtc.rl_start + crtc.rl_visible); } @@ -958,14 +962,21 @@ crtc.retrace_callback(crtc.off_screen, offset); } -/* - * Experimental approximation of snow. - * Real snow would be of lower intensity than normal pixels because it is - * typically only displayed for one frame. - * Also, read access to the screen memory should probably cause it too. - */ -#define SNOW 0 +void crtc_update_snow(uint16_t addr, uint8_t value) +{ +#if CRTC_SNOW + /* snow ... */ + int beampos = (int)(maincpu_clk - CRTC_STORE_OFFSET + 1 - crtc.rl_start) * + crtc.hw_cols + - crtc.beam_offset; + int width = crtc.rl_visible * crtc.hw_cols; + if (beampos >= 0 && beampos < width) { + crtc.prefetch[beampos] = value; + } +#endif /* SNOW */ +} + /* * The caller must mask the addr to an acceptable range for the screen size. * This is needed in the caller because there it is known which addresses @@ -1006,16 +1017,8 @@ } } } -#if SNOW - /* snow ... */ - int beampos = (int)(maincpu_clk - CRTC_STORE_OFFSET + 1 - crtc.rl_start) * - crtc.hw_cols - - crtc.beam_offset; - int width = crtc.rl_visible * crtc.hw_cols; - - if (beampos >= 0 && beampos < width) { - crtc.prefetch[beampos] = value; - } +#if CRTC_SNOW + crtc_update_snow(addr, value); #endif /* SNOW */ } #endif /* CRTC_BEAM_RACING */ Modified: trunk/vice/src/crtc/crtc.h =================================================================== --- trunk/vice/src/crtc/crtc.h 2025-06-02 00:07:01 UTC (rev 45693) +++ trunk/vice/src/crtc/crtc.h 2025-06-05 20:46:21 UTC (rev 45694) @@ -93,10 +93,16 @@ * * Additionally, the timing of the "off_screen" signal for non-CRTC is * corrected, at the cost of extra alarms. + * + * CRTC_SNOW: Experimental approximation of snow. + * Real snow would be of lower intensity than normal pixels because it is + * typically only displayed for one frame. */ #define CRTC_BEAM_RACING 1 +#define CRTC_SNOW 0 #if CRTC_BEAM_RACING void crtc_update_prefetch(uint16_t addr, uint8_t value); +void crtc_update_snow(uint16_t addr, uint8_t value); #endif /* Modified: trunk/vice/src/pet/petmem.c =================================================================== --- trunk/vice/src/pet/petmem.c 2025-06-02 00:07:01 UTC (rev 45693) +++ trunk/vice/src/pet/petmem.c 2025-06-05 20:46:21 UTC (rev 45694) @@ -207,7 +207,11 @@ */ static uint8_t read_vmem(uint16_t addr) { - last_access = mem_ram[0x8000 + (addr & 0x3fff)]; + addr &= 0x3fff; + last_access = mem_ram[0x8000 + addr]; +#if CRTC_BEAM_RACING && CRTC_SNOW + crtc_update_snow(addr, last_access); +#endif return last_access; } @@ -231,13 +235,19 @@ */ static uint8_t read_vmirror(uint16_t addr) { - last_access = mem_ram[0x8000 + (addr & 0x0bff)]; /* 0x3FF + 0x800 */ + addr &= 0x0bff; /* 0x3FF + 0x800 */ + last_access = mem_ram[0x8000 + addr]; +#if CRTC_BEAM_RACING + if (addr < 0x0400) { + crtc_update_snow(addr, last_access); + } +#endif return last_access; } static void store_vmirror(uint16_t addr, uint8_t value) { - addr &= 0x0bff; + addr &= 0x0bff; /* 0x3FF + 0x800 */ mem_ram[0x8000 + addr] = value; last_access = value; #if CRTC_BEAM_RACING @@ -1104,12 +1114,21 @@ mem_read_limit_tab[i] = 0; } } else { - fetch = ram9 ? ram_read : + /* + * On 8296, $9xxx can be used by the CRTC. With a jumper, even more + * than that, but we don't emulate that. + */ + void (*store9)(uint16_t, uint8_t); + + fetch = ram9 ? read_vmem : /* ram9 can only be set on 8296 */ petrom_9_loaded ? rom_read : read_unused; + store9 = petres.map == PET_MAP_8296 ? store_vmem : + store; + for (i = 0x90; i < 0xa0; i++) { _mem_read_tab[i] = fetch; - _mem_write_tab[i] = store; + _mem_write_tab[i] = store9; _mem_read_base_tab[i] = NULL; mem_read_limit_tab[i] = 0; } @@ -1241,7 +1260,7 @@ *limit = mem_read_limit_tab; } -/* called by mem_update_config(), mem_toggle_watchpoints() */ +/* called by mem_initialize_memory(), mem_toggle_watchpoints() */ static void mem_update_tab_ptrs(int flag) { if (flag) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-06-02 00:07:05
|
Revision: 45693 http://sourceforge.net/p/vice-emu/code/45693 Author: gpz Date: 2025-06-02 00:07:01 +0000 (Mon, 02 Jun 2025) Log Message: ----------- added some hints on tde vs autostart Modified Paths: -------------- trunk/vice/doc/vice.texi Modified: trunk/vice/doc/vice.texi =================================================================== --- trunk/vice/doc/vice.texi 2025-06-01 23:15:06 UTC (rev 45692) +++ trunk/vice/doc/vice.texi 2025-06-02 00:07:01 UTC (rev 45693) @@ -1442,7 +1442,8 @@ If you want to allow the started program to access the host file system, you will have to enable "virtual device traps". If you want the autostart logic to disable true drive emulation temporarily to speed up the autostart, then enable "handle -TDE at autostart. +TDE at autostart (this is required if true drive emulation would be enabled +otherwise - as is the default). @xref{Disk and tape images}. for more information about images and autostart. @@ -3431,7 +3432,7 @@ a proper disk or tape image file. If true drive emulation is turned on, and the @dfn{Handle TDE at Autostart} -setting is enabled, true drive emulation will be turned off before running +setting is enabled, true drive emulation will be turned off before loading the program and then turned on again after it has been loaded. This way, you get the maximum possible speed while loading the file, but you do not lose compatibility once the program itself is @@ -3603,7 +3604,7 @@ @item To speed up loading .prg files, enable Options->Host->Autostart->Autostart PRG Settings->Autostart mode->Inject into RAM -(@code{AutostartPrgMode} = 0) +(@code{AutostartPrgMode} = 1) @item To speed up loading .d64 files, @@ -3786,7 +3787,8 @@ @item AutostartHandleTrueDriveEmulation Boolean, if true handle (enable/disable) True Drive Emulation on autostart (all emulators except vsid). This is disabled by default to ensure maximum -compatibility. +compatibility. It @emph{must} be enabled, if true drive emulation is enabled, and +@code{AutostartPrgMode} is 0. @vindex AutostartWarp @item AutostartWarp @@ -3798,6 +3800,8 @@ Integer specifying the autostart mode for prg files (all emulators except vsid). (0: virtual filesystem, 1: inject to RAM, 2: copy to D64) +Note that @code{AutostartHandleTrueDriveEmulation} must be enabled, if true drive +emulation is enabled. @vindex AutostartDelayRandom @item AutostartDelayRandom This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-06-01 23:15:09
|
Revision: 45692 http://sourceforge.net/p/vice-emu/code/45692 Author: gpz Date: 2025-06-01 23:15:06 +0000 (Sun, 01 Jun 2025) Log Message: ----------- fix device traps in xplus4 (hopefully), fixes #2143 Modified Paths: -------------- trunk/vice/src/plus4/plus4mem.c Modified: trunk/vice/src/plus4/plus4mem.c =================================================================== --- trunk/vice/src/plus4/plus4mem.c 2025-06-01 13:21:15 UTC (rev 45691) +++ trunk/vice/src/plus4/plus4mem.c 2025-06-01 23:15:06 UTC (rev 45692) @@ -923,13 +923,13 @@ #else /* redirect kernal to cartridge port */ mem_read_tab[1][i] = plus4cart_kernal_read; - mem_read_base_tab[1][i] = NULL; + mem_read_base_tab[1][i] = plus4memrom_kernal_trap_rom + ((i & 0x3f) << 8); mem_read_tab[3][i] = plus4cart_kernal_read; - mem_read_base_tab[3][i] = NULL; + mem_read_base_tab[3][i] = plus4memrom_kernal_trap_rom + ((i & 0x3f) << 8); mem_read_tab[5][i] = plus4cart_kernal_read; - mem_read_base_tab[5][i] = NULL; + mem_read_base_tab[5][i] = plus4memrom_kernal_trap_rom + ((i & 0x3f) << 8); mem_read_tab[7][i] = plus4cart_kernal_read; - mem_read_base_tab[7][i] = NULL; + mem_read_base_tab[7][i] = plus4memrom_kernal_trap_rom + ((i & 0x3f) << 8); #endif mem_read_tab[9][i] = plus4memrom_extromhi1_read; mem_read_base_tab[9][i] = extromhi1 + ((i & 0x3f) << 8); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rh...@us...> - 2025-06-01 13:21:18
|
Revision: 45691 http://sourceforge.net/p/vice-emu/code/45691 Author: rhialto Date: 2025-06-01 13:21:15 +0000 (Sun, 01 Jun 2025) Log Message: ----------- c1541: fix segfault when not attaching disk image. When a disk image is attached, vdrive_device_setup() is called to set up the vdrive struct. This includes memory for the disk error string buffer. If you do a "c1541 -write foo bar" command (so without attaching a disk image), c1541 wants to write a DRIVE NOT READY to the error string buffer. This segfaults because it has not been allocated. Fix: Call vdrive_device_setup() right after a vdrive is allocated, so it is always good to use. Also, when freeing the buffers in vdrive_device_shutdown(), set them to NULL to make sure they are not re-used accidentally. When vdrive_device_setup() is called again for attaching a disk image, be paranoid and first call vdrive_device_shutdown() on it. When detaching an image, call vdrive_device_shutdown() even if no image was attached. This prevents memory leaks. Also: replace some 8's by DRIVE_UNIT_MIN. Modified Paths: -------------- trunk/vice/src/c1541.c trunk/vice/src/vdrive/vdrive.c Modified: trunk/vice/src/c1541.c =================================================================== --- trunk/vice/src/c1541.c 2025-05-22 19:03:56 UTC (rev 45690) +++ trunk/vice/src/c1541.c 2025-06-01 13:21:15 UTC (rev 45691) @@ -252,7 +252,7 @@ return NULL; } - return drives[unit - 8]; + return drives[unit - DRIVE_UNIT_MIN]; } /* ------------------------------------------------------------------------- */ @@ -1089,6 +1089,7 @@ return -1; } + vdrive_device_shutdown(vdrive); vdrive_device_setup(vdrive, unit); vdrive_attach_image(image, unit, 0, vdrive); return 0; @@ -1117,9 +1118,10 @@ disk_image_media_destroy(image); disk_image_destroy(image); vdrive->image = NULL; - /* also clean up buffer used by the vdrive */ - vdrive_device_shutdown(vdrive); } + + /* also clean up buffer used by the vdrive */ + vdrive_device_shutdown(vdrive); } /** \brief Open image or create a new one @@ -5220,7 +5222,7 @@ return FD_NOTREADY; } - printf("validating in unit %d ...\n", dnr + 8); + printf("validating in unit %d ...\n", dnr + DRIVE_UNIT_MIN); vdrive_command_validate(drives[dnr]); return FD_OK; @@ -5363,10 +5365,10 @@ } if (dest_name == (char *)finfo->name) { - printf("writing file `%s' to unit %d\n", finfo->name, dnr + 8); + printf("writing file `%s' to unit %d\n", finfo->name, dnr + DRIVE_UNIT_MIN); } else { printf("writing file `%s' as `%s' to unit %d\n", finfo->name, - dest_name, dnr + 8); + dest_name, dnr + DRIVE_UNIT_MIN); } if (rel_record_length == 0) { @@ -5630,6 +5632,7 @@ for (i = 0; i < NUM_DISK_UNITS; i++) { drives[i] = lib_calloc(1, sizeof *drives[i]); + vdrive_device_setup(drives[i], DRIVE_UNIT_MIN + i); } /* The first arguments without leading `-' are interpreted as disk images @@ -5638,10 +5641,10 @@ if ((i - 1) == NUM_DISK_UNITS) { fprintf(stderr, "Ignoring disk image `%s'\n", argv[i]); } else { - if (open_disk_image(drives[i - 1], argv[i], (unsigned int)(i - 1 + 8)) != 0) { + if (open_disk_image(drives[i - 1], argv[i], (unsigned int)(i - 1 + DRIVE_UNIT_MIN)) != 0) { /* error: clean up and exit */ while (--i >= 1) { - close_disk_image(drives[i - 1], (unsigned int)(i - 1 + 8)); + close_disk_image(drives[i - 1], (unsigned int)(i - 1 + DRIVE_UNIT_MIN)); } for (i = 0; i < NUM_DISK_UNITS; i++) { lib_free(drives[i]); @@ -5764,7 +5767,7 @@ /* free memory used by the virtual drives */ for (i = 0; i < NUM_DISK_UNITS; i++) { if (drives[i]) { - close_disk_image(drives[i], i + 8); + close_disk_image(drives[i], i + DRIVE_UNIT_MIN); lib_free(drives[i]); } } @@ -5811,7 +5814,7 @@ if (check_drive_unit(dnr) < 0) { return FD_BADDEV; } - dnr -= 8; + dnr -= DRIVE_UNIT_MIN; } p00save[dnr] = (unsigned int)enable; Modified: trunk/vice/src/vdrive/vdrive.c =================================================================== --- trunk/vice/src/vdrive/vdrive.c 2025-05-22 19:03:56 UTC (rev 45690) +++ trunk/vice/src/vdrive/vdrive.c 2025-06-01 13:21:15 UTC (rev 45691) @@ -176,6 +176,7 @@ p = &(vdrive->buffers[i]); vdrive_free_buffer(p); lib_free(p->buffer); + p->buffer = NULL; } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-05-22 19:03:59
|
Revision: 45690 http://sourceforge.net/p/vice-emu/code/45690 Author: compyx Date: 2025-05-22 19:03:56 +0000 (Thu, 22 May 2025) Log Message: ----------- Joyatick: gtk3: pack input widgets in scrolled window Use a scrolled window with automatic vertical scroll bars to avoid stretching the settings dialog when there are many inputs (e.g. buttons) available for a device. Modified Paths: -------------- branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/settings_joymap.c Modified: branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/settings_joymap.c =================================================================== --- branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/settings_joymap.c 2025-05-20 22:09:53 UTC (rev 45689) +++ branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/settings_joymap.c 2025-05-22 19:03:56 UTC (rev 45690) @@ -205,6 +205,31 @@ return grid; } +/** \brief Create GtkScrolledWindow wrapping a widget + * + * Create scrolled window with vertical scroll bars, visible only when the + * content doesn't fit the preset height, and add \a child as its child. + * + * \param[in] child child widget for the scrolled window + * + * \return new \c GtkScrolledWindow + */ +static GtkWidget *scrolled_window_helper(GtkWidget *child) +{ + GtkWidget *scrolled = gtk_scrolled_window_new(NULL, NULL); + + gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scrolled), + GTK_POLICY_NEVER, + GTK_POLICY_AUTOMATIC); + gtk_widget_set_hexpand(scrolled, TRUE); + gtk_widget_set_vexpand(scrolled, FALSE); + /* FIXME: can we avoid setting "fixed" width? */ + gtk_widget_set_size_request(scrolled, -1, 380); + gtk_container_add(GTK_CONTAINER(scrolled), child); + return scrolled; +} + + /* TODO: Repaint widgets once after all events have been processed, with * Gtk fram tick or so? */ @@ -215,15 +240,15 @@ GtkWidget *bgrid; GtkWidget *hgrid; - grid = grid_helper("<b>Device events</b>", 16, 8, 3); - + grid = gtk_grid_new(); agrid = create_axes_grid(joydev); bgrid = create_buttons_grid(joydev); hgrid = grid_helper("<b>Hats (TODO)</b>", 8, 8, 2); - gtk_grid_attach(GTK_GRID(grid), agrid, 0, 1, 1, 1); - gtk_grid_attach(GTK_GRID(grid), bgrid, 1, 1, 1, 1); - gtk_grid_attach(GTK_GRID(grid), hgrid, 2, 1, 1, 1); + gtk_grid_attach(GTK_GRID(grid), scrolled_window_helper(agrid), 0, 0, 1, 1); + gtk_grid_attach(GTK_GRID(grid), scrolled_window_helper(bgrid), 1, 0, 1, 1); + gtk_grid_attach(GTK_GRID(grid), scrolled_window_helper(hgrid), 2, 0, 1, 1); + return grid; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-05-20 22:09:55
|
Revision: 45689 http://sourceforge.net/p/vice-emu/code/45689 Author: gpz Date: 2025-05-20 22:09:53 +0000 (Tue, 20 May 2025) Log Message: ----------- include extra SIDs in the I/O list in the monitor in vsid, fixes bug #1852 Modified Paths: -------------- trunk/vice/src/c64/c64mem.h trunk/vice/src/c64/vsidmem.c trunk/vice/src/c64/vsidmeminit.c Modified: trunk/vice/src/c64/c64mem.h =================================================================== --- trunk/vice/src/c64/c64mem.h 2025-05-20 21:37:25 UTC (rev 45688) +++ trunk/vice/src/c64/c64mem.h 2025-05-20 22:09:53 UTC (rev 45689) @@ -82,6 +82,7 @@ void c64_mem_ui_shutdown(void); uint8_t vsid_io_read(uint16_t addr); +uint8_t vsid_io_peek(uint16_t addr); void vsid_io_store(uint16_t addr, uint8_t val); #endif Modified: trunk/vice/src/c64/vsidmem.c =================================================================== --- trunk/vice/src/c64/vsidmem.c 2025-05-20 21:37:25 UTC (rev 45688) +++ trunk/vice/src/c64/vsidmem.c 2025-05-20 22:09:53 UTC (rev 45689) @@ -53,6 +53,7 @@ #include "monitor.h" #include "ram.h" #include "sid.h" +#include "sid-resources.h" #include "tpi.h" #include "vicii-mem.h" #include "vicii-phi1.h" @@ -792,6 +793,9 @@ return cia1_peek(addr); case 0xdd00: return cia2_peek(addr); + case 0xde00: + case 0xdf00: + return vsid_io_peek(addr); } return 0xff; } @@ -990,6 +994,12 @@ mon_ioreg_add_list(&mem_ioreg_list, "CIA1", 0xdc00, 0xdc0f, mem_dump_io, NULL, IO_MIRROR_NONE); mon_ioreg_add_list(&mem_ioreg_list, "CIA2", 0xdd00, 0xdd0f, mem_dump_io, NULL, IO_MIRROR_NONE); + if (sid_stereo >= 1) { + mon_ioreg_add_list(&mem_ioreg_list, "SID2", sid2_address_start, sid2_address_start + 0x1f, sid2_dump, NULL, IO_MIRROR_NONE); + } + if (sid_stereo >= 2) { + mon_ioreg_add_list(&mem_ioreg_list, "SID3", sid3_address_start, sid3_address_start + 0x1f, sid3_dump, NULL, IO_MIRROR_NONE); + } return mem_ioreg_list; } Modified: trunk/vice/src/c64/vsidmeminit.c =================================================================== --- trunk/vice/src/c64/vsidmeminit.c 2025-05-20 21:37:25 UTC (rev 45688) +++ trunk/vice/src/c64/vsidmeminit.c 2025-05-20 22:09:53 UTC (rev 45689) @@ -89,6 +89,23 @@ return vicii_read_phi1(); } +uint8_t vsid_io_peek(uint16_t addr) +{ + if (sid_stereo >= 1 + && addr >= sid2_address_start + && addr < sid2_address_end) { + return sid_peek(addr); + } + + if (sid_stereo >= 2 + && addr >= sid3_address_start + && addr < sid3_address_end) { + return sid_peek(addr); + } + + return vicii_read_phi1(); +} + void vsid_io_store(uint16_t addr, uint8_t val) { if (sid_stereo >= 1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-05-20 21:37:27
|
Revision: 45688 http://sourceforge.net/p/vice-emu/code/45688 Author: gpz Date: 2025-05-20 21:37:25 +0000 (Tue, 20 May 2025) Log Message: ----------- one header isn't enough Modified Paths: -------------- trunk/vice/src/arch/gtk3/uimachinewindow.c Modified: trunk/vice/src/arch/gtk3/uimachinewindow.c =================================================================== --- trunk/vice/src/arch/gtk3/uimachinewindow.c 2025-05-20 20:51:00 UTC (rev 45687) +++ trunk/vice/src/arch/gtk3/uimachinewindow.c 2025-05-20 21:37:25 UTC (rev 45688) @@ -50,6 +50,7 @@ #ifdef WINDOWS_COMPILE #include "directx_renderer.h" +#include "directx_renderer_impl.h" #else #include "opengl_renderer.h" #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-05-20 20:51:01
|
Revision: 45687 http://sourceforge.net/p/vice-emu/code/45687 Author: gpz Date: 2025-05-20 20:51:00 +0000 (Tue, 20 May 2025) Log Message: ----------- blind fix for direct-x. crossing fingers Modified Paths: -------------- trunk/vice/src/arch/gtk3/uimachinewindow.c Modified: trunk/vice/src/arch/gtk3/uimachinewindow.c =================================================================== --- trunk/vice/src/arch/gtk3/uimachinewindow.c 2025-05-20 20:07:39 UTC (rev 45686) +++ trunk/vice/src/arch/gtk3/uimachinewindow.c 2025-05-20 20:51:00 UTC (rev 45687) @@ -330,11 +330,19 @@ double render_w = canvas->geometry->screen_size.width; #else /* get width from render context instead */ +#ifdef WINDOWS_COMPILE + vice_directx_renderer_context_t *context = (vice_directx_renderer_context_t *)canvas->renderer_context; + double render_w = context->bitmap_width; + if (canvas->videoconfig->double_size_enabled) { + render_w /= 2.0f; + } +#else vice_opengl_renderer_context_t *context = (vice_opengl_renderer_context_t *)canvas->renderer_context; double render_w = context->current_frame_width; if (canvas->videoconfig->double_size_enabled) { render_w /= 2.0f; } +#endif /* sanity check */ if (render_w != canvas->geometry->screen_size.width) { static int This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-05-20 20:07:41
|
Revision: 45686 http://sourceforge.net/p/vice-emu/code/45686 Author: gpz Date: 2025-05-20 20:07:39 +0000 (Tue, 20 May 2025) Log Message: ----------- workaround 'fix' sortof for bug #2133 - instead of getting the canvas width from the geometry, recalculate it from the texture size. Also print a warning if the two values do not match, since that indicates a problem elsewhere. Modified Paths: -------------- trunk/vice/src/arch/gtk3/uimachinewindow.c trunk/vice/src/arch/sdl/lightpendrv.c trunk/vice/src/joyport/lightpen.c trunk/vice/src/raster/raster.c trunk/vice/src/vic20/victypes.h Modified: trunk/vice/src/arch/gtk3/uimachinewindow.c =================================================================== --- trunk/vice/src/arch/gtk3/uimachinewindow.c 2025-05-20 18:07:40 UTC (rev 45685) +++ trunk/vice/src/arch/gtk3/uimachinewindow.c 2025-05-20 20:07:39 UTC (rev 45686) @@ -294,6 +294,7 @@ #elif defined(WINDOWS_COMPILE) + /* scale is a uniform scaling applied to eg high dpi widgets by gtk */ int scale = gtk_widget_get_scale_factor(widget); POINT pt; /* mouse_host_moved(motion->x_root * scale, motion->y_root * scale); */ @@ -308,6 +309,7 @@ #else /* Xlib, warp is relative to window */ + /* scale is a uniform scaling applied to eg high dpi widgets by gtk */ int scale = gtk_widget_get_scale_factor(widget); mouse_host_moved( (widget_x + motion->x) * scale, @@ -322,8 +324,27 @@ /* * Mouse isn't captured, so we update the pen position. */ - +#if 0 + /* FIXME: this value is wrong in (at least) xvic, it is always the full + width of produced video, not just the width of the shown window */ double render_w = canvas->geometry->screen_size.width; +#else + /* get width from render context instead */ + vice_opengl_renderer_context_t *context = (vice_opengl_renderer_context_t *)canvas->renderer_context; + double render_w = context->current_frame_width; + if (canvas->videoconfig->double_size_enabled) { + render_w /= 2.0f; + } + /* sanity check */ + if (render_w != canvas->geometry->screen_size.width) { + static int + if (!once) { + log_warning(LOG_DEFAULT, "geometry->screen_size.width (%u) does not match actual rendered width (%f)", + canvas->geometry->screen_size.width, render_w); + once++; + } + } +#endif double render_h = canvas->geometry->last_displayed_line - canvas->geometry->first_displayed_line + 1; /* There might be some sweet off-by-0.5 bugs here */ Modified: trunk/vice/src/arch/sdl/lightpendrv.c =================================================================== --- trunk/vice/src/arch/sdl/lightpendrv.c 2025-05-20 18:07:40 UTC (rev 45685) +++ trunk/vice/src/arch/sdl/lightpendrv.c 2025-05-20 20:07:39 UTC (rev 45686) @@ -32,8 +32,17 @@ #include "machine.h" #include "lightpen.h" #include "lightpendrv.h" +#include "log.h" #include "videoarch.h" +/* #define DEBUG_LIGHTPEN */ + +#ifdef DEBUG_LIGHTPEN +#define DBG(x) log_printf x +#else +#define DBG(x) +#endif + /* ------------------------------------------------------------------ */ /* External interface */ @@ -51,9 +60,7 @@ buttons = 0; } -#ifdef SDL_DEBUG - fprintf(stderr, "%s : x = %i, y = %i, buttons = %02x\n", __func__, x, y, buttons); -#endif + DBG(("%s : x = %i, y = %i, buttons = %02x", __func__, x, y, buttons)); screen_num = sdl_active_canvas_num; Modified: trunk/vice/src/joyport/lightpen.c =================================================================== --- trunk/vice/src/joyport/lightpen.c 2025-05-20 18:07:40 UTC (rev 45685) +++ trunk/vice/src/joyport/lightpen.c 2025-05-20 20:07:39 UTC (rev 45686) @@ -29,6 +29,15 @@ #include <stdio.h> +/* #define DEBUG_LIGHTPEN */ + +#ifdef DEBUG_LIGHTPEN +#include "log.h" +#define DBG(x) log_printf x +#else +#define DBG(x) +#endif + #if defined(HAVE_MOUSE) && defined(HAVE_LIGHTPEN) #include "joyport.h" @@ -538,10 +547,16 @@ return 0; } -/* Update lightpen coordinates and button status. Called at the end of each frame. +/* Update lightpen coordinates and button status. + Called at the end of each frame by the UI code. + For x128, window 1 is VICII, window 0 is VDC. Others always use window 0. - x and y are the canvas coordinates; double size, hwscale and offsets are removed in the arch side. - Negative values of x and/or y can be used to indicate that the pointer is off the (emulated) screen. */ + + x and y are the host canvas coordinates; double size, hwscale and offsets are + removed in the arch side. + + Negative values of x and/or y can be used to indicate that the pointer is off + the (emulated) screen. */ void lightpen_update(int window, int x, int y, int buttons) { CLOCK pulse_time; @@ -554,6 +569,8 @@ return; } +/* DBG(("lightpen_update: x: %i y: %i buttons: %04x", x, y, buttons)); */ + lightpen_update_buttons(buttons); if ((x < 0) || (y < 0)) { Modified: trunk/vice/src/raster/raster.c =================================================================== --- trunk/vice/src/raster/raster.c 2025-05-20 18:07:40 UTC (rev 45685) +++ trunk/vice/src/raster/raster.c 2025-05-20 20:07:39 UTC (rev 45686) @@ -54,7 +54,15 @@ #include "video.h" #include "viewport.h" +/* #define DEBUG_RASTER */ +#ifdef DEBUG_RASTER +#define DBG(x) log_printf x +#else +#define DBG(x) +#endif + + static int raster_calc_frame_buffer_width(raster_t *raster) { return raster->geometry->screen_size.width @@ -409,12 +417,13 @@ if (geometry->screen_size.width != screen_width || geometry->screen_size.height != screen_height || geometry->extra_offscreen_border_left != extra_offscreen_border_left - || geometry->extra_offscreen_border_right - != extra_offscreen_border_right) { + || geometry->extra_offscreen_border_right != extra_offscreen_border_right) { geometry->screen_size.width = screen_width; geometry->screen_size.height = screen_height; geometry->extra_offscreen_border_left = extra_offscreen_border_left; geometry->extra_offscreen_border_right = extra_offscreen_border_right; + DBG(("raster_set_geometry screen_size.width:%d height:%d extra_offscreen_border_left: %d right:%d", + screen_width, screen_height, extra_offscreen_border_left, extra_offscreen_border_right)); raster_realize_frame_buffer(raster); } Modified: trunk/vice/src/vic20/victypes.h =================================================================== --- trunk/vice/src/vic20/victypes.h 2025-05-20 18:07:40 UTC (rev 45685) +++ trunk/vice/src/vic20/victypes.h 2025-05-20 20:07:39 UTC (rev 45686) @@ -215,17 +215,23 @@ /* Graphics buffer (chargen/bitmap) */ uint8_t gbuf[VIC_MAX_TEXT_COLS]; - unsigned int cycles_per_line; + /* Geometry and timing parameters of the selected VIC emulation. */ unsigned int screen_height; unsigned int first_displayed_line; unsigned int last_displayed_line; - unsigned int screen_width; - unsigned int display_width; - unsigned int cycle_offset; - unsigned int max_text_cols; + int screen_leftborderwidth; int screen_rightborderwidth; + unsigned int screen_width; /* max width of video (different for PAL/NTSC) */ + unsigned int display_width; /* width to display (different for border modes) */ + + /* parameters (set by vic-chip-model). */ + unsigned int cycles_per_line; + + unsigned int cycle_offset; + unsigned int max_text_cols; + vic_light_pen_t light_pen; /* Video chip capabilities. */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-05-20 18:07:42
|
Revision: 45685 http://sourceforge.net/p/vice-emu/code/45685 Author: gpz Date: 2025-05-20 18:07:40 +0000 (Tue, 20 May 2025) Log Message: ----------- fix saving minimon .crt file, fixes bug #2141 Modified Paths: -------------- trunk/vice/src/vic20/cart/minimon.c Modified: trunk/vice/src/vic20/cart/minimon.c =================================================================== --- trunk/vice/src/vic20/cart/minimon.c 2025-05-20 16:55:53 UTC (rev 45684) +++ trunk/vice/src/vic20/cart/minimon.c 2025-05-20 18:07:40 UTC (rev 45685) @@ -740,6 +740,8 @@ FILE *fd; size_t ret; + DBG(("minimon_bin_save '%s'", filename)); + if (filename == NULL) { return -1; } @@ -768,11 +770,13 @@ FILE *fd; crt_chip_header_t chip; + DBG(("minimon_crt_save '%s'", filename)); + if (minimon_rom == NULL) { return -1; } - fd = crt_create(filename, CARTRIDGE_VIC20_MINIMON, 0, 0, STRING_MINIMON); + fd = crt_create_vic20(filename, CARTRIDGE_VIC20_MINIMON, 0, STRING_MINIMON); if (fd == NULL) { return -1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-05-20 16:55:56
|
Revision: 45684 http://sourceforge.net/p/vice-emu/code/45684 Author: gpz Date: 2025-05-20 16:55:53 +0000 (Tue, 20 May 2025) Log Message: ----------- support for the 'speedy' plus4 freezer cartridge Modified Paths: -------------- trunk/vice/data/hotkeys/hotkeys-cartridge.vhk trunk/vice/doc/vice.texi trunk/vice/src/arch/gtk3/uimachinemenu.c trunk/vice/src/arch/sdl/actions-cartridge.c trunk/vice/src/arch/sdl/menu_plus4cart.c trunk/vice/src/arch/shared/uiactions.c trunk/vice/src/arch/shared/uiactions.h trunk/vice/src/cartridge.h trunk/vice/src/plus4/cart/Makefile.am trunk/vice/src/plus4/cart/plus4cart.c trunk/vice/src/plus4/cart/plus4cart.h trunk/vice/src/plus4/plus4io.c trunk/vice/src/plus4/plus4mem.c trunk/vice/src/plus4/plus4memrom.c trunk/vice/src/tools/cartconv/plus4-cartridges.c Added Paths: ----------- trunk/vice/src/plus4/cart/speedy.c trunk/vice/src/plus4/cart/speedy.h Modified: trunk/vice/data/hotkeys/hotkeys-cartridge.vhk =================================================================== --- trunk/vice/data/hotkeys/hotkeys-cartridge.vhk 2025-05-18 15:55:35 UTC (rev 45683) +++ trunk/vice/data/hotkeys/hotkeys-cartridge.vhk 2025-05-20 16:55:53 UTC (rev 45684) @@ -6,13 +6,13 @@ !if !MACOS cart-attach <Alt>c cart-detach <Alt><Shift>c - !if C64 || C64SC || SCPU64 || C128 || VIC20 + !if C64 || C64SC || SCPU64 || C128 || VIC20 || PLUS4 cart-freeze <Alt>z !endif !else cart-attach <Command>c cart-detach <Command><Shift>c - !if C64 || C64SC || SCPU64 || C128 || VIC20 + !if C64 || C64SC || SCPU64 || C128 || VIC20 || PLUS4 cart-freeze <Command>z !endif !endif Modified: trunk/vice/doc/vice.texi =================================================================== --- trunk/vice/doc/vice.texi 2025-05-18 15:55:35 UTC (rev 45683) +++ trunk/vice/doc/vice.texi 2025-05-20 16:55:53 UTC (rev 45684) @@ -15769,6 +15769,8 @@ 2: Plus4 multi cart @item 3: 1MB Cartridge +@item + 4: "Speedy" freezer cartridge @end itemize @vindex CartridgeFile @@ -15824,6 +15826,10 @@ Attach a 1MiB/2MiB "Plus4 multi cart" image. The binary should contain all c1lo banks first, then all c1hi banks. +@findex -cartspeedy +@item -cartspeedy <name> +Attach a 8kiB "Speedy" image + @end table @c @node FIXME @@ -23917,6 +23923,8 @@ c264 magic cart @item multi Plus4 multi cart +@item speedy +"Speedy" freezer cart @end table @b{CBM2 cartridges:} @@ -35600,6 +35608,8 @@ @tab Plus4 multi cart @item 3 @tab 1MB Cartridge +@item 4 +@tab "Speedy" freezer cartridge @end multitable For all Plus4 binary formats (non .crt) the convention is to store all banks of @@ -35714,6 +35724,31 @@ This cartridge has one banking register at $fe00. @c @node FIXME +@subsubsection 4 - Speedy + +@multitable @columnfractions .3 .7 +@item Size +@tab 8KiB +@item Load address +@tab $8000-$BFFF (mirrored twice) (C1LO) +@end multitable + +@example + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F ASCII + ----------------------------------------------- ---------------- + 0000: 50 4c 55 53 34 20 43 41 52 54 52 49 44 47 45 20 PLUS4 CARTRIDGE + 0010: 00 00 00 40 02 00 00 04 00 00 00 00 00 00 00 00 ...@............ + 0020: 53 70 65 65 64 79 00 00 00 00 00 00 00 00 00 00 Speedy.......... + 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 0040: 43 48 49 50 00 00 20 10 00 00 00 00 80 00 20 00 CHIP.. ....... . + 0050: 4c 0a 80 42 4f 50 02 43 42 4d a2 00 bd 26 80 9d L..BOP.CBM...&.. +@dots{} + 2030: 20 20 20 20 20 20 20 20 00 84 00 a4 00 06 00 ef ................ + 2040: 12 ff fd ff fd ff ff ff ff ff df ff ff ff ff ff ................ +@end example + + +@c @node FIXME @subsection CBM2 Cartridge Specifics Modified: trunk/vice/src/arch/gtk3/uimachinemenu.c =================================================================== --- trunk/vice/src/arch/gtk3/uimachinemenu.c 2025-05-18 15:55:35 UTC (rev 45683) +++ trunk/vice/src/arch/gtk3/uimachinemenu.c 2025-05-20 16:55:53 UTC (rev 45684) @@ -387,7 +387,7 @@ /* {{{ file_menu_cart_freeze */ /** \brief 'File' menu - cartridge section for C64/C128 * - * VIC20, C64, SCPU64 and C128, containing "Cartridge freeze". + * C64, SCPU64, C128, VIC20 and Plus4 containing "Cartridge freeze". */ static const ui_menu_item_t file_menu_cart_freeze[] = { { .label = "Attach cartridge image...", @@ -411,7 +411,7 @@ /* {{{ file_menu_cart_no_freeze */ /** \brief 'File' menu - cartridge section for Plus/4, VIC-20 and CBM-II * - * Plus/4, VIC-20, CBM-II, not containing "Cartridge freeze". + * CBM-II, not containing "Cartridge freeze". */ static const ui_menu_item_t file_menu_cart_no_freeze[] = { { .label = "Attach cartridge image...", @@ -1074,11 +1074,14 @@ break; case VICE_MACHINE_C64DTV: + /* no cart section */ + /* no tape section */ file_menu_printer_section = file_menu_printer_no_userport; settings_menu_joy_section = settings_menu_joy_swap; break; case VICE_MACHINE_SCPU64: + /* no tape section */ file_menu_cart_section = file_menu_cart_freeze; file_menu_printer_section = file_menu_printer; settings_menu_joy_section = settings_menu_joy_swap; @@ -1099,7 +1102,7 @@ case VICE_MACHINE_PLUS4: file_menu_tape_section = file_menu_tape; - file_menu_cart_section = file_menu_cart_no_freeze; + file_menu_cart_section = file_menu_cart_freeze; file_menu_printer_section = file_menu_printer_no_userport; settings_menu_joy_section = settings_menu_joy_swap; break; @@ -1119,6 +1122,7 @@ case VICE_MACHINE_PET: file_menu_tape_section = file_menu_tape_xpet; + /* no cart section */ file_menu_printer_section = file_menu_printer; break; Modified: trunk/vice/src/arch/sdl/actions-cartridge.c =================================================================== --- trunk/vice/src/arch/sdl/actions-cartridge.c 2025-05-18 15:55:35 UTC (rev 45683) +++ trunk/vice/src/arch/sdl/actions-cartridge.c 2025-05-20 16:55:53 UTC (rev 45684) @@ -164,6 +164,10 @@ .handler = sdl_ui_activate_item_action, .dialog = true }, + { .action = ACTION_CART_ATTACH_RAW_SPEEDY, + .handler = sdl_ui_activate_item_action, + .dialog = true + }, { .action = ACTION_CART_ATTACH_RAW_C1_FULL, .handler = sdl_ui_activate_item_action, .dialog = true @@ -191,6 +195,9 @@ { .action = ACTION_CART_DETACH, .handler = cart_detach_action }, + { .action = ACTION_CART_FREEZE, + .handler = cart_freeze_action + }, UI_ACTION_MAP_TERMINATOR }; Modified: trunk/vice/src/arch/sdl/menu_plus4cart.c =================================================================== --- trunk/vice/src/arch/sdl/menu_plus4cart.c 2025-05-18 15:55:35 UTC (rev 45683) +++ trunk/vice/src/arch/sdl/menu_plus4cart.c 2025-05-20 16:55:53 UTC (rev 45684) @@ -73,6 +73,9 @@ case CARTRIDGE_PLUS4_JACINT1MB: action = ACTION_CART_ATTACH_RAW_JACINT1MB; break; + case CARTRIDGE_PLUS4_SPEEDY: + action = ACTION_CART_ATTACH_RAW_SPEEDY; + break; case CARTRIDGE_PLUS4_GENERIC_C1: action = ACTION_CART_ATTACH_RAW_C1_FULL; break; @@ -170,6 +173,12 @@ .callback = attach_cart_callback, .data = (ui_callback_data_t)CARTRIDGE_PLUS4_JACINT1MB }, + { .action = ACTION_CART_ATTACH_RAW_SPEEDY, + .string = "Attach raw " CARTRIDGE_PLUS4_NAME_SPEEDY " image", + .type = MENU_ENTRY_DIALOG, + .callback = attach_cart_callback, + .data = (ui_callback_data_t)CARTRIDGE_PLUS4_SPEEDY + }, SDL_MENU_ITEM_SEPARATOR, { .action = ACTION_CART_ATTACH_RAW_C1_FULL, Modified: trunk/vice/src/arch/shared/uiactions.c =================================================================== --- trunk/vice/src/arch/shared/uiactions.c 2025-05-18 15:55:35 UTC (rev 45683) +++ trunk/vice/src/arch/shared/uiactions.c 2025-05-20 16:55:53 UTC (rev 45684) @@ -212,7 +212,7 @@ { ACTION_CART_ATTACH_RAW_C2_HIGH, "cart-attach-raw-c2-high", "Attach high C2 cartridge image", VICE_MACHINE_PLUS4 }, { ACTION_CART_DETACH, "cart-detach", "Detach cartridge", (VICE_MACHINE_C64|VICE_MACHINE_C64SC|VICE_MACHINE_SCPU64|VICE_MACHINE_C128| VICE_MACHINE_VIC20|VICE_MACHINE_PLUS4|VICE_MACHINE_CBM6x0) }, - { ACTION_CART_FREEZE, "cart-freeze", "Press cartridge freeze button", (VICE_MACHINE_C64|VICE_MACHINE_C64SC|VICE_MACHINE_SCPU64|VICE_MACHINE_C128|VICE_MACHINE_VIC20) }, + { 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) }, { ACTION_CART_DETACH_1000, "cart-detach-1000", "Detach cartridge image at $1000", VICE_MACHINE_CBM6x0 }, { ACTION_CART_DETACH_2000, "cart-detach-2000", "Detach cartridge image at $2000", VICE_MACHINE_CBM6x0 }, { ACTION_CART_DETACH_4000, "cart-detach-4000", "Detach cartridge image at $4000", VICE_MACHINE_CBM6x0 }, Modified: trunk/vice/src/arch/shared/uiactions.h =================================================================== --- trunk/vice/src/arch/shared/uiactions.h 2025-05-18 15:55:35 UTC (rev 45683) +++ trunk/vice/src/arch/shared/uiactions.h 2025-05-20 16:55:53 UTC (rev 45684) @@ -127,6 +127,7 @@ ACTION_CART_ATTACH_RAW_JACINT1MB, /* Plus/4 */ ACTION_CART_ATTACH_RAW_MAGIC, /* Plus/4 */ ACTION_CART_ATTACH_RAW_MULTI, /* Plus/4 */ + ACTION_CART_ATTACH_RAW_SPEEDY, /* Plus/4 */ ACTION_CART_ATTACH_RAW_C1_FULL, /* Plus/4 */ ACTION_CART_ATTACH_RAW_C1_LOW, /* Plus/4 */ ACTION_CART_ATTACH_RAW_C1_HIGH, /* Plus/4 */ Modified: trunk/vice/src/cartridge.h =================================================================== --- trunk/vice/src/cartridge.h 2025-05-18 15:55:35 UTC (rev 45683) +++ trunk/vice/src/cartridge.h 2025-05-20 16:55:53 UTC (rev 45684) @@ -566,8 +566,9 @@ #define CARTRIDGE_PLUS4_MAGIC 1 /* c264 magic cart */ #define CARTRIDGE_PLUS4_MULTI 2 /* plus4 multi cart */ #define CARTRIDGE_PLUS4_JACINT1MB 3 /* 1MB Cartridge */ +#define CARTRIDGE_PLUS4_SPEEDY 4 /* Speedy */ -#define CARTRIDGE_PLUS4_LAST 3 +#define CARTRIDGE_PLUS4_LAST 4 /* FIXME: get rid of this */ #define CARTRIDGE_PLUS4_DETECT 0x8200 /* low byte must be 0x00 */ @@ -591,6 +592,7 @@ #define CARTRIDGE_PLUS4_NAME_JACINT1MB "1MB Cartridge" #define CARTRIDGE_PLUS4_NAME_MAGIC "c264 magic cart" #define CARTRIDGE_PLUS4_NAME_MULTI "Plus4 multi cart" +#define CARTRIDGE_PLUS4_NAME_SPEEDY "Speedy" /* * cbm2 cartridge system Modified: trunk/vice/src/plus4/cart/Makefile.am =================================================================== --- trunk/vice/src/plus4/cart/Makefile.am 2025-05-18 15:55:35 UTC (rev 45683) +++ trunk/vice/src/plus4/cart/Makefile.am 2025-05-20 16:55:53 UTC (rev 45684) @@ -28,6 +28,8 @@ plus4-generic.h \ plus4-generic.c \ plus4-sidcart.c \ + speedy.h \ + speedy.c \ jacint1mb.h \ jacint1mb.c \ magiccart.h \ Modified: trunk/vice/src/plus4/cart/plus4cart.c =================================================================== --- trunk/vice/src/plus4/cart/plus4cart.c 2025-05-18 15:55:35 UTC (rev 45683) +++ trunk/vice/src/plus4/cart/plus4cart.c 2025-05-20 16:55:53 UTC (rev 45684) @@ -40,6 +40,7 @@ #include "export.h" #include "plus4cart.h" #include "plus4mem.h" +#include "plus4memrom.h" #include "lib.h" #include "log.h" #include "util.h" @@ -54,6 +55,7 @@ #include "magiccart.h" #include "multicart.h" #include "plus4-generic.h" +#include "speedy.h" #ifdef DEBUGCART #define DBG(x) log_printf x @@ -117,6 +119,7 @@ { CARTRIDGE_PLUS4_NAME_JACINT1MB, CARTRIDGE_PLUS4_JACINT1MB, CARTRIDGE_GROUP_UTIL }, { CARTRIDGE_PLUS4_NAME_MAGIC, CARTRIDGE_PLUS4_MAGIC, CARTRIDGE_GROUP_UTIL }, { CARTRIDGE_PLUS4_NAME_MULTI, CARTRIDGE_PLUS4_MULTI, CARTRIDGE_GROUP_UTIL }, + { CARTRIDGE_PLUS4_NAME_SPEEDY, CARTRIDGE_PLUS4_SPEEDY, CARTRIDGE_GROUP_FREEZER }, { NULL, 0, 0 } }; @@ -185,6 +188,7 @@ { "-cartcrt", CALL_FUNCTION, CMDLINE_ATTRIB_NEED_ARGS, cart_attach_cmdline, (void *)CARTRIDGE_CRT, NULL, NULL, "<Name>", "Attach CRT cartridge image" }, + /* seperate cartridge types */ { "-cartjacint", CALL_FUNCTION, CMDLINE_ATTRIB_NEED_ARGS, cart_attach_cmdline, (void*)CARTRIDGE_PLUS4_JACINT1MB, NULL, NULL, @@ -195,6 +199,10 @@ { "-cartmulti", CALL_FUNCTION, CMDLINE_ATTRIB_NEED_ARGS, cart_attach_cmdline, (void*)CARTRIDGE_PLUS4_MULTI, NULL, NULL, "<Name>", "Attach 1MiB/2MiB " CARTRIDGE_PLUS4_NAME_MULTI " image" }, + { "-cartspeedy", CALL_FUNCTION, CMDLINE_ATTRIB_NEED_ARGS, + cart_attach_cmdline, (void*)CARTRIDGE_PLUS4_SPEEDY, NULL, NULL, + "<Name>", "Attach 8KiB " CARTRIDGE_PLUS4_NAME_SPEEDY " image" }, + /* no cartridge */ { "+cart", CALL_FUNCTION, CMDLINE_ATTRIB_NONE, cart_attach_cmdline, NULL, NULL, NULL, @@ -263,6 +271,7 @@ case CARTRIDGE_PLUS4_JACINT1MB: case CARTRIDGE_PLUS4_MAGIC: case CARTRIDGE_PLUS4_MULTI: + case CARTRIDGE_PLUS4_SPEEDY: break; default: return -1; @@ -361,6 +370,79 @@ /* ---------------------------------------------------------------------*/ /* expansion port memory read/write hooks */ + +/* c000 - ffff */ +/* a cartridge may "force" data on the bus when the regular kernal should + be selected instead */ +uint8_t plus4cart_kernal_read(uint16_t addr) +{ + uint8_t value = 0xff; + int ret = CART_READ_THROUGH; + DBGRW(("plus4cart_kernal_read mem_cartridge_type: %04x addr: %04x", (unsigned)mem_cartridge_type, addr)); + switch (mem_cartridge_type) { + case CARTRIDGE_PLUS4_SPEEDY: + ret = speedy_kernal_read(addr, &value); + break; + } + if (ret == CART_READ_THROUGH) { + return plus4memrom_kernal_read(addr); + } + return value; +} + +/* fd00 - fdff */ +/* a cartridge may "force" data on the bus when the (internal) I/O should + be selected instead */ +int plus4cart_fd00_read(uint16_t addr, uint8_t *value) +{ + int ret = CART_READ_THROUGH; + switch (mem_cartridge_type) { + case CARTRIDGE_PLUS4_SPEEDY: + ret = speedy_fd00_read(addr, value); + break; + } + return ret; +} + +/* same as above, but without side-effects (for the monitor) */ +int plus4cart_fd00_peek(uint16_t addr, uint8_t *value) +{ + int ret = CART_READ_THROUGH; + switch (mem_cartridge_type) { + case CARTRIDGE_PLUS4_SPEEDY: + ret = speedy_fd00_read(addr, value); + break; + } + return ret; +} + +/* fe00 - feff */ +/* a cartridge may "force" data on the bus when the (internal) I/O should + be selected instead */ +int plus4cart_fe00_read(uint16_t addr, uint8_t *value) +{ + int ret = CART_READ_THROUGH; + switch (mem_cartridge_type) { + case CARTRIDGE_PLUS4_SPEEDY: + ret = speedy_fe00_read(addr, value); + break; + } + return ret; +} + +/* same as above, but without side-effects (for the monitor) */ +int plus4cart_fe00_peek(uint16_t addr, uint8_t *value) +{ + int ret = CART_READ_THROUGH; + switch (mem_cartridge_type) { + case CARTRIDGE_PLUS4_SPEEDY: + ret = speedy_fe00_read(addr, value); + break; + } + return ret; +} + +/* 8000 - bfff */ uint8_t plus4cart_c1lo_read(uint16_t addr) { DBGRW(("plus4cart_c1lo_read mem_cartridge_type: %04x addr: %04x", (unsigned)mem_cartridge_type, addr)); @@ -379,11 +461,14 @@ return magiccart_c1lo_read(addr); case CARTRIDGE_PLUS4_MULTI: return multicart_c1lo_read(addr); + case CARTRIDGE_PLUS4_SPEEDY: + return speedy_c1lo_read(addr); } /* FIXME: when no cartridge is attached, we will probably read open i/o */ return 0xff; } +/* c000 - ffff */ uint8_t plus4cart_c1hi_read(uint16_t addr) { DBGRW(("plus4cart_c1hi_read mem_cartridge_type: %04x addr: %04x", (unsigned)mem_cartridge_type, addr)); @@ -403,6 +488,22 @@ return 0xff; } +/* + segment: + bit 0-1: 2 upper bits of address + bit 2: ROM select (0: RAM, 1: ROM) +*/ +uint8_t *plus4cart_get_tedmem_base(unsigned int segment) +{ + uint8_t *base = NULL; + switch (mem_cartridge_type) { + case CARTRIDGE_PLUS4_SPEEDY: + base = speedy_get_tedmem_base(segment); + break; + } + return base; +} + void cartridge_mmu_translate(unsigned int addr, uint8_t **base, int *start, int *limit) { *base = NULL; @@ -425,6 +526,8 @@ return magiccart_reset(); case CARTRIDGE_PLUS4_MULTI: return multicart_reset(); + case CARTRIDGE_PLUS4_SPEEDY: + return speedy_reset(); } } @@ -468,6 +571,7 @@ jacint1mb_detach(); magiccart_detach(); multicart_detach(); + speedy_detach(); #endif mem_cartridge_type = CARTRIDGE_NONE; @@ -493,6 +597,9 @@ case CARTRIDGE_PLUS4_MULTI: multicart_detach(); break; + case CARTRIDGE_PLUS4_SPEEDY: + speedy_detach(); + break; } } cart_power_off(); @@ -586,6 +693,8 @@ return magiccart_bin_attach(filename, rawcart); case CARTRIDGE_PLUS4_MULTI: return multicart_bin_attach(filename, rawcart); + case CARTRIDGE_PLUS4_SPEEDY: + return speedy_bin_attach(filename, rawcart); } log_error(LOG_DEFAULT, "cartridge_bin_attach: unsupported type (%04x)", (unsigned int)type); @@ -613,6 +722,9 @@ case CARTRIDGE_PLUS4_MULTI: multicart_config_setup(rawcart); break; + case CARTRIDGE_PLUS4_SPEEDY: + speedy_config_setup(rawcart); + break; } } } @@ -670,6 +782,9 @@ case CARTRIDGE_PLUS4_MULTI: rc = multicart_crt_attach(fd, rawcart); break; + case CARTRIDGE_PLUS4_SPEEDY: + rc = speedy_crt_attach(fd, rawcart); + break; default: archdep_startup_log_error("unknown CRT ID: %d", new_crttype); rc = -1; @@ -791,7 +906,21 @@ cart_freeze_alarm_time = maincpu_clk + delay; alarm_set(cartridge_freeze_alarm, cart_freeze_alarm_time); #endif - DBG(("cartridge_trigger_freeze delay %d cycles", delay)); + DBG(("cartridge_trigger_freeze type:%d delay %d cycles", mem_cartridge_type, delay)); + + /* main slot */ + switch (mem_cartridge_type) { + case CARTRIDGE_PLUS4_JACINT1MB: + case CARTRIDGE_PLUS4_MAGIC: + case CARTRIDGE_PLUS4_MULTI: + break; + case CARTRIDGE_PLUS4_SPEEDY: + speedy_freeze(); + break; + default: + archdep_startup_log_error("unknown CRT ID: %d", plus4cart_type); + break; + } } /* FIXME: add additional image to standard cartridge */ @@ -944,6 +1073,11 @@ return -1; } break; + case CARTRIDGE_PLUS4_SPEEDY: + if (speedy_snapshot_write_module(s) < 0) { + return -1; + } + break; default: /* If the cart cannot be saved, we obviously can't load it either. @@ -1047,6 +1181,11 @@ goto fail2; } break; + case CARTRIDGE_PLUS4_SPEEDY: + if (speedy_snapshot_read_module(s) < 0) { + goto fail2; + } + break; default: DBG(("CART snapshot read: cart %i handler missing", cart_ids[i])); Modified: trunk/vice/src/plus4/cart/plus4cart.h =================================================================== --- trunk/vice/src/plus4/cart/plus4cart.h 2025-05-18 15:55:35 UTC (rev 45683) +++ trunk/vice/src/plus4/cart/plus4cart.h 2025-05-20 16:55:53 UTC (rev 45684) @@ -42,10 +42,23 @@ #define PLUS4_C1LO_ROM_SIZE (16 * 0x400) #define PLUS4_C1HI_ROM_SIZE (16 * 0x400) +#define CART_READ_PLUS4MEM -1 +#define CART_READ_THROUGH 0 +#define CART_READ_VALID 1 + /* expansion port access functions */ +uint8_t plus4cart_kernal_read(uint16_t addr); + uint8_t plus4cart_c1lo_read(uint16_t addr); uint8_t plus4cart_c1hi_read(uint16_t addr); +int plus4cart_fd00_read(uint16_t addr, uint8_t *value); +int plus4cart_fe00_read(uint16_t addr, uint8_t *value); +int plus4cart_fd00_peek(uint16_t addr, uint8_t *value); +int plus4cart_fe00_peek(uint16_t addr, uint8_t *value); + +uint8_t *plus4cart_get_tedmem_base(unsigned int segment); + /* FIXME: these live in plus4-generic.c */ /* FIXME: we need this because of a reference in plus4mem.c that should be replaced by a better, indirect, access mechanism */ Added: trunk/vice/src/plus4/cart/speedy.c =================================================================== --- trunk/vice/src/plus4/cart/speedy.c (rev 0) +++ trunk/vice/src/plus4/cart/speedy.c 2025-05-20 16:55:53 UTC (rev 45684) @@ -0,0 +1,327 @@ + +/* + * speedy.h - Speedy Freezer Cartridge + * + * Written by + * groepaz <gr...@gm...> + * + * This file is part of VICE, the Versatile Commodore Emulator. + * See README for copyright notice. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307 USA. + * + */ + +/* + Speedy Freezer Cartridge + + - 8KiB mapped to c1lo, mirrored twice so it fills the 16k + - "Freeze" button, which will cause the following: + - the circuit "waits" for a (TED-) interrupt to occur + - now A9 is pulled low, which will cause the IRQ vector being fetched from + offset 0x1dfe/0x1dff in the ROM + - this results in the address 0xFD10 + - Code at 0xFD10 jumps to 0xFDF4, where it pages itself into c1l memory + + */ + +/* #define DEBUG_SPEEDY */ + +#include "vice.h" + +#include <stdio.h> +#include <string.h> + +#include "archdep.h" +#include "cartridge.h" +#include "cartio.h" +#include "crt.h" +#include "export.h" +#include "log.h" +#include "lib.h" +#include "interrupt.h" +#include "maincpu.h" +#include "monitor.h" +#include "plus4cart.h" +#include "plus4mem.h" +#include "snapshot.h" +#include "util.h" + +#include "speedy.h" + +#ifdef DEBUG_SPEEDY +#define DBG(x) log_printf x +#else +#define DBG(x) +#endif + +#define SPEEDYROMSIZE 0x2000 + +static int freeze_active = 0; +static int freeze_active_q = 0; +static int speedy_filetype = 0; + +static unsigned char *speedyrom = NULL; + +static const export_resource_t export_res = { + CARTRIDGE_PLUS4_NAME_SPEEDY, 0, PLUS4_CART_C1LO, NULL, NULL, CARTRIDGE_PLUS4_SPEEDY +}; + +/* ------------------------------------------------------------------------- */ + +/* read 0x8000...0xbfff */ +uint8_t speedy_c1lo_read(uint16_t addr) +{ + unsigned int offset = (addr & 0x1fff); + + /* DBG(("speedy_c1lo_read (freeze:%d) addr:%04x offs:%04x value: %02x", + freeze_active, addr, offset, speedyrom[offset])); */ + + if (freeze_active_q) { + DBG(("speedy_c1lo_read disabling freeze at addr:%04x", addr)); + freeze_active_q = 0; + } + + return speedyrom[offset]; +} + +int speedy_fd00_read(uint16_t addr, uint8_t *value) +{ + unsigned int offset; + if (freeze_active_q) { + offset = (addr & 0x1fff); + offset &= ~0x0200; + *value = speedyrom[offset]; + DBG(("speedy_fd00_read addr: 0x%04x offs: 0x%04x value:0x%02x", addr, offset, *value)); + return CART_READ_VALID; + } + + return CART_READ_THROUGH; +} + +int speedy_fe00_read(uint16_t addr, uint8_t *value) +{ + unsigned int offset; + if (freeze_active_q) { + offset = (addr & 0x1fff); + offset &= ~0x0200; + *value = speedyrom[offset]; + DBG(("speedy_fe00_read addr: 0x%04x offs: 0x%04x value:0x%02x", addr, offset, *value)); + return CART_READ_VALID; + } + + return CART_READ_THROUGH; +} + +/* read 0xc000...0xffff (kernal) */ +int speedy_kernal_read(uint16_t addr, uint8_t *value) +{ + unsigned int offset; + + if (freeze_active) { + if ((addr == 0xfffe) || (addr == 0xffff)) { + DBG(("speedy_kernal_read set Q (addr: 0x%04x)", addr)); + freeze_active_q = 1; + freeze_active = 0; /* release button */ + } + } + + if (freeze_active_q) { + offset = (addr & 0x1fff); + offset &= ~0x0200; + *value = speedyrom[offset]; + DBG(("speedy_kernal_read addr: 0x%04x offs: 0x%04x value:0x%02x", addr, offset, *value)); + return CART_READ_VALID; + } + + return CART_READ_THROUGH; +} + +/* + segment: + bit 0-1: 2 upper bits of address + bit 2: ROM select (0: RAM, 1: ROM) +*/ +uint8_t *speedy_get_tedmem_base(unsigned int segment) +{ + return speedyrom; +} + +void speedy_reset(void) +{ + DBG(("speedy_reset")); + freeze_active_q = 0; + freeze_active = 0; +} + +void speedy_freeze(void) +{ + DBG(("speedy_freeze")); + /* the flipflop will clock in the state of the irq line */ + freeze_active_q = 0; + freeze_active = 1; +} + +void speedy_config_setup(uint8_t *rawcart) +{ + DBG(("speedy_config_setup")); + memcpy(speedyrom, rawcart, SPEEDYROMSIZE); +} + +static int speedy_common_attach(void) +{ + DBG(("speedy_common_attach")); + + if(!(speedyrom = lib_malloc(SPEEDYROMSIZE))) { + return -1; + } + + if (export_add(&export_res) < 0) { + return -1; + } + + return 0; +} + +int speedy_bin_attach(const char *filename, uint8_t *rawcart) +{ + speedy_filetype = 0; + + DBG(("speedy_bin_attach '%s'", filename)); + + /* we accept 8KiB images */ + if (util_file_load(filename, rawcart, SPEEDYROMSIZE, UTIL_FILE_LOAD_SKIP_ADDRESS) < 0) { + return -1; + } + + speedy_filetype = CARTRIDGE_FILETYPE_BIN; + return speedy_common_attach(); +} + +int speedy_crt_attach(FILE *fd, uint8_t *rawcart) +{ + crt_chip_header_t chip; + + DBG(("speedy_crt_attach")); + + if (crt_read_chip_header(&chip, fd)) { + return -1; + } + + if ((chip.bank >= 1) || (chip.size != 0x2000)) { + return -1; + } + /* DBG(("bank: %d offset: %06x \n", chip.bank, chip.bank << 14)); */ + + if (crt_read_chip(rawcart, 0, &chip, fd)) { + return -1; + } + + speedy_filetype = CARTRIDGE_FILETYPE_CRT; + return speedy_common_attach(); +} + +void speedy_detach(void) +{ + DBG(("speedy_detach")); + export_remove(&export_res); + lib_free(speedyrom); + speedyrom = NULL; +} + +/* ---------------------------------------------------------------------*/ + +/* CARTSPEEDY snapshot module format: + + type | name | version | description + ------------------------------------------------- + BYTE | freeze_active | 0.1+ | was freeze pressed? + BYTE | freeze_active_q | 0.1+ | was freeze activated? + ARRAY | ROM | 0.1+ | 8KiB of ROM data + */ + +/* FIXME: since we cant actually make snapshots due to TED bugs, the following + is completely untested */ + +static const char snap_module_name[] = "CARTSPEEDY"; +#define SNAP_MAJOR 0 +#define SNAP_MINOR 1 + +int speedy_snapshot_write_module(snapshot_t *s) +{ + snapshot_module_t *m; + + DBG(("speedy_snapshot_write_module")); + + m = snapshot_module_create(s, snap_module_name, SNAP_MAJOR, SNAP_MINOR); + + if (m == NULL) { + return -1; + } + + if (0 + || SMW_B(m, (uint8_t)freeze_active) < 0 + || SMW_B(m, (uint8_t)freeze_active_q) < 0 + || SMW_BA(m, speedyrom, SPEEDYROMSIZE) < 0) { + snapshot_module_close(m); + return -1; + } + + snapshot_module_close(m); + + return 0; +} + +int speedy_snapshot_read_module(snapshot_t *s) +{ + uint8_t vmajor, vminor; + snapshot_module_t *m; + + DBG(("speedy_snapshot_read_module")); + + 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, &freeze_active) < 0 + || SMR_B_INT(m, &freeze_active_q) < 0 + || SMR_BA(m, speedyrom, SPEEDYROMSIZE) < 0) { + goto fail; + } + + snapshot_module_close(m); + + speedy_common_attach(); + + /* set filetype to none */ + speedy_filetype = 0; + + return 0; + +fail: + snapshot_module_close(m); + return -1; +} + Added: trunk/vice/src/plus4/cart/speedy.h =================================================================== --- trunk/vice/src/plus4/cart/speedy.h (rev 0) +++ trunk/vice/src/plus4/cart/speedy.h 2025-05-20 16:55:53 UTC (rev 45684) @@ -0,0 +1,53 @@ + +/* + * speedy.h - Speedy Freezer Cartridge + * + * Written by + * groepaz <gr...@gm...> + * + * This file is part of VICE, the Versatile Commodore Emulator. + * See README for copyright notice. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA + * 02111-1307 USA. + * + */ + +#ifndef VICE_SPEEDY_H +#define VICE_SPEEDY_H + +#include "types.h" + +uint8_t speedy_c1lo_read(uint16_t addr); + +int speedy_kernal_read(uint16_t addr, uint8_t *value); +int speedy_fd00_read(uint16_t addr, uint8_t *value); +int speedy_fe00_read(uint16_t addr, uint8_t *value); + +uint8_t *speedy_get_tedmem_base(unsigned int segment); + +void speedy_config_setup(uint8_t *rawcart); +int speedy_bin_attach(const char *filename, uint8_t *rawcart); +int speedy_crt_attach(FILE *fd, uint8_t *rawcart); + +void speedy_detach(void); + +void speedy_reset(void); +void speedy_freeze(void); + +int speedy_snapshot_write_module(snapshot_t *s); +int speedy_snapshot_read_module(snapshot_t *s); + +#endif Modified: trunk/vice/src/plus4/plus4io.c =================================================================== --- trunk/vice/src/plus4/plus4io.c 2025-05-18 15:55:35 UTC (rev 45683) +++ trunk/vice/src/plus4/plus4io.c 2025-05-20 16:55:53 UTC (rev 45684) @@ -37,6 +37,7 @@ #include "lib.h" #include "log.h" #include "monitor.h" +#include "plus4cart.h" #include "plus4mem.h" #include "resources.h" #include "tedtypes.h" @@ -48,13 +49,13 @@ /* #define IODEBUGRW */ #ifdef IODEBUG -#define DBG(x) printf x +#define DBG(x) log_printf x #else #define DBG(x) #endif #ifdef IODEBUGRW -#define DBGRW(x) printf x +#define DBGRW(x) log_printf x #else #define DBGRW(x) #endif @@ -172,7 +173,7 @@ current = current->next; - DBG(("IO: check %d sources for addr %04x", real_amount, addr)); + DBG(("IO: check %d sources for addr %04x", amount, addr)); while (current) { /* DBG(("IO: check '%s'", current->device->name)); */ if (current->device->io_source_valid && @@ -495,15 +496,31 @@ uint8_t plus4io_fd00_read(uint16_t addr) { + uint8_t value; + DBGRW(("IO: io-fd00 r %04x", addr)); - ted.last_cpu_val = io_read(&plus4io_fd00_head, addr); + + /* some cartridge(s) might force data on the bus when I/O is selected */ + if (plus4cart_fd00_read(addr, &value) == CART_READ_VALID) { + ted.last_cpu_val = value; + } else { + ted.last_cpu_val = io_read(&plus4io_fd00_head, addr); + } + /*DBG(("IO read: io-fd00 r %04x val %02x", addr, ted.last_cpu_val));*/ return ted.last_cpu_val; } +/* same as above, but without side effects (for the monitor) */ uint8_t plus4io_fd00_peek(uint16_t addr) { + uint8_t value; DBGRW(("IO: io-fd00 p %04x", addr)); - return io_peek(&plus4io_fd00_head, addr); + + if (plus4cart_fd00_peek(addr, &value) != CART_READ_VALID) { + value = io_peek(&plus4io_fd00_head, addr); + } + /*DBG(("IO peek: io-fd00 r %04x val %02x", addr, value));*/ + return value; } void plus4io_fd00_store(uint16_t addr, uint8_t value) @@ -515,15 +532,27 @@ uint8_t plus4io_fe00_read(uint16_t addr) { + uint8_t value; DBGRW(("IO: io-fe00 r %04x", addr)); - ted.last_cpu_val = io_read(&plus4io_fe00_head, addr); + + /* some cartridge(s) might force data on the bus when I/O is selected */ + if (plus4cart_fe00_read(addr, &value) == CART_READ_VALID) { + ted.last_cpu_val = value; + } else { + ted.last_cpu_val = io_read(&plus4io_fe00_head, addr); + } return ted.last_cpu_val; } +/* same as above, but without side effects (for the monitor) */ uint8_t plus4io_fe00_peek(uint16_t addr) { + uint8_t value; DBGRW(("IO: io-fe00 p %04x", addr)); - return io_peek(&plus4io_fe00_head, addr); + if (plus4cart_fe00_peek(addr, &value) != CART_READ_VALID) { + value = io_peek(&plus4io_fe00_head, addr); + } + return value; } void plus4io_fe00_store(uint16_t addr, uint8_t value) Modified: trunk/vice/src/plus4/plus4mem.c =================================================================== --- trunk/vice/src/plus4/plus4mem.c 2025-05-18 15:55:35 UTC (rev 45683) +++ trunk/vice/src/plus4/plus4mem.c 2025-05-20 16:55:53 UTC (rev 45684) @@ -36,6 +36,7 @@ #include "datasette.h" #include "digiblaster.h" #include "iecbus.h" +#include "log.h" #include "maincpu.h" #include "mem.h" #include "monitor.h" @@ -60,6 +61,14 @@ #include "types.h" #include "mos6510.h" +/* #define DEBUG_MEM */ + +#ifdef DEBUG_MEM +#define DBG(x) log_printf x +#else +#define DBG(x) +#endif + static int hard_reset_flag = 1; /* ------------------------------------------------------------------------- */ @@ -100,7 +109,7 @@ #define RAM8 mem_ram + 0x8000 #define RAMC mem_ram + 0xc000 -static uint8_t *chargen_tab[8][16] = { +static uint8_t *chargen_base_tab[8][16] = { /* 0000-3fff, RAM selected */ { RAM0, RAM0, RAM0, RAM0, RAM0, RAM0, RAM0, RAM0, @@ -143,12 +152,67 @@ plus4memrom_basic_rom, extromlo1, extromlo2, extromlo3 }, /* c000-ffff, ROM selected */ { plus4memrom_kernal_rom, plus4memrom_kernal_rom, - plus4memrom_kernal_rom, plus4memrom_kernal_rom, + plus4memrom_kernal_rom, plus4memrom_kernal_rom, extromhi1, extromhi1, extromhi1, extromhi1, extromhi2, extromhi2, extromhi2, extromhi2, extromhi3, extromhi3, extromhi3, extromhi3 } }; +typedef uint8_t *read_base_func_t(unsigned int segment); +typedef read_base_func_t *read_base_func_ptr_t; + +/* function(s) to fetch a dynamic base from */ +static read_base_func_ptr_t chargen_read_base_tab[8][16] = { + /* 0000-3fff, RAM selected */ + { NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL }, + /* 4000-7fff, RAM selected */ + { NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL }, + /* 8000-bfff, RAM selected */ + { NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL }, + /* c000-ffff, RAM selected */ + { NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL }, + + /* 0000-3fff, ROM selected */ + /* FIXME: this should be "open", ie read the last value from the bus */ + { NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL }, + /* 4000-7fff, ROM selected */ + /* FIXME: this should be "open", ie read the last value from the bus */ + { NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL }, + /* 8000-bfff, ROM selected */ + /* FIXME: we cant directly point to cartridge ROM here, we need a better + (indirect) way to do this */ + { NULL, NULL, plus4cart_get_tedmem_base, NULL, + NULL, NULL, plus4cart_get_tedmem_base, NULL, + NULL, NULL, plus4cart_get_tedmem_base, NULL, + NULL, NULL, plus4cart_get_tedmem_base, NULL }, + + /* c000-ffff, ROM selected */ + { NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL, + /* FIXME: we cant directly point to cartridge ROM here, we need a better + (indirect) way to do this */ + NULL, NULL, NULL, NULL, + NULL, NULL, NULL, NULL } +}; + /* segment: bit 0-1: 2 upper bits of address @@ -156,7 +220,20 @@ */ uint8_t *mem_get_tedmem_base(unsigned int segment) { - return chargen_tab[segment][mem_config >> 1]; + uint8_t *base; + read_base_func_ptr_t basefunc; + + if ((basefunc = chargen_read_base_tab[segment][mem_config >> 1]) == NULL) { + /* no base read function, use the base tab */ + return chargen_base_tab[segment][mem_config >> 1]; + } + + if ((base = basefunc(segment)) != NULL) { + return base; + } + + /* if the base read function returned NULL, use the base tab */ + return chargen_base_tab[segment][mem_config >> 1]; } /* ------------------------------------------------------------------------- */ @@ -689,26 +766,26 @@ case 256: case 64: for (i = 0; i < 16; i++) { - chargen_tab[1][i] = RAM4; - chargen_tab[2][i] = RAM8; - chargen_tab[3][i] = RAMC; - chargen_tab[5][i] = RAM4; + chargen_base_tab[1][i] = RAM4; + chargen_base_tab[2][i] = RAM8; + chargen_base_tab[3][i] = RAMC; + chargen_base_tab[5][i] = RAM4; } break; case 32: for (i = 0; i < 16; i++) { - chargen_tab[1][i] = RAM4; - chargen_tab[2][i] = RAM0; - chargen_tab[3][i] = RAM4; - chargen_tab[5][i] = RAM4; + chargen_base_tab[1][i] = RAM4; + chargen_base_tab[2][i] = RAM0; + chargen_base_tab[3][i] = RAM4; + chargen_base_tab[5][i] = RAM4; } break; case 16: for (i = 0; i < 16; i++) { - chargen_tab[1][i] = RAM0; - chargen_tab[2][i] = RAM0; - chargen_tab[3][i] = RAM0; - chargen_tab[5][i] = RAM0; + chargen_base_tab[1][i] = RAM0; + chargen_base_tab[2][i] = RAM0; + chargen_base_tab[3][i] = RAM0; + chargen_base_tab[5][i] = RAM0; } break; } @@ -800,6 +877,7 @@ mem_read_base_tab[5][i] = NULL; mem_read_tab[7][i] = plus4memrom_extromlo3_read; mem_read_base_tab[7][i] = extromlo3 + ((i & 0x3f) << 8); + mem_read_tab[9][i] = plus4memrom_basic_read; mem_read_base_tab[9][i] = plus4memrom_basic_rom + ((i & 0x3f) << 8); mem_read_tab[11][i] = plus4memrom_extromlo1_read; @@ -809,6 +887,7 @@ mem_read_base_tab[13][i] = NULL; mem_read_tab[15][i] = plus4memrom_extromlo3_read; mem_read_base_tab[15][i] = extromlo3 + ((i & 0x3f) << 8); + mem_read_tab[17][i] = plus4memrom_basic_read; mem_read_base_tab[17][i] = plus4memrom_basic_rom + ((i & 0x3f) << 8); mem_read_tab[19][i] = plus4memrom_extromlo1_read; @@ -818,6 +897,7 @@ mem_read_base_tab[21][i] = NULL; mem_read_tab[23][i] = plus4memrom_extromlo3_read; mem_read_base_tab[23][i] = extromlo3 + ((i & 0x3f) << 8); + mem_read_tab[25][i] = plus4memrom_basic_read; mem_read_base_tab[25][i] = plus4memrom_basic_rom + ((i & 0x3f) << 8); mem_read_tab[27][i] = plus4memrom_extromlo1_read; @@ -831,18 +911,26 @@ /* Setup Kernal ROM and extension ROMs at $E000-$FFFF. */ for (i = 0xc0; i <= 0xff; i++) { +#if 0 mem_read_tab[1][i] = plus4memrom_kernal_read; - mem_read_base_tab[1][i] = plus4memrom_kernal_trap_rom - + ((i & 0x3f) << 8); + mem_read_base_tab[1][i] = plus4memrom_kernal_trap_rom + ((i & 0x3f) << 8); mem_read_tab[3][i] = plus4memrom_kernal_read; - mem_read_base_tab[3][i] = plus4memrom_kernal_trap_rom - + ((i & 0x3f) << 8); + mem_read_base_tab[3][i] = plus4memrom_kernal_trap_rom + ((i & 0x3f) << 8); mem_read_tab[5][i] = plus4memrom_kernal_read; - mem_read_base_tab[5][i] = plus4memrom_kernal_trap_rom - + ((i & 0x3f) << 8); + mem_read_base_tab[5][i] = plus4memrom_kernal_trap_rom + ((i & 0x3f) << 8); mem_read_tab[7][i] = plus4memrom_kernal_read; - mem_read_base_tab[7][i] = plus4memrom_kernal_trap_rom - + ((i & 0x3f) << 8); + mem_read_base_tab[7][i] = plus4memrom_kernal_trap_rom + ((i & 0x3f) << 8); +#else + /* redirect kernal to cartridge port */ + mem_read_tab[1][i] = plus4cart_kernal_read; + mem_read_base_tab[1][i] = NULL; + mem_read_tab[3][i] = plus4cart_kernal_read; + mem_read_base_tab[3][i] = NULL; + mem_read_tab[5][i] = plus4cart_kernal_read; + mem_read_base_tab[5][i] = NULL; + mem_read_tab[7][i] = plus4cart_kernal_read; + mem_read_base_tab[7][i] = NULL; +#endif mem_read_tab[9][i] = plus4memrom_extromhi1_read; mem_read_base_tab[9][i] = extromhi1 + ((i & 0x3f) << 8); mem_read_tab[11][i] = plus4memrom_extromhi1_read; @@ -851,6 +939,7 @@ mem_read_base_tab[13][i] = extromhi1 + ((i & 0x3f) << 8); mem_read_tab[15][i] = plus4memrom_extromhi1_read; mem_read_base_tab[15][i] = extromhi1 + ((i & 0x3f) << 8); + mem_read_tab[17][i] = plus4cart_c1hi_read; /*mem_read_base_tab[17][i] = extromhi2 + ((i & 0x3f) << 8);*/ mem_read_base_tab[17][i] = NULL; @@ -863,6 +952,7 @@ mem_read_tab[23][i] = plus4cart_c1hi_read; /*mem_read_base_tab[23][i] = extromhi2 + ((i & 0x3f) << 8);*/ mem_read_base_tab[23][i] = NULL; + mem_read_tab[25][i] = plus4memrom_extromhi3_read; mem_read_base_tab[25][i] = extromhi3 + ((i & 0x3f) << 8); mem_read_tab[27][i] = plus4memrom_extromhi3_read; @@ -1203,6 +1293,23 @@ 1 0 Cartridge HI (hi external #1) 1 1 reserved + fdd0 "BASIC", "KERNAL" + fdd1 "3+1", "KERNAL" + fdd2 "CART-1", "KERNAL" + fdd3 "CART-2", "KERNAL" + fdd4 "BASIC", "3+1" + fdd5 "3+1", "3+1" + fdd6 "CART-1", "3+1" + fdd7 "CART-2", "3+1" + fdd8 "BASIC", "CART-1" + fdd9 "3+1", "CART-1" + fdda "CART-1", "CART-1" + fddb "CART-2", "CART-1" + fddc "BASIC", "CART-2" + fddd "3+1", "CART-2" + fdde "CART-1", "CART-2" + fddf "CART-2", "CART-2" + $FF00- TED registers $FF3E ROM select, Write switches on ROM bank Modified: trunk/vice/src/plus4/plus4memrom.c =================================================================== --- trunk/vice/src/plus4/plus4memrom.c 2025-05-18 15:55:35 UTC (rev 45683) +++ trunk/vice/src/plus4/plus4memrom.c 2025-05-20 16:55:53 UTC (rev 45684) @@ -36,6 +36,14 @@ #include "sysfile.h" #include "types.h" +/* #define DEBUG_MEMROM */ + +#ifdef DEBUG_MEMROM +#define DBG(x) log_printf x +#else +#define DBG(x) +#endif + uint8_t plus4memrom_basic_rom[PLUS4_BASIC_ROM_SIZE]; uint8_t plus4memrom_kernal_rom[PLUS4_KERNAL_ROM_SIZE]; @@ -48,6 +56,7 @@ uint8_t plus4memrom_kernal_trap_rom[PLUS4_KERNAL_ROM_SIZE]; +/* c000 - ffff */ uint8_t plus4memrom_kernal_read(uint16_t addr) { return plus4memrom_kernal_rom[addr & 0x3fff]; @@ -60,6 +69,7 @@ } #endif +/* 8000 - bfff */ uint8_t plus4memrom_basic_read(uint16_t addr) { return plus4memrom_basic_rom[addr & 0x3fff]; @@ -75,6 +85,7 @@ uint8_t plus4memrom_trap_read(uint16_t addr) { + DBG(("plus4memrom_trap_read 0x%04x", addr)); switch (addr & 0xc000) { case 0xc000: return plus4memrom_kernal_trap_rom[addr & 0x3fff]; @@ -95,6 +106,7 @@ /* c0lo internal "function rom" (plus4) */ uint8_t plus4memrom_extromlo1_read(uint16_t addr) { + DBG(("plus4memrom_extromlo1_read 0x%04x", addr)); return extromlo1[addr & 0x3fff]; } @@ -107,6 +119,7 @@ /* c2lo can be internal or external cartridge, used by v364 speech rom */ uint8_t plus4memrom_extromlo3_read(uint16_t addr) { + DBG(("plus4memrom_extromlo3_read 0x%04x", addr)); return extromlo3[addr & 0x3fff]; } @@ -113,6 +126,7 @@ /* c2hi can be internal or external cartridge, used by v364 speech rom */ uint8_t plus4memrom_extromhi3_read(uint16_t addr) { + DBG(("plus4memrom_extromhi3_read 0x%04x", addr)); return extromhi3[addr & 0x3fff]; } @@ -225,7 +239,9 @@ } else { switch ((mem_config >> 3) & 3) { case 0: - return plus4memrom_kernal_read(addr); + /*return plus4memrom_kernal_read(addr);*/ + /* enable redirecting kernal to cartridge port */ + return plus4cart_kernal_read(addr); case 1: /* c0hi */ return plus4memrom_extromhi1_read(addr); case 2: /* c1hi */ Modified: trunk/vice/src/tools/cartconv/plus4-cartridges.c =================================================================== --- trunk/vice/src/tools/cartconv/plus4-cartridges.c 2025-05-18 15:55:35 UTC (rev 45683) +++ trunk/vice/src/tools/cartconv/plus4-cartridges.c 2025-05-20 16:55:53 UTC (rev 45684) @@ -27,6 +27,6 @@ {0, 0, CARTRIDGE_SIZE_2MB | CARTRIDGE_SIZE_4MB, 0x4000, 0x8000, 0, CRT_CHIP_ROM, CARTRIDGE_PLUS4_NAME_MULTI, "multi", save_multicart_crt}, {0, 0, CARTRIDGE_SIZE_1MB, 0x4000, 0x8000, 64, CRT_CHIP_ROM, CARTRIDGE_PLUS4_NAME_JACINT1MB, "jacint", save_regular_crt}, + {0, 0, CARTRIDGE_SIZE_8KB, 0x2000, 0x8000, 1, CRT_CHIP_ROM, CARTRIDGE_PLUS4_NAME_SPEEDY, "speedy", save_regular_crt}, {0, 0, 0, 0, 0, 0, 0, NULL, NULL, NULL} }; - This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-05-18 15:55:39
|
Revision: 45683 http://sourceforge.net/p/vice-emu/code/45683 Author: gpz Date: 2025-05-18 15:55:35 +0000 (Sun, 18 May 2025) Log Message: ----------- fix and improve drive LED brightness modulation by PWM, patch by David De La Harpe Golden, Justin Mason Modified Paths: -------------- trunk/vice/src/drive/drive.c Modified: trunk/vice/src/drive/drive.c =================================================================== --- trunk/vice/src/drive/drive.c 2025-05-15 18:54:46 UTC (rev 45682) +++ trunk/vice/src/drive/drive.c 2025-05-18 15:55:35 UTC (rev 45683) @@ -903,7 +903,13 @@ and the LED was on */ led_pwm1 = 1000; } else { - led_pwm1 = (int)(drive->led_active_ticks / led_period * 1000); + led_pwm1 = (int)((drive->led_active_ticks * 1000) / led_period); + /* With the 1541's real LED, the human eye perceives brightness much earlier in the PWM + * duty cycle range; the blog post at + * https://blog.mbedded.ninja/programming/firmware/controlling-led-brightness-using-pwm/ + * describes this. so adjust our output intensity level to compensate, using a square + * root power function to produce higher RGB outputs at lower PWM duty cycle levels. */ + led_pwm1 = 1000 * sqrt((float) led_pwm1 / 1000.0); } assert(led_pwm1 <= MAX_PWM); if (led_pwm1 > MAX_PWM) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-05-15 18:54:52
|
Revision: 45682 http://sourceforge.net/p/vice-emu/code/45682 Author: compyx Date: 2025-05-15 18:54:46 +0000 (Thu, 15 May 2025) Log Message: ----------- Joystick: Gtk3 UI: add GtkStack(Switcher) to experimental dialog Split mapping/calibration dialog into three "tabs": input testing, mapping and calibration. Modified Paths: -------------- branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/settings_joymap.c Modified: branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/settings_joymap.c =================================================================== --- branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/settings_joymap.c 2025-05-15 17:11:39 UTC (rev 45681) +++ branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/settings_joymap.c 2025-05-15 18:54:46 UTC (rev 45682) @@ -21,6 +21,10 @@ static GtkWidget *event_widget_new(joystick_device_t *joydev); +static GtkWidget *inputs_grid; +static GtkWidget *mappings_grid; +static GtkWidget *calibration_grid; + static GtkWidget *layout; static GtkWidget *device_combo; static GtkWidget *event_widget; @@ -95,7 +99,7 @@ gtk_widget_destroy(event_widget); } event_widget = event_widget_new(joystick_device_by_index(index)); - gtk_grid_attach(GTK_GRID(layout), event_widget, 0, 2, 2, 1); + gtk_grid_attach(GTK_GRID(inputs_grid), event_widget, 0, 2, 2, 1); gtk_widget_show_all(event_widget); start_polling(joystick_device_by_index(index)); } @@ -235,6 +239,8 @@ GtkWidget *settings_joymap_widget_create(GtkWidget *parent) { GtkWidget *label; + GtkWidget *stack; + GtkWidget *switcher; int row = 0; @@ -250,18 +256,29 @@ gtk_grid_set_column_spacing(GTK_GRID(layout), 16); gtk_grid_set_row_spacing(GTK_GRID(layout), 8); - label = label_helper("<b>Joystick mappings playground</b>"); - gtk_widget_set_margin_bottom(label, 8); - gtk_grid_attach(GTK_GRID(layout), label, 0, row, 2, 1); - row++; - + label = gtk_label_new("Host device"); + gtk_widget_set_halign(label, GTK_ALIGN_START); device_combo = device_combo_new(); gtk_widget_set_hexpand(device_combo, TRUE); - label = gtk_label_new("Device"); - gtk_widget_set_halign(label, GTK_ALIGN_START); - gtk_grid_attach(GTK_GRID(layout), label, 0, row, 1, 1); + gtk_grid_attach(GTK_GRID(layout), label, 0, row, 1, 1); gtk_grid_attach(GTK_GRID(layout), device_combo, 1, row, 1, 1); + row++; + stack = gtk_stack_new(); + switcher = gtk_stack_switcher_new(); + gtk_stack_switcher_set_stack(GTK_STACK_SWITCHER(switcher), GTK_STACK(stack)); + + gtk_grid_attach(GTK_GRID(layout), switcher, 0, row++, 2, 1); + gtk_grid_attach(GTK_GRID(layout), stack, 0, row++, 2, 1); + + inputs_grid = gtk_grid_new(); + mappings_grid = gtk_grid_new(); + calibration_grid = gtk_grid_new(); + gtk_stack_add_titled(GTK_STACK(stack), inputs_grid, "inputs", "Inputs"); + gtk_stack_add_titled(GTK_STACK(stack), mappings_grid, "mappings", "Mappings"); + gtk_stack_add_titled(GTK_STACK(stack), calibration_grid, "calibration", "Calibration"); + + g_signal_connect(G_OBJECT(layout), "destroy", G_CALLBACK(on_joymap_widget_destroy), This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-05-15 17:11:44
|
Revision: 45681 http://sourceforge.net/p/vice-emu/code/45681 Author: compyx Date: 2025-05-15 17:11:39 +0000 (Thu, 15 May 2025) Log Message: ----------- Joystick: store axis range and neutral position in axis object Calculate range (max - min + 1) and neutral position (min + (range / 2) when adding an axis object to a joystick device object. This avoids having to do calculations in event handlers and other places. Modified Paths: -------------- branches/compyx/joymap-003/vice/src/joyport/joystick.c branches/compyx/joymap-003/vice/src/joyport/joystick.h Modified: branches/compyx/joymap-003/vice/src/joyport/joystick.c =================================================================== --- branches/compyx/joymap-003/vice/src/joyport/joystick.c 2025-05-15 16:30:56 UTC (rev 45680) +++ branches/compyx/joymap-003/vice/src/joyport/joystick.c 2025-05-15 17:11:39 UTC (rev 45681) @@ -3071,19 +3071,9 @@ } else { /* here we apply calibration */ if (axis->calibration.invert) { - /* invert value by calculating the distance from center and taking - * the opposite side of the center */ - uint32_t range = axis->maximum - axis->minimum; - int32_t center; - - /* integer range: add 1 but avoid overflow (unlikely since HID - * axis values appear to be 16-bit signed integers) */ - if (range < UINT32_MAX) { - range++; - } - - center = axis->maximum - (range / 2); - value = center - value; + /* invert value by calculating the distance from neutral and taking + * the opposite side of the neuatral position */ + value = axis->neutral - value; } if (value <= axis->calibration.threshold.negative) { direction = JOY_AXIS_NEGATIVE; @@ -3933,15 +3923,9 @@ static void joystick_calibration_default_for_axis(joystick_axis_t *axis) { if (!axis->digital) { - int32_t range = axis->maximum - axis->minimum; - - /* add one to get proper range, but only if the result fits */ - if (range < INT32_MAX) { - range++; - } /* default: 0-25% negative, 25-75% neutral, 75-100% positive */ - axis->calibration.threshold.negative = axis->minimum + (range / 4); - axis->calibration.threshold.positive = axis->minimum + ((range / 4) * 3); + axis->calibration.threshold.negative = axis->minimum + (axis->range / 4); + axis->calibration.threshold.positive = axis->minimum + ((axis->range / 4) * 3); } else { axis->calibration.threshold.negative = -1; axis->calibration.threshold.positive = +1; @@ -3967,6 +3951,8 @@ axis->index = -1; axis->minimum = INT16_MIN; axis->maximum = INT16_MAX; + axis->range = UINT16_MAX + 1; + axis->neutral = 0; axis->digital = false; axis->device = NULL; joystick_mapping_init(&axis->mapping.negative); @@ -4139,6 +4125,14 @@ sizeof *joydev->axes * (size_t)joydev->max_axes); } + /* calculate range and neutral position */ + axis->range = axis->maximum - axis->minimum; + /*add 1 to get proper range, but avoid overflow */ + if (axis->range < UINT32_MAX) { + axis->range++; + } + axis->neutral = axis->minimum + (axis->range / 2); + /* set default calibration */ joystick_calibration_default_for_axis(axis); #if 0 Modified: branches/compyx/joymap-003/vice/src/joyport/joystick.h =================================================================== --- branches/compyx/joymap-003/vice/src/joyport/joystick.h 2025-05-15 16:30:56 UTC (rev 45680) +++ branches/compyx/joymap-003/vice/src/joyport/joystick.h 2025-05-15 17:11:39 UTC (rev 45681) @@ -212,6 +212,8 @@ /* capabilities (TODO: more data like fuzz, flat) */ int32_t minimum; /**< minimum axis value */ int32_t maximum; /**< maximum axis value */ + uint32_t range; /**< range of axis (maximum - minimum + 1) */ + int32_t neutral; /**< neutral position value */ bool digital; /**< axis is digital (reports -1, 0, 1) */ struct { joystick_mapping_t negative; /**< negative direction */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-05-15 16:30:59
|
Revision: 45680 http://sourceforge.net/p/vice-emu/code/45680 Author: gpz Date: 2025-05-15 16:30:56 +0000 (Thu, 15 May 2025) Log Message: ----------- fix lightpen logic, require RMB to be pressed and held down for 'PEN' type devices to produce lightpen events (via 'fireA) Modified Paths: -------------- trunk/vice/src/arch/gtk3/uimachinewindow.c trunk/vice/src/joyport/lightpen.c trunk/vice/src/joyport/lightpen.h Modified: trunk/vice/src/arch/gtk3/uimachinewindow.c =================================================================== --- trunk/vice/src/arch/gtk3/uimachinewindow.c 2025-05-15 06:08:55 UTC (rev 45679) +++ trunk/vice/src/arch/gtk3/uimachinewindow.c 2025-05-15 16:30:56 UTC (rev 45680) @@ -370,10 +370,10 @@ pthread_mutex_lock(&canvas->lock); if (button == 1) { /* Left mouse button */ - canvas->pen_buttons |= LP_HOST_BUTTON_1; + canvas->pen_buttons |= LP_HOST_BUTTON_LEFT; } else if (button == 3) { /* Right mouse button */ - canvas->pen_buttons |= LP_HOST_BUTTON_2; + canvas->pen_buttons |= LP_HOST_BUTTON_RIGHT; } pthread_mutex_unlock(&canvas->lock); @@ -387,10 +387,10 @@ pthread_mutex_lock(&canvas->lock); if (button == 1) { /* Left mouse button */ - canvas->pen_buttons &= ~LP_HOST_BUTTON_1; + canvas->pen_buttons &= ~LP_HOST_BUTTON_LEFT; } else if (button == 3) { /* Right mouse button */ - canvas->pen_buttons &= ~LP_HOST_BUTTON_2; + canvas->pen_buttons &= ~LP_HOST_BUTTON_RIGHT; } pthread_mutex_unlock(&canvas->lock); Modified: trunk/vice/src/joyport/lightpen.c =================================================================== --- trunk/vice/src/joyport/lightpen.c 2025-05-15 06:08:55 UTC (rev 45679) +++ trunk/vice/src/joyport/lightpen.c 2025-05-15 16:30:56 UTC (rev 45680) @@ -146,7 +146,7 @@ /* Lightpen/gun type */ struct lp_type_s { - /* PEN needs button to be pressed to register, GUN doesn't */ + /* PEN needs right host button to be pressed to register, GUN doesn't */ enum { PEN, GUN } type; /* Buttons: bitmask for joyport 1 pins, with 0x20 for potY and 0x40 for potX */ uint8_t button1; @@ -265,16 +265,16 @@ lightpen_buttons = buttons; /* check potx/poty */ - lightpen_button_y = ((((lp_type[lightpen_type].button1 & 0x20) == 0x20) && (buttons & LP_HOST_BUTTON_1)) - || (((lp_type[lightpen_type].button2 & 0x20) == 0x20) && (buttons & LP_HOST_BUTTON_2))) + lightpen_button_y = ((((lp_type[lightpen_type].button1 & 0x20) == 0x20) && (buttons & LP_HOST_BUTTON_LEFT)) + || (((lp_type[lightpen_type].button2 & 0x20) == 0x20) && (buttons & LP_HOST_BUTTON_RIGHT))) ? 1 : 0; - lightpen_button_x = ((((lp_type[lightpen_type].button1 & 0x40) == 0x40) && (buttons & LP_HOST_BUTTON_1)) - || (((lp_type[lightpen_type].button2 & 0x40) == 0x40) && (buttons & LP_HOST_BUTTON_2))) + lightpen_button_x = ((((lp_type[lightpen_type].button1 & 0x40) == 0x40) && (buttons & LP_HOST_BUTTON_LEFT)) + || (((lp_type[lightpen_type].button2 & 0x40) == 0x40) && (buttons & LP_HOST_BUTTON_RIGHT))) ? 1 : 0; - lightpen_check_button_mask((uint8_t)(lp_type[lightpen_type].button1 & 0x1f), buttons & LP_HOST_BUTTON_1); - lightpen_check_button_mask((uint8_t)(lp_type[lightpen_type].button2 & 0x1f), buttons & LP_HOST_BUTTON_2); + lightpen_check_button_mask((uint8_t)(lp_type[lightpen_type].button1 & 0x1f), buttons & LP_HOST_BUTTON_LEFT); + lightpen_check_button_mask((uint8_t)(lp_type[lightpen_type].button2 & 0x1f), buttons & LP_HOST_BUTTON_RIGHT); } /* --------------------------------------------------------- */ @@ -567,7 +567,8 @@ return; } - if ((lp_type[lightpen_type].type == PEN) && !(buttons & LP_HOST_BUTTON_1)) { + /* type "PEN" only sends events when right host button is pressed */ + if ((lp_type[lightpen_type].type == PEN) && !(buttons & LP_HOST_BUTTON_RIGHT)) { return; } Modified: trunk/vice/src/joyport/lightpen.h =================================================================== --- trunk/vice/src/joyport/lightpen.h 2025-05-15 06:08:55 UTC (rev 45679) +++ trunk/vice/src/joyport/lightpen.h 2025-05-15 16:30:56 UTC (rev 45680) @@ -67,7 +67,7 @@ void lightpen_update(int window, int x, int y, int buttons); /* Host mouse button bitmasks. (the value 4 for the right mouse button comes from SDL) */ -#define LP_HOST_BUTTON_1 1 -#define LP_HOST_BUTTON_2 4 +#define LP_HOST_BUTTON_LEFT 1 +#define LP_HOST_BUTTON_RIGHT 4 #endif This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-05-15 06:08:57
|
Revision: 45679 http://sourceforge.net/p/vice-emu/code/45679 Author: compyx Date: 2025-05-15 06:08:55 +0000 (Thu, 15 May 2025) Log Message: ----------- Joystick: add joystick button LED widget Add simple GtkDrawingArea widget to indicate joystick button state. At some point the various LED-style widget should be refactored into a base LED widget that supports the various use cases in the UI (optional label, optionally clickable by adding a GtkEventBox). Modified Paths: -------------- branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/Makefile.am branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/settings_joymap.c Added Paths: ----------- branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/joybuttonledwidget.c branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/joybuttonledwidget.h Modified: branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/Makefile.am =================================================================== --- branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/Makefile.am 2025-05-14 18:45:28 UTC (rev 45678) +++ branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/Makefile.am 2025-05-15 06:08:55 UTC (rev 45679) @@ -77,6 +77,7 @@ ffmpegwidget.c \ hvscstilwidget.c \ jamdialog.c \ + joybuttonledwidget.c \ joystickautofirewidget.c \ joystickdevicewidget.c \ joystickmenupopup.c \ @@ -250,6 +251,7 @@ ffmpegwidget.h \ hvscstilwidget.h \ jamdialog.h \ + joybuttonledwidget.h \ joystickautofirewidget.h \ joystickdevicewidget.h \ joystickmenupopup.h \ Added: branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/joybuttonledwidget.c =================================================================== --- branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/joybuttonledwidget.c (rev 0) +++ branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/joybuttonledwidget.c 2025-05-15 06:08:55 UTC (rev 45679) @@ -0,0 +1,194 @@ +/** \file joybuttonledwidget.c + * \brief Joystick button LED widget + * \author Bas Wassink <b.w...@zi...> + * + * Show joystick button state as a LED. + */ + +#include "vice.h" +#include <gtk/gtk.h> +#include "log.h" + +#include "joybuttonledwidget.h" + + +/** \brief Width of widget including padding */ +#define LED_WIDGET_WIDTH 28 + +/** \brief Height of widget including padding */ +#define LED_WIDGET_HEIGHT 14 + +/** \brief Ratio of drawing area rectangle width to total widget widget */ +#define LED_RECT_WIDTH_RATIO 0.666 + +/** \brief Ratio of drawing area rectangle height to total widget height */ +#define LED_RECT_HEIGHT_RATIO 0.666 + +/** \brief Default color for ON/Pressed */ +#define LED_COLOR_ON "#20ff33" + +/** \brief Default color for OFF/Released */ +#define LED_COLOR_OFF "#333333" + + +/** \brief InternaL state of a LED */ +typedef struct led_state_s { + GdkRGBA color_on; /**< color for ON */ + GdkRGBA color_off; /**< color for OFF */ + gboolean active; /**< LED active state */ +} led_state_t; + + +/** \brief Get internal LED state object + * + * \param[in] self joy button LED + * + * \return internal state object + */ +static led_state_t *get_state(GtkWidget *self) +{ + return g_object_get_data(G_OBJECT(self), "LEDState"); +} + +/** \brief Handler for the 'destroy' event of a LED + * + * Clean up extra state of widget. + * + * \param[in] self joy button LED + * \param[in] state joy button state object + */ +static void on_destroy(GtkWidget *self, gpointer state) +{ + g_free(state); +} + +/** \brief Handler for the 'draw' event of a LED + * + * \param[in] self joy button LED + * \param[in] cr cairo context + * \param[in] state LED internal state object + * + * \return \c FALSE to allow other events to propagate (do we need this?) + */ +static gboolean on_draw(GtkWidget *self, cairo_t *cr, gpointer state) +{ + GdkRGBA color; + int area_w; + int area_h; + gdouble led_w; + gdouble led_h; + gdouble led_x; + gdouble led_y; + led_state_t *st = state; + + color = st->active ? st->color_on : st->color_off; + area_w = gtk_widget_get_allocated_width(self); + area_h = gtk_widget_get_allocated_height(self); + led_w = area_w * LED_RECT_WIDTH_RATIO; + led_h = area_h * LED_RECT_HEIGHT_RATIO; + led_x = (area_w - led_w) / 2.0; /* center */ + led_y = (area_h - led_h) / 2.0; /* center */ + + cairo_set_source_rgb(cr, color.red, color.green, color.blue); + cairo_rectangle(cr, led_x, led_y, led_w, led_h); + cairo_fill(cr); + + return FALSE; +} + + +/** \brief Create joystick button LED widget + * + * Create LED-style indicator for joystick button presses. + * + * The optional \a on and \a off arguments are strings that are passed to + * \c gdk_rgba_parse(), see https://docs.gtk.org/gdk3/method.RGBA.parse.html + * + * \param[in] on color for \b ON (pass \c NULL for default #LED_COLOR_ON) + * \param[in] off color for \b OFF (pass \c NULL for default #LED_COLOR_OFF) + * + * \return new joystick button LED widget + * + * \see #LED_COLOR_ON + * \see #LED_COLOR_OFF + */ +GtkWidget *joy_button_led_widget_new(const char *on, const char *off) +{ + GtkWidget *led; + led_state_t *state; + + if (on == NULL) { + on = LED_COLOR_ON; + } + if (off == NULL) { + off = LED_COLOR_OFF; + } + + /* set up drawing area */ + led = gtk_drawing_area_new(); + gtk_widget_set_hexpand(led, FALSE); + gtk_widget_set_vexpand(led, FALSE); + gtk_widget_set_halign(led, GTK_ALIGN_START); + gtk_widget_set_valign(led, GTK_ALIGN_CENTER); + gtk_widget_set_size_request(led, LED_WIDGET_WIDTH, LED_WIDGET_HEIGHT); + + /* set up internal state */ + state = g_malloc(sizeof *state); + state->active = FALSE; + if (!gdk_rgba_parse(&state->color_on, on)) { + log_warning(LOG_DEFAULT, + "joy button LED: failed to parse '%s' as a valid color for" + " ON, falling back to '%s'", + on, LED_COLOR_ON); + gdk_rgba_parse(&state->color_on, LED_COLOR_ON); + } + if (!gdk_rgba_parse(&state->color_off, off)) { + log_warning(LOG_DEFAULT, + "joy button LED: failed to parse '%s' as a valid color for" + " OFF, falling back to '%s'", + off, LED_COLOR_OFF); + gdk_rgba_parse(&state->color_off, LED_COLOR_OFF); + } + g_object_set_data(G_OBJECT(led), "LEDState", (gpointer)state); + + g_signal_connect_unlocked(G_OBJECT(led), + "destroy", + G_CALLBACK(on_destroy), + (gpointer)state); + g_signal_connect_unlocked(G_OBJECT(led), + "draw", + G_CALLBACK(on_draw), + (gpointer)state); + return led; +} + + +/** \brief Get current state of joystick button LED + * + * \param[in] led joystick button LED + * + * \return current state + */ +gboolean joy_button_led_widget_get_active(GtkWidget *led) +{ + led_state_t *state = get_state(led); + + return state->active; +} + + +/** \brief Set state of joystick button LED + * + * \param[in] led joystick button LED + * \param[in] active new state for \a led + */ +void joy_button_led_widget_set_active(GtkWidget *led, gboolean active) +{ + led_state_t *state = get_state(led); + + if (active != state->active) { + state->active = active; + /* state has changed: queue redraw of widget */ + gtk_widget_queue_draw(led); + } +} Added: branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/joybuttonledwidget.h =================================================================== --- branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/joybuttonledwidget.h (rev 0) +++ branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/joybuttonledwidget.h 2025-05-15 06:08:55 UTC (rev 45679) @@ -0,0 +1,14 @@ +/** \file joybuttonledwidget.h + * \brief Joystick button LED widget - header + */ + +#ifndef VICE_JOY_BUTTON_LED_WIDGET_H +#define VICE_JOY_BUTTON_LED_WIDGET_H + +#include <gtk/gtk.h> + +GtkWidget *joy_button_led_widget_new (const char *on, const char *off); +gboolean joy_button_led_widget_get_active(GtkWidget *led); +void joy_button_led_widget_set_active(GtkWidget *led, gboolean active); + +#endif Modified: branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/settings_joymap.c =================================================================== --- branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/settings_joymap.c 2025-05-14 18:45:28 UTC (rev 45678) +++ branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/settings_joymap.c 2025-05-15 06:08:55 UTC (rev 45679) @@ -13,7 +13,7 @@ #include "joyport.h" #include "joystick.h" #include "resources.h" -#include "statusbarledwidget.h" +#include "joybuttonledwidget.h" #include "vice_gtk3.h" #include "settings_joymap.h" @@ -146,62 +146,80 @@ } -/* TODO: Repaint widgets once after all events have been processed, with - * Gtk fram tick or so? - */ -static GtkWidget *event_widget_new(joystick_device_t *joydev) +static GtkWidget *create_axes_grid(joystick_device_t *joydev) { GtkWidget *grid; - GtkWidget *label; - GtkWidget *agrid; - GtkWidget *bgrid; - GtkWidget *hgrid; int i; - grid = grid_helper("<b>Device events</b>", 16, 8, 3); - - agrid = grid_helper("<b>Axes</b>", 8, 8, 2); - bgrid = grid_helper("<b>Buttons</b>", 8, 8, 2); - hgrid = grid_helper("<b>Hatss</b>", 8, 8, 2); - gtk_grid_attach(GTK_GRID(grid), agrid, 0, 1, 1, 1); - gtk_grid_attach(GTK_GRID(grid), bgrid, 1, 1, 1, 1); - gtk_grid_attach(GTK_GRID(grid), hgrid, 2, 1, 1, 1); - + grid = grid_helper("<b>Axes</b>", 8, 8, 2); for (i = 0; i < joydev->num_axes; i++) { - joystick_axis_t *axis = joydev->axes[i]; - GtkWidget *scale; + GtkWidget *label; + GtkWidget *scale; + joystick_axis_t *axis = joydev->axes[i]; + gdouble range = (gdouble)(axis->maximum - axis->minimum + 1); + gdouble center = (gdouble)axis->minimum + range / 2.0; label = gtk_label_new(axis->name); gtk_widget_set_halign(label, GTK_ALIGN_START); scale = gtk_scale_new_with_range(GTK_ORIENTATION_HORIZONTAL, - (gdouble)(axis->minimum), - (gdouble)(axis->maximum), + (gdouble)axis->minimum, + (gdouble)axis->maximum, 1.0); gtk_scale_set_digits(GTK_SCALE(scale), 0); gtk_scale_set_value_pos(GTK_SCALE(scale), GTK_POS_RIGHT); - gtk_range_set_value(GTK_RANGE(scale), axis->minimum + ((axis->maximum - axis->minimum) / 2)); + gtk_range_set_value(GTK_RANGE(scale), center); gtk_widget_set_size_request(scale, 200, -1); - gtk_grid_attach(GTK_GRID(agrid), label, 0, i + 1, 1, 1); - gtk_grid_attach(GTK_GRID(agrid), scale, 1, i + 1, 1, 1); - + gtk_grid_attach(GTK_GRID(grid), label, 0, i + 1, 1, 1); + gtk_grid_attach(GTK_GRID(grid), scale, 1, i + 1, 1, 1); } + return grid; +} + +static GtkWidget *create_buttons_grid(joystick_device_t *joydev) +{ + GtkWidget *grid; + int i; + + grid = grid_helper("<b>Buttons</b>", 8, 8, 2); for (i = 0; i < joydev->num_buttons; i++) { + GtkWidget *label; + GtkWidget *led; joystick_button_t *button = joydev->buttons[i]; - GtkWidget *led; label = gtk_label_new(button->name); gtk_widget_set_halign(label, GTK_ALIGN_START); - led = statusbar_led_widget_create(NULL, "#00ff00", "#000000"); - statusbar_led_widget_set_active(led, FALSE); + led = joy_button_led_widget_new(NULL, NULL); + joy_button_led_widget_set_active(led, FALSE); - gtk_grid_attach(GTK_GRID(bgrid), label, 0, i + 1, 1 ,1); - gtk_grid_attach(GTK_GRID(bgrid), led, 1, i + 1, 1 ,1); + gtk_grid_attach(GTK_GRID(grid), label, 0, i + 1, 1, 1); + gtk_grid_attach(GTK_GRID(grid), led, 1, i + 1, 1, 1); } + return grid; +} +/* TODO: Repaint widgets once after all events have been processed, with + * Gtk fram tick or so? + */ +static GtkWidget *event_widget_new(joystick_device_t *joydev) +{ + GtkWidget *grid; + GtkWidget *agrid; + GtkWidget *bgrid; + GtkWidget *hgrid; + + grid = grid_helper("<b>Device events</b>", 16, 8, 3); + + agrid = create_axes_grid(joydev); + bgrid = create_buttons_grid(joydev); + hgrid = grid_helper("<b>Hats (TODO)</b>", 8, 8, 2); + gtk_grid_attach(GTK_GRID(grid), agrid, 0, 1, 1, 1); + gtk_grid_attach(GTK_GRID(grid), bgrid, 1, 1, 1, 1); + gtk_grid_attach(GTK_GRID(grid), hgrid, 2, 1, 1, 1); + return grid; } @@ -213,6 +231,7 @@ } + GtkWidget *settings_joymap_widget_create(GtkWidget *parent) { GtkWidget *label; @@ -285,11 +304,7 @@ if (grid != NULL && GTK_IS_GRID(grid)) { led = gtk_grid_get_child_at(GTK_GRID(grid), 1, 1 + button->index); if (led != NULL) { - gboolean pressed = value ? TRUE: FALSE; - - if (statusbar_led_widget_get_active(led) != pressed) { - statusbar_led_widget_set_active(led, value ? TRUE : FALSE); - } + joy_button_led_widget_set_active(led, value ? TRUE : FALSE); } } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rh...@us...> - 2025-05-14 18:45:31
|
Revision: 45678 http://sourceforge.net/p/vice-emu/code/45678 Author: rhialto Date: 2025-05-14 18:45:28 +0000 (Wed, 14 May 2025) Log Message: ----------- Fix some typos in comments. Modified Paths: -------------- trunk/vice/src/pet/pethre.c Modified: trunk/vice/src/pet/pethre.c =================================================================== --- trunk/vice/src/pet/pethre.c 2025-05-14 18:18:26 UTC (rev 45677) +++ trunk/vice/src/pet/pethre.c 2025-05-14 18:45:28 UTC (rev 45678) @@ -211,16 +211,16 @@ * reads (my translation from German): * ------ * The 8296 HIRES Graphics is an emulation of the 512*256 Commodore High Speed - * Graphivs, which uses the built-in RAM and 6502 microprocessor. + * Graphics, which uses the built-in RAM and 6502 microprocessor. * * A hardware addition is plugged into the socket of the CRTC (UC9) and the * character ROM (UC5). * - * The software for emulating the High Speed Graphivs is contained in a 4 KB + * The software for emulating the High Speed Graphics is contained in a 4 KB * EPROM ($9000, UE10), een BASIC-extension to use the graphics is in a * further 4K EPROM ($A000, UE9). * - * The "hidden" RAM behind the EPROM in UE9 and the BASIC ROM is used As screen + * The "hidden" RAM behind the EPROM in UE9 and the BASIC ROM is used as screen * memory. * * On the extension board there is a 4-fold DIL switch (1 to 4), with which one @@ -250,7 +250,7 @@ * 3) high = Latch On * ------ * (unfortunately the document doesn't say what "Latch On" does, but I guess - * that if it is off, it has no effect and the /RAM* signals are default.) + * that if it is off, the /RAM* signals are set by the DIL switches.) * * - JU1 : set /RAMSELA to GND (do not use JU1/JU3 together) * - JU2 : set /RAMSEL9 to GND (do not use JU2/JU4 together) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rh...@us...> - 2025-05-14 18:18:28
|
Revision: 45677 http://sourceforge.net/p/vice-emu/code/45677 Author: rhialto Date: 2025-05-14 18:18:26 +0000 (Wed, 14 May 2025) Log Message: ----------- On the 8296 we do not (invert the screen by clearing MA12). The CRTC code (crtc.c) which tests vaddr_revswitch (as it is called there) has no explicit value for "we do not have the reverse feature at all", but it is clever enough to use an uninverted screen if the toggle bit is part of the "normal" screen addressing bits. So we just use the video address mask (vaddr_mask) bits as the vaddr_revswitch to disable inverting. Modified Paths: -------------- trunk/vice/src/pet/pet.c Modified: trunk/vice/src/pet/pet.c =================================================================== --- trunk/vice/src/pet/pet.c 2025-05-14 11:47:56 UTC (rev 45676) +++ trunk/vice/src/pet/pet.c 2025-05-14 18:18:26 UTC (rev 45677) @@ -947,6 +947,7 @@ vmask, cols, petres.model.crtc); */ int hwflag = (cols == 80) ? CRTC_HW_DOUBLE_CHARS : 0; + int vrevmask; /* Note: see bug #1954. * The real cause for the timing difference is unknown so far. * If found, the condition below will probably change. */ @@ -953,6 +954,9 @@ if (cols == 80 && petres.map != PET_MAP_8296) { hwflag |= CRTC_HW_LATE_BEAM; } + /* On the 8296 we do not (invert the screen by clearing MA12). */ + vrevmask = petres.map == PET_MAP_8296 ? vmask : 0x1000; + crtc_set_screen_options(cols, 25 * 10); crtc_set_screen_addr(mem_ram + 0x8000); crtc_set_hw_options(hwflag, @@ -959,7 +963,7 @@ vmask, 0x2000, /* vchar: MA13 */ 512, /* vcoffset */ - 0x1000); /* vrevmask: MA12 */ + vrevmask); /* vrevmask: MA12 */ crtc_set_retrace_type(petres.model.crtc ? CRTC_RETRACE_TYPE_CRTC : CRTC_RETRACE_TYPE_DISCRETE); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-05-14 11:48:00
|
Revision: 45676 http://sourceforge.net/p/vice-emu/code/45676 Author: gpz Date: 2025-05-14 11:47:56 +0000 (Wed, 14 May 2025) Log Message: ----------- disable debug msg Modified Paths: -------------- trunk/vice/src/drive/drivemem.c Modified: trunk/vice/src/drive/drivemem.c =================================================================== --- trunk/vice/src/drive/drivemem.c 2025-05-14 08:41:08 UTC (rev 45675) +++ trunk/vice/src/drive/drivemem.c 2025-05-14 11:47:56 UTC (rev 45676) @@ -51,7 +51,7 @@ #include "wd1770.h" #include "cmdhd.h" -#define DEBUG_DRIVEMEM +/* #define DEBUG_DRIVEMEM */ #ifdef DEBUG_DRIVEMEM #define LOG(x) log_printf x This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-05-14 08:41:12
|
Revision: 45675 http://sourceforge.net/p/vice-emu/code/45675 Author: compyx Date: 2025-05-14 08:41:08 +0000 (Wed, 14 May 2025) Log Message: ----------- Merge trunk (r45655:HEAD) into branch Modified Paths: -------------- branches/compyx/joymap-003/vice/data/hotkeys/hotkeys-cartridge.vhk branches/compyx/joymap-003/vice/doc/vice.texi branches/compyx/joymap-003/vice/src/arch/gtk3/novte/iso2022.cc branches/compyx/joymap-003/vice/src/arch/gtk3/novte/keymap.cc branches/compyx/joymap-003/vice/src/arch/gtk3/novte/ring.cc branches/compyx/joymap-003/vice/src/arch/gtk3/novte/table.cc branches/compyx/joymap-003/vice/src/arch/gtk3/novte/vte.cc branches/compyx/joymap-003/vice/src/arch/gtk3/novte/vteaccess.cc branches/compyx/joymap-003/vice/src/arch/gtk3/novte/vteconv.cc branches/compyx/joymap-003/vice/src/arch/gtk3/novte/vtedefines.hh branches/compyx/joymap-003/vice/src/arch/gtk3/novte/vtedraw.cc branches/compyx/joymap-003/vice/src/arch/gtk3/novte/vtegtk.cc branches/compyx/joymap-003/vice/src/arch/gtk3/novte/vterowdata.cc branches/compyx/joymap-003/vice/src/arch/gtk3/novte/vteseq.cc branches/compyx/joymap-003/vice/src/arch/gtk3/novte/vtestream-file.h branches/compyx/joymap-003/vice/src/arch/gtk3/uimachinemenu.c branches/compyx/joymap-003/vice/src/arch/gtk3/uisettings.c branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/Makefile.am branches/compyx/joymap-003/vice/src/arch/sdl/actions-cartridge.c branches/compyx/joymap-003/vice/src/arch/sdl/menu_vic20cart.c branches/compyx/joymap-003/vice/src/arch/sdl/uiimagefilereq.c branches/compyx/joymap-003/vice/src/arch/shared/uiactions.c branches/compyx/joymap-003/vice/src/arch/shared/uiactions.h branches/compyx/joymap-003/vice/src/c128/c128mem.c branches/compyx/joymap-003/vice/src/c128/c128mem.h branches/compyx/joymap-003/vice/src/c128/c128meminit.c branches/compyx/joymap-003/vice/src/c64/c64datasette.c branches/compyx/joymap-003/vice/src/c64/c64mem.c branches/compyx/joymap-003/vice/src/c64/c64mem.h branches/compyx/joymap-003/vice/src/c64/c64meminit.c branches/compyx/joymap-003/vice/src/c64/c64memsc.c branches/compyx/joymap-003/vice/src/c64/cart/ltkernal.c branches/compyx/joymap-003/vice/src/c64/cart/magicvoice.c branches/compyx/joymap-003/vice/src/c64/vsidmem.c branches/compyx/joymap-003/vice/src/c64/vsidmeminit.c branches/compyx/joymap-003/vice/src/c64dtv/c64dtv-stubs.c branches/compyx/joymap-003/vice/src/cartridge.h branches/compyx/joymap-003/vice/src/cbm2/cbm2datasette.c branches/compyx/joymap-003/vice/src/core/ata.c branches/compyx/joymap-003/vice/src/datasette/datasette.h branches/compyx/joymap-003/vice/src/drive/iec/memiec.c branches/compyx/joymap-003/vice/src/monitor/mon_command.c branches/compyx/joymap-003/vice/src/monitor/monitor_binary.c branches/compyx/joymap-003/vice/src/pet/petdatasette.c branches/compyx/joymap-003/vice/src/plus4/plus4datasette.c branches/compyx/joymap-003/vice/src/scpu64/scpu64-stubs.c branches/compyx/joymap-003/vice/src/scpu64/scpu64mem.c branches/compyx/joymap-003/vice/src/scpu64/scpu64mem.h branches/compyx/joymap-003/vice/src/scpu64/scpu64meminit.c branches/compyx/joymap-003/vice/src/tapeport/Makefile.am branches/compyx/joymap-003/vice/src/tapeport/tapeport.c branches/compyx/joymap-003/vice/src/tapeport/tapeport.h branches/compyx/joymap-003/vice/src/tools/cartconv/vic20-cartridges.c branches/compyx/joymap-003/vice/src/vic20/cart/Makefile.am branches/compyx/joymap-003/vice/src/vic20/cart/vic20cart.c branches/compyx/joymap-003/vice/src/vic20/cart/vic20cartmem.c branches/compyx/joymap-003/vice/src/vic20/cart/vic20cartmem.h branches/compyx/joymap-003/vice/src/vic20/cart/writenow.c branches/compyx/joymap-003/vice/src/vic20/vic20datasette.c Added Paths: ----------- branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/settings_minimon.c branches/compyx/joymap-003/vice/src/arch/gtk3/widgets/settings_minimon.h branches/compyx/joymap-003/vice/src/tapeport/wordcraft-dongle.c branches/compyx/joymap-003/vice/src/tapeport/wordcraft-dongle.h branches/compyx/joymap-003/vice/src/vic20/cart/minimon.c branches/compyx/joymap-003/vice/src/vic20/cart/minimon.h Modified: branches/compyx/joymap-003/vice/data/hotkeys/hotkeys-cartridge.vhk =================================================================== --- branches/compyx/joymap-003/vice/data/hotkeys/hotkeys-cartridge.vhk 2025-05-12 17:39:06 UTC (rev 45674) +++ branches/compyx/joymap-003/vice/data/hotkeys/hotkeys-cartridge.vhk 2025-05-14 08:41:08 UTC (rev 45675) @@ -6,13 +6,13 @@ !if !MACOS cart-attach <Alt>c cart-detach <Alt><Shift>c - !if C64 || C64SC || SCPU64 || C128 + !if C64 || C64SC || SCPU64 || C128 || VIC20 cart-freeze <Alt>z !endif !else cart-attach <Command>c cart-detach <Command><Shift>c - !if C64 || C64SC || SCPU64 || C128 + !if C64 || C64SC || SCPU64 || C128 || VIC20 cart-freeze <Command>z !endif !endif Modified: branches/compyx/joymap-003/vice/doc/vice.texi =================================================================== --- branches/compyx/joymap-003/vice/doc/vice.texi 2025-05-12 17:39:06 UTC (rev 45674) +++ branches/compyx/joymap-003/vice/doc/vice.texi 2025-05-14 08:41:08 UTC (rev 45675) @@ -8566,6 +8566,9 @@ @item 6 @tab tapecart @tab x64, x64sc, x128 +@item 7 +@tab WordCraft dongle +@tab xpet @end multitable @table @code @@ -14375,10 +14378,221 @@ @end itemize @node VIC20 cartridges, VIC20 memory expansions, VIC20-specific, VIC20-specific -@subsection Using cartridge images +@subsection Using cartridges + +Generally a cartridge can be enabled by attaching its respective cartridge +image, or using the respective menu option for cartridges that do not +require an image. + +@dfn{Cartridge images} are like disk images, but contain the contents of +cartridge ROM and/or RAM images instead of disk images. Two kinds of cartridge +images are supported: + +@itemize @bullet +@item +@file{.crt} images, as originally used by the CCS64 emulator by Per H\xE5kan Sundell +@item +raw @file{.bin} images, without load address +@item +raw @file{.prg} images, with load address +@end itemize + +Use cartconv to convert .bin or .prg images to .crt format. + +To attach cartridges, use the ``Attach a cartridge image'' submenu. When using +@file{.crt} images, this will work for every cartridge which is supported. For +raw @file{.bin} or @file{.prg} images you will have to select the correct type +of cartridge first, or use command line options. + +When you have successfully attached a cartridge image, +you should then reset the machine to make sure the cartridge initializes +itself. (Or enable the "reset on cartridge change" option). + +Of course, it is also possible to detach a currently attached +cartridge image (``Detach cartridge image''). + +The cartridge system is organized in "Slots" to allow more than one cartridge +connected at a time, like it can be done using an expansion port expander on +a real VIC20 (see below). + +The imaginary expansion port expander is organized in 4 slots, the +cartridges are associated with them like this: + +@c @node FIXME +@subsubsection Slot 0 + +All carts that have a passthrough connector go here. Once a "Slot 0" +cartridge is enabled all further cartridges are connected to its respective +passthrough port. + +Only one cartridge of this type can be active at a time. + +"Slot 0" carts have individual "enable" switches, enabling means enabling permanently. + +The following cartridges are emulated in this slot: + +@itemize @bullet +@item +Minimon +@end itemize + + +@c @node FIXME +@subsubsection Slot 1 + +Mostly RAM based cartridges which for one reason or the other might make sense +to be enabled together with one of the "Main Slot" cartridges go here. + +Only one cartridge of this type can be active at a time. + +"Slot 1" carts have individual "enable" switches, enabling means enabling permanently + +Currently no cartridges use this slot + + +@c @node FIXME +@subsubsection Main Slot + +All other cartridges which are not pure i/o extensions go here. + +Only one cartridge of this type can be active at a time. + +Cartridges in the "Main Slot" must be explicitly set as default to enable them permanently. + +The following cartridges are emulated in this slot: + +@itemize @bullet +@item +generic 4KiB, 8KiB and 16KiB cartridges located at $2000, $4000, $6000, $a000, $b000 (see below) +@item +Behrbonz +@item +Final Expansion +@item +Megacart +@item +Mikro Assembler +@item +Rabbit tape turbo +@item +Super Expander +@item +Ultimem +@item +VIC Flash Plugin +@item +Write Now +@end itemize + + +@c @node FIXME +@subsubsection I/O Slot + +All carts that are pure I/O extensions go here. + +Any number of "I/O Slot" Carts may be active at a time. + +"I/O Slot" carts have individual "enable" switches, enabling means enabling permanently. + +The following cartridges are emulated in this slot: + +@itemize @bullet +@item +ACIA (Swiftlink, Turbo232) +@item +MIDI (Passport/Syntech, Datel/Siel/JMS/C-Lab, Maplin, Namesoft, Sequential) +@item +RAM Expansion Module (REU) +@item +SID Cartridge +@item +VIC1112 IEEE-488 Interface +@end itemize + +On top of that, xvic emulates the "Masquerade" IO expander, which make it possible +to use (some) C64 cartridges at the VIC20: + +@itemize @bullet +@item +ACIA (Swiftlink, Turbo232) +@item +DigiMAX +@item +DS12C887 RTC +@item +Ethernet (The Final Ethernet, RR-Net) +@item +GEO-RAM +@item +SFX Sound Expander +@item +SFX Sound Sampler +@end itemize + + +@c @node FIXME +@subsubsection Expected behaviour + +When the emulator is run without arguments, all settings from the config file +should be applied and arguments override settings from the config file. + +When saving the settings to the config file it is expected that on the next run +of the emulator all settings will be in the same state as they were when saved. + +There is an exception to this rule: the cartridge in the "Main Slot" must be +explicitly set as default before it gets saved to the config file. + +@code{+cart} should disable ALL cartridges, including eventually activated REU, +Swiftlink and all similar expansionport devices. + +@code{-cartXYZ} options should generally attach AND activate a cart of type XYZ. +As a consequence, attaching carts this way which are NOT in the "Main Slot" will +also enable the cart permanently. + +@c @node FIXME +@subsubsection Common problems + +If attaching a cartridge does not work as expected, this may be because of various +reasons: + +@itemize @bullet + +@item Not seldomly VIC20 related files with @code{.crt} extension found "in the wild" are +plain binaries, and not in actual @code{.crt} format - if in doubt use @code{cartconv} +to verify and/or fix). + +@item You may have unintentionally enabled more than one cartridge at once, for +example by saving the settings with GEORAM enabled, and then later attaching a game +cartridge from the command-line. The cartridge system will allow certain combinations, +but (as on the real thing) not all do (can) actually work. To make sure this is +not the case, either detach all cartridges from the menus, or use @code{+cart} +on the command-line. + +@item The cartridge image might be broken. Try one from a different source. If you +are sure the dump is ok (for example because you dumped it yourself) then make sure +it is in proper linear order (on some cartridges, for example "capture", address and/or +data lines at the eprom are shuffled around so a dump made with an eprom burner can not +be used as is). + +@item Last not least you might have encountered a bug in the emulation. If you +suspect this is the case, and you can still reproduce the bug after checking the +things above, please file a bug report including the following information: + +@itemize @bullet +@item attach your vicerc and a reference to the cartridge binaries +@item if you can, comment in the respective DEBUGXYZ macros prominently defined at the +top of these files: src/vic20/cart/vic20cart.c src/vic20/cart/vic20cartmem.c src/vic20/vic20io.c +src/vic20/vic20export.c and then recompile. this will add debug output that might make +it much easier to locate certain problems. +@end itemize + +@end itemize + +@subsubsection Using cartridge images + As with the C64 (@pxref{C64 cartridges}), it is possible to attach -several types of cartridge images: +several types of generic cartridge images: @itemize @bullet @item @@ -14462,6 +14676,10 @@ @item 8: Mikro Assembler @item + 9: Write Now +@item + 10: Minimon +@item - 10: SID Cartridge @item - 11: IEEE-4888 @@ -14648,11 +14866,27 @@ @item IEEE488 Boolean specifying whether the IEEE488 interface should be emulated or not. -@vindex MachineVideoStandard -@item MachineVideoStandard -Integer that specifies the video standard of the emulated machine -(1: PAL, 2: NTSC). +@vindex MinimonFilename +@item MinimonFilename +String specifying the filename of the Minimon ROM image. +@vindex MinimonEnabled +@item MinimonEnabled +Boolean specifying whether Minimon emulation is enabled. + +@vindex MinimonPgmSwitch +@item MinimonPgmSwitch +Boolean specifying whether the Minimon ROM is writeable. + +@vindex MinimonIoSwitch +@item MinimonIoSwitch +Boolean specifying whether the Minimon ROM is active in IO2/3 (default: enabled) + +@vindex MinimonImageWrite +@item MinimonImageWrite +Boolean specifying whether changes to the Minimon ROM will be written back to the +ROM image file. + @end table @c @node FIXME @@ -14933,22 +15167,34 @@ (@code{GEORAMsize}). (512, 1024, 2048, 4096) -@findex -model -@item -model <model> -Specify the VIC20 model you want to emulate -(@code{MachineVideoStandard}, @code{RamBlock0}, @code{RamBlock1}, @code{RamBlock2}, @code{RamBlock3} and @code{RamBlock5}). -(vic20/vic20pal/vic20ntsc, vic21) +@findex -minimon, +minimon +@item -minimon +@itemx +minimon +Enable/Disable the Minimon expansion +(@code{MinimonEnabled=1}, @code{MinimonEnabled=0}). -@findex -pal -@item -pal -Use PAL sync factor -(@code{MachineVideoStandard=1}). +@findex -minimonrom +@item -minimonrom <name> +Specify name of Minimon ROM image (@code{MinimonFilename}). -@findex -ntsc -@item -ntsc -Use NTSC sync factor -(@code{MachineVideoStandard=2}). +@findex -minimonrw, -minimonro +@item -minimonrw +@itemx -minimonro +Save/Do not save the Minimon ROM when changed +(@code{MinimonImageWrite=1}, @code{MinimonImageWrite=0}). +@findex -minimonpgm, +minimonpgm +@item -minimonpgm +@itemx +minimonpgm +Set/Remove the Minimon PGM switch +(@code{MinimonPgmSwitch=1}, @code{MinimonPgmSwitch=0}). + +@findex -minimonio, +minimonio +@item -minimonio +@itemx +minimonio +Set/Remove the Minimon IO switch +(@code{MinimonIoSwitch=1}, @code{MinimonIoSwitch=0}). + @end table @c @node FIXME @@ -14959,6 +15205,11 @@ @table @code +@vindex MachineVideoStandard +@item MachineVideoStandard +Integer that specifies the video standard of the emulated machine +(1: PAL, 2: NTSC). + @vindex VICVideoCache @item VICVideoCache Boolean specifying whether the video cache is turned on. @@ -15098,6 +15349,22 @@ @table @code +@findex -model +@item -model <model> +Specify the VIC20 model you want to emulate +(@code{MachineVideoStandard}, @code{RamBlock0}, @code{RamBlock1}, @code{RamBlock2}, @code{RamBlock3} and @code{RamBlock5}). +(vic20/vic20pal/vic20ntsc, vic21) + +@findex -pal +@item -pal +Use PAL sync factor +(@code{MachineVideoStandard=1}). + +@findex -ntsc +@item -ntsc +Use NTSC sync factor +(@code{MachineVideoStandard=2}). + @findex -VICvcache, +VICvcache @item -VICvcache @itemx +VICvcache @@ -16915,7 +17182,7 @@ @node Colour PET @subsection Colour PET The Colour PET is a simple extension by Steve Gray -@uref{http://www.6502.org/users/sjgray/projects/colourpet/}. It exploits +@uref{http://cbmsteve.ca/colourpet/index.html}. It exploits the similarities and differences between the 4032 and 8032 models, to use memory at $8800 as colour RAM. @@ -20636,7 +20903,7 @@ @itemx exp Print out list of attached expansion port devices. -@item keybuf "<string>" +@item keybuf <string> Put the specified string into the keyboard buffer. Note that you can specify specific keycodes by using C-style escaped hexcodes ("\x0a"). @@ -20883,9 +21150,15 @@ @item rmdir <directory> Remove directory. -@item attach <filename> <device> +@item attach "<filename>" <device> Attach file to device. (device 32 = cart) +@item autostart "<filename>" [file_index] +Autostart a given disk/tape image or program. + +@item autoload "<filename>" [file_index] +Autoload given disk/tape image or program. + @item block_read <track> <sector> [<address>] @itemx br <track> <sector> [<address>] Read the block at the specified track and sector. If an address is @@ -20907,7 +21180,7 @@ drive implementation. As a consequence, all limitations of the virtual drives apply. Use the regular monitor commands to eg execute code in the drive. -@item list [<directory>] +@item list [<device>] List disk contents. @item load "<filename>" <device> [<address>] @@ -23609,6 +23882,8 @@ Final Expansion @item mega Mega-Cart +@item mini +Minimon @item ma Mikro Assembler @item rabbit @@ -35268,6 +35543,50 @@ @c FIXME: cartridge details @c @node FIXME +@subsubsection 10 - Minimon + +@multitable @columnfractions .3 .7 +@item Size +@tab 2KiB (ROM) +@end multitable + +@example + 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F ASCII + ----------------------------------------------- ---------------- + 0000: 56 49 43 32 30 20 43 41 52 54 52 49 44 47 45 20 VIC20 CARTRIDGE + 0010: 00 00 00 40 02 00 00 0a 00 00 00 00 00 00 00 00 ...@............ + 0020: 4d 69 6e 69 6d 6f 6e 00 00 00 00 00 00 00 00 00 Minimon......... + 0030: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................ + 0040: 43 48 49 50 00 00 08 10 00 00 00 00 98 00 08 00 CHIP............ + 0050: 20 a2 9f a2 00 8e 12 01 20 e2 9f 0d 4d 4f 4e 49 ....... ...MONI + 0060: 54 4f 52 0d 00 90 14 d8 a2 05 68 9d 10 01 ca 10 TOR.......h..... + 0070: f9 20 e2 9f 0d 42 52 45 41 4b 00 a9 c0 85 9d ba . ...BREAK...... + 0080: 8e 16 01 a9 00 85 c1 85 c2 58 20 e2 9f 0d 20 20 .........X ... + 0090: 50 43 20 20 53 52 20 41 43 20 58 52 20 59 52 20 PC SR AC XR YR + +@dots{} + 0830: ff ff 68 85 22 68 85 23 e6 22 d0 02 e6 23 a0 00 ..h."h.#."...#.. + 0840: b1 22 f0 05 20 d2 ff 90 ef a5 23 48 a5 22 48 60 .".. .....#H."H` +@end example + +This cartridge maps 2KiB ROM into the IO2 and IO3 area ($9800 - $9fff). It (the +monitor) can be started by SYS38912. + +The cartridge has two switches: + +@itemize @bullet +@item PGM: when enabled, the memory in the socket can be written to (when it is SRAM + or EEPROM) +@item CART/MON: when in MON position, the ROM is mapped into IO. in CART position + the IO is mapped transparent to the pass through port. +@end itemize + +"Freeze" (a long press on the reset button on the original cartridge) will +trigger a reset, and inhibit reads to BLK5 for ~300ms, to prevent a CBMA0 cart +from starting. + + +@c @node FIXME @subsection PLUS4 Cartridge Specifics @multitable @columnfractions .1 .9 @@ -36167,12 +36486,14 @@ @b{Olaf Seibert} Contributed some PET, including PET DWW hires, Xaw, lightpen, hardware scaling, and disk drive patches. Added proper SuperPET -support, including 6809/6309 CPU emulation. Maintained the Xaw UI. +support, including 6809/6309 CPU emulation and 6702 'dongle' chip. +Maintained the Xaw UI. Added PET HRE (High Res Emulator) board emulation. Added the 2-chip colour board for the Universal PET mainboard. Added support for 'printer/plotter' Commodore 1520. Overhauled internals of VIA and CIA code. Corrected pre-CRTC PET display timing. REL-file support for the filesystem device and c1541. +Added WordCraft dongle. @item @b{Marcus Sutton} Modified: branches/compyx/joymap-003/vice/src/arch/gtk3/novte/iso2022.cc =================================================================== --- branches/compyx/joymap-003/vice/src/arch/gtk3/novte/iso2022.cc 2025-05-12 17:39:06 UTC (rev 45674) +++ branches/compyx/joymap-003/vice/src/arch/gtk3/novte/iso2022.cc 2025-05-14 08:41:08 UTC (rev 45675) @@ -170,7 +170,7 @@ /* skip blanks -- TODOegmont: why here? */ j = gunichars->len; - g_array_set_size(gunichars, gunichars->len + outbuf-buf); + g_array_set_size(gunichars, (guint)(gunichars->len + (outbuf - buf))); for (i = 0; buf + i < outbuf; i++) { c = buf[i]; if (G_UNLIKELY (c == '\0')) { Modified: branches/compyx/joymap-003/vice/src/arch/gtk3/novte/keymap.cc =================================================================== --- branches/compyx/joymap-003/vice/src/arch/gtk3/novte/keymap.cc 2025-05-12 17:39:06 UTC (rev 45674) +++ branches/compyx/joymap-003/vice/src/arch/gtk3/novte/keymap.cc 2025-05-14 08:41:08 UTC (rev 45675) @@ -943,7 +943,7 @@ char **normal, gssize *normal_length) { - int modifier, offset; + int modifier; ssize_t offset; char *nnormal; enum _vte_modifier_encoding_method modifier_encoding_method; guint significant_modifiers; Modified: branches/compyx/joymap-003/vice/src/arch/gtk3/novte/ring.cc =================================================================== --- branches/compyx/joymap-003/vice/src/arch/gtk3/novte/ring.cc 2025-05-12 17:39:06 UTC (rev 45674) +++ branches/compyx/joymap-003/vice/src/arch/gtk3/novte/ring.cc 2025-05-14 08:41:08 UTC (rev 45675) @@ -1012,7 +1012,7 @@ if (position >= ring->end) { offset->text_offset = _vte_stream_head (ring->text_stream) + position - ring->end; offset->fragment_cells = 0; - offset->eol_cells = column; + offset->eol_cells = (gint)column; return TRUE; } @@ -1056,7 +1056,7 @@ for (i = 0, cell = row->cells; i < row->len && i < column; i++, cell++) { if (G_LIKELY (!cell->attr.fragment())) { if (G_UNLIKELY (i + cell->attr.columns() > column)) { - offset->fragment_cells = column - i; + offset->fragment_cells = (gint) (column - i); break; } num_chars += _vte_unistr_strlen(cell->c); @@ -1063,7 +1063,7 @@ } } if (i >= row->len) { - offset->eol_cells = column - i; + offset->eol_cells = (gint) (column - i); } /* count the number of UTF-8 bytes for the given number of characters */ @@ -1134,7 +1134,7 @@ /* row and buffer now contain the same text, in different representation */ /* count the number of characters for the given UTF-8 text offset */ - off = offset->text_offset - records[0].text_start_offset; + off = (unsigned int) (offset->text_offset - records[0].text_start_offset); num_chars = 0; for (i = 0; i < off && i < buffer->len; i++) { if ((buffer->str[i] & 0xC0) != 0x80) { @@ -1343,7 +1343,7 @@ if (paragraph_is_ascii) { /* Shortcut for quickly wrapping ASCII (excluding TAB) text. Don't read text_stream, and advance by a whole row of characters. */ - int len = MIN(runlength, (gsize) (columns - col)); + ssize_t len = MIN(runlength, (gsize) (columns - col)); col += len; text_offset += len; paragraph_len -= len; @@ -1351,7 +1351,7 @@ } else { /* Process one character only. */ char textbuf[6]; /* fits at least one UTF-8 character */ - int textbuf_len; + ssize_t textbuf_len; col += attr_change.attr.columns(); /* Find beginning of next UTF-8 character */ text_offset++; paragraph_len--; runlength--; Modified: branches/compyx/joymap-003/vice/src/arch/gtk3/novte/table.cc =================================================================== --- branches/compyx/joymap-003/vice/src/arch/gtk3/novte/table.cc 2025-05-12 17:39:06 UTC (rev 45674) +++ branches/compyx/joymap-003/vice/src/arch/gtk3/novte/table.cc 2025-05-14 08:41:08 UTC (rev 45675) @@ -94,7 +94,7 @@ info = head->list; head->list = last->next; if (last >= &head->stack[0] && last < &head->stack[G_N_ELEMENTS(head->stack)]){ - head->stack_allocated = last - &head->stack[0]; + head->stack_allocated = (guint) (last - &head->stack[0]); /* FIXME */ } do { struct _vte_table_arginfo *next = info->next; @@ -211,7 +211,7 @@ } table->handler = handler; g_free(table->original); - table->original = (unsigned char *) g_memdup(original, original_length); + table->original = (unsigned char *) g_memdup(original, (guint)original_length); table->original_length = original_length; return; } @@ -242,11 +242,11 @@ int initial; GByteArray *b; - initial = original_length - length; + initial = (int) (original_length - length); /* FIXME */ b = g_byte_array_new(); g_byte_array_set_size(b, 0); g_byte_array_append(b, original, initial); - g_byte_array_append(b, (const guint8*)pattern + 2, length - 2); + g_byte_array_append(b, (const guint8*)pattern + 2, (guint)(length - 2)); _vte_table_addi(table, b->data, b->len, (const char *)b->data + initial, b->len - initial, handler); g_byte_array_free(b, TRUE); Modified: branches/compyx/joymap-003/vice/src/arch/gtk3/novte/vte.cc =================================================================== --- branches/compyx/joymap-003/vice/src/arch/gtk3/novte/vte.cc 2025-05-12 17:39:06 UTC (rev 45674) +++ branches/compyx/joymap-003/vice/src/arch/gtk3/novte/vte.cc 2025-05-14 08:41:08 UTC (rev 45675) @@ -349,13 +349,13 @@ * by multiplying by the size of a character cell. * Always include the extra pixel border and overlap pixel. */ - rect.x = column_start * m_cell_width - 1; + rect.x = (int)(column_start * (m_cell_width - 1)); /* The extra + 1 is for the faux-bold overdraw */ - int xend = (column_start + n_columns) * m_cell_width + 1 + 1; + int xend = (int)(((column_start + n_columns) * m_cell_width) + 1 + 1); rect.width = xend - rect.x; - rect.y = row_to_pixel(row_start) - 1; - int yend = row_to_pixel(row_start + n_rows) + 1; + rect.y = (int)(row_to_pixel(row_start) - 1); + int yend = (int)(row_to_pixel(row_start + n_rows) + 1); rect.height = yend - rect.y; _vte_debug_print (VTE_DEBUG_UPDATES, "Invalidating pixels at (%d,%d)x(%d,%d).\n", @@ -385,11 +385,11 @@ bool block) { if (block || srow == erow) { - invalidate_cells(scolumn, ecolumn - scolumn + 1, srow, erow - srow + 1); + invalidate_cells(scolumn, (int)(ecolumn - scolumn + 1), srow, (int)(erow - srow + 1)); } else { - invalidate_cells(scolumn, m_column_count - scolumn, srow, 1); - invalidate_cells(0, m_column_count, srow + 1, erow - srow - 1); - invalidate_cells(0, ecolumn + 1, erow, 1); + invalidate_cells(scolumn, (int)(m_column_count - scolumn), srow, 1); + invalidate_cells(0, (int)m_column_count, srow + 1, (int)(erow - srow - 1)); + invalidate_cells(0, (int)ecolumn + 1, erow, 1); } } @@ -450,8 +450,8 @@ /* We have to repaint the area which is to be * scrolled. */ invalidate_cells( - 0, m_column_count, - row, count); + 0, (int)m_column_count, + row, (int)count); } } @@ -607,7 +607,7 @@ if (cell->c != 0) { int right; _vte_draw_get_char_edges(m_draw, cell->c, columns, style, NULL, &right); - columns = MAX(columns, howmany(right, m_cell_width)); + columns = MAX(columns, howmany(right, ((int)m_cell_width))); } } } @@ -647,7 +647,7 @@ auto style = _vte_draw_get_style(cell->attr.bold(), cell->attr.italic()); if (cell->c != 0) { int right; - _vte_draw_get_char_edges(m_draw, cell->c, columns, style, NULL, &right); + _vte_draw_get_char_edges(m_draw, cell->c, (int)columns, style, NULL, &right); columns = MAX(columns, howmany(right, m_cell_width)); } } @@ -658,7 +658,7 @@ _vte_debug_print(VTE_DEBUG_UPDATES, "Invalidating cursor at (%ld,%ld-%ld).\n", row, column, column + columns); - invalidate_cells(column, columns, row, 1); + invalidate_cells(column, (int)columns, row, 1); } } @@ -870,10 +870,10 @@ emit_selection_changed(); - sx = m_selection_start.col; - sy = m_selection_start.row; - ex = m_selection_end.col; - ey = m_selection_end.row; + sx = (gint)m_selection_start.col; + sy = (gint)m_selection_start.row; + ex = (gint)m_selection_end.col; + ey = (gint)m_selection_end.row; extra = m_selection_block_mode ? (VTE_TAB_WIDTH_MAX - 1) : 0; invalidate_region(MIN (sx, ex), MAX (sx, ex) + extra, MIN (sy, ey), MAX (sy, ey), @@ -1102,7 +1102,7 @@ return NULL; } - _vte_ring_get_hyperlink_at_position(m_screen->row_data, row, col, false, &hyperlink); + _vte_ring_get_hyperlink_at_position(m_screen->row_data, row, (int)col, false, &hyperlink); if (hyperlink != NULL) { /* URI is after the first semicolon */ @@ -1374,7 +1374,7 @@ NULL); if (obuf2 != NULL) { _vte_byte_array_clear(m_outgoing); - _vte_byte_array_append(m_outgoing, obuf2, bytes_written); + _vte_byte_array_append(m_outgoing, obuf2, (guint)bytes_written); g_free(obuf2); } g_free(obuf1); @@ -1427,9 +1427,9 @@ /* Figure out how many rows we need to add. */ //FIXMEchpe use long, not int - int delta = m_screen->cursor.row - _vte_ring_next(m_screen->row_data) + 1; + ssize_t delta = m_screen->cursor.row - _vte_ring_next(m_screen->row_data) + 1; if (delta > 0) { - row = insert_rows(delta); + row = insert_rows((int)delta); adjust_adjustments(); } else { /* Find the row the cursor is in. */ @@ -1457,7 +1457,7 @@ auto rows = _vte_ring_next(m_screen->row_data); auto delta = m_screen->cursor.row - rows + 1; if (G_UNLIKELY (delta > 0)) { - insert_rows(delta); + insert_rows((guint)delta); rows = _vte_ring_next(m_screen->row_data); } @@ -1671,7 +1671,7 @@ color.red += 0x3fff; } } else if (i < 232) { - int j = i - 16; + int j = (int)(i - 16); int r = j / 36, g = (j / 6) % 6, b = j % 6; int red = (r == 0) ? 0 : r * 40 + 55; int green = (g == 0) ? 0 : g * 40 + 55; @@ -1680,7 +1680,7 @@ color.green = green | green << 8; color.blue = blue | blue << 8; } else if (i < 256) { - int shade = 8 + (i - 232) * 10; + int shade = (int)(8 + (i - 232) * 10); color.red = color.green = color.blue = shade | shade << 8; } else switch (i) { case VTE_DEFAULT_BG: @@ -1725,9 +1725,9 @@ /* Set up the color entry. */ if (unset) { - reset_color(i, VTE_COLOR_SOURCE_API); + reset_color((int)i, VTE_COLOR_SOURCE_API); } else { - set_color(i, VTE_COLOR_SOURCE_API, color); + set_color((int)i, VTE_COLOR_SOURCE_API, color); } } } @@ -1932,7 +1932,7 @@ cell_end->c = '\t'; cell_end->attr.set_fragment(false); g_assert(cell_col->attr.columns() > end - col); - cell_end->attr.set_columns(cell_col->attr.columns() - (end - col)); + cell_end->attr.set_columns((int)(cell_col->attr.columns() - (end - col))); } else { _vte_debug_print(VTE_DEBUG_MISC, "Cleaning CJK right half at %ld\n", @@ -2014,7 +2014,7 @@ ring_insert(end, true); /* Update the display. */ scroll_region(start, end - start + 1, -1); - invalidate_cells(0, m_column_count, end - 2, 2); + invalidate_cells(0, (int)m_column_count, end - 2, 2); } } else { /* Scroll up with history. */ @@ -2293,7 +2293,7 @@ /* Signal that this part of the window needs drawing. */ if (G_UNLIKELY (invalidate_now)) { invalidate_cells(col - columns, - insert ? m_column_count : columns, + insert ? (int)m_column_count : columns, m_screen->cursor.row, 1); } @@ -2383,7 +2383,7 @@ if (G_UNLIKELY (processed != chunk->len)) { /* shuffle the data about */ g_memmove (chunk->data, chunk->data + processed, chunk->len - processed); - chunk->len = chunk->len - processed; + chunk->len = (guint)(chunk->len - processed); processed = sizeof (chunk->data) - chunk->len; if (processed != 0 && next_chunk != NULL) { if (next_chunk->len <= processed) { @@ -2492,10 +2492,10 @@ m_screen->cursor.row < bbox_topleft.y - VTE_CELL_BBOX_SLACK))) { /* Clip off any part of the box which isn't already on-screen. */ bbox_topleft.x = MAX(bbox_topleft.x, 0); - bbox_topleft.y = MAX(bbox_topleft.y, top_row); - bbox_bottomright.x = MIN(bbox_bottomright.x, m_column_count); + bbox_topleft.y = MAX(bbox_topleft.y, ((int)top_row)); + bbox_bottomright.x = MIN(bbox_bottomright.x, ((gint)m_column_count)); /* lazily apply the +1 to the cursor_row */ - bbox_bottomright.y = MIN(bbox_bottomright.y + 1, bottom_row + 1); + bbox_bottomright.y = MIN(bbox_bottomright.y + 1, ((gint)(bottom_row + 1))); invalidate_cells(bbox_topleft.x, bbox_bottomright.x - bbox_topleft.x, @@ -2521,10 +2521,10 @@ if ((c != *next) && ((*next & 0x1f) == *next) && //FIXMEchpe what about C1 controls - (start + 1 < next - wbuf)) { + ((start + 1) < (next - wbuf))) { const gunichar *tnext = NULL; gunichar ctrl; - int i; + ptrdiff_t i; /* We don't want to permute it if it's another * control sequence, so check if it is. */ sequence_handler_t thandler; @@ -2536,13 +2536,13 @@ NULL); /* We only do this for non-control-sequence * characters and random garbage. */ - if (tnext == next + 1) { + if (tnext == (next + 1)) { /* Save the control character. */ ctrl = *next; /* Move everything before it up a * slot. */ /* FIXMEchpe memmove! */ - for (i = next - wbuf; i > start; i--) { + for (i = (next - wbuf); i > start; i--) { wbuf[i] = wbuf[i - 1]; } /* Move the control character to the @@ -2566,8 +2566,8 @@ } } - bbox_topleft.x = MIN(bbox_topleft.x, m_screen->cursor.col); - bbox_topleft.y = MIN(bbox_topleft.y, m_screen->cursor.row); + bbox_topleft.x = MIN(bbox_topleft.x, ((gint)m_screen->cursor.col)); + bbox_topleft.y = MIN(bbox_topleft.y, ((int)m_screen->cursor.row)); /* Insert the character. */ /* FIXMEchpe should not use UNLIKELY here */ @@ -2580,10 +2580,10 @@ m_screen->cursor.row < bbox_topleft.y - VTE_CELL_BBOX_SLACK)) { /* Clip off any part of the box which isn't already on-screen. */ bbox_topleft.x = MAX(bbox_topleft.x, 0); - bbox_topleft.y = MAX(bbox_topleft.y, top_row); - bbox_bottomright.x = MIN(bbox_bottomright.x, m_column_count); + bbox_topleft.y = MAX(bbox_topleft.y, ((gint)top_row)); + bbox_bottomright.x = MIN(bbox_bottomright.x, ((gint)m_column_count)); /* lazily apply the +1 to the cursor_row */ - bbox_bottomright.y = MIN(bbox_bottomright.y + 1, bottom_row + 1); + bbox_bottomright.y = MIN(bbox_bottomright.y + 1, ((gint)(bottom_row + 1))); invalidate_cells(bbox_topleft.x, bbox_bottomright.x - bbox_topleft.x, @@ -2593,13 +2593,13 @@ bbox_topleft.x = bbox_topleft.y = G_MAXINT; } bbox_topleft.x = MIN(bbox_topleft.x, 0); - bbox_topleft.y = MIN(bbox_topleft.y, m_screen->cursor.row); + bbox_topleft.y = MIN(bbox_topleft.y, ((int)m_screen->cursor.row)); } /* Add the cells over which we have moved to the region * which we need to refresh for the user. */ - bbox_bottomright.x = MAX(bbox_bottomright.x, m_screen->cursor.col); + bbox_bottomright.x = MAX(bbox_bottomright.x, ((int)m_screen->cursor.col)); /* cursor.row + 1 (defer until inv.) */ - bbox_bottomright.y = MAX(bbox_bottomright.y, m_screen->cursor.row); + bbox_bottomright.y = MAX(bbox_bottomright.y, ((int)m_screen->cursor.row)); invalidated_text = TRUE; /* We *don't* emit flush pending signals here. */ @@ -2614,7 +2614,7 @@ * data to consult. If we have data following the * middle of the sequence, then it's just garbage data, * and for compatibility, we should discard it. */ - if (wbuf + wcount > next) { + if ((wbuf + wcount) > next) { _vte_debug_print(VTE_DEBUG_PARSE, "Invalid control " "sequence, discarding %ld " @@ -2649,7 +2649,7 @@ /* Remove most of the processed characters. */ if (start < wcount) { - g_array_remove_range(m_pending, 0, start); + g_array_remove_range(m_pending, 0, (guint)start); } else { g_array_set_size(m_pending, 0); /* If we're out of data, we needn't pause to let the @@ -2690,10 +2690,10 @@ if (invalidated_text) { /* Clip off any part of the box which isn't already on-screen. */ bbox_topleft.x = MAX(bbox_topleft.x, 0); - bbox_topleft.y = MAX(bbox_topleft.y, top_row); - bbox_bottomright.x = MIN(bbox_bottomright.x, m_column_count); + bbox_topleft.y = MAX(bbox_topleft.y, ((gint)top_row)); + bbox_bottomright.x = MIN(bbox_bottomright.x, (gint)m_column_count); /* lazily apply the +1 to the cursor_row */ - bbox_bottomright.y = MIN(bbox_bottomright.y + 1, bottom_row + 1); + bbox_bottomright.y = MIN(bbox_bottomright.y + 1, ((gint)bottom_row + 1)); invalidate_cells(bbox_topleft.x, bbox_bottomright.x - bbox_topleft.x, @@ -2948,11 +2948,11 @@ } cairo_rectangle_int_t rect; - rect.x = m_screen->cursor.col * m_cell_width + m_padding.left + - get_preedit_width(false) * m_cell_width; - rect.width = m_cell_width; /* FIXMEchpe: if columns > 1 ? */ - rect.y = row_to_pixel(m_screen->cursor.row) + m_padding.top; - rect.height = m_cell_height; + rect.x = (int)(m_screen->cursor.col * m_cell_width + m_padding.left + + get_preedit_width(false) * m_cell_width); + rect.width = (int)m_cell_width; /* FIXMEchpe: if columns > 1 ? */ + rect.y = (int)(row_to_pixel(m_screen->cursor.row) + m_padding.top); + rect.height = (int)m_cell_height; gtk_im_context_set_cursor_location(m_im_context, &rect); } @@ -4042,10 +4042,10 @@ g_assert (top != LONG_MAX && bottom != -1 && left != LONG_MAX && right != -1); auto allocation = get_allocated_rect(); - bbox->x = allocation.x + m_padding.left + left * m_cell_width; - bbox->y = allocation.y + m_padding.top + row_to_pixel(top); - bbox->width = (right - left + 1) * m_cell_width; - bbox->height = (bottom - top + 1) * m_cell_height; + bbox->x = (int)(allocation.x + m_padding.left + left * m_cell_width); + bbox->y = (int)(allocation.y + m_padding.top + row_to_pixel(top)); + bbox->width = (int)((right - left + 1) * m_cell_width); + bbox->height = (int)((bottom - top + 1) * m_cell_height); _vte_debug_print (VTE_DEBUG_HYPERLINK, "Hyperlink bounding box: x=%d y=%d w=%d h=%d\n", bbox->x, bbox->y, bbox->width, bbox->height); @@ -4104,7 +4104,7 @@ * the pseudo idx VTE_HYPERLINK_IDX_TARGET_IN_STREAM and now a real idx is allocated. * Plus, the ring's internal belief of the hovered hyperlink is also updated. */ if (do_check_hilite) { - m_hyperlink_hover_idx = _vte_ring_get_hyperlink_at_position(m_screen->row_data, rowcol.row(), rowcol.column(), true, &m_hyperlink_hover_uri); + m_hyperlink_hover_idx = _vte_ring_get_hyperlink_at_position(m_screen->row_data, rowcol.row(), (int)rowcol.column(), true, &m_hyperlink_hover_uri); } else { m_hyperlink_hover_idx = 0; m_hyperlink_hover_uri = nullptr; @@ -4229,7 +4229,7 @@ if (info == VTE_TARGET_TEXT) { gtk_selection_data_set_text(data, m_selection[sel]->str, - m_selection[sel]->len); + (gint)m_selection[sel]->len); } else if (info == VTE_TARGET_HTML) { gsize len; auto selection = text_to_utf16_mozilla(m_selection[sel], &len); @@ -4239,7 +4239,7 @@ gdk_atom_intern_static_string("text/html"), 16, (const guchar *)selection, - len); + (gint)len); } g_free(selection); } else { @@ -4361,7 +4361,7 @@ * attributes, one per byte. */ if (attributes) { vte_g_array_fill(attributes, - &attr, string->len); + &attr, (guint)(string->len)); } } @@ -4392,7 +4392,7 @@ if (pcell == NULL) { g_string_truncate(string, last_nonempty); if (attributes) { - g_array_set_size(attributes, string->len); + g_array_set_size(attributes, (guint)string->len); } attr.column = last_nonemptycol; } @@ -4418,7 +4418,7 @@ /* Make sure that the attributes array is as long as the string. */ if (attributes) { - vte_g_array_fill (attributes, &attr, string->len); + vte_g_array_fill (attributes, &attr, (guint)(string->len)); } } @@ -5768,9 +5768,9 @@ case GDK_MOTION_NOTIFY: if (m_selecting_after_threshold) { if (!gtk_drag_check_threshold (m_widget, - m_mouse_last_position.x, - m_mouse_last_position.y, - pos.x, pos.y)) { + (gint)m_mouse_last_position.x, + (gint)m_mouse_last_position.y, + (gint)pos.x, (gint)pos.y)) { return true; } @@ -6192,7 +6192,7 @@ } /* Emit a signal that the font changed. */ if (cresize) { - emit_char_size_changed(m_cell_width, m_cell_height); + emit_char_size_changed((int)m_cell_width, (int)m_cell_height); } /* Repaint. */ invalidate_all(); @@ -6428,7 +6428,7 @@ drop3 = old_top_lines - new_top_lines; drop = MIN(MIN(drop1, drop2), drop3); if (drop > 0) { - int new_ring_next = screen_->insert_delta + m_row_count - drop; + long new_ring_next = screen_->insert_delta + m_row_count - drop; _vte_debug_print(VTE_DEBUG_RESIZE, "Dropping %ld [== MIN(%ld, %ld, %ld)] rows at the bottom\n", drop, drop1, drop2, drop3); @@ -6814,13 +6814,11 @@ #if 0 refresh_size(); /* FIXME */ #endif - *minimum_width = m_cell_width * 1; - *natural_width = m_cell_width * m_column_count; + *minimum_width = (int)(m_cell_width * 1); + *natural_width = (int)(m_cell_width * m_column_count); - *minimum_width += m_padding.left + - m_padding.right; - *natural_width += m_padding.left + - m_padding.right; + *minimum_width += (int)(m_padding.left + m_padding.right); + *natural_width += (int)(m_padding.left + m_padding.right); _vte_debug_print(VTE_DEBUG_WIDGET_SIZE, "[Terminal %p] minimum_width=%d, natural_width=%d for %ldx%ld cells (padding %d,%d;%d,%d).\n", @@ -6842,13 +6840,11 @@ refresh_size(); /* FIXME */ #endif - *minimum_height = m_cell_height * 1; - *natural_height = m_cell_height * m_row_count; + *minimum_height = (int)(m_cell_height * 1); + *natural_height = (int)(m_cell_height * m_row_count); - *minimum_height += m_padding.top + - m_padding.bottom; - *natural_height += m_padding.top + - m_padding.bottom; + *minimum_height += m_padding.top + m_padding.bottom; + *natural_height += m_padding.top + m_padding.bottom; _vte_debug_print(VTE_DEBUG_WIDGET_SIZE, "[Terminal %p] minimum_height=%d, natural_height=%d for %ldx%ld cells (padding %d,%d;%d,%d).\n", @@ -7106,7 +7102,7 @@ * and also put text/html on if it's VTE_FORMAT_HTML */ gtk_clipboard_set_text(m_clipboard[sel], m_selection[sel]->str, - m_selection[sel]->len); + (gint)(m_selection[sel]->len)); } g_string_free(m_selection[sel], TRUE); m_selection[sel] = nullptr; @@ -7509,9 +7505,9 @@ case 1: _vte_draw_draw_line(m_draw, x, - y + m_underline_position, + (int)(y + m_underline_position), x + (columns * column_width) - 1, - y + m_underline_position + m_underline_thickness - 1, + (int)(y + m_underline_position + m_underline_thickness - 1), VTE_LINE_WIDTH, &dc, VTE_DRAW_OPAQUE); break; @@ -7518,16 +7514,16 @@ case 2: _vte_draw_draw_line(m_draw, x, - y + m_double_underline_position, + (int)(y + m_double_underline_position), x + (columns * column_width) - 1, - y + m_double_underline_position + m_double_underline_thickness - 1, + (int)(y + m_double_underline_position + m_double_underline_thickness - 1), VTE_LINE_WIDTH, &dc, VTE_DRAW_OPAQUE); _vte_draw_draw_line(m_draw, x, - y + m_double_underline_position + 2 * m_double_underline_thickness, + (int)(y + m_double_underline_position + 2 * m_double_underline_thickness), x + (columns * column_width) - 1, - y + m_double_underline_position + 3 * m_double_underline_thickness - 1, + (int)(y + m_double_underline_position + 3 * m_double_underline_thickness - 1), VTE_LINE_WIDTH, &dc, VTE_DRAW_OPAQUE); break; @@ -7543,9 +7539,9 @@ if (attr & VTE_ATTR_STRIKETHROUGH) { _vte_draw_draw_line(m_draw, x, - y + m_strikethrough_position, + (int)(y + m_strikethrough_position), x + (columns * column_width) - 1, - y + m_strikethrough_position + m_strikethrough_thickness - 1, + (int)(y + m_strikethrough_position + m_strikethrough_thickness - 1), VTE_LINE_WIDTH, &fg, VTE_DRAW_OPAQUE); } @@ -7552,9 +7548,9 @@ if (attr & VTE_ATTR_OVERLINE) { _vte_draw_draw_line(m_draw, x, - y + m_overline_position, + (int)(y + m_overline_position), x + (columns * column_width) - 1, - y + m_overline_position + m_overline_thickness - 1, + (int)(y + m_overline_position + m_overline_thickness - 1), VTE_LINE_WIDTH, &fg, VTE_DRAW_OPAQUE); } @@ -7561,9 +7557,9 @@ if (hilite) { _vte_draw_draw_line(m_draw, x, - y + m_regex_underline_position, + (int)(y + m_regex_underline_position), x + (columns * column_width) - 1, - y + m_regex_underline_position + m_regex_underline_thickness - 1, + (int)(y + m_regex_underline_position + m_regex_underline_thickness - 1), VTE_LINE_WIDTH, &fg, VTE_DRAW_OPAQUE); } else if (hyperlink) { @@ -7570,9 +7566,9 @@ for (double j = 1.0 / 6.0; j < columns; j += 0.5) { _vte_draw_fill_rectangle(m_draw, x + j * column_width, - y + m_regex_underline_position, + (int)(y + m_regex_underline_position), MAX(column_width / 6.0, 1.0), - m_regex_underline_thickness, + (int)(m_regex_underline_thickness), &fg, VTE_DRAW_OPAQUE); } } @@ -7609,7 +7605,7 @@ for (i = 0; i < n; i++) { gchar ubuf[7]; gint len = g_unichar_to_utf8 (cells[i].c, ubuf); - props[i].index = sumlen; + props[i].index = (guint)sumlen; props[i].saw_fg = props[i].saw_bg = FALSE; sumlen += len; } @@ -7943,9 +7939,9 @@ rgb_from_index<8, 8, 8>(back, bg); _vte_draw_fill_rectangle ( m_draw, - x + i * column_width, - y, - (j - i) * column_width + bold_offset, + (int)(x + i * column_width), + (int)y, + (gint)((j - i) * column_width + bold_offset), row_height, &bg, VTE_DRAW_OPAQUE); } @@ -7969,9 +7965,9 @@ vte::color::rgb bg; rgb_from_index<8, 8, 8>(back, bg); _vte_draw_fill_rectangle (m_draw, - x + i *column_width, - y, - (j - i) * column_width, + (int)(x + i * column_width), + (int)y, + (int)((j - i) * column_width), row_height, &bg, VTE_DRAW_OPAQUE); } @@ -8183,10 +8179,10 @@ #if VTE_DEBUG cairo_rectangle_int_t old_rect = rect; #endif - rect.x = col * m_cell_width; - rect.width = (col_stop - col) * m_cell_width; - rect.y = row_to_pixel(row); - rect.height = (row_stop - row) * m_cell_height; + rect.x = (int)(col * m_cell_width); + rect.width = (int)((col_stop - col) * m_cell_width); + rect.y = (int)row_to_pixel(row); + rect.height = (int)((row_stop - row) * m_cell_height); _vte_debug_print (VTE_DEBUG_UPDATES, "expand_rectangle" @@ -8235,10 +8231,10 @@ draw_rows(m_screen, row, row_stop, col, col_stop, - col * m_cell_width, - row_to_pixel(row), - m_cell_width, - m_cell_height); + (gint)(col * m_cell_width), + (gint)row_to_pixel(row), + (gint)m_cell_width, + (gint)m_cell_height); } void VteTerminalPrivate::paint_cursor() @@ -8263,8 +8259,8 @@ col = m_screen->cursor.col; drow = m_screen->cursor.row; - width = m_cell_width; - height = m_cell_height; + width = (int)m_cell_width; + height = (int)m_cell_height; /* TODOegmont: clamp on rows? tricky... */ if (CLAMP(col, 0, m_column_count - 1) != col) { @@ -8316,10 +8312,11 @@ int stem_width; stem_width = (int) (((float) (m_char_ascent + m_char_descent)) * m_cursor_aspect_ratio + 0.5); - stem_width = CLAMP (stem_width, VTE_LINE_WIDTH, m_cell_width); + stem_width = CLAMP (stem_width, VTE_LINE_WIDTH, (int)m_cell_width); _vte_draw_fill_rectangle(m_draw, - x, y + m_char_padding.top, stem_width, m_char_ascent + m_char_descent, + x, y + m_char_padding.top, stem_width, + (int)(m_char_ascent + m_char_descent), &bg, VTE_DRAW_OPAQUE); break; } @@ -8337,10 +8334,10 @@ /* use height (not width) so underline and ibeam will * be equally visible */ line_height = (int) (((float) (m_char_ascent + m_char_descent)) * m_cursor_aspect_ratio + 0.5); - line_height = CLAMP (line_height, VTE_LINE_WIDTH, m_char_ascent + m_char_descent); + line_height = CLAMP (line_height, VTE_LINE_WIDTH, (int)(m_char_ascent + m_char_descent)); left = m_char_padding.left; - right = item.columns * m_cell_width - m_char_padding.right; + right = (int)(item.columns * m_cell_width - m_char_padding.right); if (cell && cell->c != 0 && cell->c != ' ' && cell->c != '\t') { int l, r; @@ -8350,7 +8347,8 @@ } _vte_draw_fill_rectangle(m_draw, - x + left, y + m_cell_height - m_char_padding.bottom - line_height, + x + left, + (gint)(y + m_cell_height - m_char_padding.bottom - line_height), right - left, line_height, &bg, VTE_DRAW_OPAQUE); break; @@ -8413,14 +8411,14 @@ height = m_cell_height; /* Find out how many columns the pre-edit string takes up. */ - columns = get_preedit_width(false); - len = get_preedit_length(false); + columns = (int)get_preedit_width(false); + len = (int)get_preedit_length(false); /* If the pre-edit string won't fit on the screen if we start * drawing it at the cursor's position, move it left. */ - col = m_screen->cursor.col; + col = (int)(m_screen->cursor.col); if (col + columns > m_column_count) { - col = MAX(0, m_column_count - columns); + col = MAX(0, (int)(m_column_count - columns)); } /* Draw the preedit string, boxed. */ @@ -8440,10 +8438,10 @@ } if (G_LIKELY(m_clear_background)) { _vte_draw_clear(m_draw, - col * width, - row_to_pixel(m_screen->cursor.row), - width * columns, - height, + (int)(col * width), + (gint)row_to_pixel(m_screen->cursor.row), + (int)(width * columns), + (int)height, get_color(VTE_DEFAULT_BG), m_background_alpha); } draw_cells_with_attributes( @@ -8450,7 +8448,7 @@ items, len, m_im_preedit_attrs, TRUE, - width, height); + (int)width, (int)height); preedit_cursor = m_im_preedit_cursor; if (preedit_cursor >= 0 && preedit_cursor < len) { @@ -8466,7 +8464,7 @@ VTE_ATTR_NONE | VTE_ATTR_BOXED, FALSE, /* hyperlink */ FALSE, /* hilite */ - width, height); + (int)width, (int)height); } g_free(items); } @@ -8496,8 +8494,8 @@ return; } - allocated_width = get_allocated_width(); - allocated_height = get_allocated_height(); + allocated_width = (int)get_allocated_width(); + allocated_height = (int)get_allocated_height(); /* Designate the start of the drawing operation and clear the area. */ _vte_draw_set_cairo(m_draw, cr); Modified: branches/compyx/joymap-003/vice/src/arch/gtk3/novte/vteaccess.cc =================================================================== --- branches/compyx/joymap-003/vice/src/arch/gtk3/novte/vteaccess.cc 2025-05-12 17:39:06 UTC (rev 45674) +++ branches/compyx/joymap-003/vice/src/arch/gtk3/novte/vteaccess.cc 2025-05-14 08:41:08 UTC (rev 45675) @@ -200,7 +200,7 @@ char *next; long row, offset,... [truncated message content] |
From: <co...@us...> - 2025-05-12 17:39:08
|
Revision: 45674 http://sourceforge.net/p/vice-emu/code/45674 Author: compyx Date: 2025-05-12 17:39:06 +0000 (Mon, 12 May 2025) Log Message: ----------- Joystick: update driver implementation docs Modified Paths: -------------- branches/compyx/joymap-003/vice/doc/joystick.md Modified: branches/compyx/joymap-003/vice/doc/joystick.md =================================================================== --- branches/compyx/joymap-003/vice/doc/joystick.md 2025-05-12 15:33:17 UTC (rev 45673) +++ branches/compyx/joymap-003/vice/doc/joystick.md 2025-05-12 17:39:06 UTC (rev 45674) @@ -3,7 +3,7 @@ > To get a nicely formatted HTML version of this document, including syntax > highlighting, use: > -> `pandoc -s -t html -f gfm joystick.md > joystick.html` +> `pandoc -s -t html -f gfm joystick.md | sed 's/36em;/42em;/' > joystick.html` ## Preface @@ -112,15 +112,41 @@ } joystick_driver_t; ``` -> Currently (re)opening a device hasn't been implemented yet, so the `open()` -> method can be ignored, for now. - ### Driver methods +#### `bool open(joystick_device_t *joydev)` + +The `open()` method should open the joystick device so it's ready to be polled +(e.g. open file descriptor, initialize OS-specific objects to use the device). +If a device is already open, the method should ignore this and return `true` +(this way reopening a device via a resource setter doesn't trigger an error). +If opening the device fails this method should return `false`. + + +#### `void poll(joystick_device_t *joydev)` + The `poll()` method is called by the emulation at the end of *every emulated scanline*, and is expected to process any pending event data and pass that along to `joy_axis_event()`, `joy_button_event()` or `joy_hat_event()`. +The `poll()` method should check the `joystick_device_t`'s `status` member +before actually polling: + +```C +if ((joydev->status & JOY_POLL_MASK) == JOY_POLL_NONE) { + return; +} +``` + +> The `status` member has three poll states: `JOY_POLL_NONE` (no polling), +> `JOY_POLL_MAIN` (events are passed to the main loop, i.e. the emulated devices) +> and `JOY_POLL_UI` (events are passed to the UI for mapping and calibration). +> The generic code takes care of where events are passed to, so the driver only +> needs to concern itself with whether to poll or not (so far). + + +#### `void close(joystick_device_t *joydev)` + The `close()` method should close the host device (e.g. close file descriptor) and put the device in a proper state for opening again. It should **not** free its private data in the `priv` member of the `joystick_device_t`, that is done @@ -128,6 +154,9 @@ It should also **not** free the joystick device instance, that again is done by the joystick system. + +#### `void priv_free(void *priv)` + The `priv_free()` method (if used) is, as mentioned above, called on emulator shutdown (or once we implement plug-n-pray, on device unplugging), and can be used to free any arch-specific resources that cannot be contained in the @@ -135,6 +164,9 @@ > For example: the DirectInput driver for Windows stores a `GUID` and an > `LPDIRECTINPUTDEVICE8` instance in `priv`. + +#### `void customize(joystick_device_t *joydev)` + The `customize()` method can be used to customize the default mapping and calibration applied by the joystick system when `joystick_device_register()` is called. @@ -154,6 +186,7 @@ /* Declaration of driver methods */ static joystick_driver_t foo_driver = { + .open = foo_open, .poll = foo_poll, .close = foo_close .priv_free = foo_priv_free @@ -184,7 +217,7 @@ whatever */ joydev->vendor = foodev->vendor_id; /* USB HID vendor ID */ joydev->product = foodev->product_id; /* USB HID product ID */ - + /* Iterate axes, buttons and perhaps hats of a device and add them */ for (int a = 0; a < NUM_AXES(foodev); a++) { @@ -230,6 +263,11 @@ { foo_priv_t *priv = joydev->priv; + /* check poll state: exit if no polling is requested */ + if ((joydev->status & JOY_POLL_MASK == JOY_POLL_NONE) { + return; + } + while (HAS_EVENT_PENDING(priv->foodev) { FOO_EVENT event = GET_EVENT(priv->foodev); @@ -247,6 +285,21 @@ } +static bool foo_open(joystick_device-t *joydev) +{ + foo_priv_t *priv = joydev->priv; + + /* return true if device is already open */ + if (FOO_DEVICE_IS_OPEN(priv->foodev)) { + return true; + } + + if (!FOO_DEVICE_OPEN(priv->foodev)) { + return false; + } + return true; +} + static void foo_close(joystick_device_t *joydev) { foo_priv_t *priv = joydev->priv; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-05-12 15:33:19
|
Revision: 45673 http://sourceforge.net/p/vice-emu/code/45673 Author: gpz Date: 2025-05-12 15:33:17 +0000 (Mon, 12 May 2025) Log Message: ----------- some minimon fixes, better handling of the case when no rom image is attached at startup Modified Paths: -------------- trunk/vice/src/vic20/cart/minimon.c Modified: trunk/vice/src/vic20/cart/minimon.c =================================================================== --- trunk/vice/src/vic20/cart/minimon.c 2025-05-12 05:23:26 UTC (rev 45672) +++ trunk/vice/src/vic20/cart/minimon.c 2025-05-12 15:33:17 UTC (rev 45673) @@ -179,6 +179,48 @@ /* ------------------------------------------------------------------------- */ +static int minimon_rom_reload(char *filename); + +/* FIXME: this still needs to be tweaked to match the hardware */ +static RAMINITPARAM ramparam = { + .start_value = 255, + .value_invert = 2, + .value_offset = 1, + + .pattern_invert = 0x100, + .pattern_invert_value = 255, + + .random_start = 0, + .random_repeat = 0, + .random_chance = 0, +}; + +static void clear_ram(void) +{ + DBG(("clear_rom: clear buffer with RAM pattern")); + ram_init_with_pattern(minimon_rom, CART_ROM_SIZE, &ramparam); +} + +static void clear_eprom(void) +{ + DBG(("clear_rom: clear buffer with EPROM pattern")); + memset(minimon_rom, CART_ROM_SIZE, 0xff); +} + +static void allocate_rom(void) +{ + if (!minimon_rom) { + DBG(("allocate_rom: allocate buffer")); + minimon_rom = lib_malloc(CART_ROM_SIZE); + clear_ram(); + if (minimon_image_filename) { + minimon_rom_reload(minimon_image_filename); + } + } +} + +/* ------------------------------------------------------------------------- */ + /* Some prototypes are needed */ static uint8_t minimon_io2_read(uint16_t addr); static uint8_t minimon_io3_read(uint16_t addr); @@ -231,6 +273,9 @@ /* (only) register the io devices */ static int io_register(void) { + DBG(("io_register")); + allocate_rom(); + /* HACK: mem_cart_blocks is reserved for main slot */ minimon_io23_temp = mem_cart_blocks & (VIC_CART_IO2 | VIC_CART_IO3); mem_cart_blocks |= (VIC_CART_IO2 | VIC_CART_IO3); @@ -251,6 +296,7 @@ /* (only) un-register the io devices */ static int io_unregister(void) { + DBG(("io_unregister")); if (minimon_io2_list_item != NULL) { io_source_unregister(minimon_io2_list_item); minimon_io2_list_item = NULL; @@ -321,30 +367,6 @@ /* ------------------------------------------------------------------------- */ -/* FIXME: this still needs to be tweaked to match the hardware */ -static RAMINITPARAM ramparam = { - .start_value = 255, - .value_invert = 2, - .value_offset = 1, - - .pattern_invert = 0x100, - .pattern_invert_value = 255, - - .random_start = 0, - .random_repeat = 0, - .random_chance = 0, -}; - -static void allocate_rom(void) -{ - if (!minimon_rom) { - DBG(("allocate_rom: allocate buffer")); - minimon_rom = lib_malloc(CART_ROM_SIZE); - } - DBG(("allocate_rom: clear buffer with pattern")); - ram_init_with_pattern(minimon_rom, CART_ROM_SIZE, &ramparam); -} - void minimon_freeze(void) { DBG(("minimon_freeze")); @@ -425,16 +447,18 @@ /* set the MinimonFilename resource */ static int set_minimon_image_filename(const char *name, void *param) { + DBG(("set_minimon_image_filename '%s'", name)); if (minimon_image_filename != NULL && name != NULL && strcmp(name, minimon_image_filename) == 0) { return 0; } - if (name != NULL && *name != '\0') { + if ((name != NULL) && (*name != '\0')) { if (util_check_filename_access(name) < 0) { return -1; } } + DBG(("set_minimon_image_filename")); if (minimon_enabled) { minimon_flush_image(); util_string_set(&minimon_image_filename, name); @@ -442,6 +466,8 @@ util_string_set(&minimon_image_filename, name); } + /* FIXME: load new image */ + return 0; } @@ -463,6 +489,15 @@ DBG(("set_minimon_enabled: %d to %d", minimon_enabled, val)); if (val) { + + /* prepare the RAM/ROM */ + if (minimon_rom) { + clear_ram(); + if (minimon_image_filename) { + minimon_rom_reload(minimon_image_filename); + } + } + /* enable cartridge */ if (export_add(&export_res23) < 0) { return -1; @@ -470,6 +505,7 @@ if (minimon_io_enabled) { io_register(); } + /* FIXME: minimon_reload_file(); */ minimon_alarm_install(); } else { /* disable cartridge */ @@ -578,11 +614,62 @@ return 0; } +static int minimon_rom_reload(char *filename) +{ + crt_header_t header; + crt_chip_header_t chip; + FILE *fd = NULL; + + DBG(("minimon_rom_attach")); + + clear_eprom(); + if (minimon_bios_type != CARTRIDGE_FILETYPE_BIN) { + fd = crt_open(filename, &header); + + if (fd == NULL) { + return -1; + } + if (crt_read_chip_header(&chip, fd)) { + fclose(fd); + goto trybinary; + } + + if (chip.size != CART_ROM_SIZE) { + fclose(fd); + goto trybinary; + } + + if (crt_read_chip(&minimon_rom[0], 0, &chip, fd)) { + fclose(fd); + goto trybinary; + } + + minimon_bios_type = CARTRIDGE_FILETYPE_CRT; + DBG(("minimon_rom_attach (loaded: crt)")); + fclose(fd); + return 0; + } +trybinary: + + if (minimon_bios_type != CARTRIDGE_FILETYPE_CRT) { + if (zfile_load(filename, minimon_rom, (size_t)CART_ROM_SIZE) < 0) { + return -1; + } + minimon_bios_type = CARTRIDGE_FILETYPE_BIN; + DBG(("minimon_rom_attach (loaded: bin)")); + return 0; + } + return -1; +} + int minimon_crt_attach(FILE *fd, uint8_t *rawcart) { crt_chip_header_t chip; + DBG(("minimon_crt_attach")); + allocate_rom(); + clear_eprom(); if (crt_read_chip_header(&chip, fd)) { goto exiterror; @@ -606,6 +693,9 @@ minimon_enabled = 1; /* resource */ minimon_io_enabled = 1; /* resource */ + minimon_bios_type = CARTRIDGE_FILETYPE_CRT; + /* FIXME: set_minimon_image_filename(filename, NULL); */ /* set the resource */ + minimon_alarm_install(); return CARTRIDGE_VIC20_MINIMON; @@ -617,7 +707,10 @@ int minimon_bin_attach(const char *filename, uint8_t *rawcart) { + DBG(("minimon_bin_attach")); + allocate_rom(); + clear_eprom(); if (zfile_load(filename, minimon_rom, (size_t)CART_ROM_SIZE) < 0) { minimon_detach(); @@ -699,32 +792,6 @@ return -1; } -#if 0 -static int minimon_activate(void) -{ - minimon_bios_changed = 0; - /* mmc64_reset(); */ - return 0; -} - -static int minimon_deactivate(void) -{ - int ret; - - if (minimon_bios_changed &&minimon_bios_write) { - if (minimon_bios_type == CARTRIDGE_FILETYPE_CRT) { - ret = minimon_crt_save(minimon_bios_filename); - } else { - ret = minimon_bin_save(minimon_bios_filename); - } - if (ret <= 0) { - return 0; /* FIXME */ - } - } - return 0; -} -#endif - int minimon_flush_image(void) { /* FIXME */ @@ -768,6 +835,7 @@ return set_minimon_enabled(0, (void*)1); /* setup the resource */ } + /* ------------------------------------------------------------------------- */ /* MINIMON snapshot module format: This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-05-12 05:23:28
|
Revision: 45672 http://sourceforge.net/p/vice-emu/code/45672 Author: compyx Date: 2025-05-12 05:23:26 +0000 (Mon, 12 May 2025) Log Message: ----------- Fix printf format specifier warning Modified Paths: -------------- trunk/vice/src/monitor/monitor_binary.c Modified: trunk/vice/src/monitor/monitor_binary.c =================================================================== --- trunk/vice/src/monitor/monitor_binary.c 2025-05-11 15:51:30 UTC (rev 45671) +++ trunk/vice/src/monitor/monitor_binary.c 2025-05-12 05:23:26 UTC (rev 45672) @@ -1497,7 +1497,7 @@ response_size = 4 + count * (item_size + 1); if (response_size > UINT32_MAX) { monitor_binary_error(e_MON_ERR_INVALID_PARAMETER, command->request_id); - log_message(LOG_DEFAULT, "monitor binary cpuhistory: Response too long %lu", response_size); + log_message(LOG_DEFAULT, "monitor binary cpuhistory: Response too long %"PRI_SIZE_T, response_size); return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-05-11 15:51:33
|
Revision: 45671 http://sourceforge.net/p/vice-emu/code/45671 Author: gpz Date: 2025-05-11 15:51:30 +0000 (Sun, 11 May 2025) Log Message: ----------- don't use g_memdup2 Modified Paths: -------------- trunk/vice/src/arch/gtk3/novte/table.cc Modified: trunk/vice/src/arch/gtk3/novte/table.cc =================================================================== --- trunk/vice/src/arch/gtk3/novte/table.cc 2025-05-11 14:22:41 UTC (rev 45670) +++ trunk/vice/src/arch/gtk3/novte/table.cc 2025-05-11 15:51:30 UTC (rev 45671) @@ -211,7 +211,7 @@ } table->handler = handler; g_free(table->original); - table->original = (unsigned char *) g_memdup2(original, original_length); + table->original = (unsigned char *) g_memdup(original, (guint)original_length); table->original_length = original_length; return; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |