Skip to content

Commit

Permalink
7.3 - The need for speed build!
Browse files Browse the repository at this point in the history
  • Loading branch information
wavemotion-dave committed May 31, 2022
1 parent fb44235 commit f0f1ae2
Show file tree
Hide file tree
Showing 8 changed files with 84 additions and 55 deletions.
Binary file modified ColecoDS.nds
Binary file not shown.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ include $(DEVKITARM)/ds_rules

export TARGET := ColecoDS
export TOPDIR := $(CURDIR)
export VERSION := 7.2b
export VERSION := 7.3

ICON := -b $(CURDIR)/logo.bmp "ColecoDS $(VERSION);wavemotion-dave;https://github.com/wavemotion-dave/ColecoDS"

Expand Down
27 changes: 10 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,6 @@ Thanks to Alekmaul who provided the
baseline code to work with and to lobo
for the menu graphical design.

Thanks to Reesy for the DrZ80 core.

Thanks to Flubba for the SN76496 sound core.

Thanks to the C-BIOS team for the open
Expand All @@ -89,7 +87,7 @@ Known Issues :
* Borders are not correctly rendered - only a few games utilize them and are still fully playable without this.
* Games that utilize voice samples (Squish Em Sam, Wizard of Wor, etc) will not play the speech due to sound emulation limitations.
* The original 2011 release of StarForce will crash - this is a known bug. There is a patched version of the game StarForce on Atariage.
* MSX envelope and Sord M5 CTC sound and noise emulation is not perfectly accurate (but close enough).
* MSX envelope, Einstein and Sord M5 CTC sound and noise emulation is not perfectly accurate (but close enough).
* MSX Konami SCC sound chip is not emulated (Gradius 2/3, Salamander, etc. won't have proper music)

ADAM Compatibility :
Expand All @@ -109,7 +107,7 @@ the default MSX Mapper is set to "GUESS" which does a fairly good job loading th
* A small number of games don't work with the open-source C-BIOS. In this case you would need a real msx.rom BIOS. You can set this up in Game Options.
* Most 64K games use the ASC16 memory mapper - so you can try that one... but a few (e.g. Mutants from the Deep) are linear mapped from 0-64K and you will need to pick LINEAR64 in Game Options.
* The auto-detection on KONAMI8 and KONAMI-SCC mappers is pretty good... but many other games using ASCII8 or ASCII16 don't detect well - you should try those mappers if the "larger than 64K" game won't run.
* Some of the really big games (128K or larger) run slow - if you're not getting full frame rate, you can try switching to the DrZ80 core (not all games will run with this) and/or you can disable Vertical Sync and/or enable Frame Skip. Recommend you turn off Vertical Sync at a minimum to get the most speed from large MSX games.
* Some of the really big games (128K or larger) run slow - if you're not getting full frame rate, you can try the speed configuration changes mentioned further below.
* Occasionally one ROM won't run but an alternate dump might. For example, the 384K version of R-Type is a bit of a mess for the emulator to handle, but someone made a clean 512K version that loads and runs great.
* Some MSX games take 4 or 5 seconds to initialize and start running due to checking various slots and subslots for memory - be patient.
* With a little diligence in trying different mapping/BIOS combinations, you should be able to achieve a 98% run rate on MSX1 games.
Expand Down Expand Up @@ -188,6 +186,8 @@ There is full support for Spinner X (P1) and Spinner Y (P2) or map
both of them to get support for trackball games. These also work
for games like Turbo steering. You can change the spinner sensitivity
to one of five different settings (Normal, Fast, Fastest, Slow, Slowest).
By default, the spinners are only enabled for the few games that use
them - but you can force them by changing the Spinner Speed.

For the MSX emulation, the colecovision keypad is mapped as follows:
```
Expand Down Expand Up @@ -232,29 +232,22 @@ it for almost all games (Princess Quest is one game where you might turn it off)
handle it for the more simple games. So by default it's enabled for DSi and disabled for DS-LITE/PHAT.
You can toggle this in the "Game Options" (and START=SAVE it out as you wish).

A Tale of Two Cores :
-----------------------
ColecoDS supports 2 different Z80 CPU cores.
DrZ80 is very fast but is not 100% accurate so some games don't run right.
CZ80 is 10% slower but is much closer to 100% accurate and games generally run great.
For the DSi and above, the CZ80 core is the default.
For the DS-LITE/PHAT, the DrZ80 core is the default.
You can toggle this (and save on a per-game basis) in GAME OPTIONS.
If you want to use the CZ80 core but need a bit more speed to make the
games playable - you can also play with Vertical Sync and Frame Skip settings.

The Need For Speed :
-----------------------
If a game just isn't running at the right speed or has periods of slowdown (not
attributed to the actual game), here are the things you can try in the order I
would personally try them:
* If it's a Colecovision game, make sure 'RAM MIRROR' is disabled. Only a few games need this (it will crash if you set it wrong).
* Turn off Vertical Sync
* Turn on Frame Skip
* Turn on Frame Skip - there are two settings here... show 3/4 (light frame skip) and show 1/2 (heavy frame skip)
* Set Max Sprites to 4
* Switch to the DrZ80 fast CPU core

Versions :
-----------------------
V7.3: 31-May-2022 by wavemotion-dave
* Massive optimization of the VDP core and memory handling so we are now almost 35% faster on Colecovision games and more than 10% faster on all other systems.
* Due to these optmizations, the DrZ80 core has been removed and only the high-compatibility CZ80 core remains.

V7.2: 14-May-2022 by wavemotion-dave
* Improved Einstein driver to allow SHIFT and CONTROL key maps.
* Added AY Envelope Reset option for the few games that need it (Warp & Warp, Killer Station)
Expand Down
Binary file modified arm9/gfx_data/pdev_bg0.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 3 additions & 1 deletion arm9/source/colecoDS.c
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ u8 einstein_mode __attribute__((section(".dtcm"))) = 0; // Set to 1 wh
u8 creativision_mode __attribute__((section(".dtcm"))) = 0; // Set to 1 when a .cv ROM is loaded (Creativision)
u8 coleco_mode __attribute__((section(".dtcm"))) = 0; // Set to 1 when a Colecovision ROM is loaded

u16 machine_mode __attribute__((section(".dtcm"))) = 0x0001; // A faster way to know what type of machine we are

u8 kbd_key __attribute__((section(".dtcm"))) = 0; // 0 if no key pressed, othewise the ASCII key (e.g. 'A', 'B', '3', etc)
u16 nds_key __attribute__((section(".dtcm"))) = 0; // 0 if no key pressed, othewise the NDS keys from keysCurrent() or similar

Expand Down Expand Up @@ -323,7 +325,7 @@ mm_word OurSoundMixer(mm_word len, mm_addr dest, mm_stream_formats format)
}
else
{
if (msx_mode || svi_mode || einstein_mode) // If we are an MSX or SVI, we can just use the one AY sound core
if (machine_mode & (MODE_MSX | MODE_SVI | MODE_EINSTEIN))
{
ay76496Mixer(len*4, dest, &aycol);
}
Expand Down
13 changes: 13 additions & 0 deletions arm9/source/colecoDS.h
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,22 @@ extern u8 adam_CapsLock;
extern u8 adam_unsaved_data;
extern u8 creativision_mode;

extern u16 machine_mode;

extern char lastAdamDataPath[];
extern u32 tape_pos, tape_len;

#define MODE_COLECO 0x0001
#define MODE_ADAM 0x0002
#define MODE_SG_1000 0x0004
#define MODE_SORDM5 0x0008
#define MODE_PV2000 0x0010
#define MODE_MEMOTECH 0x0020
#define MODE_EINSTEIN 0x0040
#define MODE_SVI 0x0080
#define MODE_MSX 0x0100
#define MODE_PENCIL2 0x0200

#define WAITVBL swiWaitForVBlank(); swiWaitForVBlank(); swiWaitForVBlank(); swiWaitForVBlank(); swiWaitForVBlank();

extern volatile u16 vusCptVBL; // Video Management
Expand Down
51 changes: 36 additions & 15 deletions arm9/source/colecomngt.c
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,22 @@ u8 loadrom(const char *path,u8 * ptr, int nmemb)
// For some combinations, we have hotspots or other memory stuff that
// needs to be more complicated than simply returning pColecoMem[].
// -------------------------------------------------------------------------
bIsComplicatedRAM = (bMagicMegaCart || bActivisionPCB || adam_mode || pv2000_mode) ? 1:0; // Assume RAM is complicated until told otherweise
bIsComplicatedRAM = (bMagicMegaCart || bActivisionPCB || adam_mode || pv2000_mode) ? 1:0; // Set to 1 if we have to do more than just simple memory read...

// -----------------------------------------------------------------------
// To speed up processing in the memory write functions, we accumulate
// the bits so we only have to fetch one machine_mode variable.
// -----------------------------------------------------------------------
if (pencil2_mode) machine_mode = MODE_PENCIL2;
else if (msx_mode) machine_mode = MODE_MSX;
else if (svi_mode) machine_mode = MODE_SVI;
else if (einstein_mode) machine_mode = MODE_EINSTEIN;
else if (memotech_mode) machine_mode = MODE_MEMOTECH;
else if (pv2000_mode) machine_mode = MODE_PV2000;
else if (sordm5_mode) machine_mode = MODE_SORDM5;
else if (sg1000_mode) machine_mode = MODE_SG_1000;
else if (adam_mode) machine_mode = MODE_ADAM;
else machine_mode = MODE_COLECO;
}
return bOK;
}
Expand Down Expand Up @@ -887,13 +902,16 @@ void SetupAdam(bool bResetAdamNet)
/*************************************************************/
ITCM_CODE unsigned char cpu_readport16(register unsigned short Port)
{
if (sg1000_mode) {return cpu_readport_sg(Port);}
if (sordm5_mode) {return cpu_readport_m5(Port);}
if (pv2000_mode) {return cpu_readport_pv2000(Port);}
if (memotech_mode) {return cpu_readport_memotech(Port);}
if (msx_mode) {return cpu_readport_msx(Port);}
if (svi_mode) {return cpu_readport_svi(Port);}
if (einstein_mode) {return cpu_readport_einstein(Port);}
if (machine_mode & (MODE_MSX | MODE_SG_1000 | MODE_SORDM5 | MODE_PV2000 | MODE_MEMOTECH | MODE_SVI | MODE_EINSTEIN))
{
if (machine_mode & MODE_MSX) {return cpu_readport_msx(Port);}
if (machine_mode & MODE_SG_1000) {return cpu_readport_sg(Port);}
if (machine_mode & MODE_SORDM5) {return cpu_readport_m5(Port);}
if (machine_mode & MODE_PV2000) {return cpu_readport_pv2000(Port);}
if (machine_mode & MODE_MEMOTECH) {return cpu_readport_memotech(Port);}
if (machine_mode & MODE_SVI) {return cpu_readport_svi(Port);}
if (machine_mode & MODE_EINSTEIN) {return cpu_readport_einstein(Port);}
}

// Colecovision ports are 8-bit
Port &= 0x00FF;
Expand Down Expand Up @@ -938,13 +956,16 @@ ITCM_CODE unsigned char cpu_readport16(register unsigned short Port)
/*************************************************************/
void cpu_writeport16(register unsigned short Port,register unsigned char Value)
{
if (sg1000_mode) {cpu_writeport_sg(Port, Value); return;}
else if (sordm5_mode) {cpu_writeport_m5(Port, Value); return;}
else if (pv2000_mode) {cpu_writeport_pv2000(Port, Value); return;}
else if (memotech_mode) {cpu_writeport_memotech(Port, Value); return;}
else if (svi_mode) {cpu_writeport_svi(Port, Value); return;}
else if (einstein_mode) {cpu_writeport_einstein(Port, Value); return;}
else if (msx_mode) {cpu_writeport_msx(Port, Value); return;}
if (machine_mode & (MODE_MSX | MODE_SG_1000 | MODE_SORDM5 | MODE_PV2000 | MODE_MEMOTECH | MODE_SVI | MODE_EINSTEIN))
{
if (machine_mode & MODE_MSX) {cpu_writeport_msx(Port, Value); return;}
if (machine_mode & MODE_SG_1000) {cpu_writeport_sg(Port, Value); return;}
if (machine_mode & MODE_SORDM5) {cpu_writeport_m5(Port, Value); return;}
if (machine_mode & MODE_PV2000) {cpu_writeport_pv2000(Port, Value); return;}
if (machine_mode & MODE_MEMOTECH) {cpu_writeport_memotech(Port, Value); return;}
if (machine_mode & MODE_SVI) {cpu_writeport_svi(Port, Value); return;}
if (machine_mode & MODE_EINSTEIN) {cpu_writeport_einstein(Port, Value); return;}
}

// Colecovision ports are 8-bit
Port &= 0x00FF;
Expand Down
42 changes: 21 additions & 21 deletions arm9/source/cpu/z80/Z80_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -364,24 +364,24 @@ ITCM_CODE void cpu_writemem16 (u8 value,u16 address)
extern u8 sgm_enable;
extern u16 sgm_low_addr;

if (coleco_mode || adam_mode)
// --------------------------------------------------------------
// If the ADAM is enabled, we may be trying to write to AdamNet
// --------------------------------------------------------------
if (machine_mode & MODE_ADAM)
{
// --------------------------------------------------------------
// If the ADAM is enabled, we may be trying to write to AdamNet
// --------------------------------------------------------------
if (adam_mode)
{
if ((address < 0x8000) && adam_ram_lo) {pColecoMem[address]=value; AdamRAM[address] = value; if (PCBTable[address]) WritePCB(address, value);}
else if ((address >= 0x8000) && adam_ram_hi) {pColecoMem[address]=value; AdamRAM[address] = value; if (PCBTable[address]) WritePCB(address, value);}
if ((address < 0x8000) && adam_ram_lo) {pColecoMem[address]=value; AdamRAM[address] = value; if (PCBTable[address]) WritePCB(address, value);}
else if ((address >= 0x8000) && adam_ram_hi) {pColecoMem[address]=value; AdamRAM[address] = value; if (PCBTable[address]) WritePCB(address, value);}

if ((address < 0x8000) && adam_ram_lo_exp) {pColecoMem[address]=value; AdamRAM[0x10000 + address] = value;}
else if ((address >= 0x8000) && adam_ram_hi_exp) {pColecoMem[address]=value; AdamRAM[0x10000 + address] = value;}
}
if ((address < 0x8000) && adam_ram_lo_exp) {pColecoMem[address]=value; AdamRAM[0x10000 + address] = value;}
else if ((address >= 0x8000) && adam_ram_hi_exp) {pColecoMem[address]=value; AdamRAM[0x10000 + address] = value;}
}
else if (machine_mode & MODE_COLECO)
{
// -----------------------------------------------------------
// If the Super Game Module has been enabled, we have a much
// wider range of RAM that can be written (and no mirroring)
// -----------------------------------------------------------
else if (sgm_enable)
if (sgm_enable)
{
if ((address >= sgm_low_addr) && (address < 0x8000)) pColecoMem[address]=value;
}
Expand Down Expand Up @@ -418,7 +418,7 @@ ITCM_CODE void cpu_writemem16 (u8 value,u16 address)
// are going to assume well-behaved .sg ROMs as this is
// primarily a Colecovision emu with partial SG-1000 support.
// -------------------------------------------------------------
else if (sg1000_mode)
else if (machine_mode & MODE_SG_1000)
{
// Allow normal SG-1000, SC-3000 writes, plus allow for 8K RAM Expanders...
if ((address >= 0x8000) || (address >= 0x2000 && address < 0x4000))
Expand All @@ -429,21 +429,21 @@ ITCM_CODE void cpu_writemem16 (u8 value,u16 address)
// ----------------------------------------------------------------------------------
// For the Sord M5, RAM is at 0x7000 and we emulate the 32K RAM Expander above that
// ----------------------------------------------------------------------------------
else if (sordm5_mode)
else if (machine_mode & MODE_SORDM5)
{
if (address >= 0x7000)
{
pColecoMem[address]=value; // Allow pretty much anything above the base ROM area
}
}
else if (pv2000_mode)
else if (machine_mode & MODE_PV2000)
{
cpu_writemem_pv2000(value, address);
}
// ----------------------------------------------------------------------------------
// For the Memotech MTX, allow anything in the upper 48K
// ----------------------------------------------------------------------------------
else if (memotech_mode)
else if (machine_mode & MODE_MEMOTECH)
{
if (address >= memotech_RAM_start)
{
Expand All @@ -460,9 +460,9 @@ ITCM_CODE void cpu_writemem16 (u8 value,u16 address)
}
}
// ----------------------------------------------------------------------------------
// For the Memotech MTX, allow anything in the upper 48K
// For the Einstien, allow anything in the upper 48K
// ----------------------------------------------------------------------------------
else if (einstein_mode)
else if (machine_mode & MODE_EINSTEIN)
{
extern u8 Slot3RAM[];
extern u16 einstein_ram_start;
Expand All @@ -475,7 +475,7 @@ ITCM_CODE void cpu_writemem16 (u8 value,u16 address)
// ----------------------------------------------------------------------------------
// For the Spectravideo SVI - we write into any area that is designated as RAM
// ----------------------------------------------------------------------------------
else if (svi_mode)
else if (machine_mode & MODE_SVI)
{
if ( ((address < 0x8000) && svi_RAM[0]) || ((address >= 0x8000) && svi_RAM[1]) )
{
Expand All @@ -487,7 +487,7 @@ ITCM_CODE void cpu_writemem16 (u8 value,u16 address)
// ----------------------------------------------------------------------------------------------------------
// For the MSX, we support a 64K main RAM machine plus some of the more common memory mappers...
// ----------------------------------------------------------------------------------------------------------
else if (msx_mode)
else if (machine_mode & MODE_MSX)
{
// -------------------------------------------------------
// First see if this is a write to a RAM enabled slot...
Expand Down Expand Up @@ -701,7 +701,7 @@ ITCM_CODE void cpu_writemem16 (u8 value,u16 address)
}
}
}
else if (pencil2_mode)
else if (machine_mode & MODE_PENCIL2)
{
pColecoMem[address] = value;
}
Expand Down

0 comments on commit f0f1ae2

Please sign in to comment.