Skip to content

Commit

Permalink
Version 9.9 - see readme.md for details
Browse files Browse the repository at this point in the history
  • Loading branch information
wavemotion-dave committed May 2, 2024
1 parent 605e6c6 commit 54eef27
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 35 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 @@ -15,7 +15,7 @@ include $(DEVKITARM)/ds_rules

export TARGET := ColecoDS
export TOPDIR := $(CURDIR)
export VERSION := 9.8d
export VERSION := 9.9

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

Expand Down
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -407,10 +407,11 @@ And then move the soundbank.h file to the arm9/sources directory

Versions :
-----------------------
V9.9: ??-???-2024 by wavemotion-dave
V9.9: 02-May-2024 by wavemotion-dave
* Added overlays for Blackjack and War Room. Improved War Games overlay.
* Added KANA lock LED indicator for Japanese MSX keyboard layouts.
* Correctly read-back the PPG Port B (needed to make the KANA lock work but is more accurate overall).
* Improvements to various Coleco PCB types for more accurate emulation.

V9.8: 23-Apr-2024 by wavemotion-dave
* Cleanup of MSX BIOS handling - we now support the Panasonic CF-2700 directly. See MSX BIOS section for details.
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: 2 additions & 2 deletions arm9/source/C24XX.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ byte Write24XX(C24XX *D,byte V)
}
else
{
extern unsigned char write_EE_counter;
extern unsigned char write_NV_counter;
/* Depending on the state... */
switch(D->State)
{
Expand All @@ -125,7 +125,7 @@ byte Write24XX(C24XX *D,byte V)
/* Go to the next address inside N-byte page */
J = PageSize[D->Flags&C24XX_CHIP]-1;
D->Addr = ((D->Addr+1)&J)|(D->Addr&~J);
write_EE_counter = 2;
write_NV_counter = 2;
break;
case SEND_DATA:
/* See below */
Expand Down
62 changes: 35 additions & 27 deletions arm9/source/colecoDS.c
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ char initial_path[MAX_ROM_NAME] = "";
u8 adam_CapsLock = 0;
u8 msx_caps_lock = 0;
u8 msx_kana_lock = 0;
u8 write_EE_counter = 0;
u8 write_NV_counter = 0;
u32 last_tape_pos = 9999;

u8 disk_unsaved_data[3] = {0,0,0};
Expand Down Expand Up @@ -665,7 +665,7 @@ void ResetColecovision(void)
msx_caps_lock = 0; // MSX CAPS lock off
msx_kana_lock = 0; // MSX KANA lock off

write_EE_counter=0; // Nothing to write for EEPROM yet
write_NV_counter=0; // Nothing to write for EEPROM yet

playingSFX = 0; // No sound effects playing yet

Expand Down Expand Up @@ -1042,15 +1042,15 @@ void DisplayStatusLine(bool bForce)
last_pal_mode = myConfig.isPAL;
DSPrint(0,0,6, myConfig.isPAL ? "PAL":" ");
}
if (write_EE_counter > 0)
if (write_NV_counter > 0)
{
--write_EE_counter;
if (write_EE_counter == 0)
--write_NV_counter;
if (write_NV_counter == 0)
{
// Save EE now!
msxSaveEEPROM();
}
DSPrint(5,0,6, (write_EE_counter ? "EE":" "));
DSPrint(5,0,6, (write_NV_counter ? "EE":" "));
}
if (msx_mode == 3)
{
Expand Down Expand Up @@ -1227,17 +1227,17 @@ void DisplayStatusLine(bool bForce)
DSPrint(22,0,6, (romBankMask ? (bSuperGameCart ? "SC": (bActivisionPCB ? "AC":"MC")):" "));
}

if (write_EE_counter > 0)
if (write_NV_counter > 0)
{
--write_EE_counter;
if (write_EE_counter == 0)
--write_NV_counter;
if (write_NV_counter == 0)
{
// Save the modified SGC rom now!
if (bSuperGameCart) SuperGameCartSaveFlash();
else colecoSaveEEPROM(); // else save out the colecovision EE
}

DSPrint(15,0,6, (write_EE_counter ? "EE":" "));
DSPrint(15,0,6, (write_NV_counter ? (bSuperGameCart ? "SST":"EE"):" "));
}
}
}
Expand Down Expand Up @@ -4564,12 +4564,20 @@ int main(int argc, char **argv)
}


