3.8b - Cleanup across the board. File headers updated for 2023 and all tabs removed/replaced with spaces for cleaner formatting. Minor memory re-org to be as efficient as possible with the resources available.

This commit is contained in:
wavemotion-dave 2022-12-28 07:14:54 -05:00
parent 30bb98806a
commit eb94c24469
97 changed files with 558 additions and 520 deletions

View File

@ -14,7 +14,7 @@ include $(DEVKITARM)/ds_rules
export TARGET := NINTV-DS
export TOPDIR := $(CURDIR)
export VERSION := 3.8a
export VERSION := 3.8b
ICON := -b $(CURDIR)/logo.bmp "NINTV-DS $(VERSION);wavemotion-dave;https://github.com/wavemotion-dave/NINTV-DS"

Binary file not shown.

View File

@ -25,8 +25,8 @@ Features :
* High Scores for up to 10 scores pre game with various sorting options.
* Cheat / Hack support using NINTV-DS.cht (see 'extras' folder and place in /data directory)
* Tons of button / controller mapping options. Dual-Controller support (run and shoot at the same time).
* JLP support for accelerated functions, extra RAM and flash memory. When loading a game, use the X button to load and force JLP support ON if not auto-detected.
* ECS support for ECS games including sound-enchanced games like Space Patrol (use ECS mini-Keyboard Overlay)
* JLP support for accelerated functions, extra RAM and flash memory. When loading a game, use the X button to load with options and force JLP support ON if not auto-detected.
* ECS support for ECS games including sound-enchanced games like Space Patrol. If not auto-detected, when loading a game use the X button to load with options.
Technical Specs :
----------
@ -46,16 +46,17 @@ Dual Action B uses the disc from Controller 1 and the Buttons/Keypad for Control
Missing / Known Issues :
-----------------------
ECS support is partial. No UART / Cassette. On the older DS-LITE/PHAT, a minimal ECS page-flipping scheme will let you play all the commercial ECS games including
ECS support is partial. No UART / Cassette.
The older DS-LITE/PHAT can only support a minimal ECS page-flipping scheme will let you play all the commercial ECS games including
World Series Baseball (without voice), MindStrike, Jetsons and Scooby Doo Maze Chase. On the DSi or above running with extra memory, a full page-flipping scheme
is employed and it should play anything you throw at it (and World Series will have voice). Each ECS game will allow you to use the Intellivision Keypad to enter
just enough keyboard information to start the game or you can pick the ECS mini-keyboard overlay. Larger page flipping/bankswitched homewbrew games will not run.
just enough keyboard information to start the game or you can pick the ECS mini-keyboard overlay.
Check for updates on my web site : https://github.com/wavemotion-dave/NINTV-DS
License :
-----------------------
Copyright (c) 2021-2022 Dave Bernazzani (wavemotion-dave)
Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
Copying and distribution of this emulator, its source code and associated
readme files, with or without modification, are permitted in any medium without

View File

@ -1,3 +1,14 @@
// =====================================================================================
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds/arm7/audio.h>
#include <nds/fifocommon.h>
#include <nds/fifomessages.h>

View File

