Merge pull request #117 from cayce-msx/115_enable_SCC_detection

support SCC/SCC-I detection and SCC-I MegaRAM
This commit is contained in:
LibretroAdmin authored and GitHub committed 2023-04-13 01:25:48 +02:00
commit f97252b233
5 files changed
+229 -124

No files matched your search

+4
View File
@@ -99,6 +99,7 @@ void WriteSCCP(SCC *D,uint8_t R,uint8_t V)
R&=0x0F;
switch(R)
{
// set frequency
case 0: case 1: case 2: case 3: case 4:
case 5: case 6: case 7: case 8: case 9:
/* Exit if the channel is silenced */
@@ -115,6 +116,7 @@ void WriteSCCP(SCC *D,uint8_t R,uint8_t V)
D->Changed|=1<<R;
break;
// set volume
case 10: case 11: case 12: case 13: case 14:
/* Compute channel number */
R-=10;
@@ -124,6 +126,7 @@ void WriteSCCP(SCC *D,uint8_t R,uint8_t V)
D->Changed|=(1<<R)&I;
break;
// on/off bitmask
case 15:
/* Find changed channels */
R=(V^I)&0x1F;
@@ -154,6 +157,7 @@ void WriteSCCP(SCC *D,uint8_t R,uint8_t V)
/* Write data to SCC */
D->R[R]=V;
/* Wrong register, do nothing */
/* note: fMSX ignores the deform register (98C0-98DF, B8C0-B8DF) */
if(R>=0xA0) return;
/* Mark channel waveform as changed */
D->WChanged|=1<<(R>>5);
+110 -93
View File
@@ -195,25 +195,26 @@ Specify these in your RetroArch core options, either manually or via the RetroAr
A restart is required after changing most of these options.
|setting|meaning|choices<br>(*) indicates the default setting|
|---|---|---|
|`fmsx_mode`|MSX model|MSX2+*&vert;MSX1&vert;MSX2|
|`fmsx_video_mode`|select 60Hz or 50Hz|NTSC*&vert;PAL&vert;Dynamic|
|`fmsx_hires`|Support high resolution|Off*&vert;Interlaced&vert;Progressive|
|`fmsx_overscan`|Support overscan|*No&vert;Yes|
|`fmsx_mapper_type_mode`|ROM mapper - use if a ROM does not load|Guess*&vert;Generic 8kB&vert;Generic 16kB&vert;Konami5 8kB&vert;Konami4 8kB&vert;ASCII 8kB&vert;ASCII 16kB&vert;GameMaster2&vert;FMPAC|
|`fmsx_ram_pages`|RAM size|Auto*&vert;64KB&vert;128KB&vert;256KB&vert;512KB&vert;4MB|
|`fmsx_vram_pages`|Video-RAM size|Auto*&vert;32KB&vert;64KB&vert;128KB&vert;192KB|
|`fmsx_load_game_master`|Load GMASTER(2).ROM when present (will start Game Master before the game)|No*&vert;Yes|
|`fmsx_simbdos`|Simulate BDOS DiskROM access calls (faster, but does not support CALL FORMAT)|No*&vert;Yes|
|`fmsx_dos2`|Load MSXDOS2.ROM when found|No*&vert;Yes|
|`fmsx_autospace`|Autofire the spacebar|No*&vert;Yes|
|`fmsx_allsprites`|Show all sprites - do not emulate VDP hardware limitation|No*&vert;Yes|
|`fmsx_font`|load a fixed text font from RetroArch's `system_directory`|standard*&vert;DEFAULT.FNT&vert;ITALIC.FNT&vert;INTERNAT.FNT&vert;CYRILLIC.FNT&vert;KOREAN.FNT&vert;JAPANESE.FNT|
|`fmsx_flush_disk`|Save changes to .dsk image or SRAM|Never*&vert;Immediate&vert;On close&vert;To/From SRAM|
|`fmsx_phantom_disk`|Create empty disk image when none loaded|No*&vert;Yes|
|`fmsx_custom_keyboard_XXX`<br>where XXX is `up`,`down`,`left`,`right`,`a`,`b`,`y`,`x`,`start`,`select`,`l`,`r`,`l2`,`r2`,`l3`,`r3`|For User 1 Device Type 'Custom Keyboard', map RetroPad button to selected MSX keyboard key|left&vert;up&vert;right&vert;down&vert;<br>shift&vert;ctrl&vert;graph&vert;<br>backspace&vert;tab&vert;escape&vert;space&vert;capslock&vert;select&vert;home&vert;enter&vert;del&vert;insert&vert;country&vert;dead&vert;stop&vert;<br>f1&vert;f2&vert;f3&vert;f4&vert;f5&vert;<br>keypad0~9&vert;kp_multiply&vert;kp_plus&vert;kp_divide&vert;kp_minus&vert;kp_comma&vert;kp_period&vert;<br>backquote&vert;minus&vert;equals&vert;leftbracket&vert;rightbracket&vert;backslash&vert;semicolon&vert;quote&vert;comma&vert;period&vert;slash&vert;<br>0-9&vert;a-z&vert;<br>|
|`fmsx_log_level`|Configure the amount of fMSX logging|Off*&vert;Info&vert;Debug&vert;Spam|
| setting | meaning | choices<br>(*) indicates the default setting |
|------------------------------------------------------------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `fmsx_mode` | MSX model | MSX2+*&vert;MSX1&vert;MSX2 |
| `fmsx_video_mode` | select 60Hz or 50Hz | NTSC*&vert;PAL&vert;Dynamic |
| `fmsx_hires` | Support high resolution | Off*&vert;Interlaced&vert;Progressive |
| `fmsx_overscan` | Support overscan | *No&vert;Yes |
| `fmsx_mapper_type_mode` | ROM mapper - use if a ROM does not load | Guess*&vert;Generic 8kB&vert;Generic 16kB&vert;Konami5 8kB&vert;Konami4 8kB&vert;ASCII 8kB&vert;ASCII 16kB&vert;GameMaster2&vert;FMPAC |
| `fmsx_ram_pages` | RAM size | Auto*&vert;64KB&vert;128KB&vert;256KB&vert;512KB&vert;4MB |
| `fmsx_vram_pages` | Video-RAM size | Auto*&vert;32KB&vert;64KB&vert;128KB&vert;192KB |
| `fmsx_scci_megaram` | Enable SCC-I 128kB MegaRAM | Yes*&vert;No |
| `fmsx_load_game_master` | Load GMASTER(2).ROM when present (will start Game Master before the game) | No*&vert;Yes |
| `fmsx_simbdos` | Simulate BDOS DiskROM access calls (faster, but does not support CALL FORMAT) | No*&vert;Yes |
| `fmsx_dos2` | Load MSXDOS2.ROM when found | No*&vert;Yes |
| `fmsx_autospace` | Autofire the spacebar | No*&vert;Yes |
| `fmsx_allsprites` | Show all sprites - do not emulate VDP hardware limitation | No*&vert;Yes |
| `fmsx_font` | load a fixed text font from RetroArch's `system_directory` | standard*&vert;DEFAULT.FNT&vert;ITALIC.FNT&vert;INTERNAT.FNT&vert;CYRILLIC.FNT&vert;KOREAN.FNT&vert;JAPANESE.FNT |
| `fmsx_flush_disk` | Save changes to .dsk image or SRAM | Never*&vert;Immediate&vert;On close&vert;To/From SRAM |
| `fmsx_phantom_disk` | Create empty disk image when none loaded | No*&vert;Yes |
| `fmsx_custom_keyboard_XXX`<br>where XXX is `up`,`down`,`left`,`right`,`a`,`b`,`y`,`x`,`start`,`select`,`l`,`r`,`l2`,`r2`,`l3`,`r3` | For User 1 Device Type 'Custom Keyboard', map RetroPad button to selected MSX keyboard key | left&vert;up&vert;right&vert;down&vert;<br>shift&vert;ctrl&vert;graph&vert;<br>backspace&vert;tab&vert;escape&vert;space&vert;capslock&vert;select&vert;home&vert;enter&vert;del&vert;insert&vert;country&vert;dead&vert;stop&vert;<br>f1&vert;f2&vert;f3&vert;f4&vert;f5&vert;<br>keypad0~9&vert;kp_multiply&vert;kp_plus&vert;kp_divide&vert;kp_minus&vert;kp_comma&vert;kp_period&vert;<br>backquote&vert;minus&vert;equals&vert;leftbracket&vert;rightbracket&vert;backslash&vert;semicolon&vert;quote&vert;comma&vert;period&vert;slash&vert;<br>0-9&vert;a-z&vert;<br> |
| `fmsx_log_level` | Configure the amount of fMSX logging | Off*&vert;Info&vert;Debug&vert;Spam |
## PAL vs. NTSC
@@ -258,73 +259,73 @@ User 1:
* "Joystick": map RetroPad to MSX joystick A
|RetroPad|MSX|
|---|---|
|LEFT | Stick Left|
|UP | Stick Up|
|DOWN | Stick Down|
|RIGHT |Stick Right|
|A | Fire A|
|B | Fire B|
| RetroPad | MSX |
|----------|-------------|
| LEFT | Stick Left |
| UP | Stick Up |
| DOWN | Stick Down |
| RIGHT | Stick Right |
| A | Fire A |
| B | Fire B |
* "Joystick + Emulated Keyboard": map RetroPad to MSX joystick A, plus to a few MSX keyboard keys useful for gaming
|RetroPad|MSX|
|---|---|
|LEFT | Stick Left|
|UP | Stick Up|
|DOWN | Stick Down|
|RIGHT |Stick Right|
|A | Fire A|
|B | Fire B|
|X | F3|
|Y | Space|
|START | F1|
|SELECT| F2|
|L | F4|
|R | F5|
|L2 | Graph|
|R2 | Ctrl|
|L3 | Enter|
|R3 | Escape|
| RetroPad | MSX |
|----------|-------------|
| LEFT | Stick Left |
| UP | Stick Up |
| DOWN | Stick Down |
| RIGHT | Stick Right |
| A | Fire A |
| B | Fire B |
| X | F3 |
| Y | Space |
| START | F1 |
| SELECT | F2 |
| L | F4 |
| R | F5 |
| L2 | Graph |
| R2 | Ctrl |
| L3 | Enter |
| R3 | Escape |
* "Emulated Keyboard": map RetroPad to MSX keyboard cursor, plus to a few _other_ MSX keyboard keys useful for gaming - where * indicates a difference with "Joystick + Emulated Keyboard"
|RetroPad|MSX|
|---|---|
|LEFT | Arrow Left|
|UP | Arrow Up|
|DOWN | Arrow Down|
|RIGHT |Arrow Right|
|A | Space *|
|B | Enter *|
|X | N *|
|Y | M *|
|START | F1|
|SELECT| F4 *|
|L | F2 *|
|R | F3 *|
|L2 | Graph|
|R2 | Ctrl|
|L3 | F5 *|
|R3 | Escape|
| RetroPad | MSX |
|----------|-------------|
| LEFT | Arrow Left |
| UP | Arrow Up |
| DOWN | Arrow Down |
| RIGHT | Arrow Right |
| A | Space * |
| B | Enter * |
| X | N * |
| Y | M * |
| START | F1 |
| SELECT | F4 * |
| L | F2 * |
| R | F3 * |
| L2 | Graph |
| R2 | Ctrl |
| L3 | F5 * |
| R3 | Escape |
* "Custom Keyboard": maps 16 RetroPad buttons to any of the 88 keys of the MSX keyboard. Configure this in the Options.
* "Keyboard": maps host keyboard to 88-key MSX keyboard. Only on (RetroArch) platforms with a real keyboard (Linux, Windows, etc). Don't forget to press Scroll Lock to enter Game Focus Mode!
* MSX1 & 2: US/European keyboard map, cursors, numeric pad, F1-F5
* MSX2+: Japanese JIS keyboard map - see below
* with these special keys:
|Host | MSX|
|---|---|
|ctrl |CONTROL|
|shift |SHIFT|
|left alt |GRAPH|
|ins |INSERT|
|del |DELETE|
|home |HOME/CLS|
|end |SELECT|
|pause |STOP/BREAK|
|pagedown |CODE/COUNTRY|
|pageup |International: DEAD-key; accents `, ´, ^ and ¨<br/>JIS: _ (underscore) and ろ|
|numpad enter |numpad comma|
| Host | MSX |
|--------------|------------------------------------------------------------------------------|
| ctrl | CONTROL |
| shift | SHIFT |
| left alt | GRAPH |
| ins | INSERT |
| del | DELETE |
| home | HOME/CLS |
| end | SELECT |
| pause | STOP/BREAK |
| pagedown | CODE/COUNTRY |
| pageup | International: DEAD-key; accents `, ´, ^ and ¨<br/>JIS: _ (underscore) and ろ |
| numpad enter | numpad comma |
User 2:
* "Joystick": map RetroPad to MSX joystick B
@@ -351,6 +352,20 @@ To (de)activate KANA LOCK, press page down (COUNTRY). It works just like caps lo
Best enable SCREEN 1 to appreciate the full 8px width of the Japanese characters; in screen 0 characters are only 6px wide.
## Sound & music
fmsx-libretro emulates:
* [PSG](https://msx.org/wiki/Category:PSG) based on AY-3-8910: 3 channels with either tone or noise
* [MSX-MUSIC](https://www.msx.org/wiki/MSX-MUSIC) (a.k.a. [FM-PAC](https://www.msx.org/wiki/FM-PAC)) based on YM2413
* emulation is very poor: no drums, and all 9 channel voices are rendered as triangle waves
* the FM-PAC 8kB SRAM is supported - see section 'Saving state'
* [SCC](https://www.msx.org/wiki/Konami_051649) and [SCC-I including 128kB MegaRAM](https://www.msx.org/wiki/Konami_Sound_Cartridge) (a.k.a. SCC+): 5 channels of 32-Byte wavetable sound
* SCC/SCC-I is emulated in both cartridge slots 1 and 2 - see section 'Memory layout'
* Support for SCC/SCC-I detection and SCC-I MegaRAM was added to this libretro core; fMSX itself does not support either
* SCC-I MegaRAM is enabled by default, and can be disabled using core option `fmsx_scci_megaram` for tight memory situations and backwards compatibility with previous save states.
* The MegaRAM size is 128kB for compatibility with both [SD-Snatcher](https://www.generation-msx.nl/software/konami/sd-snatcher/release/1267/) as well as [Snatcher](https://www.generation-msx.nl/software/konami/snatcher/release/1144/) and the various Konami Game Collections.
MSX-AUDIO, Moonblaster, MIDI or any other more advanced audio expansions are not supported.
## Logging
When running into problems running a game, you can use logging to collect information.
@@ -421,7 +436,6 @@ In hires mode, the vertical output resolution will be doubled. Combined with ove
528 vertical lines. RetroArch will automatically scale this to retain aspect ratio and window size.
Audio: rendered in 48kHz 16b signed mono.
fMSX emulates PSG, SCC and FM-PAC.
Framerate: NTSC (US/JP) implies 60Hz - thus 60FPS, PAL (EU) implies 50Hz (=50FPS).
Gameplay and audio actually becomes 17% slower when switching from NTSC to PAL - just like on a real MSX.
@@ -431,13 +445,13 @@ Unlike BlueMSX and openMSX, fMSX does not implement any or all specific models s
The memory and [slot](https://www.msx.org/wiki/Slots) layout of this 'derivative' MSX model differs for model MSX1 vs. MSX2/2+.
#### MSX1
|primary slot| |0|1|2|3| | | |Address range|
|---|---|---|---|---|---|---|---|---|---|
|subslot| |n/a |n/a |n/a |3-0 |3-1 |3-2 |3-3 |
|page|3| |ROM content or empty |same| | |RAM mapper ^| |0xC000-0xFFFF|
|page|2| |ROM content, Game Master 2 or empty |same|FMPAC #| |RAM mapper ^| |0x8000-0xBFFF|
|page|1|BASIC ^ |ROM content, Game Master 1/2 or empty|same|FMPAC #|disk ROM *#|RAM mapper |RS-232 #|0x4000-0x7FFF|
|page|0|BIOS ^ |ROM content or empty |same| | |RAM mapper | |0x0000-0x3FFF|
| primary slot | | 0 | 1 | 2 | 3 | | | | Address range |
|--------------|-----|---------|-----------------------------------------------|------|---------|-------------|--------------|----------|---------------|
| subslot | | n/a | n/a | n/a | 3-0 | 3-1 | 3-2 | 3-3 | |
| page | 3 | | ROM content or empty | same | | | RAM mapper ^ | | 0xC000-0xFFFF |
| page | 2 | | ROM content, Game Master 2 or SCC-I MegaRAM | same | FMPAC # | | RAM mapper ^ | | 0x8000-0xBFFF |
| page | 1 | BASIC ^ | ROM content, Game Master 1/2 or SCC-I MegaRAM | same | FMPAC # | disk ROM *# | RAM mapper | RS-232 # | 0x4000-0x7FFF |
| page | 0 | BIOS ^ | ROM content or empty | same | | | RAM mapper | | 0x0000-0x3FFF |
Legend:
- \^: active page at startup
@@ -449,18 +463,21 @@ Regarding game ROM contents:
- [Game Master](https://www.generation-msx.nl/software/konami/game-master/470/), when present, is always mapped to slot 1.
- [Game Master 2](https://www.msx.org/wiki/Konami_Game_Master_2) (GM2), when present, is mapped to slot 1 except for Contra & Hai no Majutsushi.
For those 2 games, GMASTER2.ROM is mapped to slot 2. They only use GM2 for SRAM saves.
- The game (ROM content) is then mapped to the _other_ external slot, i.e., slot 2 or 1.
- The game (ROM content) is then mapped to the _other_ external slot, i.e., slot 2 or 1.
- The SCC-I MegaRAM is available in a free cartridge slot. When both are free, it is mirrored in cartridge slots 1 and 2.
When a Game Master as well a game ROM is loaded, SCC-I MegaRAM is not available.
- The SCC/SCC-I music chip is available in a free cartridge slot, and in any cartridge slot with a ROM with "Generic 8kB" or "Konami5 8kB" mapper.
#### MSX2/2+
For these two models, slot 0 is also expanded, and more optional roms are loaded when present.
|primary slot| |0 | | | |1 |2 |3 | | | |Address range|
|--- |---|--- |---|---|---|--- |--- |--- |--- |--- |--- |---|
|subslot | |0-0 |0-1|0-2|0-3|n/a |n/a |3-0 |3-1 |3-2 |3-3 |
|page |3 | |b | | |ROM content or empty |same|a | |RAM mapper ^| |0xC000-0xFFFF|
|page |2 | |b |c | |ROM content, Game Master 2 or empty |same|a / MSXDOS2 *#| |RAM mapper ^| |0x8000-0xBFFF|
|page |1 |BASIC ^|b |c | |ROM content, Game Master 1/2 or empty|same|a / MSXDOS2 *#|disk ROM *# |RAM mapper |RS-232 #|0x4000-0x7FFF|
|page |0 |BIOS ^ |b | | |ROM content or empty |same|a |extended BIOS *|RAM mapper | |0x0000-0x3FFF|
| primary slot | | 0 | | | | 1 | 2 | 3 | | | | Address range |
|--------------|---|---------|---|---|---|-----------------------------------------------|------|----------------|-----------------|--------------|----------|---------------|
| subslot | | 0-0 |0-1|0-2|0-3| n/a | n/a | 3-0 | 3-1 | 3-2 | 3-3 | |
| page |3 | |b | | | ROM content or empty | same | a | | RAM mapper ^ | | 0xC000-0xFFFF |
| page |2 | |b |c | | ROM content, Game Master 2 or SCC-I MegaRAM | same | a / MSXDOS2 *# | | RAM mapper ^ | | 0x8000-0xBFFF |
| page |1 | BASIC ^ |b |c | | ROM content, Game Master 1/2 or SCC-I MegaRAM | same | a / MSXDOS2 *# | disk ROM *# | RAM mapper | RS-232 # | 0x4000-0x7FFF |
| page |0 | BIOS ^ |b | | | ROM content or empty | same | a | extended BIOS * | RAM mapper | | 0x0000-0x3FFF |
Legend:
- \^: active page at startup
@@ -473,7 +490,7 @@ If all three optional 'dynamically mapped' ROMs are loaded, they are mapped to t
- \[0-1] PAINTER.ROM (64k, all 4 pages)
- \[0-2] FMPAC.ROM (64k, mapped to p1-2)
Regarding game ROM contents, the same applies as described for MSX1 above.
Regarding game ROM contents, SCC-I MegaRAM and SCC/SCC-I music, the same applies as described for MSX1 above.
The MSXDOS2 ROM (always in 3-0), when loaded, extends the DISK.ROM (in 3-1).
+98 -21
View File
@@ -72,7 +72,7 @@ uint8_t *VRAM,*VPAGE; /* Video RAM */
uint8_t *RAM[8]; /* Main RAM (8x8kB pages) */
uint8_t *EmptyRAM; /* Empty RAM page (8kB) */
uint8_t SaveCMOS; /* Save CMOS.ROM on exit */
uint8_t *MemMap[4][4][8]; /* Memory maps [PPage][SPage][Addr] */
uint8_t *MemMap[4][4][8]; /* Memory maps [PPage][SPage][Addr>>13] */
uint8_t *RAMData; /* RAM Mapper contents */
uint8_t RAMMapper[4]; /* RAM Mapper state */
@@ -146,8 +146,10 @@ FDIDisk FDD[NUM_FDI_DRIVES]; /* Floppy disk images */
AY8910 PSG; /* PSG registers & state */
YM2413 OPLL; /* OPLL registers & state */
SCC SCChip; /* SCC registers & state */
uint8_t SCCOn[2]; /* 1 = SCC page active */
uint16_t FMPACKey; /* MAGIC = SRAM active */
uint8_t SCCOn[2]; /* !=0: SCC page active */
uint8_t SCCIMode[2]; /* SCC-I mode register */
uint8_t *SCCIRAM; /* SCC-I RAM (16x8kB pages) */
uint16_t FMPACKey; /* MAGIC = SRAM active */
/** Real-time clock ******************************************/
uint8_t RTCReg,RTCMode; /* RTC register numbers */
@@ -485,6 +487,13 @@ int StartMSX(int NewMode,int NewRAMPages,int NewVRAMPages)
if(!(EmptyRAM=GetMemory(0x4000))) { return(0); }
memset(EmptyRAM,NORAM,0x4000);
/* Allocate 128kB (16x8kB pages) for SCC-I expanded RAM */
if(!(Mode&MSX_NO_MEGARAM))
{
if(!(SCCIRAM=GetMemory(16*0x2000))) { return(0); }
memset(SCCIRAM,0,16*0x2000);
}
/* Reset memory map to the empty space */
for(I=0;I<4;++I)
for(J=0;J<4;++J)
@@ -916,6 +925,7 @@ int ResetMSX(int NewMode,int NewRAMPages,int NewVRAMPages)
IRQPending=0x00; /* No IRQs pending */
SCCOn[0]=SCCOn[1]=0; /* SCCs off for now */
SCCIMode[0]=SCCIMode[1]=0; /* bankselect/SCC */
RTCReg=RTCMode=0; /* Clock registers */
KanCount=0;KanLetter=0; /* Kanji extension */
ChrTab=ColTab=ChrGen=VRAM; /* VDP tables */
@@ -947,18 +957,21 @@ int ResetMSX(int NewMode,int NewRAMPages,int NewVRAMPages)
/*************************************************************/
uint8_t RdZ80(uint16_t A)
{
/* Filter out everything but [xx11 1111 1xxx 1xxx] */
if((A&0x3F88)!=0x3F88) return(RAM[A>>13][A&0x1FFF]);
uint8_t J,PS,SS,I;
/* Secondary slot selector */
if(A==0xFFFF /*&& ((PSL[3]==0 && !MODEL(MSX_MSX1)) || PSL[3]==3)*/) return(~SSLReg[PSL[3]]); // might be wrong - should only read back inverse when the primary slot is expanded. Commented code would fix that.
J = A>>14; /* 16kB page number 0-3 */
PS = PSL[J]; /* Primary slot number */
SS = SSL[J]; /* Secondary slot number */
/* Floppy disk controller */
/* 7FF8h..7FFFh Standard DiskROM */
/* BFF8h..BFFFh MSX-DOS BDOS */
/* 7F80h..7F87h Arabic DiskROM */
/* 7FB8h..7FBFh SV738/TechnoAhead */
if((PSL[A>>14]==3)&&(SSL[A>>14]==1))
if(PS==3&&SS==1)
switch(A)
{
/* Standard MSX-DOS Arabic SV738 */
@@ -971,6 +984,13 @@ uint8_t RdZ80(uint16_t A)
return(Read1793(&FDC,WD1793_READY));
}
I = CartMap[PS][SS]; /* Cartridge number */
if(I<2 && SCCOn[I] && ((A&0xD800)==0x9800))
{
J=A&0x00FF;
return (A&0x2000) ? ReadSCCP(&SCChip,J) : ReadSCC(&SCChip,J);
}
/* Default to reading memory */
return(RAM[A>>13][A&0x1FFF]);
}
@@ -1381,11 +1401,46 @@ void MapROM(uint16_t A,uint8_t V)
/* Drop out if no cartridge in that slot */
if(I>=MAXSLOTS) return;
/* SCC: enable/disable for no cart */
if(!ROMData[I]&&(A==0x9000)) SCCOn[I]=(V==0x3F)? 1:0;
/* SCC handling for no cart */
/* Note: we don't do SCC-I handling if we _do_ have a ROM cart - SCC-I was only available in 2 flavours, both without ROM. */
if(I<2 && !ROMData[I] && 0x4000<=A && A<0xC000) // only support SCC(-I) in (unexpanded) external slots 1 & 2, page 1&2
{
if ((A|1)==0xBFFF && !(Mode&MSX_NO_MEGARAM))
{
SCCIMode[I]=V;
return;
}
/* all banks: SCC-I RAM; SCC regs not writeable nor SCC bank switchable */
/* did not implement SCCIMode b0-2 for individual bank handling */
if (SCCIMode[I] & 0x10)
{
RAM[A>>13][A&0x1FFF]=V;
return;
}
if ((A & 0x1800) == 0x1000) {
/* bankselect mode & writing to SCC-I mapper - switch 8kB RAM page */
J=(A>>13)-2; /* 8kB bank number 0-3 */
switch (J)
{
case 2:
SCCOn[I]=(V&0x3F)==0x3F; // SCC enable - write xx111111 to 9000-97FF
break;
case 3:
SCCOn[I]=(V&0x80); // SCC-I a.k.a. SCC+ enable - write 1xxxxxxx to B000-B7FF
break;
}
V&=0x0F; // bitmask for 16 pages
if(V!=ROMMapper[I][J] && !(Mode&MSX_NO_MEGARAM) && SCCIRAM)
{
RAM[J+2]=MemMap[PS][SS][J+2]=SCCIRAM+((int)V<<13);
ROMMapper[I][J]=V;
}
return;
}
}
/* If writing to SCC... */
if(SCCOn[I]&&((A&0xDF00)==0x9800))
/* If writing to SCC... [whether we have a ROM in this slot or not] */
if(I<2 && SCCOn[I] && ((A&0xD800)==0x9800)) // D8==1101.1000 => ignore upper b5 for SCC/SCC-I and b0-3 for 8 mirrored SCC register blocks
{
/* Compute SCC register number */
J=A&0x00FF;
@@ -1393,22 +1448,22 @@ void MapROM(uint16_t A,uint8_t V)
/* If using SCC+... */
if(A&0x2000)
{
/* When no MegaROM present, we allow the program */
/* to write into SCC wave buffer using EmptyRAM */
/* as a scratch pad. */
/* When no MegaROM present, we allow the program */
/* to write into SCC wave buffer using EmptyRAM */
/* as a scratch pad. */
if(!ROMData[I]&&(J<0xA0)) EmptyRAM[0x1800+J]=V;
/* Output data to SCC chip */
/* Output data to SCC chip */
WriteSCCP(&SCChip,J,V);
}
else
else
{
/* When no MegaROM present, we allow the program */
/* to write into SCC wave buffer using EmptyRAM */
/* as a scratch pad. */
/* When no MegaROM present, we allow the program */
/* to write into SCC wave buffer using EmptyRAM */
/* as a scratch pad. */
if(!ROMData[I]&&(J<0x80)) EmptyRAM[0x1800+J]=V;
/* Output data to SCC chip */
/* Output data to SCC chip */
WriteSCC(&SCChip,J,V);
}
@@ -1426,7 +1481,7 @@ void MapROM(uint16_t A,uint8_t V)
if((A<0x4000)||(A>0xBFFF)) break;
J=(A-0x4000)>>13;
/* Turn SCC on/off on writes to 8000h-9FFFh */
if(J==2) SCCOn[I]=(V==0x3F)? 1:0;
if(J==2 && I<2) SCCOn[I]=(V&0x3F)==0x3F;
/* Switch ROM pages */
V&=ROMMask[I];
if(V!=ROMMapper[I][J])
@@ -1456,7 +1511,7 @@ void MapROM(uint16_t A,uint8_t V)
if((A<0x5000)||(A>0xB000)||((A&0x1FFF)!=0x1000)) break;
J=(A-0x5000)>>13;
/* Turn SCC on/off on writes to 9000h */
if(J==2) SCCOn[I]=(V==0x3F)? 1:0;
if(J==2 && I<2) SCCOn[I]=(V&0x3F)==0x3F;
/* Switch ROM pages */
V&=ROMMask[I];
if(V!=ROMMapper[I][J])
@@ -3252,6 +3307,15 @@ unsigned int SaveState(unsigned char *Buf,unsigned int MaxSize)
for(K=0;K<4;++K) State[J++]=ROMMapper[I][K];
}
/* SCC setup */
if (!(Mode&MSX_NO_MEGARAM))
{
State[J++] = SCCOn[0];
State[J++] = SCCOn[1];
State[J++] = SCCIMode[0];
State[J++] = SCCIMode[1];
}
/* Write out data structures */
SaveSTRUCT(CPU);
SaveSTRUCT(PPI);
@@ -3264,6 +3328,8 @@ unsigned int SaveState(unsigned char *Buf,unsigned int MaxSize)
SaveARRAY(State);
SaveDATA(RAMData,RAMPages*0x4000);
SaveDATA(VRAM,VRAMPages*0x4000);
if (!(Mode&MSX_NO_MEGARAM) && SCCIRAM)
SaveDATA(SCCIRAM,16*0x2000);
/* Return amount of data written */
return(Size);
@@ -3293,6 +3359,8 @@ unsigned int LoadState(unsigned char *Buf,unsigned int MaxSize)
LoadARRAY(State);
LoadDATA(RAMData,RAMPages*0x4000);
LoadDATA(VRAM,VRAMPages*0x4000);
if (!(Mode&MSX_NO_MEGARAM) && SCCIRAM)
LoadDATA(SCCIRAM,16*0x2000);
/* Parse hardware state */
J=0;
@@ -3339,6 +3407,15 @@ unsigned int LoadState(unsigned char *Buf,unsigned int MaxSize)
}
}
/* SCC setup */
if (!(Mode&MSX_NO_MEGARAM))
{
SCCOn[0] = State[J++];
SCCOn[1] = State[J++];
SCCIMode[0] = State[J++];
SCCIMode[1] = State[J++];
}
/* Set RAM mapper pages */
if(RAMMask)
for(I=0;I<4;++I)
+10 -10
View File
@@ -151,16 +151,16 @@ extern "C" {
#define MSX_GUESSA 0x00010000 /* Guess ROM mapper type A */
#define MSX_GUESSB 0x00020000 /* Guess ROM mapper type B */
#define MSX_OPTIONS 0x7FFC0000 /* Miscellaneous Options: */
#define MSX_GMASTER 0x00400000 /* Load Game Master 1/2 */
#define MSX_ALLSPRITE 0x00800000 /* Show ALL sprites */
#define MSX_AUTOFIREA 0x01000000 /* Autofire joystick FIRE-A */
#define MSX_AUTOFIREB 0x02000000 /* Autofire joystick FIRE-B */
#define MSX_AUTOSPACE 0x04000000 /* Autofire SPACE button */
#define MSX_OBSOLETE 0x08000000 /* - removed from fmsx-lr - */
#define MSX_PATCHBDOS 0x10000000 /* Patch DiskROM routines */
#define MSX_FIXEDFONT 0x20000000 /* Use fixed 8x8 text font */
#define MSX_MSXDOS2 0x40000000 /* Load MSXDOS2 ROM on boot */
#define MSX_OPTIONS 0x7FFC0000 /* Miscellaneous Options: */
#define MSX_GMASTER 0x00400000 /* Load Game Master 1/2 */
#define MSX_ALLSPRITE 0x00800000 /* Show ALL sprites */
#define MSX_AUTOFIREA 0x01000000 /* Autofire joystick FIRE-A */
#define MSX_AUTOFIREB 0x02000000 /* Autofire joystick FIRE-B */
#define MSX_AUTOSPACE 0x04000000 /* Autofire SPACE button */
#define MSX_NO_MEGARAM 0x08000000 /* Disable SCC-I MegaRAM */
#define MSX_PATCHBDOS 0x10000000 /* Patch DiskROM routines */
#define MSX_FIXEDFONT 0x20000000 /* Use fixed 8x8 text font */
#define MSX_MSXDOS2 0x40000000 /* Load MSXDOS2 ROM on boot */
/*************************************************************/
/** Keyboard codes and macros ********************************/
+7
View File
@@ -923,6 +923,12 @@ static void check_variables(void)
else
VRAMPages = ModeVRAM;
var.key = "fmsx_scci_megaram";
var.value = NULL;
if (environ_cb(RETRO_ENVIRONMENT_GET_VARIABLE, &var) && var.value && strcmp(var.value, "No") == 0)
Mode |= MSX_NO_MEGARAM;
var.key = "fmsx_log_level";
var.value = NULL;
@@ -1525,6 +1531,7 @@ void retro_set_environment(retro_environment_t cb)
},
{ "fmsx_ram_pages", "MSX Main Memory; Auto|64KB|128KB|256KB|512KB|4MB" },
{ "fmsx_vram_pages", "MSX Video Memory; Auto|32KB|64KB|128KB|192KB" },
{ "fmsx_scci_megaram", "Enable SCC-I 128kB MegaRAM; Yes|No" },
{ "fmsx_log_level", "fMSX logging; Off|Info|Debug|Spam" },
{ "fmsx_game_master", "Support Game Master; No|Yes" },
{ "fmsx_simbdos", "Simulate DiskROM disk access calls; No|Yes" },