Skip to content

Commit

Permalink
Version 5.3 with integrated 2K GRAM build. See README.md for details.
Browse files Browse the repository at this point in the history
  • Loading branch information
wavemotion-dave committed Sep 7, 2024
1 parent ad33e8a commit f8d2c12
Show file tree
Hide file tree
Showing 10 changed files with 40 additions and 32 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ include $(DEVKITARM)/ds_rules

export TARGET := NINTV-DS
export TOPDIR := $(CURDIR)
export VERSION := 5.2a
export VERSION := 5.3

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

Expand Down
Binary file modified NINTV-DS.nds
Binary file not shown.
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ Features :
* Numerous button / controller mapping options. Dual-Controller support (run and shoot at the same time).
* JLP support for accelerated functions (multiply/divide), extra RAM and flash memory. If not auto-detected, when loading a game use the X button to load with options.
* ECS support for ECS games including sound-enhanced games like Space Patrol. If not auto-detected, when loading a game use the X button to load with options.
* 2K GRAM (aka Tutorvision mode) is supported on a per-game basis. Select 2K GRAM in the second page of Configuration for any game (reload game for it to take effect).

Technical Specs :
----------
Expand Down Expand Up @@ -125,6 +126,9 @@ Credits :
--------------------------------------------------------------------------------
History :
--------------------------------------------------------------------------------
V5.3 : 07-Sep-2024 by wavemotion-dave
* Integrated 2KGRAM build into the main code. There is now one unified Nintellivision build. Use Configuration to select 2KGRAM (aka Tutorvision mode) for games that support it.

V5.2 : 22-Jun-2024 by wavemotion-dave
* Improved MOB collision detection to fix GORF
* Improved MOB rendering so that Y coordinates of zero don't draw (fixes minor glitch in Beauty and the Beast at end of levels)
Expand Down
Binary file modified arm9/gfx/bgTop.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 2 additions & 1 deletion arm9/source/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ static void SetDefaultGameConfig(UINT32 crc)
myConfig.fudgeTiming = 0;
myConfig.key_click = 0;
myConfig.bSkipBlanks = 0;
myConfig.spare5 = 0;
myConfig.gramSize = GRAM_512B; // Normal 512 bytes
myConfig.spare6 = 0;
myConfig.spare7 = 0;
myConfig.spare8 = 0;
Expand Down Expand Up @@ -460,6 +460,7 @@ const struct options_t Option_Table[3][20] =
// Page 2 options
{
{"BACKTAB", {"NOT LATCHED", "LATCHED"}, &myConfig.bLatched, 2},
{"GRAM SIZE", {"512B", "2K (TUTOR)"}, &myConfig.gramSize, 2},
{"CPU FUDGE", {"NONE", "LOW", "MEDIUM", "HIGH", "MAX"}, &myConfig.fudgeTiming, 5},
{"KEYBD CLICK", {"NO" , "YES"}, &myConfig.key_click, 2},
{"SKIP BLANKS", {"NO" , "YES"}, &myConfig.bSkipBlanks, 2},
Expand Down
5 changes: 4 additions & 1 deletion arm9/source/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ struct Config_t
UINT8 fudgeTiming;
UINT8 key_click;
UINT8 bSkipBlanks;
UINT8 spare5;
UINT8 gramSize;
UINT8 spare6;
UINT8 spare7;
UINT8 spare8;
Expand Down Expand Up @@ -116,6 +116,9 @@ struct AllConfig_t
#define DPAD_DIAGONALS 3
#define DPAD_STRICT_4WAY 4

#define GRAM_512B 0
#define GRAM_2K 1

extern struct Config_t myConfig;
extern struct GlobalConfig_t myGlobalConfig;
extern struct AllConfig_t allConfigs;
Expand Down
23 changes: 22 additions & 1 deletion arm9/source/emucore/GRAM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,20 @@

#include <nds.h>
#include "GRAM.h"

#include "../config.h"

UINT8 gram_image[GRAM_SIZE] __attribute__((section(".dtcm")));
UINT8 dirtyCards[GRAM_SIZE>>3] __attribute__((section(".dtcm")));
UINT8 dirtyRAM __attribute__((section(".dtcm")));

// ------------------------------------------------------------------------------------------------------
// These are not defines so that we can adjust based on whether the 2K GRAM (aka Tutorvision mode) is
// enabled. This is 1% slower emulation but provides for the ability to have an upgraded GRAM emulation.
// ------------------------------------------------------------------------------------------------------
UINT16 GRAM_MASK __attribute__((section(".dtcm"))) = 0x01FF; // Allows indexing the 512 or 2K bytes of GRAM
UINT16 GRAM_COL_STACK_MASK __attribute__((section(".dtcm"))) = 0x01F8; // Allows for indexing 64 / 256 tiles in Color Stack mode
UINT16 GRAM_CARD_MOB_MASK __attribute__((section(".dtcm"))) = 0x3F; // Allows for indexing 64 / 256 tiles for MOBs in Color Stack mode

GRAM::GRAM()
: RAM(GRAM_SIZE, GRAM_ADDRESS, GRAM_READ_MASK, GRAM_WRITE_MASK, 8)
{}
Expand All @@ -30,6 +38,19 @@ void GRAM::reset()

for (i = 0; i < (GRAM_SIZE>>3); i++)
dirtyCards[i] = TRUE;

if (myConfig.gramSize == GRAM_2K)
{
GRAM_MASK = 0x07FF;
GRAM_COL_STACK_MASK = 0x07F8;
GRAM_CARD_MOB_MASK = 0xFF;
}
else
{
GRAM_MASK = 0x01FF;
GRAM_COL_STACK_MASK = 0x01F8;
GRAM_CARD_MOB_MASK = 0x3F;
}
}