@ -1,3 +1,14 @@
// =====================================================================================
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
/*---------------------------------------------------------------------------------
default ARM7 core

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021-2022 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#ifndef __CHEAT_H
#define __CHEAT_H

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
@ -338,8 +338,8 @@ void ApplyOptions(void)
// Check if the sound changed...
fifoSendValue32(FIFO_USER_01,(1<<16) | SOUND_KILL);
bStartSoundFifo=true;
// clears the emulator side of the audio mixer
audioMixer->resetProcessor();
// clears the emulator side of the audio mixer
audioMixer->resetProcessor();
// Set the screen scaling options for the game selected
REG_BG3PA = myConfig.stretch_x;

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#ifndef __CONFIG_H
#define __CONFIG_H

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include <stdio.h>
#include <fat.h>

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#ifndef __CONFIG_H
#define __CONFIG_H

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
@ -133,7 +133,7 @@ const char *dbg_opcode(UINT16 op)
case 0x0003:
return "DIS()";
case 0x0004:
return "JJEJD()";
return "JJEJD()";
case 0x0005:
return "TCI()";
case 0x0006:

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#ifndef __DEBUGGER_H
#define __DEBUGGER_H

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021-2022 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#ifndef __DS_TOOLS_H
#define __DS_TOOLS_H

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include "AY38900.h"
#include "ProcessorBus.h"

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
@ -51,22 +51,22 @@ class AY38900 : public Processor, public VideoProducer
friend class AY38900_Registers;
public:
AY38900(MemoryBus* mb, GROM* go, GRAM* ga);
AY38900(MemoryBus* mb, GROM* go, GRAM* ga);
/**
* Implemented from the Processor interface.
* Returns the clock speed of the AY-3-8900, currently hardcoded to the NTSC clock
* rate of 3.579545 Mhz.
*/
INT32 getClockSpeed() { return 3579545; }
INT32 getClockSpeed() { return 3579545; }
/**
* Implemented from the Processor interface.
*/
void resetProcessor();
void resetProcessor();
void getState(AY38900State *state);
void setState(AY38900State *state);
void getState(AY38900State *state);
void setState(AY38900State *state);
/**
* Implemented from the Processor interface.
@ -76,7 +76,7 @@ public:
/**
* Implemented from the VideoProducer interface.
*/
void setPixelBuffer(UINT8* pixelBuffer, UINT32 rowSize);
void setPixelBuffer(UINT8* pixelBuffer, UINT32 rowSize);
/**
* Implemented from the VideoProducer interface.
@ -88,23 +88,23 @@ public:
BackTabRAM backtab;
private:
void setGraphicsBusVisible(BOOL visible);
void renderFrame();
BOOL somethingChanged();
void markClean();
void renderBorders();
void renderMOBs();
void renderBackground();
void renderForegroundBackgroundMode();
void setGraphicsBusVisible(BOOL visible);
void renderFrame();
BOOL somethingChanged();
void markClean();
void renderBorders();
void renderMOBs();
void renderBackground();
void renderForegroundBackgroundMode();
void renderForegroundBackgroundModeLatched();
void renderColorStackMode();
void renderColorStackMode();
void renderColorStackModeLatched();
void copyBackgroundBufferToStagingArea();
void copyMOBsToStagingArea();
void renderLine(UINT8 nextByte, INT32 x, INT32 y);
void renderColoredSquares(INT32 x, INT32 y, UINT8 color0, UINT8 color1, UINT8 color2, UINT8 color3);
void determineMOBCollisions();
BOOL mobsCollide(INT32 mobNum0, INT32 mobNum1);
void copyBackgroundBufferToStagingArea();
void copyMOBsToStagingArea();
void renderLine(UINT8 nextByte, INT32 x, INT32 y);
void renderColoredSquares(INT32 x, INT32 y, UINT8 color0, UINT8 color1, UINT8 color2, UINT8 color3);
void determineMOBCollisions();
BOOL mobsCollide(INT32 mobNum0, INT32 mobNum1);
BOOL mobCollidesWithBorder(int mobNum);
BOOL mobCollidesWithForeground(int mobNum);

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include <string.h>
#include "AY38900.h"

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include "AY38914.h"
#include "AudioMixer.h"

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include <stdio.h>
#include <string.h>

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include "AudioOutputLine.h"
#include "AudioMixer.h"
@ -46,8 +47,8 @@ ITCM_CODE void playSample1(INT16 sample) // ECS PSG or Intellivoice SP0256
{
sampleBuffer[1] += currentSample[1] * commonClocksPerSample[1];
commonClockCounter[1] += commonClocksPerSample[1];
previousSample[1] = currentSample[1];
currentSample[1] = sample;
previousSample[1] = currentSample[1];
currentSample[1] = sample;
}
@ -55,8 +56,8 @@ ITCM_CODE void playSample2(INT16 sample) // ECS PSG or Intellivoice SP0256
{
sampleBuffer[2] += currentSample[2] * commonClocksPerSample[2];
commonClockCounter[2] += commonClocksPerSample[2];
previousSample[2] = currentSample[2];
currentSample[2] = sample;
previousSample[2] = currentSample[2];
currentSample[2] = sample;
}

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
@ -26,7 +26,7 @@ public:
AudioProducer() {}
virtual INT32 getClockSpeed() = 0;
virtual INT32 getClocksPerSample() = 0;
virtual INT32 getClocksPerSample() = 0;
};
#endif

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include "BackTabRAM.h"

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include <string.h>
#include "CP1610.h"
@ -172,7 +173,7 @@ UINT16 CP1610::EIS() {
I = TRUE;
D = FALSE;
D = FALSE;
return 4;
}
@ -182,7 +183,7 @@ UINT16 CP1610::DIS() {
I = FALSE;
D = FALSE;
D = FALSE;
return 4;
}
@ -192,7 +193,7 @@ UINT16 CP1610::TCI() {
//What should this really do?
D = FALSE;
D = FALSE;
return 4;
}
@ -202,7 +203,7 @@ UINT16 CP1610::CLRC() {
C = FALSE;
D = FALSE;
D = FALSE;
return 4;
}
@ -212,7 +213,7 @@ UINT16 CP1610::SETC() {
C = TRUE;
D = FALSE;
D = FALSE;
return 4;
}
@ -220,7 +221,7 @@ UINT16 CP1610::J(UINT16 target) {
r[7] = target;
interruptible = TRUE;
D = FALSE;
D = FALSE;
return 12;
}
@ -229,7 +230,7 @@ UINT16 CP1610::JSR(UINT16 registerNum, UINT16 target) {
r[7] = target;
interruptible = TRUE;
D = FALSE;
D = FALSE;
return 12;
}
@ -238,7 +239,7 @@ UINT16 CP1610::JE(UINT16 target) {
r[7] = target;
interruptible = TRUE;
D = FALSE;
D = FALSE;
return 12;
}
@ -248,7 +249,7 @@ UINT16 CP1610::JSRE(UINT16 registerNum, UINT16 target) {
r[7] = target;
interruptible = TRUE;
D = FALSE;
D = FALSE;
return 12;
}
@ -257,7 +258,7 @@ UINT16 CP1610::JD(UINT16 target) {
r[7] = target;
interruptible = TRUE;
D = FALSE;
D = FALSE;
return 12;
}
@ -267,7 +268,7 @@ UINT16 CP1610::JSRD(UINT16 registerNum, UINT16 target) {
r[7] = target;
interruptible = TRUE;
D = FALSE;
D = FALSE;
return 12;
}
@ -280,7 +281,7 @@ UINT16 CP1610::INCR(UINT16 registerNum) {
Z = !newValue;
r[registerNum] = newValue;
D = FALSE;
D = FALSE;
return 6;
}
@ -293,7 +294,7 @@ UINT16 CP1610::DECR(UINT16 registerNum) {
Z = !newValue;
r[registerNum] = newValue;
D = FALSE;
D = FALSE;
return 6;
}
@ -309,7 +310,7 @@ UINT16 CP1610::NEGR(UINT16 registerNum) {
Z = !(newValue & 0xFFFF);
r[registerNum] = (UINT16)newValue;
D = FALSE;
D = FALSE;
return 6;
}
@ -326,7 +327,7 @@ UINT16 CP1610::ADCR(UINT16 registerNum) {
Z = !(newValue & 0xFFFF);
r[registerNum] = (UINT16)newValue;
D = FALSE;
D = FALSE;
return 6;
}
@ -340,7 +341,7 @@ UINT16 CP1610::RSWD(UINT16 registerNum) {
O = !!(value & 0x0020);
C = !!(value & 0x0010);
D = FALSE;
D = FALSE;
return 6;
}
@ -353,7 +354,7 @@ UINT16 CP1610::GSWD(UINT16 registerNum) {
value |= (value << 8);
r[registerNum] = value;
D = FALSE;
D = FALSE;
return 6;
}
@ -361,7 +362,7 @@ UINT16 CP1610::NOP(UINT16) {
r[7]++;
interruptible = TRUE;
D = FALSE;
D = FALSE;
return 6;
}
@ -371,7 +372,7 @@ UINT16 CP1610::SIN(UINT16) {
//TODO: does SIN need to do anything?!
D = FALSE;
D = FALSE;
return 6;
}
@ -385,7 +386,7 @@ UINT16 CP1610::SWAP_1(UINT16 registerNum) {
Z = !value;
r[registerNum] = value;
D = FALSE;
D = FALSE;
return 6;
}
@ -399,7 +400,7 @@ UINT16 CP1610::SWAP_2(UINT16 registerNum) {
Z = !value;
r[registerNum] = value;
D = FALSE;
D = FALSE;
return 8;
}
@ -412,7 +413,7 @@ UINT16 CP1610::COMR(UINT16 registerNum) {
Z = !value;
r[registerNum] = value;
D = FALSE;
D = FALSE;
return 6;
}
@ -425,7 +426,7 @@ UINT16 CP1610::SLL_1(UINT16 registerNum) {
Z = !value;
r[registerNum] = value;
D = FALSE;
D = FALSE;
return 6;
}
@ -438,7 +439,7 @@ UINT16 CP1610::SLL_2(UINT16 registerNum) {
Z = !value;
r[registerNum] = value;
D = FALSE;
D = FALSE;
return 8;
}
@ -454,7 +455,7 @@ UINT16 CP1610::RLC_1(UINT16 registerNum) {
Z = !value;
r[registerNum] = value;
D = FALSE;
D = FALSE;
return 6;
}
@ -472,7 +473,7 @@ UINT16 CP1610::RLC_2(UINT16 registerNum) {
Z = !value;
r[registerNum] = value;
D = FALSE;
D = FALSE;
return 8;
}
@ -487,7 +488,7 @@ UINT16 CP1610::SLLC_1(UINT16 registerNum) {
Z = !value;
r[registerNum] = value;
D = FALSE;
D = FALSE;
return 6;
}
@ -503,7 +504,7 @@ UINT16 CP1610::SLLC_2(UINT16 registerNum) {
Z = !value;
r[registerNum] = value;
D = FALSE;
D = FALSE;
return 8;
}
@ -516,7 +517,7 @@ UINT16 CP1610::SLR_1(UINT16 registerNum) {
Z = !value;
r[registerNum] = value;
D = FALSE;
D = FALSE;
return 6;
}
@ -529,7 +530,7 @@ UINT16 CP1610::SLR_2(UINT16 registerNum) {
Z = !value;
r[registerNum] = value;
D = FALSE;
D = FALSE;
return 8;
}
@ -543,7 +544,7 @@ UINT16 CP1610::SAR_1(UINT16 registerNum) {
Z = !value;
r[registerNum] = value;
D = FALSE;
D = FALSE;
return 6;
}
@ -558,7 +559,7 @@ UINT16 CP1610::SAR_2(UINT16 registerNum) {
Z = !value;
r[registerNum] = value;
D = FALSE;
D = FALSE;
return 8;
}
@ -574,7 +575,7 @@ UINT16 CP1610::RRC_1(UINT16 registerNum) {
Z = !value;
r[registerNum] = value;
D = FALSE;
D = FALSE;
return 6;
}
@ -592,7 +593,7 @@ UINT16 CP1610::RRC_2(UINT16 registerNum) {
Z = !value;
r[registerNum] = value;
D = FALSE;
D = FALSE;
return 8;
}
@ -607,7 +608,7 @@ UINT16 CP1610::SARC_1(UINT16 registerNum) {
Z = !value;
r[registerNum] = value;
D = FALSE;
D = FALSE;
return 6;
}
@ -624,7 +625,7 @@ UINT16 CP1610::SARC_2(UINT16 registerNum) {
Z = !value;
r[registerNum] = value;
D = FALSE;
D = FALSE;
return 8;
}
@ -637,7 +638,7 @@ UINT16 CP1610::MOVR(UINT16 sourceReg, UINT16 destReg) {
Z = !value;
r[destReg] = value;
D = FALSE;
D = FALSE;
return (destReg >= 6 ? 7 : 6);
}
@ -654,7 +655,7 @@ UINT16 CP1610::ADDR(UINT16 sourceReg, UINT16 destReg) {
Z = !(newValue & 0xFFFF);
r[destReg] = (UINT16)newValue;
D = FALSE;
D = FALSE;
return 6;
}
@ -671,7 +672,7 @@ UINT16 CP1610::SUBR(UINT16 sourceReg, UINT16 destReg) {
Z = !(newValue & 0xFFFF);
r[destReg] = (UINT16)newValue;
D = FALSE;
D = FALSE;
return 6;
}
@ -687,7 +688,7 @@ UINT16 CP1610::CMPR(UINT16 sourceReg, UINT16 destReg) {
S = !!(newValue & 0x8000);
Z = !(newValue & 0xFFFF);
D = FALSE;
D = FALSE;
return 6;
}
@ -700,7 +701,7 @@ UINT16 CP1610::ANDR(UINT16 sourceReg, UINT16 destReg) {
Z = !newValue;
r[destReg] = newValue;
D = FALSE;
D = FALSE;
return 6;
}
@ -713,7 +714,7 @@ UINT16 CP1610::XORR(UINT16 sourceReg, UINT16 destReg) {
Z = !newValue;
r[destReg] = newValue;
D = FALSE;
D = FALSE;
return 6;
}
@ -723,11 +724,11 @@ UINT16 CP1610::BEXT(UINT16 condition, INT16 displacement) {
if (ext == condition) {
r[7] = (UINT16)(r[7] + displacement);
D = FALSE;
D = FALSE;
return 9;
}
D = FALSE;
D = FALSE;
return 7;
}
@ -737,7 +738,7 @@ UINT16 CP1610::B(INT16 displacement) {
r[7] = (UINT16)(r[7] + displacement);
D = FALSE;
D = FALSE;
return 9;
}
@ -745,7 +746,7 @@ UINT16 CP1610::NOPP(INT16) {
r[7] += 2;
interruptible = TRUE;
D = FALSE;
D = FALSE;
return 7;
}
@ -755,11 +756,11 @@ UINT16 CP1610::BC(INT16 displacement) {
if (C) {
r[7] = (UINT16)(r[7] + displacement);
D = FALSE;
D = FALSE;
return 9;
}
D = FALSE;
D = FALSE;
return 7;
}
@ -769,11 +770,11 @@ UINT16 CP1610::BNC(INT16 displacement) {
if (!C) {
r[7] = (UINT16)(r[7] + displacement);
D = FALSE;
D = FALSE;
return 9;
}
D = FALSE;
D = FALSE;
return 7;
}
@ -783,11 +784,11 @@ UINT16 CP1610::BOV(INT16 displacement) {
if (O) {
r[7] = (UINT16)(r[7] + displacement);
D = FALSE;
D = FALSE;
return 9;
}
D = FALSE;
D = FALSE;
return 7;
}
@ -797,11 +798,11 @@ UINT16 CP1610::BNOV(INT16 displacement) {
if (!O) {
r[7] = (UINT16)(r[7] + displacement);
D = FALSE;
D = FALSE;
return 9;
}
D = FALSE;
D = FALSE;
return 7;
}
@ -811,11 +812,11 @@ UINT16 CP1610::BPL(INT16 displacement) {
if (!S) {
r[7] = (UINT16)(r[7] + displacement);
D = FALSE;
D = FALSE;
return 9;
}
D = FALSE;
D = FALSE;
return 7;
}
@ -825,11 +826,11 @@ UINT16 CP1610::BMI(INT16 displacement) {
if (S) {
r[7] = (UINT16)(r[7] + displacement);
D = FALSE;
D = FALSE;
return 9;
}
D = FALSE;
D = FALSE;
return 7;
}
@ -839,11 +840,11 @@ UINT16 CP1610::BEQ(INT16 displacement) {
if (Z) {
r[7] = (UINT16)(r[7] + displacement);
D = FALSE;
D = FALSE;
return 9;
}
D = FALSE;
D = FALSE;
return 7;
}
@ -853,11 +854,11 @@ UINT16 CP1610::BNEQ(INT16 displacement) {
if (!Z) {
r[7] = (UINT16)(r[7] + displacement);
D = FALSE;
D = FALSE;
return 9;
}
D = FALSE;
D = FALSE;
return 7;
}
@ -867,11 +868,11 @@ UINT16 CP1610::BLT(INT16 displacement) {
if (S != O) {
r[7] = (UINT16)(r[7] + displacement);
D = FALSE;
D = FALSE;
return 9;
}
D = FALSE;
D = FALSE;
return 7;
}
@ -881,11 +882,11 @@ UINT16 CP1610::BGE(INT16 displacement) {
if (S == O) {
r[7] = (UINT16)(r[7] + displacement);
D = FALSE;
D = FALSE;
return 9;
}
D = FALSE;
D = FALSE;
return 7;
}
@ -895,11 +896,11 @@ UINT16 CP1610::BLE(INT16 displacement) {
if (Z || (S != O)) {
r[7] = (UINT16)(r[7] + displacement);
D = FALSE;
D = FALSE;
return 9;
}
D = FALSE;
D = FALSE;
return 7;
}
@ -909,11 +910,11 @@ UINT16 CP1610::BGT(INT16 displacement) {
if (!(Z || (S != O))) {
r[7] = (UINT16)(r[7] + displacement);
D = FALSE;
D = FALSE;
return 9;
}
D = FALSE;
D = FALSE;
return 7;
}
@ -923,11 +924,11 @@ UINT16 CP1610::BUSC(INT16 displacement) {
if (C != S) {
r[7] = (UINT16)(r[7] + displacement);
D = FALSE;
D = FALSE;
return 9;
}
D = FALSE;
D = FALSE;
return 7;
}
@ -937,11 +938,11 @@ UINT16 CP1610::BESC(INT16 displacement) {
if (C == S) {
r[7] = (UINT16)(r[7] + displacement);
D = FALSE;
D = FALSE;
return 9;
}
D = FALSE;
D = FALSE;
return 7;
}
@ -951,7 +952,7 @@ UINT16 CP1610::MVO(UINT16 registerNum, UINT16 address) {
memoryBus->poke(address, r[registerNum]);
D = FALSE;
D = FALSE;
return 11;
}
@ -965,7 +966,7 @@ UINT16 CP1610::MVO_ind(UINT16 registerWithAddress, UINT16 registerToMove) {
if (registerWithAddress & 0x04)
r[registerWithAddress]++;
D = FALSE;
D = FALSE;
return 9;
}
@ -975,7 +976,7 @@ UINT16 CP1610::MVI(UINT16 address, UINT16 registerNum) {
r[registerNum] = memoryBus->peek(address);
D = FALSE;
D = FALSE;
return 10;
}
@ -985,7 +986,7 @@ UINT16 CP1610::MVI_ind(UINT16 registerWithAddress, UINT16 registerToReceive) {
r[registerToReceive] = getIndirect(registerWithAddress);
D = FALSE;
D = FALSE;
return (D ? 10 : (registerWithAddress == 6 ? 11 : 8));
}
@ -1002,7 +1003,7 @@ UINT16 CP1610::ADD(UINT16 address, UINT16 registerNum) {
Z = !(newValue & 0xFFFF);
r[registerNum] = (UINT16)newValue;
D = FALSE;
D = FALSE;
return 10;
}
@ -1019,7 +1020,7 @@ UINT16 CP1610::ADD_ind(UINT16 registerWithAddress, UINT16 registerToReceive) {
Z = !(newValue & 0xFFFF);
r[registerToReceive] = (UINT16)newValue;
D = FALSE;
D = FALSE;
return (D ? 10 : (registerWithAddress == 6 ? 11 : 8));
}
@ -1036,7 +1037,7 @@ UINT16 CP1610::SUB(UINT16 address, UINT16 registerNum) {
Z = !(newValue & 0xFFFF);
r[registerNum] = (UINT16)newValue;
D = FALSE;
D = FALSE;
return 10;
}
@ -1053,7 +1054,7 @@ UINT16 CP1610::SUB_ind(UINT16 registerWithAddress, UINT16 registerToReceive) {
Z = !(newValue & 0xFFFF);
r[registerToReceive] = (UINT16)newValue;
D = FALSE;
D = FALSE;
return (D ? 10 : (registerWithAddress == 6 ? 11 : 8));
}
@ -1069,7 +1070,7 @@ UINT16 CP1610::CMP(UINT16 address, UINT16 registerNum) {
S = !!(newValue & 0x8000);
Z = !(newValue & 0xFFFF);
D = FALSE;
D = FALSE;
return 10;
}
@ -1085,7 +1086,7 @@ UINT16 CP1610::CMP_ind(UINT16 registerWithAddress, UINT16 registerToReceive) {
S = !!(newValue & 0x8000);
Z = !(newValue & 0xFFFF);
D = FALSE;
D = FALSE;
return (D ? 10 : (registerWithAddress == 6 ? 11 : 8));
}
@ -1098,7 +1099,7 @@ UINT16 CP1610::AND(UINT16 address, UINT16 registerNum) {
Z = !value;
r[registerNum] = value;
D = FALSE;
D = FALSE;
return 10;
}
@ -1111,7 +1112,7 @@ UINT16 CP1610::AND_ind(UINT16 registerWithAddress, UINT16 registerToReceive) {
Z = !value;
r[registerToReceive] = value;
D = FALSE;
D = FALSE;
return (D ? 10 : (registerWithAddress == 6 ? 11 : 8));
}
@ -1124,7 +1125,7 @@ UINT16 CP1610::XOR(UINT16 address, UINT16 registerNum) {
Z = !value;
r[registerNum] = value;
D = FALSE;
D = FALSE;
return 10;
}
@ -1137,7 +1138,7 @@ UINT16 CP1610::XOR_ind(UINT16 registerWithAddress, UINT16 registerToReceive) {
Z = !value;
r[registerToReceive] = value;
D = FALSE;
D = FALSE;
return (D ? 10 : (registerWithAddress == 6 ? 11 : 8));
}
@ -1153,7 +1154,7 @@ UINT16 CP1610::decode(void)
case 0x0003:
return DIS();
case 0x0004:
{
{
int read = PEEK_FAST((UINT16)(r[7] + 1));
int reg = ((read & 0x0300) >> 8);
int interrupt = (read & 0x0003);
@ -1180,7 +1181,7 @@ UINT16 CP1610::decode(void)
else
return HLT(); //invalid opcode
}
}
}
case 0x0005:
return TCI();
case 0x0006:

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,3 +1,14 @@
// =====================================================================================
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include "ECS.h"
extern UINT8 ecs_ram[];

View File

@ -1,3 +1,13 @@
// =====================================================================================
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#ifndef ECS_H
#define ECS_H

View File

@ -1,3 +1,13 @@
// =====================================================================================
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include "ECSKeyboard.h"
#include "HandController.h"

View File

@ -1,3 +1,14 @@
// =====================================================================================
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#ifndef ECSKEYBOARD_H
#define ECSKEYBOARD_H
@ -16,7 +27,7 @@ class ECSKeyboard : public AY38914_InputOutput, public InputConsumer
virtual ~ECSKeyboard();
const CHAR* getName() { return "ECS Keyboard"; }
void resetInputConsumer();
/**

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include "Emulator.h"
#include "Intellivision.h"

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
@ -38,8 +38,8 @@ class Emulator : public Peripheral
UINT8 GetPeripheralCount();
Peripheral* GetPeripheral(UINT8);
UINT16 GetVideoWidth();
UINT16 GetVideoHeight();
UINT16 GetVideoWidth();
UINT16 GetVideoHeight();
virtual BOOL SaveState(struct _stateStruct *saveState) = 0;
virtual BOOL LoadState(struct _stateStruct *saveState) = 0;
@ -48,17 +48,17 @@ class Emulator : public Peripheral
void SetRip(Rip* rip);
void InitVideo(VideoBus* video, UINT32 width, UINT32 height);
void ReleaseVideo();
void InitAudio(AudioMixer* audio, UINT32 sampleRate);
void ReleaseAudio();
void InitVideo(VideoBus* video, UINT32 width, UINT32 height);
void ReleaseVideo();
void InitAudio(AudioMixer* audio, UINT32 sampleRate);
void ReleaseAudio();
void LoadFastMemory();
void ApplyCheats();
void Reset();
void Run();
void FlushAudio();
void Render();
void Render();
static Emulator* GetEmulator(void);

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include "GRAM.h"

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include "HandController.h"
#include "Intellivision.h"

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
@ -25,7 +25,7 @@ class HandController : public AY38914_InputOutput, public InputConsumer
virtual ~HandController();
const CHAR* getName() { return name; }
void resetInputConsumer();
/**

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
@ -29,7 +29,7 @@ public:
INT32 getId() { return id; }
virtual const CHAR* getName() = 0;
virtual void resetInputConsumer() = 0;
/**

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include <stdio.h>
#include <time.h>
@ -104,12 +105,12 @@ BOOL Intellivision::SaveState(struct _stateStruct *saveState)
intellivoice.getState(&saveState->ivoiceState);
ecs.getState(&saveState->ecsState);
return didSave;
return didSave;
}
BOOL Intellivision::LoadState(struct _stateStruct *saveState)
{
BOOL didLoadState = TRUE;
BOOL didLoadState = TRUE;
cpu.setState(&saveState->cpuState);
stic.setState(&saveState->sticState);
@ -120,6 +121,6 @@ BOOL Intellivision::LoadState(struct _stateStruct *saveState)
intellivoice.setState(&saveState->ivoiceState);
ecs.getState(&saveState->ecsState);
return didLoadState;
return didLoadState;
}

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include "Intellivoice.h"
void Intellivoice::getState(IntellivoiceState *state)

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#ifndef INTELLIVOICE_H
#define INTELLIVOICE_H
@ -26,14 +27,14 @@ TYPEDEF_STRUCT_PACK( _IntellivoiceState
class Intellivoice : public Peripheral
{
public:
Intellivoice()
: Peripheral("Intellivoice", "Intellivoice")
{
AddProcessor(&sp0256);
Intellivoice()
: Peripheral("Intellivoice", "Intellivoice")
{
AddProcessor(&sp0256);
AddAudioProducer(&sp0256);
AddRAM(&sp0256.registers);
AddROM(&sp0256.ivoiceROM);
}
AddROM(&sp0256.ivoiceROM);
}
UINT32 getProcessorCount();
void getProcessor(INT32 i, Processor** p);
UINT32 getMemoryCount();

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include <stdio.h>
#include <fat.h>

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#ifndef JLP_H
#define JLP_H

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
@ -218,9 +218,9 @@ void MOB::setState(MOBState *state)
boundingRectangle.width = state->mob_rect_width;
boundingRectangle.height = state->mob_rect_height;
this->boundsChanged = TRUE;
this->shapeChanged = TRUE;
this->colorChanged = TRUE;
this->boundsChanged = TRUE;
this->shapeChanged = TRUE;
this->colorChanged = TRUE;
}

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
@ -19,7 +19,7 @@ class MOBRect
public:
inline BOOL intersects(MOBRect* r)
{
return !((r->x + r->width <= x) || (r->y + r->height <= y) || (r->x >= x + width) || (r->y >= y + height));
return !((r->x + r->width <= x) || (r->y + r->height <= y) || (r->x >= x + width) || (r->y >= y + height));
}
INT16 x;
INT16 y;

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include <stdio.h>
#include "MemoryBus.h"
@ -24,7 +25,7 @@ class UnusedMemory : public Memory
public:
UnusedMemory() {};
virtual ~UnusedMemory() {}
virtual void reset() {}
virtual void reset() {}
UINT8 getByteWidth() {return 2;}
UINT16 getReadSize() {return 2;}
UINT16 getReadAddress() {return 0;}
@ -41,13 +42,14 @@ public:
// -------------------------------------------------------------------------------
// This is a serious resource hog... it's multiple 16-bit 64k arrays take
// up a significant bit of our RAM... the max overlapped memories is what
// soaks up quite a bit of main RAM. We limit this to only 3 overlapping
// soaks up quite a bit of main RAM. We limit this for older DS hardware
// memories per address location which is sufficient provided we are only
// loading normal ROMs into a stock intellivision with, at most, an intellivoice
// or the JLP cart as the only peripherals... still, this is a strain on the
// older DS-LITE/PHAT. The original BLISS core allowed 16 overlapping memory
// regions (to handle page flipping) which barely fit into the DSi and wouldn't
// run on the DS-LITE/PHAT so we've stripped that way down to the bare essentials.
// regions (to handle page flipping) which does fit into the DSi but is too
// large for the original DS-LITE/PHAT so for older hardware, we strip down
// to the bare essentials.
// -------------------------------------------------------------------------------
UINT32 *overlappedMemoryPool = NULL;
@ -71,7 +73,11 @@ MemoryBus::MemoryBus()
memset(writeableMemoryCounts, 0, sizeof(UINT8) * size);
writeableMemorySpace = new Memory**[size];
// We do this rather than allocate peicemeal so we avoid malloc overhead and extra bytes padded (saves almost 500K on DS)
// ---------------------------------------------------------------------------------------------------------------------------
// We do this rather than allocate piecemeal so we avoid malloc overhead and extra bytes padded (saves almost 500K on DS)
// On the DS with 3 overlapped memories (enough for most games), this is still 1.5MB of memory (out of the 3.5MB available)
// On the DSi with a full 16 overlapped memories (enough for any game), this is a whopping 8MB (out of the 15.5MB available)
// ---------------------------------------------------------------------------------------------------------------------------
overlappedMemoryPool = new UINT32[size*MAX_OVERLAPPED_MEMORIES*2];
for (i = 0; i < size; i++)
@ -101,6 +107,8 @@ MemoryBus::MemoryBus()
MemoryBus::~MemoryBus()
{
delete[] writeableMemoryCounts;
delete[] writeableMemorySpace;
delete[] readableMemorySpace;
delete[] overlappedMemoryPool;
}

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
@ -33,7 +33,7 @@ class MemoryBus
void reset();
inline UINT16 peek(UINT16 location) {if (readableMemoryCounts[location] == 1) return readableMemorySpace[location][0]->peek(location); else return peek_slow(location);}
inline UINT16 peek(UINT16 location) {if (((UINT16 *) 0x06820000)[location] == 1) return readableMemorySpace[location][0]->peek(location); else return peek_slow(location);}
UINT16 peek_slow(UINT16 location);
// ------------------------------------------------------------------------------------------------

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
@ -106,7 +106,7 @@ class Peripheral
*
* @return the number of ROM units
*/
UINT16 GetROMCount();
UINT16 GetROMCount();
/**
* Gets a pointer to the ROM unit indicated by an index.
@ -114,7 +114,7 @@ class Peripheral
* @param index the index of the ROM unit to return
* @return a pointer to the ROM unit
*/
ROM* GetROM(UINT16 index);
ROM* GetROM(UINT16 index);
/**
* Adds a video producer to this peripheral.
@ -195,7 +195,7 @@ class Peripheral
audioProducerCount(0),
inputConsumerCount(0),
ramCount(0),
romCount(0)
romCount(0)
{
if (name) strcpy(peripheralName, name);
else strcpy(peripheralName, "");
@ -227,9 +227,9 @@ class Peripheral
UINT8 audioProducerCount;
InputConsumer* inputConsumers[MAX_COMPONENTS];
UINT8 inputConsumerCount;
RAM* rams[MAX_ROMS];
RAM* rams[MAX_ROMS];
UINT8 ramCount;
ROM* roms[MAX_ROMS];
ROM* roms[MAX_ROMS];
UINT8 romCount;
};

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
@ -55,8 +55,8 @@ class Processor
const char* name;
ProcessorBus* processorBus;
ScheduleQueue* scheduleQueue;
ProcessorBus* processorBus;
ScheduleQueue* scheduleQueue;
};
#endif

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include "ProcessorBus.h"
@ -28,7 +29,7 @@ ProcessorBus::~ProcessorBus()
void ProcessorBus::addProcessor(Processor* p)
{
processors[processorCount] = p;
processorCount++;
processorCount++;
p->processorBus = this;
p->scheduleQueue = new ScheduleQueue(p);
}
@ -64,7 +65,7 @@ void ProcessorBus::reset()
//reorder the processor queue so that it is in the natural (starting) order
for (UINT32 i = 0; i < processorCount; i++) {
Processor* p = processors[i];
Processor* p = processors[i];
totalClockSpeed = lcm(totalClockSpeed, ((UINT64)p->getClockSpeed()));
ScheduleQueue* nextQueue = p->scheduleQueue;
@ -84,8 +85,8 @@ void ProcessorBus::reset()
//pre-cache the multiplication factor required to convert each processor's clock speed to
//the common clock speed, and reset each processor
for (UINT32 i = 0; i < processorCount; i++) {
Processor* p = processors[i];
for (UINT32 i = 0; i < processorCount; i++) {
Processor* p = processors[i];
p->scheduleQueue->tickFactor = (totalClockSpeed / ((UINT64)p->getClockSpeed()));
p->resetProcessor();
}
@ -95,9 +96,9 @@ ITCM_CODE void ProcessorBus::run()
{
running = true;
while (running) {
if (startQueue->next == NULL) {
break;
}
if (startQueue->next == NULL) {
break;
}
//tick the processor that is at the head of the queue
int minTicks = (int)((startQueue->next->tick / startQueue->tickFactor) + 1);
startQueue->tick = ((UINT64)startQueue->processor->tick(minTicks)) * startQueue->tickFactor;

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
@ -28,38 +28,38 @@ public:
virtual ~ProcessorBus();
void addProcessor(Processor* p);
void removeProcessor(Processor* p);
void removeAll();
void removeAll();
void reset();
void run();
void stop();
void reset();
void run();
void stop();
void halt(Processor* p);
void halt(Processor* p);
void unhalt(Processor* p);
void pause(Processor* p, int ticks);
private:
void reschedule(ScheduleQueue*);
void reschedule(ScheduleQueue*);
UINT32 processorCount;
Processor* processors[MAX_PROCESSORS];
bool running;
ScheduleQueue* startQueue;
ScheduleQueue* endQueue;
bool running;
ScheduleQueue* startQueue;
ScheduleQueue* endQueue;
};
class ScheduleQueue
{
friend class ProcessorBus;
friend class ProcessorBus;
private:
ScheduleQueue(Processor* p)
: tickFactor(0),
tick(0),
previous(NULL),
next(NULL)
{
: tickFactor(0),
tick(0),
previous(NULL),
next(NULL)
{
this->processor = p;
}

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include "../ds_tools.h"
#include "Intellivision.h"
@ -38,34 +39,41 @@ RAM::RAM(UINT16 size, UINT16 location, UINT16 readAddressMask, UINT16 writeAddre
if ((location == JLP_RAM_ADDRESS) && (size == JLP_RAM_SIZE))
{
image = (UINT16*)jlp_ram; // Special 8K words of 16-bit RAM
memset(jlp_ram, 0x00, JLP_RAM_SIZE);
}
else if ((location == GRAM_ADDRESS) && (size == GRAM_SIZE))
{
image = (UINT16*)gram_image; // Special fixed fast 8-bit RAM
memset(gram_image, 0x00, GRAM_SIZE);
}
else if ((bitWidth == 8) && ((size == 0x400) || (size == ECS_RAM_SIZE)))
{
image = (UINT16*)ecs_ram8; // Use this for 8-bit RAM on the ECS, USFC Chess and Land Battle (or others if they have 1K or 2K of 8-bit RAM on board the cart)
memset(ecs_ram8, 0x00, ECS_RAM_SIZE);
}
else if ((location == RAM16BIT_LOCATION) && (size == RAM16BIT_SIZE))
{
image = (UINT16*)inty_16bit_ram; // Internal 16-bit Intellivision RAM
memset(inty_16bit_ram, 0x00, RAM16BIT_SIZE);
}
else if ((location == RAM8BIT_LOCATION) && (size == RAM8BIT_SIZE))
{
image = (UINT16*)inty_8bit_ram; // Internal 8-bit Intellivision RAM
memset(inty_8bit_ram, 0x00, RAM8BIT_SIZE);
}
else if (size >= 0x100) // And for any game needing 256 bytes/words or more of extra RAM we use the slow ram buffer
{
image = (UINT16*)&slow_ram16[slow_ram16_idx]; // Slow RAM for one-off carts that declare a lot of extra RAM (mostly demos)
slow_ram16_idx += size;
if (slow_ram16_idx > 0x4000) FatalError("OUT OF SLOW MEMORY");
else for (UINT16 i=0; i<size; i++) image[i] = 0;
}
else
{
image = &fast_ram16[fast_ram16_idx]; // Otherwise it's a small pool being requested... "allocate" it from the internal fast buffer... should never run out since this will just be internal Intellivision RAM
fast_ram16_idx += size;
if (fast_ram16_idx > sizeof(fast_ram16)) FatalError("OUT OF FAST MEMORY");
else for (UINT16 i=0; i<size; i++) image[i] = 0;
}
}

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <stdio.h>
#include <string.h>
#include "ROM.h"
@ -37,7 +38,7 @@ void ROM::Initialize(const CHAR* n, const CHAR* f, UINT32 o, UINT8 byteWidth, UI
filename = new CHAR[strlen(f)+1];
strcpy(filename, f);
fileoffset = o;
this->byteWidth = byteWidth;
this->byteWidth = byteWidth;
this->size = size;
this->location = location;
this->readAddressMask = readMask;
@ -61,20 +62,20 @@ BOOL ROM::load(const char* filename)
BOOL ROM::load(const char* filename, UINT32 offset)
{
FILE* f = fopen(filename, "rb");
FILE* f = fopen(filename, "rb");
if (!f)
return FALSE;
fseek(f, offset, SEEK_SET);
int byteCount = size*byteWidth;
int totalSize = 0;
while (totalSize < byteCount) {
int totalSize = 0;
while (totalSize < byteCount) {
for (UINT8 k = 0; k < byteWidth; k++)
((UINT8*)image)[totalSize+(byteWidth-k-1)] = (UINT8)fgetc(f);
totalSize += byteWidth;
}
fclose(f);
loaded = TRUE;
((UINT8*)image)[totalSize+(byteWidth-k-1)] = (UINT8)fgetc(f);
totalSize += byteWidth;
}
fclose(f);
loaded = TRUE;
return TRUE;
}
@ -83,14 +84,14 @@ BOOL ROM::load(void* buffer)
{
UINT8* byteImage = (UINT8*)buffer;
int byteCount = size*byteWidth;
int totalSize = 0;
while (totalSize < byteCount) {
int totalSize = 0;
while (totalSize < byteCount) {
for (UINT8 k = 0; k < byteWidth; k++)
((UINT8*)image)[totalSize+(byteWidth-k-1)] = byteImage[totalSize+k];
totalSize += byteWidth;
}
((UINT8*)image)[totalSize+(byteWidth-k-1)] = byteImage[totalSize+k];
totalSize += byteWidth;
}
loaded = TRUE;
loaded = TRUE;
return TRUE;
}

View File

@ -1,14 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#ifndef ROM_H
#define ROM_H
@ -29,7 +29,7 @@ public:
BOOL load(const CHAR* filename);
BOOL load(const CHAR* filename, UINT32 offset);
BOOL load(void* image);
BOOL isLoaded() { return loaded; }
BOOL isLoaded() { return loaded; }
BOOL isInternal() { return internal; }
//enabled attributes
@ -37,7 +37,7 @@ public:
BOOL IsEnabled() { return enabled; }
//functions to implement the Memory interface
virtual void reset() {}
virtual void reset() {}
UINT8 getByteWidth();
UINT16 getReadSize();

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include <stdio.h>

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
@ -80,9 +80,9 @@ private:
CHAR peripheralNames[MAX_PERIPHERALS][32];
PeripheralCompatibility peripheralUsages[MAX_PERIPHERALS];
UINT32 peripheralCount;
CHAR filename[MAX_PATH];
CHAR filename[MAX_PATH];
UINT32 mySize;
UINT32 crc;
UINT32 crc;
};
#endif

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include "SP0256.h"

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include "SP0256.h"
#include "SP0256_Registers.h"

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
@ -23,7 +23,7 @@ class SP0256_Registers : public RAM
friend class SP0256;
public:
void reset() {}
void reset() {}
void poke(UINT16 location, UINT16 value);
UINT16 peek(UINT16 location);

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include <stdio.h>
#include <string.h>
@ -44,7 +45,7 @@ void VideoBus::removeVideoProducer(VideoProducer* p)
{
for (UINT32 i = 0; i < videoProducerCount; i++) {
if (videoProducers[i] == p) {
videoProducers[i]->setPixelBuffer(NULL, 0);
videoProducers[i]->setPixelBuffer(NULL, 0);
for (UINT32 j = i; j < (videoProducerCount-1); j++)
videoProducers[j] = videoProducers[j+1];
@ -62,20 +63,20 @@ void VideoBus::removeAll()
void VideoBus::init(UINT32 width, UINT32 height)
{
VideoBus::release();
VideoBus::release();
pixelBufferWidth = width;
pixelBufferHeight = height;
pixelBufferRowSize = width * sizeof(UINT8);
pixelBufferSize = width * height * sizeof(UINT8);
pixelBuffer = new UINT8[width * height];
pixelBufferWidth = width;
pixelBufferHeight = height;
pixelBufferRowSize = width * sizeof(UINT8);
pixelBufferSize = width * height * sizeof(UINT8);
pixelBuffer = new UINT8[width * height];
if ( pixelBuffer ) {
memset(pixelBuffer, 0, pixelBufferSize);
}
if ( pixelBuffer ) {
memset(pixelBuffer, 0, pixelBufferSize);
}
for (UINT32 i = 0; i < videoProducerCount; i++)
videoProducers[i]->setPixelBuffer(pixelBuffer, pixelBufferRowSize);
for (UINT32 i = 0; i < videoProducerCount; i++)
videoProducers[i]->setPixelBuffer(pixelBuffer, pixelBufferRowSize);
}
ITCM_CODE void VideoBus::render()
@ -88,15 +89,15 @@ ITCM_CODE void VideoBus::render()
void VideoBus::release()
{
if (pixelBuffer) {
for (UINT32 i = 0; i < videoProducerCount; i++)
videoProducers[i]->setPixelBuffer(NULL, 0);
if (pixelBuffer) {
for (UINT32 i = 0; i < videoProducerCount; i++)
videoProducers[i]->setPixelBuffer(NULL, 0);
pixelBufferWidth = 0;
pixelBufferHeight = 0;
pixelBufferRowSize = 0;
pixelBufferSize = 0;
delete[] pixelBuffer;
pixelBuffer = NULL;
}
pixelBufferWidth = 0;
pixelBufferHeight = 0;
pixelBufferRowSize = 0;
pixelBufferSize = 0;
delete[] pixelBuffer;
pixelBuffer = NULL;
}
}

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
@ -32,16 +32,15 @@ class VideoBus
virtual void release();
protected:
UINT8* pixelBuffer;
UINT32 pixelBufferSize;
UINT32 pixelBufferRowSize;
UINT32 pixelBufferWidth;
UINT32 pixelBufferHeight;
UINT8* pixelBuffer;
UINT32 pixelBufferSize;
UINT32 pixelBufferRowSize;
UINT32 pixelBufferWidth;
UINT32 pixelBufferHeight;
private:
VideoProducer* videoProducers[MAX_VIDEO_PRODUCERS];
UINT32 videoProducerCount;
};
#endif

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
@ -29,9 +29,9 @@ class VideoProducer
* that it has entered vertical blank.
*/
virtual void setPixelBuffer(UINT8* pixelBuffer, UINT32 rowSize) = 0;
virtual void setPixelBuffer(UINT8* pixelBuffer, UINT32 rowSize) = 0;
virtual void render() = 0;
virtual void render() = 0;
};
#endif

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
@ -20,29 +20,21 @@ extern "C" {
#define unlikely(x) __builtin_expect(!!(x), 0)
//primitive types
typedef signed char INT8;
typedef unsigned char UINT8;
typedef signed short INT16;
typedef unsigned short UINT16;
typedef signed int INT32;
typedef unsigned int UINT32;
// There is no ANSI standard for 64 bit integers :(
#ifdef _MSC_VER
typedef __int64 INT64; // MS VC++
typedef unsigned __int64 UINT64; // MS VC++
#else
typedef signed long long int INT64; // C99 C++11
typedef unsigned long long int UINT64; // C99 C++11
#endif
typedef char CHAR;
typedef signed char INT8;
typedef unsigned char UINT8;
typedef signed short INT16;
typedef unsigned short UINT16;
typedef signed int INT32;
typedef unsigned int UINT32;
typedef signed long long int INT64; // C99 C++11
typedef unsigned long long int UINT64; // C99 C++11
typedef char CHAR;
#if !defined(BOOL)
#if defined(__MACH__)
typedef signed char BOOL;
typedef signed char BOOL;
#else
typedef int BOOL;
typedef int BOOL;
#endif
#endif
@ -50,11 +42,11 @@ typedef int BOOL;
extern INT32 debug[];
#if !defined(TRUE)
#define TRUE (1)
#define TRUE (1)
#endif
#if !defined(FALSE)
#define FALSE (0)
#define FALSE (0)
#endif
#if !defined(NULL)
@ -65,13 +57,8 @@ extern INT32 debug[];
#endif
#endif
#define SWAP32BIT(swap) ((((swap) << 24) & 0xFF000000) | \
(((swap) << 8) & 0x00FF0000) | \
(((swap) >> 8) & 0x0000FF00) | \
(((swap) >> 24) & 0x000000FF))
#if !defined(__LITTLE_ENDIAN__) && defined(_WIN32)
#define __LITTLE_ENDIAN__ (1)
#define __LITTLE_ENDIAN__ (1)
#endif
#if defined(__LITTLE_ENDIAN__)
@ -87,16 +74,16 @@ extern INT32 debug[];
#include <string.h>
typedef unsigned char UCHAR;
typedef unsigned short USHORT;
typedef unsigned char UCHAR;
typedef unsigned short USHORT;
#ifndef GUID
typedef struct
{
unsigned int data1;
unsigned short data2;
unsigned short data3;
unsigned char data4[8];
unsigned int data1;
unsigned short data2;
unsigned short data3;
unsigned char data4[8];
} GUID;
#endif
@ -112,73 +99,8 @@ typedef struct
#define MAX_PATH 256
#endif
// total hack for non-windows
#ifndef GUID_SysKeyboard
#define GUID_SysKeyboard (GUID){0}
#define DIK_NUMPAD7 ((INT32)0x81)
#define DIK_NUMPAD8 ((INT32)0x41)
#define DIK_NUMPAD9 ((INT32)0x21)
#define DIK_NUMPAD4 ((INT32)0x82)
#define DIK_NUMPAD5 ((INT32)0x42)
#define DIK_NUMPAD6 ((INT32)0x22)
#define DIK_NUMPAD1 ((INT32)0x84)
#define DIK_NUMPAD2 ((INT32)0x44)
#define DIK_NUMPAD3 ((INT32)0x24)
#define DIK_NUMPADPERIOD ((INT32)0x88)
#define DIK_NUMPAD0 ((INT32)0x48)
#define DIK_NUMPADENTER ((INT32)0x28)
#define DIK_SPACE ((INT32)0xA0)
#define DIK_LALT ((INT32)0x00)
#define DIK_LCONTROL ((INT32)0x60)
#define DIK_RCONTROL ((INT32)0xC0)
#define DIK_UP ((INT32)0x04)
#define DIK_W ((INT32)0x16)
#define DIK_RIGHT ((INT32)0x02)
#define DIK_S ((INT32)0x13)
#define DIK_DOWN ((INT32)0x01)
#define DIK_A ((INT32)0x19)
#define DIK_LEFT ((INT32)0x08)
#define DIK_Q ((INT32)0x1C)
#define DIK_COMMA ((INT32)0x0)
#define DIK_N ((INT32)0x0)
#define DIK_V ((INT32)0x0)
#define DIK_X ((INT32)0x0)
#define DIK_PERIOD ((INT32)0x0)
#define DIK_M ((INT32)0x0)
#define DIK_B ((INT32)0x0)
#define DIK_C ((INT32)0x0)
#define DIK_Z ((INT32)0x0)
#define DIK_SEMICOLON ((INT32)0x0)
#define DIK_K ((INT32)0x0)
#define DIK_H ((INT32)0x0)
#define DIK_F ((INT32)0x0)
#define DIK_P ((INT32)0x0)
#define DIK_I ((INT32)0x0)
#define DIK_Y ((INT32)0x0)
#define DIK_R ((INT32)0x0)
#define DIK_GRAVE ((INT32)0x0)
#define DIK_TAB ((INT32)0x0)
#define DIK_RETURN ((INT32)0x0)
#define DIK_O ((INT32)0x0)
#define DIK_U ((INT32)0x0)
#define DIK_T ((INT32)0x0)
#define DIK_E ((INT32)0x0)
#define DIK_L ((INT32)0x0)
#define DIK_J ((INT32)0x0)
#define DIK_G ((INT32)0x0)
#define DIK_D ((INT32)0x0)
#define DIK_LSHIFT ((INT32)0x0)
#define DIK_F2 ((INT32)0x0)
#define DI__WTFX ((INT32)0xFA)
#define DI__WTFY ((INT32)0xFB)
#endif
#ifdef __cplusplus
}
#endif
#endif //TYPES_H

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include <stdio.h>
#include <fat.h>

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#ifndef __HIGHSCORE_H
#define __HIGHSCORE_H

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#ifndef __DS_LOADGAME_H
#define __DS_LOADGAME_H

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include <fat.h>
#include <stdio.h>
@ -43,7 +44,7 @@ int main(int argc, char **argv)
if (!fatInitDefault())
{
iprintf("Unable to initialize libfat!\n");
return -1;
return -1;
}
srand(time(0));
@ -102,7 +103,7 @@ int main(int argc, char **argv)
// Main loop of emulation - no initial file
dsMainLoop(NULL);
}
// Free memory to be correct
dsFreeEmu();

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#ifndef __MANUAL_H
#define __MANUAL_H

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#ifndef __OVERLAY_H
#define __OVERLAY_H

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#include <nds.h>
#include <stdio.h>
#include <fat.h>
@ -79,18 +80,18 @@ BOOL do_save(const CHAR* filename, UINT8 slot)
if (slow_ram16_idx != 0) memcpy(slowRAMState[slot].image, slow_ram16, 0x4000*sizeof(UINT16));
// Write the entire save states as a single file... overwrite if it exists.
FILE* file = fopen(filename, "wb+");
FILE* file = fopen(filename, "wb+");
if (file != NULL)
if (file != NULL)
{
fwrite(&saveState, 1, sizeof(saveState), file);
if (currentRip->JLP16Bit) fwrite(&jlpState, 1, sizeof(jlpState), file); // A few gaems utilize the JLP RAM
if (slow_ram16_idx != 0) fwrite(slowRAMState, 1, sizeof(slowRAMState), file); // A tiny fraction of games need even MORE ram... we have a large "slow" buffer for those...
didSave = TRUE;
fclose(file);
}
}
return didSave;
return didSave;
}
// ----------------------------------------------------------------------------------
@ -98,14 +99,14 @@ BOOL do_save(const CHAR* filename, UINT8 slot)
// ----------------------------------------------------------------------------------
BOOL do_load(const CHAR* filename, UINT8 slot)
{
BOOL didLoadState = FALSE;
BOOL didLoadState = FALSE;
memset(&saveState, 0x00, sizeof(saveState));
FILE* file = fopen(filename, "rb");
FILE* file = fopen(filename, "rb");
if (file != NULL)
if (file != NULL)
{
int size = fread(&saveState, 1, sizeof(saveState), file);
int size = fread(&saveState, 1, sizeof(saveState), file);
if ((size != sizeof(saveState)) || (saveState.saveFileVersion != CURRENT_SAVE_FILE_VER))
{
@ -143,9 +144,9 @@ BOOL do_load(const CHAR* filename, UINT8 slot)
didLoadState = TRUE;
}
fclose(file);
}
}
return didLoadState;
return didLoadState;
}

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#ifndef __SAVESTATE_H
#define __SAVESTATE_H

View File

@ -1,7 +1,7 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.

View File

@ -1,13 +1,14 @@
// =====================================================================================
// Copyright (c) 2021 Dave Bernazzani (wavemotion-dave)
// Copyright (c) 2021-2023 Dave Bernazzani (wavemotion-dave)
//
// Copying and distribution of this emulator, it's source code and associated
// Copying and distribution of this emulator, its source code and associated
// readme files, with or without modification, are permitted in any medium without
// royalty provided the this copyright notice is used and wavemotion-dave (NINTV-DS)
// and Kyle Davis (BLISS) are thanked profusely.
//
// The NINTV-DS emulator is offered as-is, without any warranty.
// =====================================================================================
#ifndef __VIDEOAUD_H
#define __VIDEOAUD_H