Skip to content

Commit

Permalink
more supported SC-55 variants
Browse files Browse the repository at this point in the history
  • Loading branch information
nukeykt committed Apr 26, 2024
1 parent a7bee1c commit 9bcc94d
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 26 deletions.
23 changes: 18 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ Supported models:
- CM-300/SCC-1 (v1.10/v1.20 firmwares are confirmed to work)
- SC-55st (v1.01)
- JV-880 (v1.0.0)
- SCB-55/RLP-3194
- RLP-3237

Special thanks:
- John McMaster: SC-55 PCM chip decap.
Expand All @@ -17,6 +19,11 @@ Special thanks:
- HardWareMan.
- giulioz: JV-880 support

## License

Nuked SC-55 can be distributed and used under the original MAME license (see LICENSE file).
Non-commercial license was chosen to prevent making and selling SC-55 emulation boxes using (or around) this code, as well as preventing from using it in the commercial music production.

## Status

3 ICs are needed to be emulated:
Expand Down Expand Up @@ -91,12 +98,18 @@ R15209312 (WAVE A) -> jv880_waverom1.bin
R15209313 (WAVE B) -> jv880_waverom2.bin
Expansion PCBs -> jv880_waverom_expansion.bin (optional)
```
SCB-55/RLP-3194:
R15199827 (H8/532 mcu) -> scb55_rom1.bin
R15279828 (H8/532 extra code) -> scb55_rom2.bin
R15209359 (WAVE 16M) -> scb55_waverom1.bin
R15279813 (WAVE 8M) -> scb55_waverom2.bin
## License
RLP-3237:
R15199827 (H8/532 mcu) -> rlp3237_rom1.bin
R15209486 (H8/532 extra code) -> rlp3237_rom2.bin
R15279824 (WAVE 16M) -> rlp3237_waverom1.bin
Nuked SC-55 can be distributed and used under the original MAME license (see LICENSE file).
Non-commercial license was chosen to prevent making and selling SC-55 emulation boxes using (or around) this code, as well as preventing from using it in the commercial music production.
```

## Additional info