ITCM_CODE void GRAM::poke(UINT16 location, UINT16 value)
Expand Down
26 changes: 6 additions & 20 deletions arm9/source/emucore/GRAM.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,13 @@

#define GRAM_ADDRESS 0x3800 // GRAM base address (mirros handled with READ/WRITE masks below)

//#define GRAM_2K // Enable this line if you want to experiment with a 2K GRAM build
#define GRAM_SIZE 0x0800 // Max of 2K GRAM even though most of the time we will only use the normal 512 byte version
#define GRAM_READ_MASK 0xFFFF // To allow for a full 2K GRAM even though the actual GRAM MASK might restrict
#define GRAM_WRITE_MASK 0x3FFF // To allow for a full 2K GRAM even though the actual GRAM MASK might restrict

#ifdef GRAM_2K

#define GRAM_SIZE 0x0800 // 2K of GRAM is non-standard but possible!
#define GRAM_READ_MASK 0xFFFF // This is what produces the GRAM read aliases due to incomplete address decoding
#define GRAM_WRITE_MASK 0x3FFF // This is what produces the GRAM write aliases due to incomplete address decoding
#define GRAM_MASK 0x07FF // Allows indexing all 2K of GRAM
#define GRAM_COL_STACK_MASK 0x07F8 // Allows for indexing 256 tiles in Color Stack mode
#define GRAM_CARD_MOB_MASK 0xFF // Allows for indexing 256 tiles for MOBs in Color Stack mode

#else // Normal 512b GRAM

#define GRAM_SIZE 0x0200 // 512 bytes of GRAM
#define GRAM_READ_MASK 0xF9FF // This is what produces the GRAM read aliases due to incomplete address decoding
#define GRAM_WRITE_MASK 0x39FF // This is what produces the GRAM write aliases due to incomplete address decoding
#define GRAM_MASK 0x01FF // Allows indexing the 512 bytes of GRAM
#define GRAM_COL_STACK_MASK 0x01F8 // Allows for indexing 64 tiles in Color Stack mode
#define GRAM_CARD_MOB_MASK 0x3F // Allows for indexing 64 tiles for MOBs in Color Stack mode

#endif // GRAM_2K
extern UINT16 GRAM_MASK;
extern UINT16 GRAM_COL_STACK_MASK;
extern UINT16 GRAM_CARD_MOB_MASK;

extern UINT8 gram_image[GRAM_SIZE];
extern UINT8 dirtyCards[GRAM_SIZE>>3];
Expand Down
7 changes: 0 additions & 7 deletions arm9/source/nintv-ds.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@
#include "manual.h"
#include "bgBottom.h"
#include "bgTop.h"
#include "bgTop2K.h"
#include "bgMenu-Green.h"
#include "bgMenu-White.h"
#include "Emulator.h"
Expand Down Expand Up @@ -1270,15 +1269,9 @@ void dsShowScreenMain(bool bFull, bool bPlayJingle)
bg1b = bgInitSub(1, BgType_Text8bpp, BgSize_T_256x256, 30,0);
bgSetPriority(bg0b,1);bgSetPriority(bg1b,0);

#ifdef GRAM_2K
decompress(bgTop2KTiles, bgGetGfxPtr(bg0), LZ77Vram);
decompress(bgTop2KMap, (void*) bgGetMapPtr(bg0), LZ77Vram);
dmaCopy((void *) bgTop2KPal,(u16*) BG_PALETTE,256*2);
#else
decompress(bgTopTiles, bgGetGfxPtr(bg0), LZ77Vram);
decompress(bgTopMap, (void*) bgGetMapPtr(bg0), LZ77Vram);
dmaCopy((void *) bgTopPal,(u16*) BG_PALETTE,256*2);
#endif

if (bPlayJingle)
{
Expand Down
2 changes: 1 addition & 1 deletion arm9/source/savestate.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ extern Emulator *currentEmu;
extern Rip *currentRip;
extern UINT16 global_frames;

#define CURRENT_SAVE_FILE_VER 0x000B
#define CURRENT_SAVE_FILE_VER 0x000C

// ------------------------------------------------------
// We allow up to 3 saves per game. More than enough.
Expand Down

0 comments on commit f8d2c12

Please sign in to comment.