#define MAX_DPRINTF_STR_SIZE 256
u32 MAX_DEBUG_BUF_SIZE = 0;
// -----------------------------------------------------------------------
// The code below is a handy set of debug tools that allows us to
// write printf() like strings out to a file. Basically we accumulate
// the strings into a large RAM buffer and then when the L+R shoulder
// buttons are pressed and held, we will snapshot out the debug.log file.
// The DS-Lite only gets a small 16K debug buffer but the DSi gets 4MB!
// -----------------------------------------------------------------------

#define MAX_DPRINTF_STR_SIZE 256
u32 MAX_DEBUG_BUF_SIZE = 0;

char *debug_buffer = 0;
char fstr[MAX_DPRINTF_STR_SIZE] = {0};
uint32_t debug_len = 0;
u32 debug_len = 0;
extern char szName[]; // Reuse buffer which has no other in-game use

void debug_init()
{
Expand All @@ -4590,9 +4598,21 @@ void debug_init()
debug_len = 0;
}

void debug_printf(const char * str, ...)
{
va_list ap = {0};

va_start(ap, str);
vsnprintf(szName, MAX_DPRINTF_STR_SIZE, str, ap);
va_end(ap);

strcat(debug_buffer, szName);
debug_len += strlen(szName);
}

void debug_save()
{
if (debug_len > 0)
if (debug_len > 0) // Only if we have debug data to write...
{
FILE *fp = fopen("debug.log", "w");
if (fp)
Expand All @@ -4603,17 +4623,5 @@ void debug_save()
}
}

void debug_printf(const char * str, ...)
{
va_list ap = {0};

va_start(ap, str);
vsnprintf(fstr, MAX_DPRINTF_STR_SIZE, str, ap);
va_end(ap);

strcat(debug_buffer, fstr);
debug_len += strlen(fstr);
}

// End of file

4 changes: 2 additions & 2 deletions arm9/source/colecoDS.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#include <string.h>
#include "C24XX.h"

#define VERSIONCLDS "9.8"
#define VERSIONCLDS "9.9"

extern u32 debug[0x10];

Expand Down Expand Up @@ -276,7 +276,7 @@ extern u32 keyCoresp[MAX_KEY_OPTIONS];
extern u16 NDS_keyMap[];

extern u8 soundEmuPause;
extern u8 write_EE_counter;
extern u8 write_NV_counter;
extern u8 msx_japanese_matrix;

extern int bg0, bg1, bg0b, bg1b;
Expand Down
2 changes: 1 addition & 1 deletion arm9/source/colecomngt.c
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ u8 colecoInit(char *szGame)
dmaFillWords(uVide | (uVide<<16),pVidFlipBuf+uBcl*128,256);
}

write_EE_counter=0;
write_NV_counter=0;
spinner_enabled = false;
ctc_enabled = false;

Expand Down
2 changes: 1 addition & 1 deletion arm9/source/cpu/z80/Z80_interface.c
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ ITCM_CODE void cpu_writemem16(u8 value,u16 address)
if (msx_sram_at_8000)
{
SRAM_Memory[address&0x3FFF] = value; // Write SRAM area
write_EE_counter = 4; // This will back the EE in 4 seconds of non-activity on the SRAM
write_NV_counter = 4; // This will back the EE in 4 seconds of non-activity on the SRAM
}
else RAM_Memory[address]=value; // Allow write - this is a RAM mapped slot
}
Expand Down

0 comments on commit 54eef27

Please sign in to comment.