Expand Down Expand Up @@ -149,6 +162,6 @@ COMMA -> ENCODER L
PERIOD -> ENCODER R
```

- `-mk2`, `-st`, `mk1`, `-cm300` and `-jv880` command line arguments can be used to specify rom set. If no model is specified emulator will try to autodetect rom set (based on file names).
- `-mk2`, `-st`, `-mk1`, `-cm300`, `-jv880`, `-scb55` and `-rlp3237` command line arguments can be used to specify rom set. If no model is specified emulator will try to autodetect rom set (based on file names).

- Due to a bug in the SC-55mk2's firmware, some parameters don't reset properly on startup. Do GM, GS or MT-32 reset using buttons to fix this issue.
2 changes: 1 addition & 1 deletion src/lcd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ void LCD_Update(void)
if (!lcd_init)
return;

if (!mcu_cm300 && !mcu_st)
if (!mcu_cm300 && !mcu_st && !mcu_scb55)
{
MCU_WorkThread_Lock();

Expand Down
73 changes: 53 additions & 20 deletions src/mcu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,9 @@ const char* rs_name[ROM_SET_COUNT] = {
"SC-55st",
"SC-55mk1",
"CM-300/SCC-1",
"JV880"
"JV-880",
"SCB-55",
"RLP-3237"
};

const char* roms[ROM_SET_COUNT][5] =
Expand Down Expand Up @@ -90,6 +92,18 @@ const char* roms[ROM_SET_COUNT][5] =
"jv880_waverom1.bin",
"jv880_waverom2.bin",
"jv880_waverom_expansion.bin",

"scb55_rom1.bin",
"scb55_rom2.bin",
"scb55_waverom1.bin",
"scb55_waverom2.bin",
"",

"rlp3237_rom1.bin",
"rlp3237_rom2.bin",
"rlp3237_waverom1.bin",
"",
"",
};

int romset = ROM_SET_MK2;
Expand Down Expand Up @@ -121,6 +135,7 @@ int mcu_mk1 = 0; // 0 - SC-55mkII, SC-55ST. 1 - SC-55, CM-300/SCC-1
int mcu_cm300 = 0; // 0 - SC-55, 1 - CM-300/SCC-1
int mcu_st = 0; // 0 - SC-55mk2, 1 - SC-55ST
int mcu_jv880 = 0; // 0 - SC-55, 1 - JV880
int mcu_scb55 = 0; // 0 - sub mcu (e.g SC-55mk2), 1 - no sub mcu (e.g SCB-55)

static int ga_int[8];
static int ga_int_enable = 0;
Expand Down Expand Up @@ -496,7 +511,7 @@ uint8_t MCU_Read(uint32_t address)
{
ret = PCM_Read(address & 0x3f);
}
else if (address >= 0xec00 && address < 0xf000)
else if (!mcu_scb55 && address >= 0xec00 && address < 0xf000)
{
ret = SM_SysRead(address & 0xff);
}
Expand Down Expand Up @@ -713,7 +728,7 @@ void MCU_Write(uint32_t address, uint8_t value)
{
PCM_Write(address & 0x3f, value);
}
else if (address >= 0xec00 && address < 0xf000)
else if (!mcu_scb55 && address >= 0xec00 && address < 0xf000)
{
SM_SysWrite(address & 0xff, value);
}
Expand Down Expand Up @@ -960,7 +975,7 @@ int SDLCALL work_thread(void* data)

TIMER_Clock(mcu.cycles);

if (!mcu_mk1 && !mcu_jv880)
if (!mcu_mk1 && !mcu_jv880 && !mcu_scb55)
SM_Update(mcu.cycles);
else
{
Expand Down Expand Up @@ -1343,6 +1358,16 @@ int main(int argc, char *argv[])
romset = ROM_SET_JV880;
autodetect = false;
}
else if (!strcmp(argv[i], "-scb55"))
{
romset = ROM_SET_SCB55;
autodetect = false;
}
else if (!strcmp(argv[i], "-rlp3237"))
{
romset = ROM_SET_RLP3237;
autodetect = false;
}
else if (!strcmp(argv[i], "-gs"))
{
resetType = ResetType::GS_RESET;
Expand Down Expand Up @@ -1378,6 +1403,8 @@ int main(int argc, char *argv[])
bool good = true;
for (size_t j = 0; j < 5; j++)
{
if (roms[i][j][0] == '\0')
continue;
std::string path = basePath + "/" + roms[i][j];
auto h = Files::utf8_fopen(path.c_str(), "rb");
if (!h)
Expand Down Expand Up @@ -1419,22 +1446,25 @@ int main(int argc, char *argv[])
lcd_width = 820;
lcd_height = 100;
break;
case ROM_SET_SCB55:
case ROM_SET_RLP3237:
mcu_scb55 = true;
break;
}

std::string rpaths[5] =
{
basePath + "/" + roms[romset][0],
basePath + "/" + roms[romset][1],
basePath + "/" + roms[romset][2],
basePath + "/" + roms[romset][3],
basePath + "/" + roms[romset][4]
};
std::string rpaths[5];

bool r_ok = true;
std::string errors_list;

for(size_t i = 0; i < 5; ++i)
{
if (roms[romset][i][0] == '\0')
{
rpaths[i] = "";
continue;
}
rpaths[i] = basePath + "/" + roms[romset][i];
s_rf[i] = Files::utf8_fopen(rpaths[i].c_str(), "rb");
bool optional = mcu_jv880 && i == 4;
r_ok &= optional || (s_rf[i] != nullptr);
Expand Down Expand Up @@ -1553,17 +1583,20 @@ int main(int argc, char *argv[])

unscramble(tempbuf, waverom1, 0x200000);

if (fread(tempbuf, 1, 0x100000, s_rf[3]) != 0x100000)
if (s_rf[3])
{
fprintf(stderr, "FATAL ERROR: Failed to read the WaveRom2.\n");
fflush(stderr);
closeAllR();
return 1;
}
if (fread(tempbuf, 1, 0x100000, s_rf[3]) != 0x100000)
{
fprintf(stderr, "FATAL ERROR: Failed to read the WaveRom2.\n");
fflush(stderr);
closeAllR();
return 1;
}

unscramble(tempbuf, waverom2, 0x100000);
unscramble(tempbuf, mcu_scb55 ? waverom3 : waverom2, 0x100000);
}

if (fread(sm_rom, 1, ROMSM_SIZE, s_rf[4]) != ROMSM_SIZE)
if (s_rf[4] && fread(sm_rom, 1, ROMSM_SIZE, s_rf[4]) != ROMSM_SIZE)
{
fprintf(stderr, "FATAL ERROR: Failed to read the sub mcu ROM.\n");
fflush(stderr);
Expand Down
3 changes: 3 additions & 0 deletions src/mcu.h
Original file line number Diff line number Diff line change
Expand Up @@ -418,6 +418,8 @@ enum {
ROM_SET_MK1,
ROM_SET_CM300,
ROM_SET_JV880,
ROM_SET_SCB55,
ROM_SET_RLP3237,
ROM_SET_COUNT
};

Expand All @@ -429,6 +431,7 @@ extern int mcu_mk1;
extern int mcu_cm300;
extern int mcu_st;
extern int mcu_jv880;
extern int mcu_scb55;

extern SDL_atomic_t mcu_button_pressed;

Expand Down

0 comments on commit 9bcc94d

Please sign in to comment.