vice-emu-commit Mailing List for VICE (Page 7)
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
(18) |
Nov
|
Dec
|
From: <co...@us...> - 2025-04-28 16:50:54
|
Revision: 45648 http://sourceforge.net/p/vice-emu/code/45648 Author: compyx Date: 2025-04-28 16:50:35 +0000 (Mon, 28 Apr 2025) Log Message: ----------- Merge trunk (r45645:HEAD) into branch Modified Paths: -------------- branches/compyx/joymap-002/vice/src/c128/c128-resources.c branches/compyx/joymap-002/vice/src/c128/c128model.h branches/compyx/joymap-002/vice/src/c64/c64-resources.c branches/compyx/joymap-002/vice/src/c64/c64.h branches/compyx/joymap-002/vice/src/c64/c64mem.c branches/compyx/joymap-002/vice/src/c64/c64memsc.c branches/compyx/joymap-002/vice/src/c64/c64model.h branches/compyx/joymap-002/vice/src/c64/c64pla.c branches/compyx/joymap-002/vice/src/c64/c64pla.h Modified: branches/compyx/joymap-002/vice/src/c128/c128-resources.c =================================================================== --- branches/compyx/joymap-002/vice/src/c128/c128-resources.c 2025-04-28 10:19:46 UTC (rev 45647) +++ branches/compyx/joymap-002/vice/src/c128/c128-resources.c 2025-04-28 16:50:35 UTC (rev 45648) @@ -133,7 +133,7 @@ int cia1_model = CIA_MODEL_6526A; int cia2_model = CIA_MODEL_6526A; -static int board_type = BOARD_C128D; +int board_type = BOARD_C128D; static int set_c128_full_banks(int val, void *param) { @@ -178,7 +178,7 @@ static int set_board_type(int val, void *param) { int old_board_type = board_type; - if ((val < 0) || (val > 1)) { + if ((val < BOARD_C128) || (val > BOARD_LAST)) { return -1; } board_type = val; Modified: branches/compyx/joymap-002/vice/src/c128/c128model.h =================================================================== --- branches/compyx/joymap-002/vice/src/c128/c128model.h 2025-04-28 10:19:46 UTC (rev 45647) +++ branches/compyx/joymap-002/vice/src/c128/c128model.h 2025-04-28 16:50:35 UTC (rev 45648) @@ -44,8 +44,7 @@ #define C128MODEL_UNKNOWN 99 -#define BOARD_C128 0 -#define BOARD_C128D 1 +#include "c64model.h" /* for the BOARD_ constants */ #define OLD_CIA 0 #define NEW_CIA 1 Modified: branches/compyx/joymap-002/vice/src/c64/c64-resources.c =================================================================== --- branches/compyx/joymap-002/vice/src/c64/c64-resources.c 2025-04-28 10:19:46 UTC (rev 45647) +++ branches/compyx/joymap-002/vice/src/c64/c64-resources.c 2025-04-28 16:50:35 UTC (rev 45648) @@ -135,7 +135,7 @@ static int set_board_type(int val, void *param) { int old_board_type = board_type; - if ((val < 0) || (val > BOARD_LAST)) { + if ((val < 0) || (val > BOARD_LAST_C64)) { return -1; } board_type = val; Modified: branches/compyx/joymap-002/vice/src/c64/c64.h =================================================================== --- branches/compyx/joymap-002/vice/src/c64/c64.h 2025-04-28 10:19:46 UTC (rev 45647) +++ branches/compyx/joymap-002/vice/src/c64/c64.h 2025-04-28 16:50:35 UTC (rev 45648) @@ -77,6 +77,8 @@ 8500 */ #define C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES 350000 +/* bits 3,4,5 are not connected on SX-64 board. apparently they take a bit longer */ +#define SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES 1500000 /* cpuports.prg from the lorenz testsuite will fail when the falloff takes less than 5984 cycles. he explicitly delays by ~1280 cycles and mentions capacitance, Modified: branches/compyx/joymap-002/vice/src/c64/c64mem.c =================================================================== --- branches/compyx/joymap-002/vice/src/c64/c64mem.c 2025-04-28 10:19:46 UTC (rev 45647) +++ branches/compyx/joymap-002/vice/src/c64/c64mem.c 2025-04-28 16:50:35 UTC (rev 45648) @@ -50,6 +50,7 @@ #include "cartio.h" #include "cartridge.h" #include "cia.h" +#include "lib.h" #include "machine.h" #include "maincpu.h" #include "mem.h" @@ -269,11 +270,28 @@ case 1: retval = pport.data_read; + /* discharge the "capacitor" */ + /* FIXME: bits 3,4,5 are not connected on SX-64 boards - whether they show similar behaviour needs to be tested */ + if (board_type == BOARD_SX64) { + /* set real value of read bit 3 */ + if (pport.data_falloff_bit3 && (pport.data_set_clk_bit3 < maincpu_clk)) { + pport.data_falloff_bit3 = 0; + pport.data_set_bit3 = 0; + } + /* set real value of read bit 4 */ + if (pport.data_falloff_bit4 && (pport.data_set_clk_bit4 < maincpu_clk)) { + pport.data_falloff_bit4 = 0; + pport.data_set_bit4 = 0; + } + /* set real value of read bit 5 */ + if (pport.data_falloff_bit5 && (pport.data_set_clk_bit5 < maincpu_clk)) { + pport.data_falloff_bit5 = 0; + pport.data_set_bit5 = 0; + } + } - /* discharge the "capacitor" */ - /* set real value of read bit 6 */ if (pport.data_falloff_bit6 && (pport.data_set_clk_bit6 < maincpu_clk)) { pport.data_falloff_bit6 = 0; @@ -287,6 +305,23 @@ } /* for unused bits in input mode, the value comes from the "capacitor" */ + if (board_type == BOARD_SX64) { + /* set real value of bit 3 */ + if (!(pport.dir_read & 0x08)) { + retval &= ~0x08; + retval |= pport.data_set_bit3; + } + /* set real value of bit 4 */ + if (!(pport.dir_read & 0x10)) { + retval &= ~0x10; + retval |= pport.data_set_bit4; + } + /* set real value of bit 5 */ + if (!(pport.dir_read & 0x20)) { + retval &= ~0x20; + retval |= pport.data_set_bit5; + } + } /* set real value of bit 6 */ if (!(pport.dir_read & 0x40)) { @@ -328,6 +363,9 @@ } } +#define FALLOFF_RANDOM (C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES / 5) +#define FALLOFF_RANDOM_SX (SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES / 5) + /* store zeropage, 0/1 goes to CPU port */ void zero_store(uint16_t addr, uint8_t value) { @@ -355,10 +393,34 @@ stable value) to input mode (where the input is floating), some of the charge is transferred to the floating input */ + if (board_type == BOARD_SX64) { + if ((pport.dir & 0x08)) { + if ((pport.dir ^ value) & 0x08) { + pport.data_set_clk_bit3 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_set_bit3 = pport.data & 0x08; + pport.data_falloff_bit3 = 1; + } + } + if ((pport.dir & 0x10)) { + if ((pport.dir ^ value) & 0x10) { + pport.data_set_clk_bit4 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_set_bit4 = pport.data & 0x10; + pport.data_falloff_bit4 = 1; + } + } + if ((pport.dir & 0x20)) { + if ((pport.dir ^ value) & 0x20) { + pport.data_set_clk_bit5 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_set_bit5 = pport.data & 0x20; + pport.data_falloff_bit5 = 1; + } + } + } + /* check if bit 6 has flipped */ if ((pport.dir & 0x40)) { if ((pport.dir ^ value) & 0x40) { - pport.data_set_clk_bit6 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES; + pport.data_set_clk_bit6 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM); pport.data_set_bit6 = pport.data & 0x40; pport.data_falloff_bit6 = 1; } @@ -367,7 +429,7 @@ /* check if bit 7 has flipped */ if ((pport.dir & 0x80)) { if ((pport.dir ^ value) & 0x80) { - pport.data_set_clk_bit7 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES; + pport.data_set_clk_bit7 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM); pport.data_set_bit7 = pport.data & 0x80; pport.data_falloff_bit7 = 1; } @@ -398,16 +460,34 @@ otherwise don't touch it */ if (pport.dir & 0x80) { pport.data_set_bit7 = value & 0x80; - pport.data_set_clk_bit7 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES; + pport.data_set_clk_bit7 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM); pport.data_falloff_bit7 = 1; } if (pport.dir & 0x40) { pport.data_set_bit6 = value & 0x40; - pport.data_set_clk_bit6 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES; + pport.data_set_clk_bit6 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM); pport.data_falloff_bit6 = 1; } + if (board_type == BOARD_SX64) { + if (pport.dir & 0x20) { + pport.data_set_bit5 = value & 0x20; + pport.data_set_clk_bit5 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_falloff_bit5 = 1; + } + if (pport.dir & 0x10) { + pport.data_set_bit4 = value & 0x10; + pport.data_set_clk_bit4 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_falloff_bit4 = 1; + } + if (pport.dir & 0x08) { + pport.data_set_bit3 = value & 0x08; + pport.data_set_clk_bit3 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_falloff_bit3 = 1; + } + } + if (pport.data != value) { pport.data = value; mem_pla_config_changed(); Modified: branches/compyx/joymap-002/vice/src/c64/c64memsc.c =================================================================== --- branches/compyx/joymap-002/vice/src/c64/c64memsc.c 2025-04-28 10:19:46 UTC (rev 45647) +++ branches/compyx/joymap-002/vice/src/c64/c64memsc.c 2025-04-28 16:50:35 UTC (rev 45648) @@ -51,6 +51,7 @@ #include "cartridge.h" #include "cia.h" #include "cpmcart.h" +#include "lib.h" #include "machine.h" #include "mainc64cpu.h" #include "maincpu.h" @@ -275,6 +276,23 @@ /* FIXME: bits 3,4,5 are not connected on SX-64 boards - whether they show similar behaviour needs to be tested */ + if (board_type == BOARD_SX64) { + /* set real value of read bit 3 */ + if (pport.data_falloff_bit3 && (pport.data_set_clk_bit3 < maincpu_clk)) { + pport.data_falloff_bit3 = 0; + pport.data_set_bit3 = 0; + } + /* set real value of read bit 4 */ + if (pport.data_falloff_bit4 && (pport.data_set_clk_bit4 < maincpu_clk)) { + pport.data_falloff_bit4 = 0; + pport.data_set_bit4 = 0; + } + /* set real value of read bit 5 */ + if (pport.data_falloff_bit5 && (pport.data_set_clk_bit5 < maincpu_clk)) { + pport.data_falloff_bit5 = 0; + pport.data_set_bit5 = 0; + } + } /* set real value of read bit 6 */ if (pport.data_falloff_bit6 && (pport.data_set_clk_bit6 < maincpu_clk)) { @@ -289,6 +307,23 @@ } /* for unused bits in input mode, the value comes from the "capacitor" */ + if (board_type == BOARD_SX64) { + /* set real value of bit 3 */ + if (!(pport.dir_read & 0x08)) { + retval &= ~0x08; + retval |= pport.data_set_bit3; + } + /* set real value of bit 4 */ + if (!(pport.dir_read & 0x10)) { + retval &= ~0x10; + retval |= pport.data_set_bit4; + } + /* set real value of bit 5 */ + if (!(pport.dir_read & 0x20)) { + retval &= ~0x20; + retval |= pport.data_set_bit5; + } + } /* set real value of bit 6 */ if (!(pport.dir_read & 0x40)) { @@ -328,6 +363,9 @@ } } +#define FALLOFF_RANDOM (C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES / 5) +#define FALLOFF_RANDOM_SX (SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES / 5) + /* store zeropage, 0/1 goes to CPU port */ void zero_store(uint16_t addr, uint8_t value) { @@ -354,10 +392,34 @@ stable value) to input mode (where the input is floating), some of the charge is transferred to the floating input */ + if (board_type == BOARD_SX64) { + if ((pport.dir & 0x08)) { + if ((pport.dir ^ value) & 0x08) { + pport.data_set_clk_bit3 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_set_bit3 = pport.data & 0x08; + pport.data_falloff_bit3 = 1; + } + } + if ((pport.dir & 0x10)) { + if ((pport.dir ^ value) & 0x10) { + pport.data_set_clk_bit4 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_set_bit4 = pport.data & 0x10; + pport.data_falloff_bit4 = 1; + } + } + if ((pport.dir & 0x20)) { + if ((pport.dir ^ value) & 0x20) { + pport.data_set_clk_bit5 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_set_bit5 = pport.data & 0x20; + pport.data_falloff_bit5 = 1; + } + } + } + /* check if bit 6 has flipped */ if ((pport.dir & 0x40)) { if ((pport.dir ^ value) & 0x40) { - pport.data_set_clk_bit6 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES; + pport.data_set_clk_bit6 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM); pport.data_set_bit6 = pport.data & 0x40; pport.data_falloff_bit6 = 1; } @@ -366,7 +428,7 @@ /* check if bit 7 has flipped */ if ((pport.dir & 0x80)) { if ((pport.dir ^ value) & 0x80) { - pport.data_set_clk_bit7 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES; + pport.data_set_clk_bit7 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM); pport.data_set_bit7 = pport.data & 0x80; pport.data_falloff_bit7 = 1; } @@ -398,16 +460,34 @@ otherwise don't touch it */ if (pport.dir & 0x80) { pport.data_set_bit7 = value & 0x80; - pport.data_set_clk_bit7 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES; + pport.data_set_clk_bit7 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM); pport.data_falloff_bit7 = 1; } if (pport.dir & 0x40) { pport.data_set_bit6 = value & 0x40; - pport.data_set_clk_bit6 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES; + pport.data_set_clk_bit6 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM); pport.data_falloff_bit6 = 1; } + if (board_type == BOARD_SX64) { + if (pport.dir & 0x20) { + pport.data_set_bit5 = value & 0x20; + pport.data_set_clk_bit5 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_falloff_bit5 = 1; + } + if (pport.dir & 0x10) { + pport.data_set_bit4 = value & 0x10; + pport.data_set_clk_bit4 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_falloff_bit4 = 1; + } + if (pport.dir & 0x08) { + pport.data_set_bit3 = value & 0x08; + pport.data_set_clk_bit3 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_falloff_bit3 = 1; + } + } + if (pport.data != value) { pport.data = value; mem_pla_config_changed(); Modified: branches/compyx/joymap-002/vice/src/c64/c64model.h =================================================================== --- branches/compyx/joymap-002/vice/src/c64/c64model.h 2025-04-28 10:19:46 UTC (rev 45647) +++ branches/compyx/joymap-002/vice/src/c64/c64model.h 2025-04-28 16:50:35 UTC (rev 45648) @@ -70,11 +70,15 @@ #define GLUE_DISCRETE 0 #define GLUE_CUSTOM_IC 1 -#define BOARD_C64 0 -#define BOARD_MAX 1 -#define BOARD_SX64 2 -#define BOARD_C128 3 -#define BOARD_LAST 3 +/* CAUTION: these are shared with x128 */ +#define BOARD_C64 0 +#define BOARD_MAX 1 +#define BOARD_SX64 2 +#define BOARD_LAST_C64 2 +/* put all C128 boards last */ +#define BOARD_C128 3 +#define BOARD_C128D 4 +#define BOARD_LAST 4 #define IEC_HARD_RESET 0 #define IEC_SOFT_RESET 1 Modified: branches/compyx/joymap-002/vice/src/c64/c64pla.c =================================================================== --- branches/compyx/joymap-002/vice/src/c64/c64pla.c 2025-04-28 10:19:46 UTC (rev 45647) +++ branches/compyx/joymap-002/vice/src/c64/c64pla.c 2025-04-28 16:50:35 UTC (rev 45648) @@ -28,6 +28,7 @@ #include "vice.h" #include "c64pla.h" +#include "c64model.h" #include "datasette.h" #include "mem.h" #include "tapeport.h" @@ -44,6 +45,9 @@ /* Tape sense line out status. */ static uint8_t old_port_sense_out = 0xff; +/* import from c64-resources.c - don't use the resource for performance reasons */ +extern int board_type; + void c64pla_config_changed(int tape_sense, int write_in, int motor_in, int caps_sense, uint8_t pullup) { pport.data_out = (pport.data_out & ~pport.dir) | (pport.data & pport.dir); @@ -72,17 +76,23 @@ if (((pport.dir & pport.data) & 0x20) != old_port_data_out) { old_port_data_out = (pport.dir & pport.data) & 0x20; - tapeport_set_motor(TAPEPORT_PORT_1, !old_port_data_out); + if (board_type != BOARD_SX64) { + tapeport_set_motor(TAPEPORT_PORT_1, !old_port_data_out); + } } if (((~pport.dir | pport.data) & 0x8) != old_port_write_bit) { old_port_write_bit = (~pport.dir | pport.data) & 0x8; - tapeport_toggle_write_bit(TAPEPORT_PORT_1, (~pport.dir | pport.data) & 0x8); + if (board_type != BOARD_SX64) { + tapeport_toggle_write_bit(TAPEPORT_PORT_1, (~pport.dir | pport.data) & 0x8); + } } if (((pport.dir & pport.data) & 0x10) != old_port_sense_out) { old_port_sense_out = (pport.dir & pport.data) & 0x10; - tapeport_set_sense_out(TAPEPORT_PORT_1, !old_port_sense_out); + if (board_type != BOARD_SX64) { + tapeport_set_sense_out(TAPEPORT_PORT_1, !old_port_sense_out); + } } pport.dir_read = pport.dir; @@ -100,8 +110,14 @@ pport.data_read = 0; pport.dir = 0; pport.dir_read = 0; + pport.data_set_bit3 = 0; + pport.data_set_bit4 = 0; + pport.data_set_bit5 = 0; pport.data_set_bit6 = 0; pport.data_set_bit7 = 0; + pport.data_falloff_bit3 = 0; + pport.data_falloff_bit4 = 0; + pport.data_falloff_bit5 = 0; pport.data_falloff_bit6 = 0; pport.data_falloff_bit7 = 0; } Modified: branches/compyx/joymap-002/vice/src/c64/c64pla.h =================================================================== --- branches/compyx/joymap-002/vice/src/c64/c64pla.h 2025-04-28 10:19:46 UTC (rev 45647) +++ branches/compyx/joymap-002/vice/src/c64/c64pla.h 2025-04-28 16:50:35 UTC (rev 45648) @@ -43,6 +43,9 @@ uint8_t data_out; /* cycle that should invalidate the unused bits of the data port. */ + CLOCK data_set_clk_bit3; /* SX-64 only */ + CLOCK data_set_clk_bit4; /* SX-64 only */ + CLOCK data_set_clk_bit5; /* SX-64 only */ CLOCK data_set_clk_bit6; CLOCK data_set_clk_bit7; @@ -49,10 +52,16 @@ /* indicates if the unused bits of the data port are still valid or should be read as 0, 1 = unused bits valid, 0 = unused bits should be 0 */ + uint8_t data_set_bit3; /* SX-64 only */ + uint8_t data_set_bit4; /* SX-64 only */ + uint8_t data_set_bit5; /* SX-64 only */ uint8_t data_set_bit6; uint8_t data_set_bit7; /* indicated if the unused bits are in the process of falling off. */ + uint8_t data_falloff_bit3; /* SX-64 only */ + uint8_t data_falloff_bit4; /* SX-64 only */ + uint8_t data_falloff_bit5; /* SX-64 only */ uint8_t data_falloff_bit6; uint8_t data_falloff_bit7; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-04-28 10:20:04
|
Revision: 45647 http://sourceforge.net/p/vice-emu/code/45647 Author: compyx Date: 2025-04-28 10:19:46 +0000 (Mon, 28 Apr 2025) Log Message: ----------- Joystick: DirectInput: manually keep track of 'acquired' state of devices Since DirectInput doesn't provide a way to determine if a device is acquired we must keep track of this ourselves. Modified Paths: -------------- branches/compyx/joymap-002/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c Modified: branches/compyx/joymap-002/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c =================================================================== --- branches/compyx/joymap-002/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-04-27 21:28:22 UTC (rev 45646) +++ branches/compyx/joymap-002/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-04-28 10:19:46 UTC (rev 45647) @@ -26,7 +26,8 @@ */ #include "vice.h" - +#include <stdbool.h> +#include <stdint.h> #include "joyport.h" #include "joystick.h" #include "lib.h" @@ -54,8 +55,11 @@ * Contains arch-specific data of a joystick device. */ typedef struct joy_priv_s { - GUID guid; /**< GUID */ - LPDIRECTINPUTDEVICE8 didev; /**< DirectInput device instance */ + GUID guid; /**< GUID */ + LPDIRECTINPUTDEVICE8 didev; /**< DirectInput device instance */ + bool acquired; /**< device has been acquired (DirectInput + doesn't provide any method to determine + if a device is acquired) */ LONG prev_axes[DIJS2_MAX_AXES]; /**< prev state of axes */ BYTE prev_buttons[DIJS2_MAX_BUTTONS]; /**< prev state of buttons */ WORD prev_hats[DIJS2_MAX_HATS]; /**< prev state of POVs */ @@ -82,7 +86,8 @@ static joy_priv_t *joy_priv_new(void) { joy_priv_t *priv = lib_calloc(sizeof *priv, 1); - priv->didev = NULL; + priv->didev = NULL; + priv->acquired = false; /* set POV values to neutral (0xffff) */ memset(priv->prev_hats, 0xff, sizeof priv->prev_hats); return priv; @@ -124,11 +129,13 @@ result = IDirectInputDevice8_Acquire(priv->didev); if (SUCCEEDED(result)) { - return true; + priv->acquired = true; + } else { + log_error(winjoy_log, "failed to acquire device \"%s\": error 0x%08lx", + joydev->name, (unsigned long)result); + priv->acquired = false; } - log_error(winjoy_log, "failed to acquire device \"%s\": error 0x%08lx", - joydev->name, (unsigned long)result); - return false; + return priv->acquired; } /** \brief Joystick drive poll() method @@ -166,7 +173,11 @@ HRESULT result; /* poll device */ - priv = joydev->priv; + priv = joydev->priv; + if (!priv->acquired) { + /* not open, done */ + return; + } result = IDirectInputDevice8_Poll(priv->didev); if (result != DI_OK && result != DI_NOEFFECT) { return; @@ -248,6 +259,7 @@ joy_priv_t *priv = joydev->priv; IDirectInputDevice8_Unacquire(priv->didev); + priv->acquired = false; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-04-27 21:28:41
|
Revision: 45646 http://sourceforge.net/p/vice-emu/code/45646 Author: gpz Date: 2025-04-27 21:28:22 +0000 (Sun, 27 Apr 2025) Log Message: ----------- emulate open cpu port bits 3-4 on the SX64 board, add some randomness to the delay time for all of them, which should be a bit more correct Modified Paths: -------------- trunk/vice/src/c64/c64.h trunk/vice/src/c64/c64mem.c trunk/vice/src/c64/c64memsc.c trunk/vice/src/c64/c64pla.c trunk/vice/src/c64/c64pla.h Modified: trunk/vice/src/c64/c64.h =================================================================== --- trunk/vice/src/c64/c64.h 2025-04-27 21:09:22 UTC (rev 45645) +++ trunk/vice/src/c64/c64.h 2025-04-27 21:28:22 UTC (rev 45646) @@ -77,6 +77,8 @@ 8500 */ #define C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES 350000 +/* bits 3,4,5 are not connected on SX-64 board. apparently they take a bit longer */ +#define SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES 1500000 /* cpuports.prg from the lorenz testsuite will fail when the falloff takes less than 5984 cycles. he explicitly delays by ~1280 cycles and mentions capacitance, Modified: trunk/vice/src/c64/c64mem.c =================================================================== --- trunk/vice/src/c64/c64mem.c 2025-04-27 21:09:22 UTC (rev 45645) +++ trunk/vice/src/c64/c64mem.c 2025-04-27 21:28:22 UTC (rev 45646) @@ -50,6 +50,7 @@ #include "cartio.h" #include "cartridge.h" #include "cia.h" +#include "lib.h" #include "machine.h" #include "maincpu.h" #include "mem.h" @@ -269,11 +270,28 @@ case 1: retval = pport.data_read; + /* discharge the "capacitor" */ + /* FIXME: bits 3,4,5 are not connected on SX-64 boards - whether they show similar behaviour needs to be tested */ + if (board_type == BOARD_SX64) { + /* set real value of read bit 3 */ + if (pport.data_falloff_bit3 && (pport.data_set_clk_bit3 < maincpu_clk)) { + pport.data_falloff_bit3 = 0; + pport.data_set_bit3 = 0; + } + /* set real value of read bit 4 */ + if (pport.data_falloff_bit4 && (pport.data_set_clk_bit4 < maincpu_clk)) { + pport.data_falloff_bit4 = 0; + pport.data_set_bit4 = 0; + } + /* set real value of read bit 5 */ + if (pport.data_falloff_bit5 && (pport.data_set_clk_bit5 < maincpu_clk)) { + pport.data_falloff_bit5 = 0; + pport.data_set_bit5 = 0; + } + } - /* discharge the "capacitor" */ - /* set real value of read bit 6 */ if (pport.data_falloff_bit6 && (pport.data_set_clk_bit6 < maincpu_clk)) { pport.data_falloff_bit6 = 0; @@ -287,6 +305,23 @@ } /* for unused bits in input mode, the value comes from the "capacitor" */ + if (board_type == BOARD_SX64) { + /* set real value of bit 3 */ + if (!(pport.dir_read & 0x08)) { + retval &= ~0x08; + retval |= pport.data_set_bit3; + } + /* set real value of bit 4 */ + if (!(pport.dir_read & 0x10)) { + retval &= ~0x10; + retval |= pport.data_set_bit4; + } + /* set real value of bit 5 */ + if (!(pport.dir_read & 0x20)) { + retval &= ~0x20; + retval |= pport.data_set_bit5; + } + } /* set real value of bit 6 */ if (!(pport.dir_read & 0x40)) { @@ -328,6 +363,9 @@ } } +#define FALLOFF_RANDOM (C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES / 5) +#define FALLOFF_RANDOM_SX (SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES / 5) + /* store zeropage, 0/1 goes to CPU port */ void zero_store(uint16_t addr, uint8_t value) { @@ -355,10 +393,34 @@ stable value) to input mode (where the input is floating), some of the charge is transferred to the floating input */ + if (board_type == BOARD_SX64) { + if ((pport.dir & 0x08)) { + if ((pport.dir ^ value) & 0x08) { + pport.data_set_clk_bit3 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_set_bit3 = pport.data & 0x08; + pport.data_falloff_bit3 = 1; + } + } + if ((pport.dir & 0x10)) { + if ((pport.dir ^ value) & 0x10) { + pport.data_set_clk_bit4 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_set_bit4 = pport.data & 0x10; + pport.data_falloff_bit4 = 1; + } + } + if ((pport.dir & 0x20)) { + if ((pport.dir ^ value) & 0x20) { + pport.data_set_clk_bit5 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_set_bit5 = pport.data & 0x20; + pport.data_falloff_bit5 = 1; + } + } + } + /* check if bit 6 has flipped */ if ((pport.dir & 0x40)) { if ((pport.dir ^ value) & 0x40) { - pport.data_set_clk_bit6 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES; + pport.data_set_clk_bit6 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM); pport.data_set_bit6 = pport.data & 0x40; pport.data_falloff_bit6 = 1; } @@ -367,7 +429,7 @@ /* check if bit 7 has flipped */ if ((pport.dir & 0x80)) { if ((pport.dir ^ value) & 0x80) { - pport.data_set_clk_bit7 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES; + pport.data_set_clk_bit7 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM); pport.data_set_bit7 = pport.data & 0x80; pport.data_falloff_bit7 = 1; } @@ -398,16 +460,34 @@ otherwise don't touch it */ if (pport.dir & 0x80) { pport.data_set_bit7 = value & 0x80; - pport.data_set_clk_bit7 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES; + pport.data_set_clk_bit7 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM); pport.data_falloff_bit7 = 1; } if (pport.dir & 0x40) { pport.data_set_bit6 = value & 0x40; - pport.data_set_clk_bit6 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES; + pport.data_set_clk_bit6 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM); pport.data_falloff_bit6 = 1; } + if (board_type == BOARD_SX64) { + if (pport.dir & 0x20) { + pport.data_set_bit5 = value & 0x20; + pport.data_set_clk_bit5 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_falloff_bit5 = 1; + } + if (pport.dir & 0x10) { + pport.data_set_bit4 = value & 0x10; + pport.data_set_clk_bit4 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_falloff_bit4 = 1; + } + if (pport.dir & 0x08) { + pport.data_set_bit3 = value & 0x08; + pport.data_set_clk_bit3 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_falloff_bit3 = 1; + } + } + if (pport.data != value) { pport.data = value; mem_pla_config_changed(); Modified: trunk/vice/src/c64/c64memsc.c =================================================================== --- trunk/vice/src/c64/c64memsc.c 2025-04-27 21:09:22 UTC (rev 45645) +++ trunk/vice/src/c64/c64memsc.c 2025-04-27 21:28:22 UTC (rev 45646) @@ -51,6 +51,7 @@ #include "cartridge.h" #include "cia.h" #include "cpmcart.h" +#include "lib.h" #include "machine.h" #include "mainc64cpu.h" #include "maincpu.h" @@ -275,6 +276,23 @@ /* FIXME: bits 3,4,5 are not connected on SX-64 boards - whether they show similar behaviour needs to be tested */ + if (board_type == BOARD_SX64) { + /* set real value of read bit 3 */ + if (pport.data_falloff_bit3 && (pport.data_set_clk_bit3 < maincpu_clk)) { + pport.data_falloff_bit3 = 0; + pport.data_set_bit3 = 0; + } + /* set real value of read bit 4 */ + if (pport.data_falloff_bit4 && (pport.data_set_clk_bit4 < maincpu_clk)) { + pport.data_falloff_bit4 = 0; + pport.data_set_bit4 = 0; + } + /* set real value of read bit 5 */ + if (pport.data_falloff_bit5 && (pport.data_set_clk_bit5 < maincpu_clk)) { + pport.data_falloff_bit5 = 0; + pport.data_set_bit5 = 0; + } + } /* set real value of read bit 6 */ if (pport.data_falloff_bit6 && (pport.data_set_clk_bit6 < maincpu_clk)) { @@ -289,6 +307,23 @@ } /* for unused bits in input mode, the value comes from the "capacitor" */ + if (board_type == BOARD_SX64) { + /* set real value of bit 3 */ + if (!(pport.dir_read & 0x08)) { + retval &= ~0x08; + retval |= pport.data_set_bit3; + } + /* set real value of bit 4 */ + if (!(pport.dir_read & 0x10)) { + retval &= ~0x10; + retval |= pport.data_set_bit4; + } + /* set real value of bit 5 */ + if (!(pport.dir_read & 0x20)) { + retval &= ~0x20; + retval |= pport.data_set_bit5; + } + } /* set real value of bit 6 */ if (!(pport.dir_read & 0x40)) { @@ -328,6 +363,9 @@ } } +#define FALLOFF_RANDOM (C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES / 5) +#define FALLOFF_RANDOM_SX (SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES / 5) + /* store zeropage, 0/1 goes to CPU port */ void zero_store(uint16_t addr, uint8_t value) { @@ -354,10 +392,34 @@ stable value) to input mode (where the input is floating), some of the charge is transferred to the floating input */ + if (board_type == BOARD_SX64) { + if ((pport.dir & 0x08)) { + if ((pport.dir ^ value) & 0x08) { + pport.data_set_clk_bit3 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_set_bit3 = pport.data & 0x08; + pport.data_falloff_bit3 = 1; + } + } + if ((pport.dir & 0x10)) { + if ((pport.dir ^ value) & 0x10) { + pport.data_set_clk_bit4 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_set_bit4 = pport.data & 0x10; + pport.data_falloff_bit4 = 1; + } + } + if ((pport.dir & 0x20)) { + if ((pport.dir ^ value) & 0x20) { + pport.data_set_clk_bit5 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_set_bit5 = pport.data & 0x20; + pport.data_falloff_bit5 = 1; + } + } + } + /* check if bit 6 has flipped */ if ((pport.dir & 0x40)) { if ((pport.dir ^ value) & 0x40) { - pport.data_set_clk_bit6 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES; + pport.data_set_clk_bit6 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM); pport.data_set_bit6 = pport.data & 0x40; pport.data_falloff_bit6 = 1; } @@ -366,7 +428,7 @@ /* check if bit 7 has flipped */ if ((pport.dir & 0x80)) { if ((pport.dir ^ value) & 0x80) { - pport.data_set_clk_bit7 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES; + pport.data_set_clk_bit7 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM); pport.data_set_bit7 = pport.data & 0x80; pport.data_falloff_bit7 = 1; } @@ -398,16 +460,34 @@ otherwise don't touch it */ if (pport.dir & 0x80) { pport.data_set_bit7 = value & 0x80; - pport.data_set_clk_bit7 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES; + pport.data_set_clk_bit7 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM); pport.data_falloff_bit7 = 1; } if (pport.dir & 0x40) { pport.data_set_bit6 = value & 0x40; - pport.data_set_clk_bit6 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES; + pport.data_set_clk_bit6 = maincpu_clk + C64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM); pport.data_falloff_bit6 = 1; } + if (board_type == BOARD_SX64) { + if (pport.dir & 0x20) { + pport.data_set_bit5 = value & 0x20; + pport.data_set_clk_bit5 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_falloff_bit5 = 1; + } + if (pport.dir & 0x10) { + pport.data_set_bit4 = value & 0x10; + pport.data_set_clk_bit4 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_falloff_bit4 = 1; + } + if (pport.dir & 0x08) { + pport.data_set_bit3 = value & 0x08; + pport.data_set_clk_bit3 = maincpu_clk + SX64_CPU6510_DATA_PORT_FALL_OFF_CYCLES + lib_unsigned_rand(0, FALLOFF_RANDOM_SX); + pport.data_falloff_bit3 = 1; + } + } + if (pport.data != value) { pport.data = value; mem_pla_config_changed(); Modified: trunk/vice/src/c64/c64pla.c =================================================================== --- trunk/vice/src/c64/c64pla.c 2025-04-27 21:09:22 UTC (rev 45645) +++ trunk/vice/src/c64/c64pla.c 2025-04-27 21:28:22 UTC (rev 45646) @@ -28,6 +28,7 @@ #include "vice.h" #include "c64pla.h" +#include "c64model.h" #include "datasette.h" #include "mem.h" #include "tapeport.h" @@ -44,6 +45,9 @@ /* Tape sense line out status. */ static uint8_t old_port_sense_out = 0xff; +/* import from c64-resources.c - don't use the resource for performance reasons */ +extern int board_type; + void c64pla_config_changed(int tape_sense, int write_in, int motor_in, int caps_sense, uint8_t pullup) { pport.data_out = (pport.data_out & ~pport.dir) | (pport.data & pport.dir); @@ -72,17 +76,23 @@ if (((pport.dir & pport.data) & 0x20) != old_port_data_out) { old_port_data_out = (pport.dir & pport.data) & 0x20; - tapeport_set_motor(TAPEPORT_PORT_1, !old_port_data_out); + if (board_type != BOARD_SX64) { + tapeport_set_motor(TAPEPORT_PORT_1, !old_port_data_out); + } } if (((~pport.dir | pport.data) & 0x8) != old_port_write_bit) { old_port_write_bit = (~pport.dir | pport.data) & 0x8; - tapeport_toggle_write_bit(TAPEPORT_PORT_1, (~pport.dir | pport.data) & 0x8); + if (board_type != BOARD_SX64) { + tapeport_toggle_write_bit(TAPEPORT_PORT_1, (~pport.dir | pport.data) & 0x8); + } } if (((pport.dir & pport.data) & 0x10) != old_port_sense_out) { old_port_sense_out = (pport.dir & pport.data) & 0x10; - tapeport_set_sense_out(TAPEPORT_PORT_1, !old_port_sense_out); + if (board_type != BOARD_SX64) { + tapeport_set_sense_out(TAPEPORT_PORT_1, !old_port_sense_out); + } } pport.dir_read = pport.dir; @@ -100,8 +110,14 @@ pport.data_read = 0; pport.dir = 0; pport.dir_read = 0; + pport.data_set_bit3 = 0; + pport.data_set_bit4 = 0; + pport.data_set_bit5 = 0; pport.data_set_bit6 = 0; pport.data_set_bit7 = 0; + pport.data_falloff_bit3 = 0; + pport.data_falloff_bit4 = 0; + pport.data_falloff_bit5 = 0; pport.data_falloff_bit6 = 0; pport.data_falloff_bit7 = 0; } Modified: trunk/vice/src/c64/c64pla.h =================================================================== --- trunk/vice/src/c64/c64pla.h 2025-04-27 21:09:22 UTC (rev 45645) +++ trunk/vice/src/c64/c64pla.h 2025-04-27 21:28:22 UTC (rev 45646) @@ -43,6 +43,9 @@ uint8_t data_out; /* cycle that should invalidate the unused bits of the data port. */ + CLOCK data_set_clk_bit3; /* SX-64 only */ + CLOCK data_set_clk_bit4; /* SX-64 only */ + CLOCK data_set_clk_bit5; /* SX-64 only */ CLOCK data_set_clk_bit6; CLOCK data_set_clk_bit7; @@ -49,10 +52,16 @@ /* indicates if the unused bits of the data port are still valid or should be read as 0, 1 = unused bits valid, 0 = unused bits should be 0 */ + uint8_t data_set_bit3; /* SX-64 only */ + uint8_t data_set_bit4; /* SX-64 only */ + uint8_t data_set_bit5; /* SX-64 only */ uint8_t data_set_bit6; uint8_t data_set_bit7; /* indicated if the unused bits are in the process of falling off. */ + uint8_t data_falloff_bit3; /* SX-64 only */ + uint8_t data_falloff_bit4; /* SX-64 only */ + uint8_t data_falloff_bit5; /* SX-64 only */ uint8_t data_falloff_bit6; uint8_t data_falloff_bit7; }; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-04-27 21:09:39
|
Revision: 45645 http://sourceforge.net/p/vice-emu/code/45645 Author: gpz Date: 2025-04-27 21:09:22 +0000 (Sun, 27 Apr 2025) Log Message: ----------- in some places we share code between the C64 and the C128 emulator, which uses the board_type resource/setting. this change makes sure we use different values for C64 and C128 boards everywhere, and we don't use values that do not for the resource Modified Paths: -------------- trunk/vice/src/c128/c128-resources.c trunk/vice/src/c128/c128model.h trunk/vice/src/c64/c64-resources.c trunk/vice/src/c64/c64model.h Modified: trunk/vice/src/c128/c128-resources.c =================================================================== --- trunk/vice/src/c128/c128-resources.c 2025-04-27 17:41:07 UTC (rev 45644) +++ trunk/vice/src/c128/c128-resources.c 2025-04-27 21:09:22 UTC (rev 45645) @@ -133,7 +133,7 @@ int cia1_model = CIA_MODEL_6526A; int cia2_model = CIA_MODEL_6526A; -static int board_type = BOARD_C128D; +int board_type = BOARD_C128D; static int set_c128_full_banks(int val, void *param) { @@ -178,7 +178,7 @@ static int set_board_type(int val, void *param) { int old_board_type = board_type; - if ((val < 0) || (val > 1)) { + if ((val < BOARD_C128) || (val > BOARD_LAST)) { return -1; } board_type = val; Modified: trunk/vice/src/c128/c128model.h =================================================================== --- trunk/vice/src/c128/c128model.h 2025-04-27 17:41:07 UTC (rev 45644) +++ trunk/vice/src/c128/c128model.h 2025-04-27 21:09:22 UTC (rev 45645) @@ -44,8 +44,7 @@ #define C128MODEL_UNKNOWN 99 -#define BOARD_C128 0 -#define BOARD_C128D 1 +#include "c64model.h" /* for the BOARD_ constants */ #define OLD_CIA 0 #define NEW_CIA 1 Modified: trunk/vice/src/c64/c64-resources.c =================================================================== --- trunk/vice/src/c64/c64-resources.c 2025-04-27 17:41:07 UTC (rev 45644) +++ trunk/vice/src/c64/c64-resources.c 2025-04-27 21:09:22 UTC (rev 45645) @@ -135,7 +135,7 @@ static int set_board_type(int val, void *param) { int old_board_type = board_type; - if ((val < 0) || (val > BOARD_LAST)) { + if ((val < 0) || (val > BOARD_LAST_C64)) { return -1; } board_type = val; Modified: trunk/vice/src/c64/c64model.h =================================================================== --- trunk/vice/src/c64/c64model.h 2025-04-27 17:41:07 UTC (rev 45644) +++ trunk/vice/src/c64/c64model.h 2025-04-27 21:09:22 UTC (rev 45645) @@ -70,11 +70,15 @@ #define GLUE_DISCRETE 0 #define GLUE_CUSTOM_IC 1 -#define BOARD_C64 0 -#define BOARD_MAX 1 -#define BOARD_SX64 2 -#define BOARD_C128 3 -#define BOARD_LAST 3 +/* CAUTION: these are shared with x128 */ +#define BOARD_C64 0 +#define BOARD_MAX 1 +#define BOARD_SX64 2 +#define BOARD_LAST_C64 2 +/* put all C128 boards last */ +#define BOARD_C128 3 +#define BOARD_C128D 4 +#define BOARD_LAST 4 #define IEC_HARD_RESET 0 #define IEC_SOFT_RESET 1 This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-04-27 17:41:27
|
Revision: 45644 http://sourceforge.net/p/vice-emu/code/45644 Author: compyx Date: 2025-04-27 17:41:07 +0000 (Sun, 27 Apr 2025) Log Message: ----------- Merge trunk (r45639:HEAD) into branch Modified Paths: -------------- branches/compyx/joymap-002/vice/doc/vice.texi branches/compyx/joymap-002/vice/src/arch/sdl/joy.c branches/compyx/joymap-002/vice/src/arch/shared/sounddrv/sounddump.c branches/compyx/joymap-002/vice/src/sound.c branches/compyx/joymap-002/vice/src/sound.h Modified: branches/compyx/joymap-002/vice/doc/vice.texi =================================================================== --- branches/compyx/joymap-002/vice/doc/vice.texi 2025-04-26 17:30:51 UTC (rev 45643) +++ branches/compyx/joymap-002/vice/doc/vice.texi 2025-04-27 17:41:07 UTC (rev 45644) @@ -6237,16 +6237,8 @@ @itemize @bullet @item -@code{ahi}, for the Amiga/Morphos/Aros sound driver. -@item -@code{aix}, for the IBM AIX sound driver. -@item -@code{allegro}, for the DOS Allegro sound driver. -@item @code{alsa}, for the linux ALSA sound driver. @item -@code{arts}, for the *nix ARTS sound driver. -@item @code{beos}, for the BeOS/Zeta/Haiku sound driver. @item @code{bsp}, for the BeOS/Zeta/Haiku BeOS Media Kit sound driver. @@ -6254,36 +6246,26 @@ @code{coreaudio}, for the Mac OS X sound driver (@code{SoundDeviceArg} specifies the audio device, default system output by default). @item -@code{dart}, for the OS/2 sound driver. -@item @code{dummy}, fully emulating the sound output chip(s), but not actually playing samples. @item +@code{dump}, writing all the write accesses to the registers to a file +(specified by @code{SoundDeviceArg}, default value is +@code{vicesnd.sid}); +@item @code{dx}, for the Windows Direct-X sound driver. @item -@code{hpux}, for the HP-UX audio device (unfinished; +@code{netbsd}, for the NetBDS audio device (unfinished; @code{SoundDeviceArg} specifies the audio device, @file{/dev/audio} by default). @item -@code{midas}, for the DOS Midas sound driver. -@item @code{pulse}, for the Pulseaudio sound driver. @item @code{sdl}, for the Simple DirectMedia Layer audio driver. @item -@code{sgi}, for the Silicon Graphics audio device (@code{SoundDeviceArg} -specifies the audio device, @file{/dev/audio} by default); -@item -@code{speed}, like @code{dummy} but also calculating samples (mainly -used to evaluate the speed of the sample generator); -@item -@code{sun}, for the Solaris and NetBDS audio device (unfinished; +@code{sun}, for the Solaris audio device (unfinished; @code{SoundDeviceArg} specifies the audio device, @file{/dev/audio} by default). @item -@code{uss}, for the Linux/FreeBSD Universal Sound System driver -(@code{SoundDeviceArg} specifies the audio device, @file{/dev/dsp} by -default); -@item @code{wmm}, for the Windows Multimedia Waveout sound device. @end itemize @@ -6305,12 +6287,9 @@ @item @code{aiff}, for the Apple Interchange File Format 16bit sound recorder driver. @item -@code{dump}, writing all the write accesses to the registers to a file -(specified by @code{SoundDeviceArg}, default value is -@code{vicesnd.sid}); -@item @code{fs}, writing samples to a file (specified by @code{SoundDeviceArg}; default is @file{vicesnd.raw}); +@item @code{iff}, for the Amiga Interchange File Format (8SVX) 8bit sound recorder driver. @item @code{mp3}, for the MP3 sound recorder driver. @@ -6411,7 +6390,7 @@ @item -sounddev <Name> Specifies the name of the audio device (@code{SoundDeviceName}). -(ahi, aix, allegro, alsa, arts, beos, bsp, coreaudio, dart, dummy, dx, hpux, midas, pulse, sdl, sgi, sun, uss, wmm) +(alsa, beos, bsp, coreaudio, dummy, dump, dx, netbsd, pulse, sdl, sun, wmm) @findex -soundarg @item -soundarg <args> @@ -6422,7 +6401,7 @@ @item -soundrecdev <name> Specify recording sound driver (@code{SoundRecordDeviceName}). -(aiff, dump, fs, iff, mp3, flac, ogg, speed, voc, wav) +(aiff, fs, iff, mp3, flac, ogg, voc, wav) @findex -soundrecarg @item -soundrecarg <args> Modified: branches/compyx/joymap-002/vice/src/arch/sdl/joy.c =================================================================== --- branches/compyx/joymap-002/vice/src/arch/sdl/joy.c 2025-04-26 17:30:51 UTC (rev 45643) +++ branches/compyx/joymap-002/vice/src/arch/sdl/joy.c 2025-04-27 17:41:07 UTC (rev 45644) @@ -164,8 +164,16 @@ /* ------------------------------------------------------------------------- */ +/* + * Driver methods + */ + static bool sdl_joystick_open(joystick_device_t *joydev) { + /* NOP: SDL has its own mechanism for opening/closing devices and appears + * to just keep all host devices it found open. We return `true` here to + * avoid resource setters triggering an error. + */ return true; } @@ -176,18 +184,17 @@ static void sdl_joystick_close(joystick_device_t *joystick) { -#if 0 - SDL_JoystickClose(joystick); - lib_free(joy_ordinal_to_id); - joy_ordinal_to_id = NULL; -#endif + /* NOP: The actual call to SDL_JoystickClose() happens on emulator shutdown, + * not when closing via VICE's driver */ } +/** \brief SDL-specific host device data + */ typedef struct joy_priv_s { - SDL_Joystick *sdldev; - VICE_SDL_JoystickID id; - int joynum; + SDL_Joystick *sdldev; /**< SDL device reference */ + VICE_SDL_JoystickID id; /**< joystick ID used by VICE */ + int joynum; /**< joystick index according to SDL */ } joy_priv_t; Modified: branches/compyx/joymap-002/vice/src/arch/shared/sounddrv/sounddump.c =================================================================== --- branches/compyx/joymap-002/vice/src/arch/shared/sounddrv/sounddump.c 2025-04-26 17:30:51 UTC (rev 45643) +++ branches/compyx/joymap-002/vice/src/arch/shared/sounddrv/sounddump.c 2025-04-27 17:41:07 UTC (rev 45644) @@ -30,7 +30,16 @@ #include "sound.h" #include "types.h" +#include "log.h" +/* #define DEBUG_DUMP */ + +#ifdef DEBUG_DUMP +#define DBG(x) log_printf x +#else +#define DBG(x) +#endif + static FILE *dump_fd = NULL; static int dump_init(const char *param, int *speed, int *fragsize, int *fragnr, int *channels) @@ -39,21 +48,29 @@ *channels = 1; dump_fd = fopen(param ? param : "vicesnd.sid", "w"); - return !dump_fd; + DBG(("dump_init param:%p fd:%p", param, dump_fd)); + return (dump_fd == NULL) ? -1 : 0; } static int dump_write(int16_t *pbuf, size_t nr) { + /*DBG(("dump_write"));*/ return 0; } static int dump_dump(uint16_t addr, uint8_t byte, CLOCK clks) { + DBG(("dump_dump %d %d %d", (int)clks, addr, byte)); return (fprintf(dump_fd, "%d %d %d\n", (int)clks, addr, byte) < 0); } +#if 0 +/* FIXME: it is unclear why this function does this. no other sound output + driver implements "flush" for that matter +*/ static int dump_flush(char *state) { + DBG(("dump_flush state:'%s'")); if (fprintf(dump_fd, "%s", state) < 0) { return 1; } @@ -60,9 +77,11 @@ return fflush(dump_fd); } +#endif static void dump_close(void) { + DBG(("dump_close")); fclose(dump_fd); dump_fd = NULL; } @@ -73,7 +92,7 @@ dump_init, dump_write, dump_dump, - dump_flush, + NULL, /* dump_flush, */ NULL, dump_close, NULL, @@ -85,5 +104,6 @@ int sound_init_dump_device(void) { + DBG(("sound_init_dump_device")); return sound_register_device(&dump_device); } Modified: branches/compyx/joymap-002/vice/src/sound.c =================================================================== --- branches/compyx/joymap-002/vice/src/sound.c 2025-04-26 17:30:51 UTC (rev 45643) +++ branches/compyx/joymap-002/vice/src/sound.c 2025-04-27 17:41:07 UTC (rev 45644) @@ -59,7 +59,15 @@ #include "math.h" #include "ui.h" +/* #define DEBUG_SOUND */ +#ifdef DEBUG_SOUND +#define DBG(x) log_printf x +#else +#define DBG(x) +#endif + + log_t sound_log = LOG_DEFAULT; static void sounddev_close(const sound_device_t **dev); @@ -123,8 +131,12 @@ works, no files will be created accidently */ { "dummy", "Dummy sound output (no sound)", sound_init_dummy_device, SOUND_PLAYBACK_DEVICE }, + /* FIXME: the dump device (and part of the sound system) needs to be + rewritten somehow, so it can be used while actually playing sound, ie as + a record device */ + { "dump", "Sound chip write recording", sound_init_dump_device, SOUND_PLAYBACK_DEVICE }, + { "fs", "Raw sound recording", sound_init_fs_device, SOUND_RECORD_DEVICE }, - { "dump", "Sound chip state recording", sound_init_dump_device, SOUND_RECORD_DEVICE }, { "wav", "RIFF/WAV sound recording", sound_init_wav_device, SOUND_RECORD_DEVICE }, { "voc", "Creative Voice VOC sound recording", sound_init_voc_device, SOUND_RECORD_DEVICE }, { "iff", "AmigaOS IFF/8SVX sound recording", sound_init_iff_device, SOUND_RECORD_DEVICE }, @@ -141,7 +153,7 @@ #ifdef USE_VORBIS { "ogg", "OGG sound recording", sound_init_vorbis_device, SOUND_RECORD_DEVICE }, #endif - + /* the driver used for recording sound when actually recording video+sound */ { "soundmovie", "Movie sound recording", sound_init_movie_device, SOUND_MOVIE_RECORD_DEVICE }, { NULL, NULL, NULL, 0 } }; @@ -459,6 +471,7 @@ #endif } +/* perform the actual write to the sound chip */ static void sound_machine_store(sound_t *psid, uint16_t addr, uint8_t val) { if (sound_calls[addr >> 5]->store) { @@ -618,6 +631,7 @@ } else { util_string_set(&device_name, val); } + DBG(("set_device_name device_name:'%s'", device_name)); sound_state_changed = TRUE; return 0; } @@ -723,6 +737,7 @@ int sound_resources_init(void) { + DBG(("sound_resources_init")); /* Set the first device in the list as default factory value. We do this here so the default value will not end up in the config file. */ if (archdep_is_haiku() == 0) { @@ -734,6 +749,7 @@ if (resources_register_string(resources_string) < 0) { return -1; } + DBG(("sound_resources_init resources_string[0].factory_value:'%s'", resources_string[0].factory_value)); return resources_register_int(resources_int); } @@ -864,7 +880,7 @@ for (i = 0; sound_register_devices[i].name; ++i) { if (sound_register_devices[i].device_type == type) { - ++valid; + ++valid; } } @@ -1458,7 +1474,6 @@ bool sound_flush(void) { int c, i, nr, space; - char *state; /* * It's possible when changing settings via UI to end up @@ -1516,8 +1531,24 @@ } sound_resume(); +#if 0 + /* FIXME: This code does not make sense - whatever it is trying to do does + not work at all: + - ONLY the "dump" device even has a "flush" method registered + - this is called every frame, which makes the "dump" device flood the log + with useless data + - even if other drivers had a "flush" method, calling this complex string + constructing function every frame seems like a really bad idea. + */ if (snddata.playdev->flush) { + char *state; + /* dumps the state of the sound emulator - this seems to be ReSID always - + into a string(!). This function usually is used for the monitor + io command */ state = sound_machine_dump_state(snddata.psid[0]); + /* calls the "flush" method of the sound output driver with said string + as argument. the "dump" device would now output this string to the + sound log (vicesound.sid) */ i = snddata.playdev->flush(state); lib_free(state); if (i) { @@ -1525,6 +1556,7 @@ goto done; } } +#endif /* Calculate the number of samples to flush - whole fragments. */ nr = snddata.bufptr - snddata.bufptr % snddata.fragsize; @@ -1706,8 +1738,13 @@ / snddata.clkstep); } +/* dump the state of the sound chip to the monitor + + NOTE: for some reason this function is only used for SID? + */ int sound_dump(int chipno) { + DBG(("sound_dump chipno:%d", chipno)); if (chipno >= snddata.sound_chip_channels) { return -1; } @@ -1740,8 +1777,11 @@ return; } + /* perform the actual write to the sound chip */ sound_machine_store(snddata.psid[chipno], addr, val); + /* now check if we have a "dump" method (which dumps the details of the + write access to a file), and if so, call it */ if (!snddata.playdev->dump) { return; } Modified: branches/compyx/joymap-002/vice/src/sound.h =================================================================== --- branches/compyx/joymap-002/vice/src/sound.h 2025-04-26 17:30:51 UTC (rev 45643) +++ branches/compyx/joymap-002/vice/src/sound.h 2025-04-27 17:41:07 UTC (rev 45644) @@ -190,8 +190,8 @@ int (*write)(int16_t *pbuf, size_t nr); /* dump-routine to be called for every write to SID */ int (*dump)(uint16_t addr, uint8_t byte, CLOCK clks); - /* flush-routine to be called every frame */ - int (*flush)(char *state); + /* DEPRECATED: flush-routine to be called every frame (not called anywhere) */ + int (*deprecated_flush)(char *state); /* return number of samples currently available in the kernel buffer */ int (*bufferspace)(void); /* close and cleanup device */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-04-26 17:31:09
|
Revision: 45643 http://sourceforge.net/p/vice-emu/code/45643 Author: gpz Date: 2025-04-26 17:30:51 +0000 (Sat, 26 Apr 2025) Log Message: ----------- some more cleanup and comments, made 'dump' a playback device, updated docs to only list the devices we still support :) Modified Paths: -------------- trunk/vice/doc/vice.texi trunk/vice/src/arch/shared/sounddrv/sounddump.c trunk/vice/src/sound.c trunk/vice/src/sound.h Modified: trunk/vice/doc/vice.texi =================================================================== --- trunk/vice/doc/vice.texi 2025-04-25 22:27:16 UTC (rev 45642) +++ trunk/vice/doc/vice.texi 2025-04-26 17:30:51 UTC (rev 45643) @@ -6237,16 +6237,8 @@ @itemize @bullet @item -@code{ahi}, for the Amiga/Morphos/Aros sound driver. -@item -@code{aix}, for the IBM AIX sound driver. -@item -@code{allegro}, for the DOS Allegro sound driver. -@item @code{alsa}, for the linux ALSA sound driver. @item -@code{arts}, for the *nix ARTS sound driver. -@item @code{beos}, for the BeOS/Zeta/Haiku sound driver. @item @code{bsp}, for the BeOS/Zeta/Haiku BeOS Media Kit sound driver. @@ -6254,36 +6246,26 @@ @code{coreaudio}, for the Mac OS X sound driver (@code{SoundDeviceArg} specifies the audio device, default system output by default). @item -@code{dart}, for the OS/2 sound driver. -@item @code{dummy}, fully emulating the sound output chip(s), but not actually playing samples. @item +@code{dump}, writing all the write accesses to the registers to a file +(specified by @code{SoundDeviceArg}, default value is +@code{vicesnd.sid}); +@item @code{dx}, for the Windows Direct-X sound driver. @item -@code{hpux}, for the HP-UX audio device (unfinished; +@code{netbsd}, for the NetBDS audio device (unfinished; @code{SoundDeviceArg} specifies the audio device, @file{/dev/audio} by default). @item -@code{midas}, for the DOS Midas sound driver. -@item @code{pulse}, for the Pulseaudio sound driver. @item @code{sdl}, for the Simple DirectMedia Layer audio driver. @item -@code{sgi}, for the Silicon Graphics audio device (@code{SoundDeviceArg} -specifies the audio device, @file{/dev/audio} by default); -@item -@code{speed}, like @code{dummy} but also calculating samples (mainly -used to evaluate the speed of the sample generator); -@item -@code{sun}, for the Solaris and NetBDS audio device (unfinished; +@code{sun}, for the Solaris audio device (unfinished; @code{SoundDeviceArg} specifies the audio device, @file{/dev/audio} by default). @item -@code{uss}, for the Linux/FreeBSD Universal Sound System driver -(@code{SoundDeviceArg} specifies the audio device, @file{/dev/dsp} by -default); -@item @code{wmm}, for the Windows Multimedia Waveout sound device. @end itemize @@ -6305,12 +6287,9 @@ @item @code{aiff}, for the Apple Interchange File Format 16bit sound recorder driver. @item -@code{dump}, writing all the write accesses to the registers to a file -(specified by @code{SoundDeviceArg}, default value is -@code{vicesnd.sid}); -@item @code{fs}, writing samples to a file (specified by @code{SoundDeviceArg}; default is @file{vicesnd.raw}); +@item @code{iff}, for the Amiga Interchange File Format (8SVX) 8bit sound recorder driver. @item @code{mp3}, for the MP3 sound recorder driver. @@ -6411,7 +6390,7 @@ @item -sounddev <Name> Specifies the name of the audio device (@code{SoundDeviceName}). -(ahi, aix, allegro, alsa, arts, beos, bsp, coreaudio, dart, dummy, dx, hpux, midas, pulse, sdl, sgi, sun, uss, wmm) +(alsa, beos, bsp, coreaudio, dummy, dump, dx, netbsd, pulse, sdl, sun, wmm) @findex -soundarg @item -soundarg <args> @@ -6422,7 +6401,7 @@ @item -soundrecdev <name> Specify recording sound driver (@code{SoundRecordDeviceName}). -(aiff, dump, fs, iff, mp3, flac, ogg, speed, voc, wav) +(aiff, fs, iff, mp3, flac, ogg, voc, wav) @findex -soundrecarg @item -soundrecarg <args> Modified: trunk/vice/src/arch/shared/sounddrv/sounddump.c =================================================================== --- trunk/vice/src/arch/shared/sounddrv/sounddump.c 2025-04-25 22:27:16 UTC (rev 45642) +++ trunk/vice/src/arch/shared/sounddrv/sounddump.c 2025-04-26 17:30:51 UTC (rev 45643) @@ -64,6 +64,7 @@ return (fprintf(dump_fd, "%d %d %d\n", (int)clks, addr, byte) < 0); } +#if 0 /* FIXME: it is unclear why this function does this. no other sound output driver implements "flush" for that matter */ @@ -76,6 +77,7 @@ return fflush(dump_fd); } +#endif static void dump_close(void) { @@ -90,7 +92,7 @@ dump_init, dump_write, dump_dump, - dump_flush, + NULL, /* dump_flush, */ NULL, dump_close, NULL, Modified: trunk/vice/src/sound.c =================================================================== --- trunk/vice/src/sound.c 2025-04-25 22:27:16 UTC (rev 45642) +++ trunk/vice/src/sound.c 2025-04-26 17:30:51 UTC (rev 45643) @@ -131,8 +131,12 @@ works, no files will be created accidently */ { "dummy", "Dummy sound output (no sound)", sound_init_dummy_device, SOUND_PLAYBACK_DEVICE }, + /* FIXME: the dump device (and part of the sound system) needs to be + rewritten somehow, so it can be used while actually playing sound, ie as + a record device */ + { "dump", "Sound chip write recording", sound_init_dump_device, SOUND_PLAYBACK_DEVICE }, + { "fs", "Raw sound recording", sound_init_fs_device, SOUND_RECORD_DEVICE }, - { "dump", "Sound chip state recording", sound_init_dump_device, SOUND_RECORD_DEVICE }, { "wav", "RIFF/WAV sound recording", sound_init_wav_device, SOUND_RECORD_DEVICE }, { "voc", "Creative Voice VOC sound recording", sound_init_voc_device, SOUND_RECORD_DEVICE }, { "iff", "AmigaOS IFF/8SVX sound recording", sound_init_iff_device, SOUND_RECORD_DEVICE }, @@ -149,7 +153,7 @@ #ifdef USE_VORBIS { "ogg", "OGG sound recording", sound_init_vorbis_device, SOUND_RECORD_DEVICE }, #endif - + /* the driver used for recording sound when actually recording video+sound */ { "soundmovie", "Movie sound recording", sound_init_movie_device, SOUND_MOVIE_RECORD_DEVICE }, { NULL, NULL, NULL, 0 } }; @@ -467,6 +471,7 @@ #endif } +/* perform the actual write to the sound chip */ static void sound_machine_store(sound_t *psid, uint16_t addr, uint8_t val) { if (sound_calls[addr >> 5]->store) { @@ -921,7 +926,6 @@ int sound_register_device(const sound_device_t *pdevice) { if (sound_device_count < MAX_SOUND_DEVICES) { - DBG(("sound_register_device #%i ->flush:%p", sound_device_count, pdevice->flush)); sound_devices[sound_device_count] = pdevice; sound_device_count++; } else { @@ -1734,6 +1738,10 @@ / snddata.clkstep); } +/* dump the state of the sound chip to the monitor + + NOTE: for some reason this function is only used for SID? + */ int sound_dump(int chipno) { DBG(("sound_dump chipno:%d", chipno)); @@ -1769,8 +1777,11 @@ return; } + /* perform the actual write to the sound chip */ sound_machine_store(snddata.psid[chipno], addr, val); + /* now check if we have a "dump" method (which dumps the details of the + write access to a file), and if so, call it */ if (!snddata.playdev->dump) { return; } Modified: trunk/vice/src/sound.h =================================================================== --- trunk/vice/src/sound.h 2025-04-25 22:27:16 UTC (rev 45642) +++ trunk/vice/src/sound.h 2025-04-26 17:30:51 UTC (rev 45643) @@ -190,8 +190,8 @@ int (*write)(int16_t *pbuf, size_t nr); /* dump-routine to be called for every write to SID */ int (*dump)(uint16_t addr, uint8_t byte, CLOCK clks); - /* flush-routine to be called every frame */ - int (*flush)(char *state); + /* DEPRECATED: flush-routine to be called every frame (not called anywhere) */ + int (*deprecated_flush)(char *state); /* return number of samples currently available in the kernel buffer */ int (*bufferspace)(void); /* close and cleanup device */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-04-25 22:27:33
|
Revision: 45642 http://sourceforge.net/p/vice-emu/code/45642 Author: gpz Date: 2025-04-25 22:27:16 +0000 (Fri, 25 Apr 2025) Log Message: ----------- make -sounddev dump work as intended again. (see https://www.lemon64.com/forum/viewtopic.php?p=1050091#p1050091 ). Weird non working code commented out for the time being - whoever knows what it was trying to do may want to actually fix it. It probably was a bug lingering around for a long time, which was then triggered when the monitor dump function for reSID was implemented. Modified Paths: -------------- trunk/vice/src/arch/shared/sounddrv/sounddump.c trunk/vice/src/sound.c Modified: trunk/vice/src/arch/shared/sounddrv/sounddump.c =================================================================== --- trunk/vice/src/arch/shared/sounddrv/sounddump.c 2025-04-25 08:49:38 UTC (rev 45641) +++ trunk/vice/src/arch/shared/sounddrv/sounddump.c 2025-04-25 22:27:16 UTC (rev 45642) @@ -30,7 +30,16 @@ #include "sound.h" #include "types.h" +#include "log.h" +/* #define DEBUG_DUMP */ + +#ifdef DEBUG_DUMP +#define DBG(x) log_printf x +#else +#define DBG(x) +#endif + static FILE *dump_fd = NULL; static int dump_init(const char *param, int *speed, int *fragsize, int *fragnr, int *channels) @@ -39,21 +48,28 @@ *channels = 1; dump_fd = fopen(param ? param : "vicesnd.sid", "w"); - return !dump_fd; + DBG(("dump_init param:%p fd:%p", param, dump_fd)); + return (dump_fd == NULL) ? -1 : 0; } static int dump_write(int16_t *pbuf, size_t nr) { + /*DBG(("dump_write"));*/ return 0; } static int dump_dump(uint16_t addr, uint8_t byte, CLOCK clks) { + DBG(("dump_dump %d %d %d", (int)clks, addr, byte)); return (fprintf(dump_fd, "%d %d %d\n", (int)clks, addr, byte) < 0); } +/* FIXME: it is unclear why this function does this. no other sound output + driver implements "flush" for that matter +*/ static int dump_flush(char *state) { + DBG(("dump_flush state:'%s'")); if (fprintf(dump_fd, "%s", state) < 0) { return 1; } @@ -63,6 +79,7 @@ static void dump_close(void) { + DBG(("dump_close")); fclose(dump_fd); dump_fd = NULL; } @@ -85,5 +102,6 @@ int sound_init_dump_device(void) { + DBG(("sound_init_dump_device")); return sound_register_device(&dump_device); } Modified: trunk/vice/src/sound.c =================================================================== --- trunk/vice/src/sound.c 2025-04-25 08:49:38 UTC (rev 45641) +++ trunk/vice/src/sound.c 2025-04-25 22:27:16 UTC (rev 45642) @@ -59,7 +59,15 @@ #include "math.h" #include "ui.h" +/* #define DEBUG_SOUND */ +#ifdef DEBUG_SOUND +#define DBG(x) log_printf x +#else +#define DBG(x) +#endif + + log_t sound_log = LOG_DEFAULT; static void sounddev_close(const sound_device_t **dev); @@ -618,6 +626,7 @@ } else { util_string_set(&device_name, val); } + DBG(("set_device_name device_name:'%s'", device_name)); sound_state_changed = TRUE; return 0; } @@ -723,6 +732,7 @@ int sound_resources_init(void) { + DBG(("sound_resources_init")); /* Set the first device in the list as default factory value. We do this here so the default value will not end up in the config file. */ if (archdep_is_haiku() == 0) { @@ -734,6 +744,7 @@ if (resources_register_string(resources_string) < 0) { return -1; } + DBG(("sound_resources_init resources_string[0].factory_value:'%s'", resources_string[0].factory_value)); return resources_register_int(resources_int); } @@ -864,7 +875,7 @@ for (i = 0; sound_register_devices[i].name; ++i) { if (sound_register_devices[i].device_type == type) { - ++valid; + ++valid; } } @@ -910,6 +921,7 @@ int sound_register_device(const sound_device_t *pdevice) { if (sound_device_count < MAX_SOUND_DEVICES) { + DBG(("sound_register_device #%i ->flush:%p", sound_device_count, pdevice->flush)); sound_devices[sound_device_count] = pdevice; sound_device_count++; } else { @@ -1458,7 +1470,6 @@ bool sound_flush(void) { int c, i, nr, space; - char *state; /* * It's possible when changing settings via UI to end up @@ -1516,8 +1527,24 @@ } sound_resume(); +#if 0 + /* FIXME: This code does not make sense - whatever it is trying to do does + not work at all: + - ONLY the "dump" device even has a "flush" method registered + - this is called every frame, which makes the "dump" device flood the log + with useless data + - even if other drivers had a "flush" method, calling this complex string + constructing function every frame seems like a really bad idea. + */ if (snddata.playdev->flush) { + char *state; + /* dumps the state of the sound emulator - this seems to be ReSID always - + into a string(!). This function usually is used for the monitor + io command */ state = sound_machine_dump_state(snddata.psid[0]); + /* calls the "flush" method of the sound output driver with said string + as argument. the "dump" device would now output this string to the + sound log (vicesound.sid) */ i = snddata.playdev->flush(state); lib_free(state); if (i) { @@ -1525,6 +1552,7 @@ goto done; } } +#endif /* Calculate the number of samples to flush - whole fragments. */ nr = snddata.bufptr - snddata.bufptr % snddata.fragsize; @@ -1708,6 +1736,7 @@ int sound_dump(int chipno) { + DBG(("sound_dump chipno:%d", chipno)); if (chipno >= snddata.sound_chip_channels) { return -1; } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-04-25 08:49:56
|
Revision: 45641 http://sourceforge.net/p/vice-emu/code/45641 Author: compyx Date: 2025-04-25 08:49:38 +0000 (Fri, 25 Apr 2025) Log Message: ----------- Joystick: BSD: implement open()/close() driver methods Modified Paths: -------------- branches/compyx/joymap-002/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c Modified: branches/compyx/joymap-002/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c =================================================================== --- branches/compyx/joymap-002/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-04-24 10:12:22 UTC (rev 45640) +++ branches/compyx/joymap-002/vice/src/arch/gtk3/joystickdrv/joystick_bsd.c 2025-04-25 08:49:38 UTC (rev 45641) @@ -110,11 +110,12 @@ /* Forward declarations */ -static bool bsd_joy_open (joystick_device_t *joydev); -static void bsd_joy_poll (joystick_device_t *joydev); -static void bsd_joy_close (joystick_device_t *joydev); -static void bsd_joy_customize(joystick_device_t *joydev); -static void joy_priv_free (void *priv); +static bool bsd_joy_open (joystick_device_t *joydev); +static void bsd_joy_poll (joystick_device_t *joydev); +static void bsd_joy_close (joystick_device_t *joydev); +static void bsd_joy_customize(joystick_device_t *joydev); +static joy_priv_t *joy_hid_open (const char *node); +static void joy_priv_free (void *priv); /** \brief Log for BSD joystick driver */ @@ -140,14 +141,14 @@ { joy_priv_t *priv = lib_malloc(sizeof *priv); - priv->buffer = NULL; - priv->rep_desc = NULL; - priv->rep_size = 0; - priv->fd = -1; - priv->rep_id = 0; - priv->prev_axes = NULL; + priv->buffer = NULL; + priv->rep_desc = NULL; + priv->rep_size = 0; + priv->fd = -1; + priv->rep_id = 0; + priv->prev_axes = NULL; priv->prev_buttons = NULL; - priv->prev_hats = NULL; + priv->prev_hats = NULL; return priv; } @@ -163,10 +164,7 @@ joy_priv_t *p = priv; if (p != NULL) { - if (p->fd >= 0) { - close(p->fd); - } - lib_free(p->buffer); + lib_free(p->buffer); if (p->rep_desc != NULL) { hid_dispose_report_desc(p->rep_desc); } @@ -173,6 +171,9 @@ lib_free(p->prev_axes); lib_free(p->prev_buttons); lib_free(p->prev_hats); + if (p->fd >= 0) { + close(p->fd); + } lib_free(p); } } @@ -183,7 +184,25 @@ */ static bool bsd_joy_open (joystick_device_t *joydev) { - return true; /* NOP */ + if (joydev != NULL) { + joy_priv_t *priv = joydev->priv; + + if (priv == NULL) { + log_error(bsd_joy_log, + "%s(): failed to open device %s", + __func__, joydev->node); + return false; /* error opening device, already reported */ + } + priv->fd = open(joydev->node, O_RDONLY|O_NONBLOCK); + if (priv->fd < 0) { + log_error(bsd_joy_log, + "%s(): failed to open device %s: %d: %s", + __func__, joydev->node, errno, strerror(errno)); + return false; + } + return true; + } + return false; } /** \brief Poll joystick device @@ -304,8 +323,12 @@ static void bsd_joy_close(joystick_device_t *joydev) { if (joydev != NULL && joydev->priv != NULL) { - joy_priv_free(joydev->priv); - joydev->priv = NULL; + joy_priv_t *priv = joydev->priv; + + if (priv->fd >= 0) { + close(priv->fd); + priv->fd = -1; + } } } @@ -352,9 +375,9 @@ * the report ID and size and allocates a \c joy_priv_t instance with all that * data. * - * \param[in] node path in <tt>/dev/</tt> to the device + * \param[in] node path in \c /dev/ to the device * - * \return new initialized \c joy_priv_t instance or <tt>NULL</tt> on error + * \return new initialized \c joy_priv_t instance or \c NULL on error */ static joy_priv_t *joy_hid_open(const char *node) { @@ -404,11 +427,11 @@ /* success: allocate private data object and store what we need for polling * and further querying */ priv = joy_priv_new(); - priv->buffer = lib_malloc((size_t)rep_size); - priv->rep_desc = rep_desc; - priv->rep_size = rep_size; - priv->rep_id = rep_id; - priv->fd = fd; + priv->buffer = lib_malloc((size_t)rep_size); + priv->rep_desc = rep_desc; + priv->rep_size = rep_size; + priv->rep_id = rep_id; + priv->fd = fd; return priv; } @@ -619,6 +642,8 @@ node = full_node_path(namelist[n]->d_name); joydev = scan_device(node); if (joydev != NULL) { + joy_priv_t *priv; + log_message(bsd_joy_log, "%s: %s", joydev->node, joydev->name); /* scan axes, buttons and hats */ @@ -631,14 +656,13 @@ joydev->node, joydev->name); joystick_device_free(joydev); } else { - /* allocate arrays for previous values of inputs */ - joy_priv_t *priv = joydev->priv; - - priv->prev_axes = lib_malloc((size_t)joydev->num_axes * + priv = joydev->priv; + /* allocate arrays for previous input states */ + priv->prev_axes = lib_calloc((size_t)joydev->num_axes, sizeof *priv->prev_axes); - priv->prev_buttons = lib_malloc((size_t)joydev->num_buttons * + priv->prev_buttons = lib_calloc((size_t)joydev->num_buttons, sizeof *priv->prev_buttons); - priv->prev_hats = lib_malloc((size_t)joydev->num_hats * + priv->prev_hats = lib_calloc((size_t)joydev->num_hats, sizeof *priv->prev_hats); } } else { @@ -648,6 +672,10 @@ joydev->node, joydev->name); joystick_device_free(joydev); } + + /* close device */ + priv = joydev->priv; + close(priv->fd); } lib_free(node); free(namelist[n]); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-04-24 10:12:40
|
Revision: 45640 http://sourceforge.net/p/vice-emu/code/45640 Author: compyx Date: 2025-04-24 10:12:22 +0000 (Thu, 24 Apr 2025) Log Message: ----------- Joystick: update DirectInput driver to support opening/closing devices via resources Not tested yet, no joysticks at work =D Modified Paths: -------------- branches/compyx/joymap-002/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c Modified: branches/compyx/joymap-002/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c =================================================================== --- branches/compyx/joymap-002/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-04-24 06:39:44 UTC (rev 45639) +++ branches/compyx/joymap-002/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-04-24 10:12:22 UTC (rev 45640) @@ -225,9 +225,6 @@ * is reported as 0xffff. * Translate position on a circle to joystick directions, clockwise * from North through to Northwest */ -#if 0 - printf("HAT %d: %u\n", i, (unsigned int)value); -#endif if (value == 0xffff) { /* report neutral position */ direction = JOYSTICK_DIRECTION_NONE; @@ -238,33 +235,6 @@ WORD hidx = ((value + 2250) % 36000) / 4500; direction = hat_map[hidx]; } -#if 0 - } else if (value >= 33750 || value < 2250) { - /* North */ - direction = JOYSTICK_DIRECTION_UP; - } else if (value >= 2250 && value < 6750) { - /* Northeast */ - direction = JOYSTICK_DIRECTION_UP|JOYSTICK_DIRECTION_RIGHT; - } else if (value >= 6750 && value < 11250) { - /* East */ - direction = JOYSTICK_DIRECTION_RIGHT; - } else if (value >= 11250 && value < 15750) { - /* Southeast */ - direction = JOYSTICK_DIRECTION_DOWN|JOYSTICK_DIRECTION_RIGHT; - } else if (value >= 15750 && value < 20250) { - /* South */ - direction = JOYSTICK_DIRECTION_DOWN; - } else if (value >= 20250 && value < 24750) { - /* Southwest */ - direction = JOYSTICK_DIRECTION_DOWN|JOYSTICK_DIRECTION_LEFT; - } else if (value >= 24750 && value < 29250) { - /* West */ - direction = JOYSTICK_DIRECTION_LEFT; - } else if (value >= 29250 && value < 33750) { - /* Northwest */ - direction = JOYSTICK_DIRECTION_UP|JOYSTICK_DIRECTION_LEFT; - } -#endif joy_hat_event(hat, direction); } } @@ -465,12 +435,6 @@ (LPVOID)joydev, DIDFT_ABSAXIS|DIDFT_BUTTON|DIDFT_POV); - /* Open device manually for polling, until the driver's open() method has - * been properly implemented and tested (changing resource "JoyDeviceN" - * should close the old device and open the new one) - */ - win32_joy_open(joydev); - /* register device and continue */ joystick_device_register(joydev); return DIENUM_CONTINUE; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-04-24 06:40:01
|
Revision: 45639 http://sourceforge.net/p/vice-emu/code/45639 Author: compyx Date: 2025-04-24 06:39:44 +0000 (Thu, 24 Apr 2025) Log Message: ----------- Joystick: only open host device when resource setter for "JoyDeviceN" is called Initially all host devices are registered but not opened, they will be opened when the resource setter for a "JoyDeviceN" resource is triggered. If a host device was already associated with said resource it will be closed before opening the new host device. Opening and closing host devices (also manually via `joystick_device_open()` and `joystick_device_close()` will allow us stop the emulation from polling and allow the UI to poll for setting mappings and calibrating inputs. Only tested on Linux && Gtk3 so far, rest will follow shortly. Modified Paths: -------------- branches/compyx/joymap-002/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c branches/compyx/joymap-002/vice/src/joyport/joystick.c branches/compyx/joymap-002/vice/src/joyport/joystick.h Modified: branches/compyx/joymap-002/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c =================================================================== --- branches/compyx/joymap-002/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-04-23 19:32:39 UTC (rev 45638) +++ branches/compyx/joymap-002/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-04-24 06:39:44 UTC (rev 45639) @@ -431,9 +431,11 @@ joydev = scan_device(namelist[i]->d_name); if (joydev != NULL) { joystick_device_register(joydev); +#if 0 /* open joystick: REMOVE once we have opening/closing via resource * and manually implemented properly */ linux_joystick_evdev_open(joydev); +#endif } } free(namelist); Modified: branches/compyx/joymap-002/vice/src/joyport/joystick.c =================================================================== --- branches/compyx/joymap-002/vice/src/joyport/joystick.c 2025-04-23 19:32:39 UTC (rev 45638) +++ branches/compyx/joymap-002/vice/src/joyport/joystick.c 2025-04-24 06:39:44 UTC (rev 45639) @@ -105,6 +105,17 @@ #define JOYPAD_NW (JOYPAD_N | JOYPAD_W) #define JOYPAD_NE (JOYPAD_N | JOYPAD_E) + +/** \brief Joystick system has been initialized + * + * Used to prevent the resource setters from trying to open host joystick + * devices that aren't yet available. + * The resource setters can only open devices *after* the joystick system has + * been fully initialized (and available host devices actually registered), + * which isn't the case when resources are initially set via command line. + */ +bool joystick_init_done = false; + static int joyport_joystick[JOYPORT_MAX_PORTS] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }; /* Global joystick value. */ @@ -823,12 +834,26 @@ static int set_joystick_device(int val, void *param) { - int port_idx = vice_ptr_to_int(param); + joystick_device_t *joydev; + int port_idx = vice_ptr_to_int(param); + if (val == joystick_port_map[port_idx]) { + /* same device, exit */ + return 0; + } + if (joystick_port_map[port_idx] >= JOYDEV_REALJOYSTICK_MIN) { int olddev = joystick_port_map[port_idx] - JOYDEV_REALJOYSTICK_MIN; if (olddev < num_joystick_devices) { joystick_devices[olddev]->joyport = -1; + /* close old device */ + if (joystick_init_done) { + joydev = joystick_device_by_index(olddev); + log_message(joy_log, + "resource JoyDevice%d: closing old device %d (%s)", + port_idx, olddev, joydev->name); + joystick_device_close(joydev); + } } } @@ -844,6 +869,16 @@ joystick_port_map[i] = JOYDEV_NONE; } } + /* open device for polling */ + if (joystick_init_done) { + joydev = joystick_device_by_index(newdev); + log_message(joy_log, + "resource JoyDevice%d: opening device %d (%s)", + port_idx, newdev, joydev->name); + if (!joystick_device_open(joydev)) { + return -1; + } + } } } @@ -2707,6 +2742,7 @@ int joystick_init(void) { int res = -1; + int i; joy_log = log_open("Joystick"); @@ -2728,11 +2764,18 @@ joystick_arch_init(); #endif - int i; for (i = 0; i < JOYPORT_MAX_PORTS; i++) { - if (joystick_port_map[i] >= JOYDEV_REALJOYSTICK_MIN) { - if (joystick_port_map[i] - JOYDEV_REALJOYSTICK_MIN < num_joystick_devices) { - joystick_devices[joystick_port_map[i] - JOYDEV_REALJOYSTICK_MIN]->joyport = i; + int devnum = joystick_port_map[i]; + + if (devnum >= JOYDEV_REALJOYSTICK_MIN) { + if (devnum - JOYDEV_REALJOYSTICK_MIN < num_joystick_devices) { + joystick_device_t *joydev = joystick_devices[devnum - JOYDEV_REALJOYSTICK_MIN]; + + joydev->joyport = i; + log_message(joy_log, + "joystick_init(): resource JoyDevice%d: opening device %d (%s)", + i + 1, devnum - JOYDEV_REALJOYSTICK_MIN, joydev->name); + joystick_device_open(joydev); } else { joystick_port_map[i] = JOYDEV_NONE; } @@ -2747,6 +2790,10 @@ log_warning(joy_log, "using minimal default mapping."); } + /* mark joystick init done so any future resource setter calls can open and + * close devices */ + joystick_init_done = true; + return 1; } @@ -4181,3 +4228,20 @@ } } + + +bool joystick_device_open(joystick_device_t *joydev) +{ + if (joydev != NULL && joy_driver.open != NULL) { + return joy_driver.open(joydev); + } + return false; +} + + +void joystick_device_close(joystick_device_t *joydev) +{ + if (joydev != NULL && joy_driver.close != NULL) { + joy_driver.close(joydev); + } +} Modified: branches/compyx/joymap-002/vice/src/joyport/joystick.h =================================================================== --- branches/compyx/joymap-002/vice/src/joyport/joystick.h 2025-04-23 19:32:39 UTC (rev 45638) +++ branches/compyx/joymap-002/vice/src/joyport/joystick.h 2025-04-24 06:39:44 UTC (rev 45639) @@ -351,6 +351,9 @@ } joystick_driver_t; +extern bool joystick_init_done; + + int joystick_init(void); int joystick_resources_init(void); int joystick_cmdline_options_init(void); @@ -448,6 +451,8 @@ joystick_device_t *joystick_device_new (void); void joystick_device_free (joystick_device_t *joydev); bool joystick_device_register (joystick_device_t *joydev); +bool joystick_device_open (joystick_device_t *joydev); +void joystick_device_close (joystick_device_t *joydev); joystick_device_t *joystick_device_by_index (int index); int joystick_device_count (void); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-04-23 19:32:57
|
Revision: 45638 http://sourceforge.net/p/vice-emu/code/45638 Author: compyx Date: 2025-04-23 19:32:39 +0000 (Wed, 23 Apr 2025) Log Message: ----------- Create branch for implementing opening/closing devices in resource setters Added Paths: ----------- branches/compyx/joymap-002/ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rh...@us...> - 2025-04-23 18:45:42
|
Revision: 45637 http://sourceforge.net/p/vice-emu/code/45637 Author: rhialto Date: 2025-04-23 18:45:22 +0000 (Wed, 23 Apr 2025) Log Message: ----------- Don't use my internal build name in the Makefile. Modified Paths: -------------- testprogs/PET/unconnected/Makefile Modified: testprogs/PET/unconnected/Makefile =================================================================== --- testprogs/PET/unconnected/Makefile 2025-04-23 18:43:18 UTC (rev 45636) +++ testprogs/PET/unconnected/Makefile 2025-04-23 18:45:22 UTC (rev 45637) @@ -3,7 +3,7 @@ SOURCE = $(NAME).asm COMPILER = acme CFLAGS = -v1 --cpu 6502 -r $(NAME).lst -f cbm -o -DEBUGGER = gtk3-xpet -default -model 3016 +DEBUGGER = xpet -default -model 3016 DEBUGFLAGS = REMOVE = rm -f This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rh...@us...> - 2025-04-23 18:43:36
|
Revision: 45636 http://sourceforge.net/p/vice-emu/code/45636 Author: rhialto Date: 2025-04-23 18:43:18 +0000 (Wed, 23 Apr 2025) Log Message: ----------- Add a test program for unconnected memory space in PETs. It is believed to be correct (similar to the VIC-20) but since it has not yet been tested on the real thing, at first it is good for regression tests only. Added Paths: ----------- testprogs/PET/unconnected/ testprogs/PET/unconnected/Makefile testprogs/PET/unconnected/readme.txt testprogs/PET/unconnected/unconnected.asm testprogs/PET/unconnected/unconnected.lst testprogs/PET/unconnected/unconnected.prg Added: testprogs/PET/unconnected/Makefile =================================================================== --- testprogs/PET/unconnected/Makefile (rev 0) +++ testprogs/PET/unconnected/Makefile 2025-04-23 18:43:18 UTC (rev 45636) @@ -0,0 +1,21 @@ +NAME = unconnected +BINARY = $(NAME).prg +SOURCE = $(NAME).asm +COMPILER = acme +CFLAGS = -v1 --cpu 6502 -r $(NAME).lst -f cbm -o +DEBUGGER = gtk3-xpet -default -model 3016 +DEBUGFLAGS = +REMOVE = rm -f + +.PHONY: all debug clean + +all: $(BINARY) + +debug: $(BINARY) + $(DEBUGGER) $(DEBUGFLAGS) $(BINARY) + +$(BINARY): $(SOURCE) + $(COMPILER) $(CFLAGS) $@ $< + +clean: + -$(REMOVE) $(BINARY) Added: testprogs/PET/unconnected/readme.txt =================================================================== --- testprogs/PET/unconnected/readme.txt (rev 0) +++ testprogs/PET/unconnected/readme.txt 2025-04-23 18:43:18 UTC (rev 45636) @@ -0,0 +1,49 @@ +This program tests what happens if unconnected space is addressed. +The normal behaviour is that the last byte on the bus remains what it was and that +is the value that is read. Usually this is the high byte of the address, +since that's what the CPU most recently read from memory. + +This is still true for indirect reads like LDA ($12),Y: the last read byte before +a possibly empty read would be from $13, the high byte of the base address. + +For zero pages with empty space, somebody could adjust the tests to run in the +drive CPU of a 4040 disk drive. I'm not holding my breath :) + +In case of indexed instructions with page crossings, there is first an dummy read. +So for example LDA $93FF,X with X=3 will do a dummy-read from $9302, and since +the last valid read from memory was #$93 (part of the address in the instruction), +the dummy read will return #$93. Then the real read from $9402 is also from empty +space, and hence will still read #$93. + +The test (in this case) stores #$AA at $9402 (the proper indexed address), #$00 +at $93FF (the base address), and #$55 at #9302 (the dummy read address, if +there is one), to detect RAM. + +If either read is from non-empty space, this will of course override the bus value. +Several of the cases below exercise this. + +Results on a 3016: + +un*connected testprog +test: result - ref/1st +$f000 : rom - rom/$ 54 ; rom +$f000,x: rom - rom/$ 20 ; rom +$1500 : ram - ram/$ aa ; ram +$16ff,x: ram - ram/$ aa ; ram +$9000 : msb - msb/$ 90 ; empty space +$9000,x: msb - msb/$ 90 ; empty space +$87ff,x: nox - nox/$ 55 ; X=3, 8702 is RAM, 8802 is empty; reads 8702 +$9d34 : msb - msb/$ 9d ; empty space +$93ff,x: msb - msb/$ 93 ; empty space +$e800 : msb - msb/$ e8 ; E800-E80F is empty +$e80f : msb - msb/$ e8 ; E800-E80F is empty +$e7ff,x: rom - rom/$ 00 ; X=3, E80x is empty, E7xx is ROM; reads E702 +$7fff,x: ram - ram/$ aa ; X=3, 7F02 is empty, 8002 is RAM; reads 8002 +$bfff,x: rom - rom/$ 57 ; X=3, BF02 is empty, C002 is ROM; reads C002 +press a key to restart + + + U + +The * and the shift-U are from the tests $7fff,x and $87ff,x. + Added: testprogs/PET/unconnected/unconnected.asm =================================================================== --- testprogs/PET/unconnected/unconnected.asm (rev 0) +++ testprogs/PET/unconnected/unconnected.asm 2025-04-23 18:43:18 UTC (rev 45636) @@ -0,0 +1,432 @@ +; unconnected +; ----------- +; Derived from the VIC-20 version, 2009 Hannu Nuotio +; Modifications for PET by Olaf "Rhialto" Seibert 2025. + +; This program tests PET unconnected bus behaviour. +; Use with a model with 16 KB of memory, so that there is empty space before +; the screen memory. Do not use BASIC 4.0 since it wants $Bxxx to be empty and +; $Cxxx to be filled. Also depends on empty space after 2 KB of screen memory +; so do not use -screen2001. Also wants $9xxx to be empty. + +; BUGS: +; - if addr MSB or ROM contents are TESTBYTE_ABS or TESTBYTE_ABS_X, the results may be incorrect + +!ct scr + +; --- Constants + +; - hw + +LOAD_ADDR = $0401 +SYS_ADDR = $0410 + +SCREEN = $8000 + +; - sw + +PRINT_LOC = SCREEN + +TESTBYTE_ABS = $55 +TESTBYTE_ABS_X = $aa + +; result type +RESULT_BYTE_ITSELF = 0 ; byte at addr or addr,x +RESULT_ADDR_MSB = 1 ; addr >> 8 +RESULT_BYTE_WRAP_X = 2 ; byte at wrapped addr +RESULT_VBUS = 3 ; vbus ("random") +RESULT_ROM = 4 ; ROM + +; --- Variables + +; - zero page + +tmp = $5e + +; pointer to print location +res_print = $5f +res_print_h = $60 + +; pointer to current test (definition) data +test_p = $61 +test_ph = $62 + +; temp pointer to test location +tmp_p = $63 +tmp_ph = $64 + +; result of test +result = $65 + + +; --- Main + +; start of program +* = LOAD_ADDR +entry: +; BASIC stub: "1 SYS 1040" +!by $0c,$10,$01,$00,$9e,$31,$30,$34,$30,$00,$00,$00 + +* = SYS_ADDR +mlcodeentry: + +; - print info + +jsr clearscreen + +lda #>PRINT_LOC +sta res_print_h +lda #<PRINT_LOC +sta res_print + +lda #<infotext_top +ldx #>infotext_top +jsr printstring + +; - test init + +lda #>testdata +sta test_ph +lda #<testdata +sta test_p + +; -- test loop + +test_next: +ldy #0 +lda (test_p),y +bne test_setup +jmp test_finished + +; - setup test + +test_setup: +tay +lda testdata_opcode,y +sta test_opcode + +lda #<infotext_test_start +ldx #>infotext_test_start +jsr printstring + +ldy #1 +lda (test_p),y +sta test_operand_high +sta tmp_ph +jsr printhex + +ldy #2 +lda (test_p),y +sta test_operand_low +sta tmp_p +jsr printhex + +ldy #0 +lda (test_p),y +cmp #1 +beq + +lda #<infotext_test_abs_x +ldx #>infotext_test_abs_x +jmp ++ ++ +lda #<infotext_test_abs +ldx #>infotext_test_abs +++ +jsr printstring + +ldy #3 +lda #TESTBYTE_ABS_X +sta (tmp_p),y +ldy #0 +sta (tmp_p),y + +ldy #0 +clc +lda tmp_p +adc #3 +bcc + +sta tmp_p +lda #TESTBYTE_ABS +sta (tmp_p),y ++ + +; - actual test + +ldy #0 +ldx #3 +testloop: +test_opcode = * +test_operand_low = * + 1 +test_operand_high = * + 2 +lda $1234 +sta result_buffer,y +iny +bne testloop + +; - calculate results + +lda result_buffer +ldy #1 +calc_loop: +cmp result_buffer,y +bne calc_found_difference +iny +bne calc_loop +; no differences found, check type +cmp #TESTBYTE_ABS +bne + +lda #RESULT_BYTE_WRAP_X +jmp test_result_found ++ +cmp #TESTBYTE_ABS_X +bne + +lda #RESULT_BYTE_ITSELF +jmp test_result_found ++ +cmp test_operand_high +bne + +lda #RESULT_ADDR_MSB +jmp test_result_found ++ +; assuming ROM +lda #RESULT_ROM +jmp test_result_found + +calc_found_difference: +; difference in results found -> v-bus (not relevant for PETs) +lda #RESULT_VBUS + +test_result_found: +sta result + +; - print results +test_result_print: +jsr printresult + +lda #<infotext_test_res_sep +ldx #>infotext_test_res_sep +jsr printstring + +; - print reference +ldy #3 +lda (test_p),y +jsr printresult + +; - print first byte from buffer +lda #<infotext_test_res_hex +ldx #>infotext_test_res_hex +jsr printstring + +lda result_buffer +jsr printhex + +; - fill up the rest of the line +lda #<infotext_rest_of_line +ldx #>infotext_rest_of_line +jsr printstring +; - test done + +clc +lda test_p +adc #4 +sta test_p +bcc + +inc test_ph ++ +jmp test_next + +; - all tests finished + +test_finished: +lda #<infotext_bottom +ldx #>infotext_bottom +jsr printstring + +- jsr $ffe4 +beq - + +jmp mlcodeentry + + +; --- Subroutines + +; - clearscreen +; changes: +; y = 0 +; +clearscreen: +ldy #0 +- lda #' ' +sta SCREEN,y +sta SCREEN+$100,y +sta SCREEN+$200,y +sta SCREEN+$300,y +iny +bne - +rts + +; - printhex +; parameters: +; res_print -> screen location to print to +; a = value to print +; changes: +; a, y = 0, tmp, res_print++ +; +printhex: +stx tmp +pha +; get upper +lsr +lsr +lsr +lsr +; lookup +tax +lda hex_lut,x +; print +jsr print +; get lower +pla +and #$0f +; lookup +tax +lda hex_lut,x +; print +jsr print +ldx tmp +rts + +; - printstring +; res_print -> screen location to print to +; a:x -> string to print +; changes: +; a, x, y, res_print++ +; +printstring: +sta printstring_src +stx printstring_src_h +ldx #0 +printstring_src = * + 1 +printstring_src_h = * + 2 +- +lda $1234,x +beq + +jsr print +inx +bne - +inc printstring_src_h +bne - ++ +rts + +; - print +; parameters: +; res_print -> screen location to print to +; a = char to print +; changes: +; y = 0, res_print++ +; +print: +ldy #0 +sta (res_print),y +inc res_print +bne + +inc res_print_h ++ +rts + +; - printresult +; parameters: +; res_print -> screen location to print to +; a = result +; changes: +; a, x, y = 0, tmp, res_print++ +; +printresult: +asl +asl +ldx #>infotext_test_result_tbl +clc +adc #<infotext_test_result_tbl +bcc + +inx ++ +jsr printstring +rts + + +; --- Data + +; - hex lookup table +hex_lut: +!tx "0123456789abcdef" + +; - Strings +; |0123456789012345678901234567890123456789| +infotext_top: +!tx "un-connected testprog " +!tx "test: result - ref/1st ",0 + +infotext_bottom: +!tx "press a key to restart ",0 + +infotext_test_start: +!tx "$",0 +infotext_test_abs: +!tx " : ",0 +infotext_test_abs_x: +!tx ",x: ",0 +infotext_test_res_sep: +!tx " - ",0 +infotext_test_res_hex: +!tx "/$ ",0 +infotext_rest_of_line: +!tx " ",0 + +; - test data +; format: +; type - 0 = end, 1 = absolute, 2 = ,x +; addr - hi, low +; reference - (see defines) +testdata: +!by 1, $f0, $00, RESULT_ROM +!by 2, $f0, $00, RESULT_ROM +!by 1, $15, $00, RESULT_BYTE_ITSELF +!by 2, $16, $ff, RESULT_BYTE_ITSELF +!by 1, $90, $00, RESULT_ADDR_MSB +!by 2, $90, $00, RESULT_ADDR_MSB +!by 2, $87, $ff, RESULT_BYTE_WRAP_X ; X=3, 8702 is RAM, 8802 is empty; reads 8702 +!by 1, $9d, $34, RESULT_ADDR_MSB +!by 2, $93, $ff, RESULT_ADDR_MSB +!by 1, $e8, $00, RESULT_ADDR_MSB ; E800-E80F is empty +!by 1, $e8, $0f, RESULT_ADDR_MSB +!by 2, $e7, $ff, RESULT_ROM ; X=3, E80x is empty, E7xx is ROM; reads E702 +!by 2, $7f, $ff, RESULT_BYTE_ITSELF ; X=3, 7F02 is empty, 8002 is RAM; reads 8002 +!by 2, $bf, $ff, RESULT_ROM ; X=3, BF02 is empty, C002 is ROM; reads C002 +!by 0 + +; Test 2, $7f, $ff, RESULT_BYTE_ITSELF is meant for a 16 K PET so that it +; dummy-reads empty, then reads RAM, but the result "RAM" is also reached for +; 32 KB models, where it dummy-reads and real-reads RAM. + +; Test 2, $bf, $ff, RESULT_ROM depends on $Bxxx being empty, so it won't work +; as intended for BASIC 4 machines. For those it should be 2, $af, $ff, RESULT_ROM. +; But the result will be "ROM" in both cases. + +; opcode, indexed by type field of testdata +testdata_opcode: +!by 0 ; 0 = unused +!by $ad ; 1 = LDA $nnnn +!by $bd ; 2 = LDA $nnnn,X + +; result text table +infotext_test_result_tbl: +!tx "ram",0 +!tx "msb",0 +!tx "nox",0 +!tx "v-b",0 +!tx "rom",0 + +!by 1,2,3 + +result_buffer: Added: testprogs/PET/unconnected/unconnected.lst =================================================================== --- testprogs/PET/unconnected/unconnected.lst (rev 0) +++ testprogs/PET/unconnected/unconnected.lst 2025-04-23 18:43:18 UTC (rev 45636) @@ -0,0 +1,434 @@ + +; ******** Source: unconnected.asm + 1 ; unconnected + 2 ; ----------- + 3 ; Derived from the VIC-20 version, 2009 Hannu Nuotio + 4 ; Modifications for PET by Olaf "Rhialto" Seibert 2025. + 5 + 6 ; This program tests PET unconnected bus behaviour. + 7 ; Use with a model with 16 KB of memory, so that there is empty space before + 8 ; the screen memory. Do not use BASIC 4.0 since it wants $Bxxx to be empty and + 9 ; $Cxxx to be filled. Also depends on empty space after 2 KB of screen memory + 10 ; so do not use -screen2001. Also wants $9xxx to be empty. + 11 + 12 ; BUGS: + 13 ; - if addr MSB or ROM contents are TESTBYTE_ABS or TESTBYTE_ABS_X, the results may be incorrect + 14 + 15 !ct scr + 16 + 17 ; --- Constants + 18 + 19 ; - hw + 20 + 21 LOAD_ADDR = $0401 + 22 SYS_ADDR = $0410 + 23 + 24 SCREEN = $8000 + 25 + 26 ; - sw + 27 + 28 PRINT_LOC = SCREEN + 29 + 30 TESTBYTE_ABS = $55 + 31 TESTBYTE_ABS_X = $aa + 32 + 33 ; result type + 34 RESULT_BYTE_ITSELF = 0 ; byte at addr or addr,x + 35 RESULT_ADDR_MSB = 1 ; addr >> 8 + 36 RESULT_BYTE_WRAP_X = 2 ; byte at wrapped addr + 37 RESULT_VBUS = 3 ; vbus ("random") + 38 RESULT_ROM = 4 ; ROM + 39 + 40 ; --- Variables + 41 + 42 ; - zero page + 43 + 44 tmp = $5e + 45 + 46 ; pointer to print location + 47 res_print = $5f + 48 res_print_h = $60 + 49 + 50 ; pointer to current test (definition) data + 51 test_p = $61 + 52 test_ph = $62 + 53 + 54 ; temp pointer to test location + 55 tmp_p = $63 + 56 tmp_ph = $64 + 57 + 58 ; result of test + 59 result = $65 + 60 + 62 ; --- Main + 63 + 64 ; start of program + 65 * = LOAD_ADDR + 66 entry: + 67 ; BASIC stub: "1 SYS 1040" + 68 0401 0c1001009e313034...!by $0c,$10,$01,$00,$9e,$31,$30,$34,$30,$00,$00,$00 + 69 + 70 * = SYS_ADDR + 71 mlcodeentry: + 72 + 73 ; - print info + 74 + 75 0410 200905 jsr clearscreen + 76 + 77 0413 a980 lda #>PRINT_LOC + 78 0415 8560 sta res_print_h + 79 0417 a900 lda #<PRINT_LOC + 80 0419 855f sta res_print + 81 + 82 041b a97a lda #<infotext_top + 83 041d a205 ldx #>infotext_top + 84 041f 203805 jsr printstring + 85 + 86 ; - test init + 87 + 88 0422 a906 lda #>testdata + 89 0424 8562 sta test_ph + 90 0426 a91a lda #<testdata + 91 0428 8561 sta test_p + 92 + 93 ; -- test loop + 94 + 95 test_next: + 96 042a a000 ldy #0 + 97 042c b161 lda (test_p),y + 98 042e d003 bne test_setup + 99 0430 4cfa04 jmp test_finished + 100 + 101 ; - setup test + 102 + 103 test_setup: + 104 0433 a8 tay + 105 0434 b95306 lda testdata_opcode,y + 106 0437 8d8c04 sta test_opcode + 107 + 108 043a a9f4 lda #<infotext_test_start + 109 043c a205 ldx #>infotext_test_start + 110 043e 203805 jsr printstring + 111 + 112 0441 a001 ldy #1 + 113 0443 b161 lda (test_p),y + 114 0445 8d8e04 sta test_operand_high + 115 0448 8564 sta tmp_ph + 116 044a 201d05 jsr printhex + 117 + 118 044d a002 ldy #2 + 119 044f b161 lda (test_p),y + 120 0451 8d8d04 sta test_operand_low + 121 0454 8563 sta tmp_p + 122 0456 201d05 jsr printhex + 123 + 124 0459 a000 ldy #0 + 125 045b b161 lda (test_p),y + 126 045d c901 cmp #1 + 127 045f f007 beq + + 128 0461 a9fb lda #<infotext_test_abs_x + 129 0463 a205 ldx #>infotext_test_abs_x + 130 0465 4c6c04 jmp ++ + 131 + + 132 0468 a9f6 lda #<infotext_test_abs + 133 046a a205 ldx #>infotext_test_abs + 134 ++ + 135 046c 203805 jsr printstring + 136 + 137 046f a003 ldy #3 + 138 0471 a9aa lda #TESTBYTE_ABS_X + 139 0473 9163 sta (tmp_p),y + 140 0475 a000 ldy #0 + 141 0477 9163 sta (tmp_p),y + 142 + 143 0479 a000 ldy #0 + 144 047b 18 clc + 145 047c a563 lda tmp_p + 146 047e 6903 adc #3 + 147 0480 9006 bcc + + 148 0482 8563 sta tmp_p + 149 0484 a955 lda #TESTBYTE_ABS + 150 0486 9163 sta (tmp_p),y + 151 + + 152 + 153 ; - actual test + 154 + 155 0488 a000 ldy #0 + 156 048a a203 ldx #3 + 157 testloop: + 158 test_opcode = * + 159 test_operand_low = * + 1 + 160 test_operand_high = * + 2 + 161 048c ad3412 lda $1234 + 162 048f 996d06 sta result_buffer,y + 163 0492 c8 iny + 164 0493 d0f7 bne testloop + 165 + 166 ; - calculate results + 167 + 168 0495 ad6d06 lda result_buffer + 169 0498 a001 ldy #1 + 170 calc_loop: + 171 049a d96d06 cmp result_buffer,y + 172 049d d024 bne calc_found_difference + 173 049f c8 iny + 174 04a0 d0f8 bne calc_loop + 175 ; no differences found, check type + 176 04a2 c955 cmp #TESTBYTE_ABS + 177 04a4 d005 bne + + 178 04a6 a902 lda #RESULT_BYTE_WRAP_X + 179 04a8 4cc504 jmp test_result_found + 180 + + 181 04ab c9aa cmp #TESTBYTE_ABS_X + 182 04ad d005 bne + + 183 04af a900 lda #RESULT_BYTE_ITSELF + 184 04b1 4cc504 jmp test_result_found + 185 + + 186 04b4 cd8e04 cmp test_operand_high + 187 04b7 d005 bne + + 188 04b9 a901 lda #RESULT_ADDR_MSB + 189 04bb 4cc504 jmp test_result_found + 190 + + 191 ; assuming ROM + 192 04be a904 lda #RESULT_ROM + 193 04c0 4cc504 jmp test_result_found + 194 + 195 calc_found_difference: + 196 ; difference in results found -> v-bus (not relevant for PETs) + 197 04c3 a903 lda #RESULT_VBUS + 198 + 199 test_result_found: + 200 04c5 8565 sta result + 201 + 202 ; - print results + 203 test_result_print: + 204 04c7 205c05 jsr printresult + 205 + 206 04ca a900 lda #<infotext_test_res_sep + 207 04cc a206 ldx #>infotext_test_res_sep + 208 04ce 203805 jsr printstring + 209 + 210 ; - print reference + 211 04d1 a003 ldy #3 + 212 04d3 b161 lda (test_p),y + 213 04d5 205c05 jsr printresult + 214 + 215 ; - print first byte from buffer + 216 04d8 a904 lda #<infotext_test_res_hex + 217 04da a206 ldx #>infotext_test_res_hex + 218 04dc 203805 jsr printstring + 219 + 220 04df ad6d06 lda result_buffer + 221 04e2 201d05 jsr printhex + 222 + 223 ; - fill up the rest of the line + 224 04e5 a908 lda #<infotext_rest_of_line + 225 04e7 a206 ldx #>infotext_rest_of_line + 226 04e9 203805 jsr printstring + 227 ; - test done + 228 + 229 04ec 18 clc + 230 04ed a561 lda test_p + 231 04ef 6904 adc #4 + 232 04f1 8561 sta test_p + 233 04f3 9002 bcc + + 234 04f5 e662 inc test_ph + 235 + + 236 04f7 4c2a04 jmp test_next + 237 + 238 ; - all tests finished + 239 + 240 test_finished: + 241 04fa a9cb lda #<infotext_bottom + 242 04fc a205 ldx #>infotext_bottom + 243 04fe 203805 jsr printstring + 244 + 245 0501 20e4ff - jsr $ffe4 + 246 0504 f0fb beq - + 247 + 248 0506 4c1004 jmp mlcodeentry + 249 + 251 ; --- Subroutines + 252 + 253 ; - clearscreen + 254 ; changes: + 255 ; y = 0 + 256 ; + 257 clearscreen: + 258 0509 a000 ldy #0 + 259 050b a920 - lda #' ' + 260 050d 990080 sta SCREEN,y + 261 0510 990081 sta SCREEN+$100,y + 262 0513 990082 sta SCREEN+$200,y + 263 0516 990083 sta SCREEN+$300,y + 264 0519 c8 iny + 265 051a d0ef bne - + 266 051c 60 rts + 267 + 268 ; - printhex + 269 ; parameters: + 270 ; res_print -> screen location to print to + 271 ; a = value to print + 272 ; changes: + 273 ; a, y = 0, tmp, res_print++ + 274 ; + 275 printhex: + 276 051d 865e stx tmp + 277 051f 48 pha + 278 ; get upper + 279 0520 4a lsr + 280 0521 4a lsr + 281 0522 4a lsr + 282 0523 4a lsr + 283 ; lookup + 284 0524 aa tax + 285 0525 bd6a05 lda hex_lut,x + 286 ; print + 287 0528 205105 jsr print + 288 ; get lower + 289 052b 68 pla + 290 052c 290f and #$0f + 291 ; lookup + 292 052e aa tax + 293 052f bd6a05 lda hex_lut,x + 294 ; print + 295 0532 205105 jsr print + 296 0535 a65e ldx tmp + 297 0537 60 rts + 298 + 299 ; - printstring + 300 ; res_print -> screen location to print to + 301 ; a:x -> string to print + 302 ; changes: + 303 ; a, x, y, res_print++ + 304 ; + 305 printstring: + 306 0538 8d4105 sta printstring_src + 307 053b 8e4205 stx printstring_src_h + 308 053e a200 ldx #0 + 309 printstring_src = * + 1 + 310 printstring_src_h = * + 2 + 311 - + 312 0540 bd3412 lda $1234,x + 313 0543 f00b beq + + 314 0545 205105 jsr print + 315 0548 e8 inx + 316 0549 d0f5 bne - + 317 054b ee4205 inc printstring_src_h + 318 054e d0f0 bne - + 319 + + 320 0550 60 rts + 321 + 322 ; - print + 323 ; parameters: + 324 ; res_print -> screen location to print to + 325 ; a = char to print + 326 ; changes: + 327 ; y = 0, res_print++ + 328 ; + 329 print: + 330 0551 a000 ldy #0 + 331 0553 915f sta (res_print),y + 332 0555 e65f inc res_print + 333 0557 d002 bne + + 334 0559 e660 inc res_print_h + 335 + + 336 055b 60 rts + 337 + 338 ; - printresult + 339 ; parameters: + 340 ; res_print -> screen location to print to + 341 ; a = result + 342 ; changes: + 343 ; a, x, y = 0, tmp, res_print++ + 344 ; + 345 printresult: + 346 055c 0a asl + 347 055d 0a asl + 348 055e a206 ldx #>infotext_test_result_tbl + 349 0560 18 clc + 350 0561 6956 adc #<infotext_test_result_tbl + 351 0563 9001 bcc + + 352 0565 e8 inx + 353 + + 354 0566 203805 jsr printstring + 355 0569 60 rts + 356 + 358 ; --- Data + 359 + 360 ; - hex lookup table + 361 hex_lut: + 362 056a 3031323334353637...!tx "0123456789abcdef" + 363 + 364 ; - Strings + 365 ; |0123456789012345678901234567890123456789| + 366 infotext_top: + 367 057a 150e2d030f0e0e05...!tx "un-connected testprog " + 368 05a2 140513143a201205...!tx "test: result - ref/1st ",0 + 369 + 370 infotext_bottom: + 371 05cb 1012051313200120...!tx "press a key to restart ",0 + 372 + 373 infotext_test_start: + 374 05f4 2400 !tx "$",0 + 375 infotext_test_abs: + 376 05f6 20203a2000 !tx " : ",0 + 377 infotext_test_abs_x: + 378 05fb 2c183a2000 !tx ",x: ",0 + 379 infotext_test_res_sep: + 380 0600 202d2000 !tx " - ",0 + 381 infotext_test_res_hex: + 382 0604 2f242000 !tx "/$ ",0 + 383 infotext_rest_of_line: + 384 0608 2020202020202020...!tx " ",0 + 385 + 386 ; - test data + 387 ; format: + 388 ; type - 0 = end, 1 = absolute, 2 = ,x + 389 ; addr - hi, low + 390 ; reference - (see defines) + 391 testdata: + 392 061a 01f00004 !by 1, $f0, $00, RESULT_ROM + 393 061e 02f00004 !by 2, $f0, $00, RESULT_ROM + 394 0622 01150000 !by 1, $15, $00, RESULT_BYTE_ITSELF + 395 0626 0216ff00 !by 2, $16, $ff, RESULT_BYTE_ITSELF + 396 062a 01900001 !by 1, $90, $00, RESULT_ADDR_MSB + 397 062e 02900001 !by 2, $90, $00, RESULT_ADDR_MSB + 398 0632 0287ff02 !by 2, $87, $ff, RESULT_BYTE_WRAP_X ; X=3, 8702 is RAM, 8802 is empty; reads 8702 + 399 0636 019d3401 !by 1, $9d, $34, RESULT_ADDR_MSB + 400 063a 0293ff01 !by 2, $93, $ff, RESULT_ADDR_MSB + 401 063e 01e80001 !by 1, $e8, $00, RESULT_ADDR_MSB ; E800-E80F is empty + 402 0642 01e80f01 !by 1, $e8, $0f, RESULT_ADDR_MSB + 403 0646 02e7ff04 !by 2, $e7, $ff, RESULT_ROM ; X=3, E80x is empty, E7xx is ROM; reads E702 + 404 064a 027fff00 !by 2, $7f, $ff, RESULT_BYTE_ITSELF ; X=3, 7F02 is empty, 8002 is RAM; reads 8002 + 405 064e 02bfff04 !by 2, $bf, $ff, RESULT_ROM ; X=3, BF02 is empty, C002 is ROM; reads C002 + 406 0652 00 !by 0 + 407 + 408 ; Test 2, $7f, $ff, RESULT_BYTE_ITSELF is meant for a 16 K PET so that it + 409 ; dummy-reads empty, then reads RAM, but the result "RAM" is also reached for + 410 ; 32 KB models, where it dummy-reads and real-reads RAM. + 411 + 412 ; Test 2, $bf, $ff, RESULT_ROM depends on $Bxxx being empty, so it won't work + 413 ; as intended for BASIC 4 machines. For those it should be 2, $af, $ff, RESULT_ROM. + 414 ; But the result will be "ROM" in both cases. + 415 + 416 ; opcode, indexed by type field of testdata + 417 testdata_opcode: + 418 0653 00 !by 0 ; 0 = unused + 419 0654 ad !by $ad ; 1 = LDA $nnnn + 420 0655 bd !by $bd ; 2 = LDA $nnnn,X + 421 + 422 ; result text table + 423 infotext_test_result_tbl: + 424 0656 12010d00 !tx "ram",0 + 425 065a 0d130200 !tx "msb",0 + 426 065e 0e0f1800 !tx "nox",0 + 427 0662 162d0200 !tx "v-b",0 + 428 0666 120f0d00 !tx "rom",0 + 429 + 430 066a 010203 !by 1,2,3 + 431 + 432 result_buffer: + 433 + +; ******** done Added: testprogs/PET/unconnected/unconnected.prg =================================================================== (Binary files differ) Index: testprogs/PET/unconnected/unconnected.prg =================================================================== --- testprogs/PET/unconnected/unconnected.prg 2025-04-23 09:26:31 UTC (rev 45635) +++ testprogs/PET/unconnected/unconnected.prg 2025-04-23 18:43:18 UTC (rev 45636) Property changes on: testprogs/PET/unconnected/unconnected.prg ___________________________________________________________________ Added: svn:mime-type ## -0,0 +1 ## +application/octet-stream \ No newline at end of property This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-04-23 09:28:02
|
Revision: 45635 http://sourceforge.net/p/vice-emu/code/45635 Author: compyx Date: 2025-04-23 09:26:31 +0000 (Wed, 23 Apr 2025) Log Message: ----------- Joystick: DirectInput: simplify hat to joystick direction conversion Rotate hat 22.5 degrees so we can do a simple table lookup for the joystick directions: index := ((V + 2250 ) % 36000) / 4500. Modified Paths: -------------- trunk/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c Modified: trunk/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c =================================================================== --- trunk/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-04-22 07:41:38 UTC (rev 45634) +++ trunk/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-04-23 09:26:31 UTC (rev 45635) @@ -151,8 +151,19 @@ &jstate.lFX, &jstate.lFY, &jstate.lFZ, &jstate.lFRx, &jstate.lFRy, &jstate.lFRz }; - int i; - HRESULT result; + /* mapping of directions to eight sections of 45 degrees */ + static const int32_t hat_map[36000/4500] = { + JOYSTICK_DIRECTION_UP, + JOYSTICK_DIRECTION_UP|JOYSTICK_DIRECTION_RIGHT, + JOYSTICK_DIRECTION_RIGHT, + JOYSTICK_DIRECTION_DOWN|JOYSTICK_DIRECTION_RIGHT, + JOYSTICK_DIRECTION_DOWN, + JOYSTICK_DIRECTION_DOWN|JOYSTICK_DIRECTION_LEFT, + JOYSTICK_DIRECTION_LEFT, + JOYSTICK_DIRECTION_UP|JOYSTICK_DIRECTION_LEFT + }; + int i; + HRESULT result; /* poll device */ priv = joydev->priv; @@ -205,7 +216,6 @@ WORD value = LOWORD(jstate.rgdwPOV[i]); WORD prev = priv->prev_hats[i]; int32_t direction = JOYSTICK_DIRECTION_NONE; /* neutral */ - if (prev == value) { continue; } @@ -221,6 +231,14 @@ if (value == 0xffff) { /* report neutral position */ direction = JOYSTICK_DIRECTION_NONE; + } else { + /* rotate hat 22.5 deg so 0-22.5 deg becomes North, 22.5-45 becomes + * Northeast, and so on, divide by 45 deg so we get an index into + * direction map */ + WORD hidx = ((value + 2250) % 36000) / 4500; + direction = hat_map[hidx]; + } +#if 0 } else if (value >= 33750 || value < 2250) { /* North */ direction = JOYSTICK_DIRECTION_UP; @@ -246,6 +264,7 @@ /* Northwest */ direction = JOYSTICK_DIRECTION_UP|JOYSTICK_DIRECTION_LEFT; } +#endif joy_hat_event(hat, direction); } } @@ -500,4 +519,7 @@ void joystick_arch_shutdown(void) { + if (dinput_handle != NULL) { + IDirectInput8_Release(dinput_handle); + } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-04-22 07:41:54
|
Revision: 45634 http://sourceforge.net/p/vice-emu/code/45634 Author: compyx Date: 2025-04-22 07:41:38 +0000 (Tue, 22 Apr 2025) Log Message: ----------- Gtk3: Use "Play" instead of "Start" for datasette controls submenu Modified Paths: -------------- trunk/vice/src/arch/gtk3/uimachinemenu.c Modified: trunk/vice/src/arch/gtk3/uimachinemenu.c =================================================================== --- trunk/vice/src/arch/gtk3/uimachinemenu.c 2025-04-19 15:37:33 UTC (rev 45633) +++ trunk/vice/src/arch/gtk3/uimachinemenu.c 2025-04-22 07:41:38 UTC (rev 45634) @@ -174,7 +174,7 @@ .type = UI_MENU_TYPE_ITEM_ACTION, .action = ACTION_TAPE_STOP_1 }, - { .label = "Start", + { .label = "Play", .type = UI_MENU_TYPE_ITEM_ACTION, .action = ACTION_TAPE_PLAY_1 }, @@ -210,7 +210,7 @@ .type = UI_MENU_TYPE_ITEM_ACTION, .action = ACTION_TAPE_STOP_1 }, - { .label = "Start", + { .label = "Play", .type = UI_MENU_TYPE_ITEM_ACTION, .action = ACTION_TAPE_PLAY_1 }, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <rh...@us...> - 2025-04-19 15:37:50
|
Revision: 45633 http://sourceforge.net/p/vice-emu/code/45633 Author: rhialto Date: 2025-04-19 15:37:33 +0000 (Sat, 19 Apr 2025) Log Message: ----------- Re-fix access to empty memory space. Now that I finally get why this almost always results in the high byte of the address, make sure that access to $9xxx, $Axxx and $Bxxx goes via read_unused() when no ROM is in the socket; this should take care of the exceptions. Previously there would be a ROM pre-filled with the empty value. Also: a memory map reset would turn off watchpoints. Keep the watchpoints active in that case. Modified Paths: -------------- trunk/vice/src/pet/petmem.c Modified: trunk/vice/src/pet/petmem.c =================================================================== --- trunk/vice/src/pet/petmem.c 2025-04-13 16:57:32 UTC (rev 45632) +++ trunk/vice/src/pet/petmem.c 2025-04-19 15:37:33 UTC (rev 45633) @@ -295,8 +295,26 @@ } #endif -uint8_t read_unused(uint16_t addr) +/* + * This is a very complicated way to return "addr >> 8" in *most* cases. + * This is because with a LOAD instruction, the last successful read on the + * bus was the high byte of the address. + * Example: LDA $9000 reads AD 00 90 as instruction bytes and then from $9000. + * Even LDA ($12),Y reads B1 12 as instruction bytes, but then 00 90 from the + * zero page, then from $9000. + * The only exception is when there is indexing with a page crossing. + * Then there is a dummy read from $90xx before the real read of $91xx. + * In that case you get $90, not $91. + * + * Annoyingly, when viewing memory with Vice's monitor, this won't work right. + */ +inline uint8_t read_unused(uint16_t addr) { + return last_access; +} + +static inline uint8_t peek_unused(uint16_t addr) +{ return addr >> 8; } @@ -752,7 +770,7 @@ /* ------------------------------------------------------------------------- */ -/* Generic memory access. */ +/* Generic 6502 memory access. */ void mem_store(uint16_t addr, uint8_t value) { @@ -764,6 +782,8 @@ return _mem_read_tab_ptr[addr >> 8](addr); } +/* Generic 6809 memory access. */ + #define PRINT_6809_STORE 0 #define PRINT_6809_READ 0 @@ -902,7 +922,7 @@ return last_access = crtc_read(addr); } /* fall through */ case 0x00: - return addr >> 8; /* empty space */ + return read_unused(addr); /* Empty space */ default: /* 0x30, 0x50, 0x60, 0x70, 0x90-0xf0 */ if (addr & 0x10) { v1 = pia1_read(addr); @@ -1084,7 +1104,9 @@ mem_read_limit_tab[i] = 0; } } else { - fetch = ram9 ? ram_read : rom_read; + fetch = ram9 ? ram_read : + petrom_9_loaded ? rom_read : + read_unused; for (i = 0x90; i < 0xa0; i++) { _mem_read_tab[i] = fetch; _mem_write_tab[i] = store; @@ -1094,7 +1116,9 @@ } /* Setup RAM/ROM at $A000 - $AFFF. */ - fetch = ramA ? ram_read : rom_read; + fetch = ramA ? ram_read : + petrom_A_loaded ? rom_read : + read_unused; for (i = 0xa0; i < 0xb0; i++) { _mem_read_tab[i] = fetch; _mem_write_tab[i] = store; @@ -1108,9 +1132,20 @@ _mem_read_base_tab, mem_read_limit_tab); } - /* Setup RAM/ROM at $B000 - $DFFF: Basic. */ + /* Setup RAM/ROM at $B000 - $BFFF: Basic 4.0 or EPROM socket. */ + fetch = ramBCD ? ram_read : + petrom_B_loaded ? rom_read : + read_unused; + for (i = 0xb0; i < 0xc0; i++) { + _mem_read_tab[i] = fetch; + _mem_write_tab[i] = store; + _mem_read_base_tab[i] = NULL; + mem_read_limit_tab[i] = 0; + } + + /* Setup RAM/ROM at $C000 - $DFFF: Basic. */ fetch = ramBCD ? ram_read : rom_read; - for (i = 0xb0; i <= 0xdf; i++) { + for (i = 0xc0; i <= 0xdf; i++) { _mem_read_tab[i] = fetch; _mem_write_tab[i] = store; _mem_read_base_tab[i] = NULL; @@ -1649,10 +1684,6 @@ mem_read_limit_tab[0x100] = 0; ram_size = petres.model.ramSize * 1024; - _mem_read_tab_ptr = _mem_read_tab; - _mem_write_tab_ptr = _mem_write_tab; - _mem_read_tab_ptr_dummy = _mem_read_tab; - _mem_write_tab_ptr_dummy = _mem_write_tab; /* setup watchpoint tables */ _mem_read_tab_watch[0] = zero_read_watch; @@ -1686,11 +1717,11 @@ _mem6809_read_tab_watch[i] = read6809_watch; _mem6809_write_tab_watch[i] = store6809_watch; } - - _mem6809_read_tab_ptr = _mem6809_read_tab; - _mem6809_write_tab_ptr = _mem6809_write_tab; } + /* Set memory access via watchpoints, if needed: _mem_read_tab_ptr etc */ + mem_toggle_watchpoints(watchpoints_active, NULL); + maincpu_resync_limits(); } @@ -1821,7 +1852,7 @@ } /* FALL THROUGH */ case 0x00: - return addr >> 8; /* Empty space */ + return peek_unused(addr); /* Empty space */ default: /* 0x30, 0x50, 0x60, 0x70, 0x90-0xf0 */ break; } @@ -2010,7 +2041,7 @@ if (addr >= 0xE900 && addr < 0xE800 + petres.model.IOSize) { uint8_t result; /* is_peek_access = 1; FIXME */ - result = read_unused(addr); + result = peek_unused(addr); /* is_peek_access = 0; FIXME */ return result; } @@ -2021,6 +2052,7 @@ /* FALLS THROUGH TO normal read with side effects */ } /* For extram, rom, cpu/cpu6809 when not accessing I/O, and ram: */ + /* TODO: might need PEEK for cases with empty space */ return mem_bank_read(bank, addr, context); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-04-13 16:57:50
|
Revision: 45632 http://sourceforge.net/p/vice-emu/code/45632 Author: gpz Date: 2025-04-13 16:57:32 +0000 (Sun, 13 Apr 2025) Log Message: ----------- improve help output and docs as suggested by tokra Modified Paths: -------------- trunk/vice/doc/vice.texi trunk/vice/src/tools/cartconv/cartconv.c Modified: trunk/vice/doc/vice.texi =================================================================== --- trunk/vice/doc/vice.texi 2025-04-13 01:29:54 UTC (rev 45631) +++ trunk/vice/doc/vice.texi 2025-04-13 16:57:32 UTC (rev 45632) @@ -23328,7 +23328,7 @@ -i <name> input filename -o <name> output filename -n <name> crt cart name --l <addr> load address +-l <addr> load address (decimal, use 0x-prefix for hexadecimal, e.g. 0xc000) -q quiet -v --verbose verbose --types show the supported cart types Modified: trunk/vice/src/tools/cartconv/cartconv.c =================================================================== --- trunk/vice/src/tools/cartconv/cartconv.c 2025-04-13 01:29:54 UTC (rev 45631) +++ trunk/vice/src/tools/cartconv/cartconv.c 2025-04-13 16:57:32 UTC (rev 45632) @@ -1342,7 +1342,7 @@ "-i <name> input filename\n" "-o <name> output filename\n" "-n <name> crt cart name\n" - "-l <addr> load address\n" + "-l <addr> load address (decimal, use 0x-prefix for hexadecimal, e.g. 0xc000)\n" "-q quiet\n" "-v --verbose verbose\n" "--types show the supported cart types\n" This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-04-13 01:30:11
|
Revision: 45631 http://sourceforge.net/p/vice-emu/code/45631 Author: gpz Date: 2025-04-13 01:29:54 +0000 (Sun, 13 Apr 2025) Log Message: ----------- fix CPU port emulation for SX64. On the SX64 board, bits 3,4,5 of the CPU port are not connected, and thus read back as 0. We still need to disable anything tape related when SX64 (and perhaps C64GS?) is selected. Modified Paths: -------------- trunk/vice/src/c64/c64-resources.c trunk/vice/src/c64/c64mem.c trunk/vice/src/c64/c64meminit.c trunk/vice/src/c64/c64memsc.c trunk/vice/src/c64/c64model.h trunk/vice/src/c64/c64scmodel.c Modified: trunk/vice/src/c64/c64-resources.c =================================================================== --- trunk/vice/src/c64/c64-resources.c 2025-04-12 13:32:34 UTC (rev 45630) +++ trunk/vice/src/c64/c64-resources.c 2025-04-13 01:29:54 UTC (rev 45631) @@ -76,7 +76,7 @@ int cia1_model; int cia2_model; -static int board_type = BOARD_C64; +int board_type = BOARD_C64; static int iec_reset = 0; static log_t res_log = LOG_DEFAULT; @@ -135,7 +135,7 @@ static int set_board_type(int val, void *param) { int old_board_type = board_type; - if ((val < 0) || (val > 1)) { + if ((val < 0) || (val > BOARD_LAST)) { return -1; } board_type = val; Modified: trunk/vice/src/c64/c64mem.c =================================================================== --- trunk/vice/src/c64/c64mem.c 2025-04-12 13:32:34 UTC (rev 45630) +++ trunk/vice/src/c64/c64mem.c 2025-04-13 01:29:54 UTC (rev 45631) @@ -43,6 +43,7 @@ #include "c64meminit.h" #include "c64memlimit.h" #include "c64memrom.h" +#include "c64model.h" #include "c64pla.h" #include "c64ui.h" #include "c64cartmem.h" @@ -67,6 +68,9 @@ /* Machine class (moved from c64.c to distinguish between x64 and x64sc) */ int machine_class = VICE_MACHINE_C64; +/* import from c64-resources.c - don't use the resource for performance reasons */ +extern int board_type; + /* C64 memory-related resources. */ /* ------------------------------------------------------------------------- */ @@ -210,7 +214,12 @@ { mem_config = (((~pport.dir | pport.data) & 0x7) | (export.exrom << 3) | (export.game << 4)); - c64pla_config_changed(tape_sense, tape_write_in, tape_motor_in, 1, 0x17); + /* NOTE: CPU port bits 3,4,5 are not connected on the SX64 board */ + if (board_type == BOARD_SX64) { + c64pla_config_changed(1, 1, 1, 1, 0x07); + } else { + c64pla_config_changed(tape_sense, tape_write_in, tape_motor_in, 1, 0x17); + } mem_update_tab_ptrs(watchpoints_active); @@ -260,6 +269,9 @@ case 1: retval = pport.data_read; + /* FIXME: bits 3,4,5 are not connected on SX-64 boards - whether they + show similar behaviour needs to be tested */ + /* discharge the "capacitor" */ /* set real value of read bit 6 */ @@ -751,7 +763,7 @@ mem_read_tab[i][0] = zero_read; mem_read_base_tab[i][0] = mem_ram; for (j = 1; j <= 0xfe; j++) { - if (board == 1 && j >= 0x08) { + if (board == BOARD_MAX && j >= 0x08) { /* mem_read_tab[i][j] = void_read; mem_read_base_tab[i][j] = NULL; mem_set_write_hook(0, j, void_store); */ @@ -776,7 +788,7 @@ } } } - if (board == 1) { + if (board == BOARD_MAX) { /* mem_read_tab[i][0xff] = void_read; mem_read_base_tab[i][0xff] = NULL; mem_set_write_hook(0, 0xff, void_store); */ @@ -840,7 +852,7 @@ plus256k_init_config(); c64_256k_init_config(); - if (board == 1) { + if (board == BOARD_MAX) { mem_limit_max_init(); } } Modified: trunk/vice/src/c64/c64meminit.c =================================================================== --- trunk/vice/src/c64/c64meminit.c 2025-04-12 13:32:34 UTC (rev 45630) +++ trunk/vice/src/c64/c64meminit.c 2025-04-13 01:29:54 UTC (rev 45631) @@ -35,6 +35,7 @@ #include "c64mem.h" #include "c64meminit.h" #include "c64memrom.h" +#include "c64model.h" #include "cartio.h" #include "machine.h" #include "resources.h" @@ -128,13 +129,13 @@ void c64meminit(unsigned int base) { unsigned int i, j; - int board = 0; + int board = BOARD_C64; if (machine_class != VICE_MACHINE_C128) { resources_get_int("BoardType", &board); } - if (board != 1) { + if (board != BOARD_MAX) { /* Setup BASIC ROM at $A000-$BFFF (memory configs 3, 7, 11, 15). */ for (i = 0xa0; i <= 0xbf; i++) { mem_read_tab_set(base + 3, i, c64memrom_basic64_read); @@ -196,7 +197,7 @@ } } - if (board != 1) { + if (board != BOARD_MAX) { /* Setup Kernal ROM at $E000-$FFFF (memory configs 2, 3, 6, 7, 10, 11, 14, 15, 26, 27, 30, 31). */ for (i = 0xe0; i <= 0xff; i++) { @@ -304,7 +305,7 @@ /* Setup Ultimax configuration. */ for (j = 16; j < 24; j++) { - if (board == 1) { + if (board == BOARD_MAX) { for (i = 0x08; i <= 0x0f; i++) { mem_read_tab_set(base + j, i, ultimax_0800_0fff_read); mem_set_write_hook(base + j, i, ultimax_0800_0fff_store); Modified: trunk/vice/src/c64/c64memsc.c =================================================================== --- trunk/vice/src/c64/c64memsc.c 2025-04-12 13:32:34 UTC (rev 45630) +++ trunk/vice/src/c64/c64memsc.c 2025-04-13 01:29:54 UTC (rev 45631) @@ -43,6 +43,7 @@ #include "c64meminit.h" #include "c64memlimit.h" #include "c64memrom.h" +#include "c64model.h" #include "c64pla.h" #include "c64ui.h" #include "c64cartmem.h" @@ -70,6 +71,9 @@ /* Machine class (moved from c64.c to distinguish between x64 and x64sc) */ int machine_class = VICE_MACHINE_C64SC; +/* import from c64-resources.c - don't use the resource for performance reasons */ +extern int board_type; + /* C64 memory-related resources. */ /* ------------------------------------------------------------------------- */ @@ -222,7 +226,12 @@ { mem_config = (((~pport.dir | pport.data) & 0x7) | (export.exrom << 3) | (export.game << 4)); - c64pla_config_changed(tape_sense, tape_write_in, tape_motor_in, 1, 0x17); + /* NOTE: CPU port bits 3,4,5 are not connected on the SX64 board */ + if (board_type == BOARD_SX64) { + c64pla_config_changed(1, 1, 1, 1, 0x07); + } else { + c64pla_config_changed(tape_sense, tape_write_in, tape_motor_in, 1, 0x17); + } mem_update_tab_ptrs(watchpoints_active); @@ -264,6 +273,9 @@ /* discharge the "capacitor" */ + /* FIXME: bits 3,4,5 are not connected on SX-64 boards - whether they + show similar behaviour needs to be tested */ + /* set real value of read bit 6 */ if (pport.data_falloff_bit6 && (pport.data_set_clk_bit6 < maincpu_clk)) { pport.data_falloff_bit6 = 0; @@ -707,7 +719,7 @@ mem_read_tab[i][0] = zero_read; mem_read_base_tab[i][0] = mem_ram; for (j = 1; j <= 0xfe; j++) { - if (board == 1 && j >= 0x08) { + if (board == BOARD_MAX && j >= 0x08) { /* mem_read_tab[i][j] = void_read; mem_read_base_tab[i][j] = NULL; mem_set_write_hook(0, j, void_store); */ @@ -717,7 +729,7 @@ mem_read_base_tab[i][j] = mem_ram; mem_write_tab[i][j] = ram_store; } - if (board == 1) { + if (board == BOARD_MAX) { /* mem_read_tab[i][0xff] = void_read; mem_read_base_tab[i][0xff] = NULL; mem_set_write_hook(0, 0xff, void_store); */ @@ -774,7 +786,7 @@ plus256k_init_config(); c64_256k_init_config(); - if (board == 1) { + if (board == BOARD_MAX) { mem_limit_max_init(); } } Modified: trunk/vice/src/c64/c64model.h =================================================================== --- trunk/vice/src/c64/c64model.h 2025-04-12 13:32:34 UTC (rev 45630) +++ trunk/vice/src/c64/c64model.h 2025-04-13 01:29:54 UTC (rev 45631) @@ -70,8 +70,11 @@ #define GLUE_DISCRETE 0 #define GLUE_CUSTOM_IC 1 -#define BOARD_C64 0 -#define BOARD_MAX 1 +#define BOARD_C64 0 +#define BOARD_MAX 1 +#define BOARD_SX64 2 +#define BOARD_C128 3 +#define BOARD_LAST 3 #define IEC_HARD_RESET 0 #define IEC_SOFT_RESET 1 @@ -101,7 +104,7 @@ int cia1_model; int cia2_model; int cia_tick; - int board; /* 0: normal, 1: ultimax */ + int board; /* 0: normal, 1: ultimax, 2: sx64, 3: C128 */ int iecreset; /* 1: reset goes to IEC bus (old) 0: only reset IEC on hard reset (new) */ const char *kernal; const char *chargen; Modified: trunk/vice/src/c64/c64scmodel.c =================================================================== --- trunk/vice/src/c64/c64scmodel.c 2025-04-12 13:32:34 UTC (rev 45630) +++ trunk/vice/src/c64/c64scmodel.c 2025-04-13 01:29:54 UTC (rev 45631) @@ -148,13 +148,13 @@ /* SX64 PAL, FIXME: guessed */ { VICII_MODEL_6569, MACHINE_SYNC_PAL, CIATICK_60HZ, - CIA_MODEL_DEFAULT_OLD, GLUE_DISCRETE, OLD_SID, BOARD_C64, + CIA_MODEL_DEFAULT_OLD, GLUE_DISCRETE, OLD_SID, BOARD_SX64, IEC_SOFT_RESET, NO_DATASETTE, HAS_IEC, HAS_USERPORT, HAS_KEYBOARD, HAS_CIA2, C64_CHARGEN_NAME, C64_KERNAL_SX64 }, /* SX64 NTSC, FIXME: guessed */ { VICII_MODEL_6567, MACHINE_SYNC_NTSC, CIATICK_60HZ, - CIA_MODEL_DEFAULT_OLD, GLUE_DISCRETE, OLD_SID, BOARD_C64, + CIA_MODEL_DEFAULT_OLD, GLUE_DISCRETE, OLD_SID, BOARD_SX64, IEC_SOFT_RESET, NO_DATASETTE, HAS_IEC, HAS_USERPORT, HAS_KEYBOARD, HAS_CIA2, C64_CHARGEN_NAME, C64_KERNAL_SX64 }, This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-04-12 13:32:51
|
Revision: 45630 http://sourceforge.net/p/vice-emu/code/45630 Author: compyx Date: 2025-04-12 13:32:34 +0000 (Sat, 12 Apr 2025) Log Message: ----------- Joystick: DirectInput: fix POV direction handling Take low WORD of POV values before checking for -1/0xffff. Neutral is reported as 0xffff, not 0xffffffff as I thought. Modified Paths: -------------- trunk/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c Modified: trunk/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c =================================================================== --- trunk/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-04-12 11:02:01 UTC (rev 45629) +++ trunk/vice/src/arch/gtk3/joystickdrv/joystick_win32_directinput.c 2025-04-12 13:32:34 UTC (rev 45630) @@ -58,7 +58,7 @@ LPDIRECTINPUTDEVICE8 didev; /**< DirectInput device instance */ LONG prev_axes[DIJS2_MAX_AXES]; /**< prev state of axes */ BYTE prev_buttons[DIJS2_MAX_BUTTONS]; /**< prev state of buttons */ - LONG prev_hats[DIJS2_MAX_HATS]; /**< prev state of POVs */ + WORD prev_hats[DIJS2_MAX_HATS]; /**< prev state of POVs */ } joy_priv_t; @@ -83,6 +83,8 @@ { joy_priv_t *priv = lib_calloc(sizeof *priv, 1); priv->didev = NULL; + /* set POV values to neutral (0xffff) */ + memset(priv->prev_hats, 0xff, sizeof priv->prev_hats); return priv; } @@ -200,21 +202,24 @@ for (i = 0; i < joydev->num_hats; i++) { /* POVs are simply reported sequentially, so hat index is POV value index */ joystick_hat_t *hat = joydev->hats[i]; - int32_t value = LOWORD(jstate.rgdwPOV[i]); + WORD value = LOWORD(jstate.rgdwPOV[i]); + WORD prev = priv->prev_hats[i]; int32_t direction = JOYSTICK_DIRECTION_NONE; /* neutral */ - LONG prev = priv->prev_hats[i]; if (prev == value) { continue; } - priv->prev_hats[i] = prev; + priv->prev_hats[i] = value; /* POVs map to 360 degrees, in units of 1/100th of a degree, neutral - * is reported as -1 / 0xffffffff. + * is reported as 0xffff. * Translate position on a circle to joystick directions, clockwise * from North through to Northwest */ - if (value < 0 || value >= 36000) { - /* invalid: report neutral position */ +#if 0 + printf("HAT %d: %u\n", i, (unsigned int)value); +#endif + if (value == 0xffff) { + /* report neutral position */ direction = JOYSTICK_DIRECTION_NONE; } else if (value >= 33750 || value < 2250) { /* North */ This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <co...@us...> - 2025-04-12 11:02:17
|
Revision: 45629 http://sourceforge.net/p/vice-emu/code/45629 Author: compyx Date: 2025-04-12 11:02:01 +0000 (Sat, 12 Apr 2025) Log Message: ----------- Joystick: update Linux driver Prevent reopening a device when calling open(), check we have an opened device before handling events in poll(). Modified Paths: -------------- trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c Modified: trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c =================================================================== --- trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-04-10 02:33:23 UTC (rev 45628) +++ trunk/vice/src/arch/gtk3/joystickdrv/joystick_linux_evdev.c 2025-04-12 11:02:01 UTC (rev 45629) @@ -162,6 +162,14 @@ } } +/** \brief Open callback for the joystick system + * + * Open joystick for polling. + * + * \param[in] joydev joystick device + * + * \return \c true on success (also when \a joydev was already opened) + */ static bool linux_joystick_evdev_open(joystick_device_t *joydev) { struct libevdev *evdev; @@ -173,10 +181,17 @@ return false; } + priv = joydev->priv; + if (priv->fd >= 0) { + /* already opened */ + return true; + } + fd = open(joydev->node, O_RDONLY|O_NONBLOCK); if (fd < 0) { return false; } + priv->fd = fd; /* get evdev instance from file descriptor */ rc = libevdev_new_from_fd(fd, &evdev); @@ -185,9 +200,6 @@ close(fd); return false; } - - priv = joydev->priv; - priv->fd = fd; priv->evdev = evdev; return true; @@ -195,7 +207,7 @@ /** \brief Poll callback for the joystick system * - * \param[in] priv driver-specific joystick data + * \param[in] joydev joystick device */ static void linux_joystick_evdev_poll(joystick_device_t *joydev) { @@ -204,7 +216,10 @@ int rc; unsigned int flags = LIBEVDEV_READ_FLAG_NORMAL; - priv = joydev->priv; + priv = joydev->priv; + if (priv == NULL || priv->fd < 0 || priv->evdev == NULL) { + return; + } evdev = priv->evdev; while (libevdev_has_event_pending(evdev)) { @@ -227,7 +242,7 @@ * * Release resources associated with the joystick. * - * \param[in] priv driver-specific joystick data + * \param[in] joydev joystick data device */ static void linux_joystick_evdev_close(joystick_device_t *joydev) { @@ -360,13 +375,16 @@ joydev->product = (uint16_t)libevdev_get_id_product(evdev); priv = joy_priv_new(); - priv->fd = fd; /* TODO: remove once open() is implemented */ - priv->evdev = evdev; /* TODO: remove once open() is implemented */ joydev->priv = priv; /* scan for valid inputs */ scan_buttons(joydev, evdev); scan_axes(joydev, evdev); + + /* clean up */ + libevdev_free(evdev); + close(fd); + return joydev; } @@ -413,7 +431,10 @@ joydev = scan_device(namelist[i]->d_name); if (joydev != NULL) { joystick_device_register(joydev); - } + /* open joystick: REMOVE once we have opening/closing via resource + * and manually implemented properly */ + linux_joystick_evdev_open(joydev); + } } free(namelist); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <emp...@us...> - 2025-04-10 02:33:40
|
Revision: 45628 http://sourceforge.net/p/vice-emu/code/45628 Author: empathicqubit Date: 2025-04-10 02:33:23 +0000 (Thu, 10 Apr 2025) Log Message: ----------- If no SDL2 renderer is explicitly specified, and no accelerated renderer can be created, try falling back to any available renderer Modified Paths: -------------- trunk/vice/src/arch/sdl/video_sdl2.c Modified: trunk/vice/src/arch/sdl/video_sdl2.c =================================================================== --- trunk/vice/src/arch/sdl/video_sdl2.c 2025-04-07 20:09:08 UTC (rev 45627) +++ trunk/vice/src/arch/sdl/video_sdl2.c 2025-04-10 02:33:23 UTC (rev 45628) @@ -732,6 +732,14 @@ SDL_RENDERER_ACCELERATED); } + if (!container->renderer && drv_index == -1) { + log_warning(sdlvideo_log, "SDL_CreateRenderer() failed. Falling back to basic renderer: %s", SDL_GetError()); + SDL_SetHintWithPriority(SDL_HINT_RENDER_VSYNC, "0", SDL_HINT_OVERRIDE); + container->renderer = SDL_CreateRenderer(container->window, + drv_index, + 0); + } + if (!container->renderer) { log_error(sdlvideo_log, "SDL_CreateRenderer() failed: %s", SDL_GetError()); sdl_container_destroy(container); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-04-07 20:09:25
|
Revision: 45627 http://sourceforge.net/p/vice-emu/code/45627 Author: gpz Date: 2025-04-07 20:09:08 +0000 (Mon, 07 Apr 2025) Log Message: ----------- better check for invalid value Modified Paths: -------------- trunk/vice/src/tools/cartconv/cartconv.c Modified: trunk/vice/src/tools/cartconv/cartconv.c =================================================================== --- trunk/vice/src/tools/cartconv/cartconv.c 2025-04-07 20:08:04 UTC (rev 45626) +++ trunk/vice/src/tools/cartconv/cartconv.c 2025-04-07 20:09:08 UTC (rev 45627) @@ -1419,12 +1419,19 @@ } return 2; case 'l': + { + char *endptr = NULL; checkarg(arg); - load_address = (int)strtoul(arg, NULL, 0); + load_address = (int)strtoul(arg, &endptr, 0); + if (strlen(arg) != (endptr - arg)) { + fprintf(stderr, "ERROR: invalid characters in number '%s'.\n", arg); + exit(-1); + } if (load_address == 0) { fprintf(stderr, "WARNING: load address is 0, are you sure?\n"); } return 2; + } case 's': checkarg(arg); if (cart_subtype == 0) { This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-04-07 20:08:21
|
Revision: 45626 http://sourceforge.net/p/vice-emu/code/45626 Author: gpz Date: 2025-04-07 20:08:04 +0000 (Mon, 07 Apr 2025) Log Message: ----------- disable debug output Modified Paths: -------------- trunk/vice/src/c64/cart/dqbb.c Modified: trunk/vice/src/c64/cart/dqbb.c =================================================================== --- trunk/vice/src/c64/cart/dqbb.c 2025-04-06 13:02:04 UTC (rev 45625) +++ trunk/vice/src/c64/cart/dqbb.c 2025-04-07 20:08:04 UTC (rev 45626) @@ -93,7 +93,7 @@ range of $de00-$deff */ -#define DBGDQBB +/* #define DBGDQBB */ #ifdef DBGDQBB #define DBG(x) log_printf x This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-04-06 13:02:21
|
Revision: 45625 http://sourceforge.net/p/vice-emu/code/45625 Author: gpz Date: 2025-04-06 13:02:04 +0000 (Sun, 06 Apr 2025) Log Message: ----------- fix typo, patch by Stefan Haubental Modified Paths: -------------- trunk/vice/src/c1541.c Modified: trunk/vice/src/c1541.c =================================================================== --- trunk/vice/src/c1541.c 2025-04-05 15:58:18 UTC (rev 45624) +++ trunk/vice/src/c1541.c 2025-04-06 13:02:04 UTC (rev 45625) @@ -403,7 +403,7 @@ "into \n<destination> in the file system. If <destination> is not " "specified, copy \nit into a file with the same name as <source>." "\nPlease note that due to GEOS using ASCII, not PETSCII, the name should" - " be\bentered in inverted case (ie to read 'rEADmE', use 'ReadMe'", + " be\nentered in inverted case (ie to read 'rEADmE', use 'ReadMe'", 1, 2, read_geos_cmd }, { "geoswrite", This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |
From: <gp...@us...> - 2025-04-05 15:58:34
|
Revision: 45624 http://sourceforge.net/p/vice-emu/code/45624 Author: gpz Date: 2025-04-05 15:58:18 +0000 (Sat, 05 Apr 2025) Log Message: ----------- output a warning when the load address given is 0, eg because of mistyping a hex number without 0x Modified Paths: -------------- trunk/vice/src/tools/cartconv/cartconv.c Modified: trunk/vice/src/tools/cartconv/cartconv.c =================================================================== --- trunk/vice/src/tools/cartconv/cartconv.c 2025-04-03 01:24:03 UTC (rev 45623) +++ trunk/vice/src/tools/cartconv/cartconv.c 2025-04-05 15:58:18 UTC (rev 45624) @@ -1421,6 +1421,9 @@ case 'l': checkarg(arg); load_address = (int)strtoul(arg, NULL, 0); + if (load_address == 0) { + fprintf(stderr, "WARNING: load address is 0, are you sure?\n"); + } return 2; case 's': checkarg(arg); This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |