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

Commit ba1431c

Browse files
committed
Update commandline arguments for readmode and add audiomode
1 parent 63c8525 commit ba1431c

File tree

8 files changed

+69
-61
lines changed

8 files changed

+69
-61
lines changed

README.md

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22
This fork has built-in support for USBSID-Pico. \
33
USBSID-Pico is a RPi Pico based board for interfacing one or two MOS SID chips and/or hardware SID emulators with your PC over USB.
44

5+
# Usage
6+
Use `-usreadmode 1` with to enable readmode for FPGASID, default is disabled.
7+
Use `-usaudiomode 1` to enable Stereo mode, default is Mono mode. Works on PCB v1.3 only!
8+
```shell
9+
# Examples
10+
x64sc -usreadmode 1 -usaudiomode 1
11+
vsid -usreadmode 1 -usaudiomode 1
12+
```
13+
514
# Linux Building and installing
615
For building you can mostly follow the instructions in the [Linux-GTK3-Howto](vice/doc/building/Linux-GTK3-Howto.txt) \
716
add `--enable-usbsid` to `./configure` for [USBSID-Pico](https://github.com/LouDnl/USBSID-Pico) support
@@ -59,7 +68,6 @@ libsdl-image1.2
5968
../../vice/configure \
6069
--prefix=/usr \
6170
--enable-option-checking=fatal \
62-
--enable-gtk3ui \
6371
--enable-usbsid \
6472
--disable-arch \
6573
--disable-html-docs \
@@ -153,13 +161,3 @@ After installing docker follow the following steps to create win32 or win64 bina
153161
# depending on the container type you created this will create a zip file in the current directory
154162
./dock-run.sh $(pwd)
155163
```
156-
157-
158-
# VICE GitHub Mirror
159-
This is the official git mirror of the [VICE subversion repo](https://sourceforge.net/p/vice-emu/code/HEAD/tree/).
160-
161-
For news, documentation, developer information, [visit the VICE website](https://vice-emu.sourceforge.io/).
162-
163-
## Download VICE
164-
* [Official Releases](https://vice-emu.sourceforge.io/#download)
165-
* [Snapshot builds of the latest code](https://github.com/VICE-Team/svn-mirror/releases)

vice/src/arch/shared/hwsiddrv/us-unixwin-device.c

Lines changed: 25 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,9 @@
6666
#pragma GCC optimize ("O3")
6767
#endif
6868

69-
static int rc = -1, sids_found = -1, no_sids = -1, soc_audio = -1, r_readmode = -1, readmode = -1;
69+
static int rc = -1, sids_found = -1, no_sids = -1;
70+
static int r_audiomode = -1, audiomode = -1;
71+
static int r_readmode = -1, readmode = -1;
7072
static uint8_t sidbuf[0x20 * US_MAXSID];
7173

7274
static CLOCK usid_main_clk;
@@ -118,23 +120,29 @@ int us_device_open(void)
118120
usbsid = create_USBSID();
119121
if (usbsid) {
120122
resources_get_int("SidUSBSIDReadMode", &r_readmode);
121-
log_message(usbsid_log, "SidUSBSIDReadMode: %d, readmode: %d\r", r_readmode, readmode);
123+
// log_message(usbsid_log, "SidUSBSIDReadMode: %d, readmode: %d\r", r_readmode, readmode);
122124
readmode = r_readmode;
125+
resources_get_int("SidUSBSIDAudioMode", &r_audiomode);
126+
// log_message(usbsid_log, "SidUSBSIDAudioMode: %d, readmode: %d\r", r_audiomode, audiomode);
127+
audiomode = r_audiomode;
123128
}
124-
/* NOTICE: Digitunes only play with threaded cycles */
125-
if (readmode == 0) {
126-
log_message(usbsid_log, "Starting in normal mode\r");
127-
rc = init_USBSID(usbsid, true, true); /* threading and cycles enabled */
128-
} else if (readmode == 1) {
129+
130+
if (readmode == 1) {
129131
log_message(usbsid_log, "Starting in read mode\r");
130132
rc = init_USBSID(usbsid, false, false); /* threading and cycles disabled */
133+
} else { /* (readmode == 0 || readmode == -1) */
134+
/* NOTICE: Digitunes only play with threaded cycles */
135+
log_message(usbsid_log, "Starting in normal mode\r");
136+
rc = init_USBSID(usbsid, true, true); /* threading and cycles enabled */
131137
}
132-
133138
if (rc < 0) {
134139
return -1;
135140
}
136141
}
137142

143+
log_message(usbsid_log, "Set audio mode to %s\r", (audiomode == 1 ? "Stereo" : "Mono"));
144+
setstereo_USBSID(usbsid, (audiomode == 1 ? audiomode : 0));
145+
138146
usid_alarm = alarm_new(maincpu_alarm_context, "usbsid", usbsid_alarm_handler, NULL);
139147
sids_found = getnumsids_USBSID(usbsid);
140148
no_sids = 0;
@@ -224,30 +232,6 @@ unsigned int us_device_available(void)
224232
return sids_found;
225233
}
226234

227-
void us_set_audio(int val)
228-
{ /* Gets set by x64sc from SID settings and by VSID at SID file change */
229-
resources_get_int("SoundOutput", &soc_audio);
230-
log_message(usbsid_log, "Global audio type is '%s'\r", (soc_audio == 2 ? "Stereo" : soc_audio == 1 ? "Mono" : "System"));
231-
232-
233-
int stereo = 0;
234-
no_sids = val+1; /* Number of SIDs requested +1 (val = 0 if 1 single SID is requested) */
235-
236-
log_message(usbsid_log, "Set requested audio type for no. SIDs %d (No. SIDs available: %d)\r", no_sids, sids_found);
237-
238-
stereo
239-
/* Number of requested SIDs equals no. available SIDs */
240-
= (no_sids == sids_found && soc_audio != 1)
241-
? (no_sids == 2 || no_sids == 4) /* 2 or 4 SIDs requested */
242-
? 1 /* then Stereo */
243-
: 0 /* else Mono */
244-
/* else number of requested SIDs does not equal no. available SIDs */
245-
: 0; /* fallback to Mono */
246-
247-
log_message(usbsid_log, "Audio type set to '%s' for %d requested SIDs\r", (stereo == 1 ? "Stereo" : "Mono"), no_sids);
248-
setstereo_USBSID(usbsid, stereo);
249-
}
250-
251235
void us_set_readmode(int val)
252236
{
253237
resources_get_int("SidUSBSIDReadMode", &r_readmode);
@@ -260,6 +244,15 @@ void us_set_readmode(int val)
260244
return;
261245
}
262246

247+
void us_set_audiomode(int val)
248+
{ /* Gets set by x64sc from SID settings and by VSID at SID file change */
249+
resources_get_int("SidUSBSIDAudioMode", &r_audiomode);
250+
log_message(usbsid_log, "Audio mode is '%s'\r", (r_audiomode == 1 ? "Stereo" : "Mono"));
251+
audiomode = r_audiomode;
252+
253+
setstereo_USBSID(usbsid, audiomode);
254+
}
255+
263256
static void usbsid_alarm_handler(CLOCK offset, void *data)
264257
{
265258
CLOCK cycles = (usid_alarm_clk + offset) - usid_main_clk;

vice/src/arch/shared/hwsiddrv/us-unixwin.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,10 +54,10 @@ void us_set_machine_parameter(long cycles_per_sec);
5454

5555
unsigned int us_device_available(void);
5656

57-
void us_set_audio(int val);
58-
5957
void us_set_readmode(int val);
6058

59+
void us_set_audiomode(int val);
60+
6161
void us_device_state_read(int chipno, struct sid_us_snapshot_state_s *sid_state);
6262

6363
void us_device_state_write(int chipno, struct sid_us_snapshot_state_s *sid_state);

vice/src/arch/shared/hwsiddrv/usbsid-unixwin-drv.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -101,17 +101,17 @@ int usbsid_drv_available(void)
101101
return 0;
102102
}
103103

104-
void usbsid_drv_set_audio(int val)
104+
void usbsid_drv_set_readmode(int val)
105105
{
106106
if (use_us_device) {
107-
us_set_audio(val);
107+
us_set_readmode(val);
108108
}
109109
}
110110

111-
void usbsid_drv_set_readmode(int val)
111+
void usbsid_drv_set_audiomode(int val)
112112
{
113113
if (use_us_device) {
114-
us_set_readmode(val);
114+
us_set_audiomode(val);
115115
}
116116
}
117117

vice/src/sid/sid-cmdline-options.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -240,9 +240,12 @@ static const cmdline_option_t hardsid_cmdline_options[] =
240240
#ifdef HAVE_USBSID
241241
static const cmdline_option_t usbsid_cmdline_options[] =
242242
{
243-
{ "-usbsidreadmode", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
243+
{ "-usreadmode", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
244244
NULL, NULL, "SidUSBSIDReadMode", NULL,
245245
"<1 or 0>", "Enable USBSID read mode (disables cycled writing & digiplay)" },
246+
{ "-usaudiomode", SET_RESOURCE, CMDLINE_ATTRIB_NEED_ARGS,
247+
NULL, NULL, "SidUSBSIDAudioMode", NULL,
248+
"<1 or 0>", "Set audio to Stereo(1) or Mono(0) (Default)" },
246249
CMDLINE_LIST_END
247250
};
248251
#endif

vice/src/sid/sid-resources.c

Lines changed: 18 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ static int sid_hardsid_right;
8989
#endif
9090
#ifdef HAVE_USBSID
9191
static int sid_usbsid_readmode;
92+
static int sid_usbsid_audiomode;
9293
#endif
9394

9495
static int set_sid_engine(int set_engine, void *param)
@@ -182,9 +183,9 @@ static int set_sid_stereo(int val, void *param)
182183
machine_sid2_enable(val);
183184
}
184185
}
185-
#ifdef HAVE_USBSID
186-
usbsid_set_audio(val); /* Set mono or stereo by no. sids */
187-
#endif
186+
// #ifdef HAVE_USBSID
187+
// usbsid_set_audio(val); /* Set mono or stereo by no. sids */
188+
// #endif
188189
return 0;
189190
}
190191

@@ -367,13 +368,21 @@ static int set_sid_hardsid_right(int val, void *param)
367368
#endif
368369

369370
#ifdef HAVE_USBSID
370-
static int set_sid_usbsid_main(int val, void *param)
371+
static int set_sid_usbsid_readmode(int val, void *param)
371372
{
372373
sid_usbsid_readmode = (unsigned int)val;
373374
usbsid_set_readmode(sid_usbsid_readmode);
374375

375376
return 0;
376377
}
378+
379+
static int set_sid_usbsid_audiomode(int val, void *param)
380+
{
381+
sid_usbsid_audiomode = (unsigned int)val;
382+
usbsid_set_audiomode(sid_usbsid_readmode);
383+
384+
return 0;
385+
}
377386
#endif
378387

379388

@@ -462,7 +471,9 @@ static const resource_int_t hardsid_resources_int[] = {
462471
#ifdef HAVE_USBSID
463472
static const resource_int_t usbsid_resources_int[] = {
464473
{ "SidUSBSIDReadMode", 0, RES_EVENT_NO, NULL,
465-
&sid_usbsid_readmode, set_sid_usbsid_main, NULL },
474+
&sid_usbsid_readmode, set_sid_usbsid_readmode, NULL },
475+
{ "SidUSBSIDAudioMode", 0, RES_EVENT_NO, NULL,
476+
&sid_usbsid_audiomode, set_sid_usbsid_audiomode, NULL },
466477
RESOURCE_INT_LIST_END
467478
};
468479
#endif
@@ -508,9 +519,11 @@ int sid_common_resources_init(void)
508519
#endif
509520

510521
#ifdef HAVE_USBSID
522+
// if (usbsid_available()) {
511523
if (resources_register_int(usbsid_resources_int) < 0) {
512524
return -1;
513525
}
526+
// }
514527
#endif
515528

516529
return resources_register_int(common_resources_int);

vice/src/sid/usbsid.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -142,20 +142,21 @@ int usbsid_available(void)
142142
return usbsid_is_open;
143143
}
144144

145-
void usbsid_set_audio(int val)
145+
void usbsid_set_readmode(int val)
146146
{
147147
if (!usbsid_is_open) {
148-
usbsid_drv_set_audio(val);
148+
usbsid_drv_set_readmode(val);
149149
}
150150
}
151151

152-
void usbsid_set_readmode(int val)
152+
void usbsid_set_audiomode(int val)
153153
{
154154
if (!usbsid_is_open) {
155-
usbsid_drv_set_readmode(val);
155+
usbsid_drv_set_audiomode(val);
156156
}
157157
}
158158

159+
159160
/* ---------------------------------------------------------------------*/
160161

161162
void usbsid_state_read(int chipno, struct sid_us_snapshot_state_s *sid_state)

vice/src/usbsid.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ int usbsid_read(uint16_t addr, int chipno);
4141
void usbsid_store(uint16_t addr, uint8_t val, int chipno);
4242
void usbsid_set_machine_parameter(long cycles_per_sec);
4343
int usbsid_available(void);
44-
void usbsid_set_audio(int val);
44+
void usbsid_set_audiomode(int val);
4545
void usbsid_set_readmode(int val);
4646

4747
int usbsid_drv_open(void);
@@ -51,7 +51,7 @@ int usbsid_drv_read(uint16_t addr, int chipno);
5151
void usbsid_drv_store(uint16_t addr, uint8_t val, int chipno);
5252
void usbsid_drv_set_machine_parameter(long cycles_per_sec);
5353
int usbsid_drv_available(void);
54-
void usbsid_drv_set_audio(int val);
54+
void usbsid_drv_set_audiomode(int val);
5555
void usbsid_drv_set_readmode(int val);
5656

5757
void usbsid_state_read(int chipno, struct sid_us_snapshot_state_s *sid_state);

0 commit comments

Comments
 (0)