minors modifications on cycle count, re-add correct svn:keywords and update correct source file headers
This commit is contained in:
parent
02a8b24523
commit
79ac4c42f1
@ -101,5 +101,5 @@
|
|||||||
- Premiere version public, ne sert que de démonstration.
|
- Premiere version public, ne sert que de démonstration.
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
$Id: Changements.txt 29 2007-04-03 14:34:02Z mtrapier $
|
$Id$
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -123,5 +123,5 @@
|
|||||||
- Premiere version public, ne sert que de dŽmonstration.
|
- Premiere version public, ne sert que de dŽmonstration.
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
$Id: Changes.txt 51 2007-05-22 16:33:04Z mtrapier $
|
$Id$
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -229,5 +229,5 @@ Vous pouvez aussi essayer de visiter un de mes sites :
|
|||||||
http://www.godzil.net
|
http://www.godzil.net
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
$Id: LisezMoi.txt 17 2007-03-27 09:25:23Z mtrapier $
|
$Id$
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-05-02 18:37:41 +0200 (mer, 02 mai 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/NESCarts.c $
|
* $HeadURL$
|
||||||
* $Revision: 50 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -2,13 +2,13 @@
|
|||||||
* Allegro Sound Driver for EMULib Sound system - The TI-NESulator Project
|
* Allegro Sound Driver for EMULib Sound system - The TI-NESulator Project
|
||||||
* SndAlleg.C
|
* SndAlleg.C
|
||||||
*
|
*
|
||||||
* Created by Manoël Trapier
|
* Created by Manoel Trapier
|
||||||
* Copyright 2003-2008 986 Corp. All rights reserved.
|
* Copyright 2003-2008 986 Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-03-28 15:50:50 +0200 (mer, 28 mar 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/types.h $
|
* $HeadURL$
|
||||||
* $Revision: 25 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include <Sound.h>
|
#include <Sound.h>
|
||||||
|
|||||||
@ -11,6 +11,13 @@
|
|||||||
/** commercially. Please, notify me, if you make any **/
|
/** commercially. Please, notify me, if you make any **/
|
||||||
/** changes to this file. **/
|
/** changes to this file. **/
|
||||||
/*************************************************************/
|
/*************************************************************/
|
||||||
|
/*
|
||||||
|
* $LastChangedDate$
|
||||||
|
* $Author$
|
||||||
|
* $HeadURL$
|
||||||
|
* $Revision$
|
||||||
|
*/
|
||||||
|
|
||||||
#include "Sound.h"
|
#include "Sound.h"
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|||||||
@ -12,10 +12,10 @@
|
|||||||
/** changes to this file. **/
|
/** changes to this file. **/
|
||||||
/*************************************************************/
|
/*************************************************************/
|
||||||
/*
|
/*
|
||||||
* $LastChangedDate: 2007-05-31 18:01:41 +0200 (jeu, 31 mai 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/Codes.h $
|
* $HeadURL$
|
||||||
* $Revision: 57 $
|
* $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
case 0x10:
|
case 0x10:
|
||||||
@ -91,7 +91,7 @@ break; /* BVS * REL */
|
|||||||
case 0x40:
|
case 0x40:
|
||||||
|
|
||||||
M_POP(R->P);
|
M_POP(R->P);
|
||||||
R->P |= R_FLAG;
|
//R->P |= R_FLAG;
|
||||||
M_POP(R->PC.B.l);
|
M_POP(R->PC.B.l);
|
||||||
M_POP(R->PC.B.h);
|
M_POP(R->PC.B.h);
|
||||||
|
|
||||||
@ -197,7 +197,7 @@ if ((R->IRequest != INT_NONE) && ((I ^ R->P) & ~I & I_FLAG))
|
|||||||
R->ICount = 1;
|
R->ICount = 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
R->P = I | R_FLAG | B_FLAG;
|
R->P = I /*| R_FLAG*/ | B_FLAG;
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|||||||
@ -13,10 +13,10 @@
|
|||||||
/** changes to this file. **/
|
/** changes to this file. **/
|
||||||
/*************************************************************/
|
/*************************************************************/
|
||||||
/*
|
/*
|
||||||
* $LastChangedDate: 2007-04-19 18:18:57 +0200 (jeu, 19 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/Debug.c $
|
* $HeadURL$
|
||||||
* $Revision: 43 $
|
* $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "M6502.h"
|
#include "M6502.h"
|
||||||
|
|||||||
@ -14,10 +14,10 @@
|
|||||||
/** changes to this file. **/
|
/** changes to this file. **/
|
||||||
/*************************************************************/
|
/*************************************************************/
|
||||||
/*
|
/*
|
||||||
* $LastChangedDate: 2007-04-16 01:55:35 +0200 (lun, 16 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: godzil $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/M6502.c $
|
* $HeadURL$
|
||||||
* $Revision: 39 $
|
* $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "M6502.h"
|
#include "M6502.h"
|
||||||
@ -201,7 +201,7 @@ INLINE byte Op6502(register word A) { return(Page[A>>13][A&0x1FFF]); }
|
|||||||
void Reset6502(M6502 *R)
|
void Reset6502(M6502 *R)
|
||||||
{
|
{
|
||||||
R->A=R->X=R->Y=0x00;
|
R->A=R->X=R->Y=0x00;
|
||||||
R->P=Z_FLAG|R_FLAG;
|
R->P=Z_FLAG;
|
||||||
R->S=0xFF;
|
R->S=0xFF;
|
||||||
R->PC.B.l=Rd6502(0xFFFC);
|
R->PC.B.l=Rd6502(0xFFFC);
|
||||||
R->PC.B.h=Rd6502(0xFFFD);
|
R->PC.B.h=Rd6502(0xFFFD);
|
||||||
@ -245,7 +245,7 @@ void Int6502(M6502 *R,byte Type)
|
|||||||
R->ICount-=7;
|
R->ICount-=7;
|
||||||
M_PUSH(R->PC.B.h);
|
M_PUSH(R->PC.B.h);
|
||||||
M_PUSH(R->PC.B.l);
|
M_PUSH(R->PC.B.l);
|
||||||
M_PUSH(R->P&~B_FLAG);
|
M_PUSH(R->P & ~(B_FLAG|R_FLAG));
|
||||||
R->P&=~D_FLAG;
|
R->P&=~D_FLAG;
|
||||||
if(R->IAutoReset&&(Type==R->IRequest)) R->IRequest=INT_NONE;
|
if(R->IAutoReset&&(Type==R->IRequest)) R->IRequest=INT_NONE;
|
||||||
if(Type==INT_NMI) J.W=0xFFFA; else { R->P|=I_FLAG;J.W=0xFFFE; }
|
if(Type==INT_NMI) J.W=0xFFFA; else { R->P|=I_FLAG;J.W=0xFFFE; }
|
||||||
@ -402,6 +402,9 @@ int DAsmCAP(char *S, word A)
|
|||||||
return (B - A);
|
return (B - A);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
extern unsigned short ScanLine;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** Run6502() ************************************************/
|
/** Run6502() ************************************************/
|
||||||
@ -413,7 +416,7 @@ word Run6502(M6502 *R)
|
|||||||
{
|
{
|
||||||
register pair J,K;
|
register pair J,K;
|
||||||
register byte I;
|
register byte I;
|
||||||
|
byte nb_of_cycle;
|
||||||
for(;;)
|
for(;;)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
@ -444,21 +447,16 @@ word Run6502(M6502 *R)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
I=Op6502(R->PC.W++);
|
I=Op6502(R->PC.W++);
|
||||||
R->ICount-=Cycles[I];
|
nb_of_cycle = Cycles[I];
|
||||||
|
|
||||||
//#ifdef DEBUG
|
//#ifdef DEBUG
|
||||||
// pushop(I);
|
// pushop(I);
|
||||||
//#endif
|
//#endif
|
||||||
|
|
||||||
icount++;
|
icount++;
|
||||||
|
|
||||||
switch(I)
|
switch(I)
|
||||||
{
|
{
|
||||||
#include "Codes.h"
|
#include "Codes.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TRACE_EXECUTION
|
#ifdef TRACE_EXECUTION
|
||||||
while(1)
|
while(1)
|
||||||
{
|
{
|
||||||
@ -478,15 +476,18 @@ word Run6502(M6502 *R)
|
|||||||
|
|
||||||
printf("%c", F & 0x80 ? FA[J] : '.');
|
printf("%c", F & 0x80 ? FA[J] : '.');
|
||||||
|
|
||||||
printf("], Stack[%02x, %02x, %02x]\n",
|
printf("], Stack[%02x, %02x, %02x], %03d, %03d\n",
|
||||||
Rd6502(0x0100 + (byte) (R->S + 1)),
|
Rd6502(0x0100 + (byte) (R->S + 1)),
|
||||||
Rd6502(0x0100 + (byte) (R->S + 2)),
|
Rd6502(0x0100 + (byte) (R->S + 2)),
|
||||||
Rd6502(0x0100 + (byte) (R->S + 3)));
|
Rd6502(0x0100 + (byte) (R->S + 3)),
|
||||||
|
R->ICount,
|
||||||
|
ScanLine
|
||||||
|
);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
R->ICount-= nb_of_cycle;
|
||||||
/* If cycle counter expired... */
|
/* If cycle counter expired... */
|
||||||
if(R->ICount<=0)
|
if(R->ICount<=0)
|
||||||
{
|
{
|
||||||
|
|||||||
@ -12,10 +12,10 @@
|
|||||||
/** changes to this file. **/
|
/** changes to this file. **/
|
||||||
/*************************************************************/
|
/*************************************************************/
|
||||||
/*
|
/*
|
||||||
* $LastChangedDate: 2007-04-23 18:55:35 +0200 (lun, 23 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/M6502.h $
|
* $HeadURL$
|
||||||
* $Revision: 45 $
|
* $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef M6502_H
|
#ifndef M6502_H
|
||||||
|
|||||||
@ -13,10 +13,10 @@
|
|||||||
/** changes to this file. **/
|
/** changes to this file. **/
|
||||||
/*************************************************************/
|
/*************************************************************/
|
||||||
/*
|
/*
|
||||||
* $LastChangedDate: 2007-05-24 15:07:13 +0200 (jeu, 24 mai 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/Tables.h $
|
* $HeadURL$
|
||||||
* $Revision: 52 $
|
* $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static byte Cycles[256] =
|
static byte Cycles[256] =
|
||||||
|
|||||||
@ -11,6 +11,12 @@
|
|||||||
/** commercially. Please, notify me, if you make any **/
|
/** commercially. Please, notify me, if you make any **/
|
||||||
/** changes to this file. **/
|
/** changes to this file. **/
|
||||||
/*************************************************************/
|
/*************************************************************/
|
||||||
|
/*
|
||||||
|
* $LastChangedDate$
|
||||||
|
* $Author$
|
||||||
|
* $HeadURL$
|
||||||
|
* $Revision$
|
||||||
|
*/
|
||||||
|
|
||||||
{ -36, 8063 },{ -12, 8063 },{ -3, 8298 },{ 3, 8358 },
|
{ -36, 8063 },{ -12, 8063 },{ -3, 8298 },{ 3, 8358 },
|
||||||
{ 8, 8201 },{ 12, 8063 },{ 15, 8054 },{ 17, 8238 },
|
{ 8, 8201 },{ 12, 8063 },{ 15, 8054 },{ 17, 8238 },
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-04-16 01:55:35 +0200 (lun, 16 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: godzil $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/NESCarts.h $
|
* $HeadURL$
|
||||||
* $Revision: 39 $
|
* $Revision$
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef NESCARTS_H
|
#ifndef NESCARTS_H
|
||||||
|
|||||||
@ -11,6 +11,12 @@
|
|||||||
/** commercially. Please, notify me, if you make any **/
|
/** commercially. Please, notify me, if you make any **/
|
||||||
/** changes to this file. **/
|
/** changes to this file. **/
|
||||||
/*************************************************************/
|
/*************************************************************/
|
||||||
|
/*
|
||||||
|
* $LastChangedDate$
|
||||||
|
* $Author$
|
||||||
|
* $HeadURL$
|
||||||
|
* $Revision$
|
||||||
|
*/
|
||||||
|
|
||||||
#ifndef SOUND_H
|
#ifndef SOUND_H
|
||||||
#define SOUND_H
|
#define SOUND_H
|
||||||
|
|||||||
@ -2,13 +2,13 @@
|
|||||||
* 6502 Memory manager - The TI-NESulator Project
|
* 6502 Memory manager - The TI-NESulator Project
|
||||||
* memory.h - Taken from the Quick6502 project
|
* memory.h - Taken from the Quick6502 project
|
||||||
*
|
*
|
||||||
* Created by Manoël Trapier on 18/09/06.
|
* Created by Manoel Trapier on 18/09/06.
|
||||||
* Copyright 2003-2008 986 Corp. All rights reserved.
|
* Copyright 2003-2008 986 Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-04-05 16:30:20 +0200 (jeu, 05 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/memory.h $
|
* $HeadURL$
|
||||||
* $Revision: 31 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#ifndef MEMORY_H
|
#ifndef MEMORY_H
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-04-16 01:55:35 +0200 (lun, 16 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: godzil $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/paddle.h $
|
* $HeadURL$
|
||||||
* $Revision: 39 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,10 @@
|
|||||||
/* Generated data file from file 'stdin' */
|
/* Generated data file from file 'stdin' */
|
||||||
|
/*
|
||||||
|
* $LastChangedDate$
|
||||||
|
* $Author$
|
||||||
|
* $HeadURL$
|
||||||
|
* $Revision$
|
||||||
|
*/
|
||||||
|
|
||||||
PALETTE basicPalette = {
|
PALETTE basicPalette = {
|
||||||
{ 0x1E, 0x1E, 0x1E, 0x07 },
|
{ 0x1E, 0x1E, 0x1E, 0x07 },
|
||||||
|
|||||||
@ -2,13 +2,13 @@
|
|||||||
* PPU debug utilities - The TI-NESulator Project
|
* PPU debug utilities - The TI-NESulator Project
|
||||||
* ppu.debug.h
|
* ppu.debug.h
|
||||||
*
|
*
|
||||||
* Created by Manoël Trapier on 12/04/07.
|
* Created by Manoel Trapier on 12/04/07.
|
||||||
* Copyright 2003-2008 986 Corp. All rights reserved.
|
* Copyright 2003-2008 986 Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-05-24 15:11:55 +0200 (jeu, 24 mai 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/ppu/ppu.debug.h $
|
* $HeadURL$
|
||||||
* $Revision: 53 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -7,10 +7,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-04-26 18:47:34 +0200 (jeu, 26 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/ppu.h $
|
* $HeadURL$
|
||||||
* $Revision: 46 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -2,13 +2,13 @@
|
|||||||
* PPU Memory manager - The TI-NESulator Project
|
* PPU Memory manager - The TI-NESulator Project
|
||||||
* ppu.memory.h - Inspired from the memory manager of the Quick6502 Project.
|
* ppu.memory.h - Inspired from the memory manager of the Quick6502 Project.
|
||||||
*
|
*
|
||||||
* Created by Manoël Trapier on 12/04/07.
|
* Created by Manoel Trapier on 12/04/07.
|
||||||
* Copyright 2003-2008 986 Corp. All rights reserved.
|
* Copyright 2003-2008 986 Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-05-24 15:11:55 +0200 (jeu, 24 mai 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/ppu/ppu.memory.h $
|
* $HeadURL$
|
||||||
* $Revision: 53 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -2,13 +2,13 @@
|
|||||||
* Base type definitions - The TI-NESulator Project
|
* Base type definitions - The TI-NESulator Project
|
||||||
* types.h - Taken from the Quick6502 project
|
* types.h - Taken from the Quick6502 project
|
||||||
*
|
*
|
||||||
* Created by Manoël Trapier on 18/09/06.
|
* Created by Manoel Trapier on 18/09/06.
|
||||||
* Copyright 2003-2008 986 Corp. All rights reserved.
|
* Copyright 2003-2008 986 Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-03-28 15:50:50 +0200 (mer, 28 mar 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/types.h $
|
* $HeadURL$
|
||||||
* $Revision: 25 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
762
src/main.c
762
src/main.c
@ -125,130 +125,130 @@ unsigned long ColorPalette[ 8 * 63 ];
|
|||||||
|
|
||||||
void CloseHook(void)
|
void CloseHook(void)
|
||||||
{
|
{
|
||||||
WantClosing = 1;
|
WantClosing = 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
void ips_fps_counter(void)
|
void ips_fps_counter(void)
|
||||||
{
|
{
|
||||||
FPS = frame;
|
FPS = frame;
|
||||||
IPS = icount;
|
IPS = icount;
|
||||||
frame = 0;
|
frame = 0;
|
||||||
icount = 0;
|
icount = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
END_OF_FUNCTION(ips_fps_counter);
|
END_OF_FUNCTION(ips_fps_counter);
|
||||||
|
|
||||||
void SaveSaveRam(char *name)
|
void SaveSaveRam(char *name)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int i;
|
int i;
|
||||||
char fname[512];
|
char fname[512];
|
||||||
//byte car;
|
//byte car;
|
||||||
strcpy(fname, name);
|
strcpy(fname, name);
|
||||||
strcat(fname, ".svt");
|
strcat(fname, ".svt");
|
||||||
if ((fp = fopen(fname, "wb")))
|
if ((fp = fopen(fname, "wb")))
|
||||||
{
|
{
|
||||||
printf("Saving savestate '%s'\n", fname);
|
printf("Saving savestate '%s'\n", fname);
|
||||||
for( i = 0x60; i < 0x80; i++)
|
for( i = 0x60; i < 0x80; i++)
|
||||||
{
|
{
|
||||||
fwrite(get_page_ptr(i), 1, 0x100, fp);
|
fwrite(get_page_ptr(i), 1, 0x100, fp);
|
||||||
}
|
}
|
||||||
|
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void LoadSaveRam(char *name)
|
void LoadSaveRam(char *name)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
int i;
|
int i;
|
||||||
char fname[512];
|
char fname[512];
|
||||||
|
|
||||||
strcpy(fname, name);
|
strcpy(fname, name);
|
||||||
strcat(fname, ".svt");
|
strcat(fname, ".svt");
|
||||||
if ((fp = fopen(fname, "rb")))
|
if ((fp = fopen(fname, "rb")))
|
||||||
{
|
{
|
||||||
printf("Loading savestate '%s'\n", fname);
|
printf("Loading savestate '%s'\n", fname);
|
||||||
for( i = 0x60; i < 0x80; i++)
|
for( i = 0x60; i < 0x80; i++)
|
||||||
{
|
{
|
||||||
fread(get_page_ptr(i), 1, 0x0100, fp);
|
fread(get_page_ptr(i), 1, 0x0100, fp);
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void LoadPalette(char *filename, PALETTE pal)
|
void LoadPalette(char *filename, PALETTE pal)
|
||||||
{
|
{
|
||||||
FILE *fp;
|
FILE *fp;
|
||||||
|
|
||||||
unsigned char r, v, b, i;
|
unsigned char r, v, b, i;
|
||||||
printf("%s: try to load pallette file '%s'", __func__, filename);
|
printf("%s: try to load pallette file '%s'", __func__, filename);
|
||||||
if ((fp = fopen(filename, "rb")) != NULL)
|
if ((fp = fopen(filename, "rb")) != NULL)
|
||||||
{
|
{
|
||||||
|
|
||||||
for (i = 0; i < 64; i++)
|
for (i = 0; i < 64; i++)
|
||||||
{
|
{
|
||||||
|
|
||||||
fread(&r, 1, 1, fp);
|
fread(&r, 1, 1, fp);
|
||||||
fread(&v, 1, 1, fp);
|
fread(&v, 1, 1, fp);
|
||||||
fread(&b, 1, 1, fp);
|
fread(&b, 1, 1, fp);
|
||||||
|
|
||||||
/* r = (r * 64) / 255;
|
/* r = (r * 64) / 255;
|
||||||
v = (v * 64) / 255;
|
v = (v * 64) / 255;
|
||||||
b = (b * 64) / 255;*/
|
b = (b * 64) / 255;*/
|
||||||
|
|
||||||
|
|
||||||
#ifdef USE_24BITS
|
#ifdef USE_24BITS
|
||||||
ColorPalette[i + (0 * 63)] = SET_RGB(r,v,b);
|
ColorPalette[i + (0 * 63)] = SET_RGB(r,v,b);
|
||||||
|
|
||||||
/* Red emphase */
|
/* Red emphase */
|
||||||
ColorPalette[i + (1 * 63)] = SET_RGB(r + 10, v - 05, b - 05);
|
ColorPalette[i + (1 * 63)] = SET_RGB(r + 10, v - 05, b - 05);
|
||||||
|
|
||||||
/* Green emphase */
|
/* Green emphase */
|
||||||
ColorPalette[i + (2 * 63)] = SET_RGB(r - 05, v + 10, b - 05);
|
ColorPalette[i + (2 * 63)] = SET_RGB(r - 05, v + 10, b - 05);
|
||||||
|
|
||||||
/* Red + green emphase */
|
/* Red + green emphase */
|
||||||
ColorPalette[i + (3 * 63)] = SET_RGB(r + 05, v + 05, b - 10);
|
ColorPalette[i + (3 * 63)] = SET_RGB(r + 05, v + 05, b - 10);
|
||||||
|
|
||||||
/* Blue emphase */
|
/* Blue emphase */
|
||||||
ColorPalette[i + (4 * 63)] = SET_RGB(r - 05, v - 05, b + 10);
|
ColorPalette[i + (4 * 63)] = SET_RGB(r - 05, v - 05, b + 10);
|
||||||
|
|
||||||
/* Red + blue emphase */
|
/* Red + blue emphase */
|
||||||
ColorPalette[i + (5 * 63)] = SET_RGB(r + 05, v - 10, b + 05);
|
ColorPalette[i + (5 * 63)] = SET_RGB(r + 05, v - 10, b + 05);
|
||||||
|
|
||||||
/* Blue + green emphase */
|
/* Blue + green emphase */
|
||||||
ColorPalette[i + (6 * 63)] = SET_RGB(r - 10, v + 05, b + 05);
|
ColorPalette[i + (6 * 63)] = SET_RGB(r - 10, v + 05, b + 05);
|
||||||
|
|
||||||
/* Red + Green + Blue emphase */
|
/* Red + Green + Blue emphase */
|
||||||
ColorPalette[i + (7 * 63)] = SET_RGB(r + 00, v + 00, b + 00);*/
|
ColorPalette[i + (7 * 63)] = SET_RGB(r + 00, v + 00, b + 00);*/
|
||||||
#else /* Else Use 8Bits */
|
#else /* Else Use 8Bits */
|
||||||
pal[i].r = r;
|
pal[i].r = r;
|
||||||
pal[i].g = v;
|
pal[i].g = v;
|
||||||
pal[i].b = b;
|
pal[i].b = b;
|
||||||
|
|
||||||
pal[i + 64].r = r;
|
pal[i + 64].r = r;
|
||||||
pal[i + 64].g = v;
|
pal[i + 64].g = v;
|
||||||
pal[i + 64].b = b;
|
pal[i + 64].b = b;
|
||||||
|
|
||||||
pal[i + 128].r = r;
|
pal[i + 128].r = r;
|
||||||
pal[i + 128].g = v;
|
pal[i + 128].g = v;
|
||||||
pal[i + 128].b = b;
|
pal[i + 128].b = b;
|
||||||
|
|
||||||
pal[i + 192].r = r;
|
pal[i + 192].r = r;
|
||||||
pal[i + 192].g = v;
|
pal[i + 192].g = v;
|
||||||
pal[i + 192].b = b;
|
pal[i + 192].b = b;
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
fclose(fp);
|
fclose(fp);
|
||||||
printf(" [ OK ]\n");
|
printf(" [ OK ]\n");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
printf("Error loading palette '%s'!\n", filename);
|
printf("Error loading palette '%s'!\n", filename);
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
int DAsm(char *S, word A);
|
int DAsm(char *S, word A);
|
||||||
@ -257,24 +257,24 @@ int oppos = 0;
|
|||||||
|
|
||||||
void pushop(word op)
|
void pushop(word op)
|
||||||
{
|
{
|
||||||
latestop[oppos] = op;
|
latestop[oppos] = op;
|
||||||
// printf("%d\n", oppos);
|
// printf("%d\n", oppos);
|
||||||
oppos = (oppos+1)%42;
|
oppos = (oppos+1)%42;
|
||||||
}
|
}
|
||||||
|
|
||||||
void showlastop(FILE *fp)
|
void showlastop(FILE *fp)
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
int i,j;
|
int i,j;
|
||||||
char S[256];
|
char S[256];
|
||||||
i = oppos;
|
i = oppos;
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
j=(DAsm(S,latestop[i])-1);
|
j=(DAsm(S,latestop[i])-1);
|
||||||
fprintf(fp, "0x%04X : %s\n", MainCPU.PC.W,S);
|
fprintf(fp, "0x%04X : %s\n", MainCPU.PC.W,S);
|
||||||
i = (i+1)%42;
|
i = (i+1)%42;
|
||||||
}
|
}
|
||||||
while(i != oppos);
|
while(i != oppos);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -282,365 +282,365 @@ NesCart *Cart;
|
|||||||
|
|
||||||
void *signalhandler(int sig)
|
void *signalhandler(int sig)
|
||||||
{
|
{
|
||||||
static int state=0;
|
static int state=0;
|
||||||
M6502 *R = &MainCPU;
|
M6502 *R = &MainCPU;
|
||||||
byte F;
|
byte F;
|
||||||
int J, I;
|
int J, I;
|
||||||
static char FA[8] = "NVRBDIZC";
|
static char FA[8] = "NVRBDIZC";
|
||||||
char S[128];
|
char S[128];
|
||||||
char name[512];
|
char name[512];
|
||||||
static FILE *fp = NULL;
|
static FILE *fp = NULL;
|
||||||
sprintf(name, "crashdump-%d.txt", (int)time(NULL));
|
sprintf(name, "crashdump-%d.txt", (int)time(NULL));
|
||||||
if (state != 0)
|
if (state != 0)
|
||||||
{
|
{
|
||||||
fprintf(stderr, "\n\n\nCrashed within signal!\nEmergency exit\n");
|
fprintf(stderr, "\n\n\nCrashed within signal!\nEmergency exit\n");
|
||||||
exit(42);
|
exit(42);
|
||||||
}
|
}
|
||||||
state = 1;
|
state = 1;
|
||||||
|
|
||||||
if (fp == NULL)
|
if (fp == NULL)
|
||||||
fp = fopen(name, "wt");
|
fp = fopen(name, "wt");
|
||||||
|
|
||||||
state = 2;
|
state = 2;
|
||||||
|
|
||||||
if (fp) fprintf(stderr,
|
if (fp) fprintf(stderr,
|
||||||
"\n\n\n\n\n"
|
"\n\n\n\n\n"
|
||||||
"#sick# TI-NESulator %d.%d #sick#\n"
|
"#sick# TI-NESulator %d.%d #sick#\n"
|
||||||
"see %s for more information",
|
"see %s for more information",
|
||||||
V_MAJOR,
|
V_MAJOR,
|
||||||
V_MINOR,
|
V_MINOR,
|
||||||
name);
|
name);
|
||||||
|
|
||||||
if (!fp) fp = stderr;
|
if (!fp) fp = stderr;
|
||||||
|
|
||||||
fprintf(fp,"\n\n\n\n\n"
|
fprintf(fp,"\n\n\n\n\n"
|
||||||
"#sick# TI-NESulator %d.%d #sick# signal: ",
|
"#sick# TI-NESulator %d.%d #sick# signal: ",
|
||||||
V_MAJOR,
|
V_MAJOR,
|
||||||
V_MINOR);
|
V_MINOR);
|
||||||
switch(sig)
|
switch(sig)
|
||||||
{
|
{
|
||||||
default:
|
default:
|
||||||
case SIGABRT: fprintf(fp,"Abnormal termination"); break;
|
case SIGABRT: fprintf(fp,"Abnormal termination"); break;
|
||||||
case SIGILL: fprintf(fp,"Illegal instruction"); break;
|
case SIGILL: fprintf(fp,"Illegal instruction"); break;
|
||||||
case SIGINT: fprintf(fp,"CTRL+C signal"); break;
|
case SIGINT: fprintf(fp,"CTRL+C signal"); break;
|
||||||
case SIGSEGV: fprintf(fp,"Segmentation fault"); break;
|
case SIGSEGV: fprintf(fp,"Segmentation fault"); break;
|
||||||
case SIGTERM: fprintf(fp,"Termination request"); break;
|
case SIGTERM: fprintf(fp,"Termination request"); break;
|
||||||
}
|
}
|
||||||
fprintf(fp,"\nAn error occured during the excution.\n Crash report information :\n");
|
fprintf(fp,"\nAn error occured during the excution.\n Crash report information :\n");
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
DAsm(S, R->PC.W);
|
DAsm(S, R->PC.W);
|
||||||
#endif
|
#endif
|
||||||
fprintf(fp, "CPU: A:%02X P:%02X X:%02X Y:%02X S:%04X PC:%04X Flags:[",
|
fprintf(fp, "CPU: A:%02X P:%02X X:%02X Y:%02X S:%04X PC:%04X Flags:[",
|
||||||
R->A, R->P, R->X, R->Y, R->S + 0x0100, R->PC.W);
|
R->A, R->P, R->X, R->Y, R->S + 0x0100, R->PC.W);
|
||||||
for (J = 0, F = R->P; J < 8; J++, F <<= 1)
|
for (J = 0, F = R->P; J < 8; J++, F <<= 1)
|
||||||
fprintf(fp, "%c", F & 0x80 ? FA[J] : '.');
|
fprintf(fp, "%c", F & 0x80 ? FA[J] : '.');
|
||||||
fprintf(fp, "]\nCPU: ");
|
fprintf(fp, "]\nCPU: ");
|
||||||
fprintf(fp, "AT PC: [%02X - %s] AT SP: [%02X %02X %02X]\nLast execution :\n",
|
fprintf(fp, "AT PC: [%02X - %s] AT SP: [%02X %02X %02X]\nLast execution :\n",
|
||||||
Rd6502(R->PC.W), S,
|
Rd6502(R->PC.W), S,
|
||||||
Rd6502(0x0100 + (byte) (R->S + 1)),
|
Rd6502(0x0100 + (byte) (R->S + 1)),
|
||||||
Rd6502(0x0100 + (byte) (R->S + 2)),
|
Rd6502(0x0100 + (byte) (R->S + 2)),
|
||||||
Rd6502(0x0100 + (byte) (R->S + 3)));
|
Rd6502(0x0100 + (byte) (R->S + 3)));
|
||||||
showlastop(fp);
|
showlastop(fp);
|
||||||
// fprintf(fp, "PPU: CR1: 0x%02X (NT:%d AI:%d SP:%d BP:%d SS:%d NMI:%d)\n",ppu.ControlRegister1.b, ppu.ControlRegister1.s.NameTblAddr, ppu.ControlRegister1.s.AddrIncrmt, ppu.ControlRegister1.s.SptPattern, ppu.ControlRegister1.s.BgPattern, ppu.ControlRegister1.s.SpriteSize, ppu.ControlRegister1.s.VBlank_NMI);
|
// fprintf(fp, "PPU: CR1: 0x%02X (NT:%d AI:%d SP:%d BP:%d SS:%d NMI:%d)\n",ppu.ControlRegister1.b, ppu.ControlRegister1.s.NameTblAddr, ppu.ControlRegister1.s.AddrIncrmt, ppu.ControlRegister1.s.SptPattern, ppu.ControlRegister1.s.BgPattern, ppu.ControlRegister1.s.SpriteSize, ppu.ControlRegister1.s.VBlank_NMI);
|
||||||
// fprintf(fp, "PPU: CR2: 0x%02X (FBC/CI:%d SV:%d BV:%d SC:%d BC:%d DT:%d)\n",ppu.ControlRegister2.b,ppu.ControlRegister2.s.Colour,ppu.ControlRegister2.s.SpriteVisibility,ppu.ControlRegister2.s.BgVisibility,ppu.ControlRegister2.s.SpriteClipping,ppu.ControlRegister2.s.BgClipping,ppu.ControlRegister2.s.DisplayType);
|
// fprintf(fp, "PPU: CR2: 0x%02X (FBC/CI:%d SV:%d BV:%d SC:%d BC:%d DT:%d)\n",ppu.ControlRegister2.b,ppu.ControlRegister2.s.Colour,ppu.ControlRegister2.s.SpriteVisibility,ppu.ControlRegister2.s.BgVisibility,ppu.ControlRegister2.s.SpriteClipping,ppu.ControlRegister2.s.BgClipping,ppu.ControlRegister2.s.DisplayType);
|
||||||
// fprintf(fp, "PPU: SR: 0x%02X (VB:%d S0:%d SSC:%d VWF:%d)\n", ppu.StatusRegister.b,ppu.StatusRegister.s.VBlankOccur,ppu.StatusRegister.s.Sprite0Occur,ppu.StatusRegister.s.SprtCount,ppu.StatusRegister.s.VRAMProtect);
|
// fprintf(fp, "PPU: SR: 0x%02X (VB:%d S0:%d SSC:%d VWF:%d)\n", ppu.StatusRegister.b,ppu.StatusRegister.s.VBlankOccur,ppu.StatusRegister.s.Sprite0Occur,ppu.StatusRegister.s.SprtCount,ppu.StatusRegister.s.VRAMProtect);
|
||||||
// fprintf(fp, "PPU: M:%d ST:%d VRAMPtr:0x%04X T:0x%04X\n",ppu.MirrorDir,ppu.ScreenType,ppu.VRAMAddrReg2.W,ppu.TmpVRamPtr);
|
// fprintf(fp, "PPU: M:%d ST:%d VRAMPtr:0x%04X T:0x%04X\n",ppu.MirrorDir,ppu.ScreenType,ppu.VRAMAddrReg2.W,ppu.TmpVRamPtr);
|
||||||
|
|
||||||
//MapperDump(fp);
|
//MapperDump(fp);
|
||||||
|
|
||||||
for(I = 0; I < 0xFFFF; I += 0x10)
|
for(I = 0; I < 0xFFFF; I += 0x10)
|
||||||
fprintf(fp, "%04X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X | %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n",
|
fprintf(fp, "%04X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X %02X | %c%c%c%c%c%c%c%c%c%c%c%c%c%c%c%c\n",
|
||||||
I,
|
I,
|
||||||
Rd6502(I+0x00), Rd6502(I+0x01), Rd6502(I+0x02), Rd6502(I+0x03),
|
Rd6502(I+0x00), Rd6502(I+0x01), Rd6502(I+0x02), Rd6502(I+0x03),
|
||||||
Rd6502(I+0x04), Rd6502(I+0x05), Rd6502(I+0x06), Rd6502(I+0x07),
|
Rd6502(I+0x04), Rd6502(I+0x05), Rd6502(I+0x06), Rd6502(I+0x07),
|
||||||
Rd6502(I+0x08), Rd6502(I+0x09), Rd6502(I+0x0A), Rd6502(I+0x0B),
|
Rd6502(I+0x08), Rd6502(I+0x09), Rd6502(I+0x0A), Rd6502(I+0x0B),
|
||||||
Rd6502(I+0x0C), Rd6502(I+0x0D), Rd6502(I+0x0E), Rd6502(I+0x0F),
|
Rd6502(I+0x0C), Rd6502(I+0x0D), Rd6502(I+0x0E), Rd6502(I+0x0F),
|
||||||
// --- //
|
// --- //
|
||||||
isprint(Rd6502(I+0x00))?Rd6502(I+0x00):'_',
|
isprint(Rd6502(I+0x00))?Rd6502(I+0x00):'_',
|
||||||
isprint(Rd6502(I+0x01))?Rd6502(I+0x01):'_',
|
isprint(Rd6502(I+0x01))?Rd6502(I+0x01):'_',
|
||||||
isprint(Rd6502(I+0x02))?Rd6502(I+0x02):'_',
|
isprint(Rd6502(I+0x02))?Rd6502(I+0x02):'_',
|
||||||
isprint(Rd6502(I+0x03))?Rd6502(I+0x03):'_',
|
isprint(Rd6502(I+0x03))?Rd6502(I+0x03):'_',
|
||||||
isprint(Rd6502(I+0x04))?Rd6502(I+0x04):'_',
|
isprint(Rd6502(I+0x04))?Rd6502(I+0x04):'_',
|
||||||
isprint(Rd6502(I+0x05))?Rd6502(I+0x05):'_',
|
isprint(Rd6502(I+0x05))?Rd6502(I+0x05):'_',
|
||||||
isprint(Rd6502(I+0x06))?Rd6502(I+0x06):'_',
|
isprint(Rd6502(I+0x06))?Rd6502(I+0x06):'_',
|
||||||
isprint(Rd6502(I+0x07))?Rd6502(I+0x07):'_',
|
isprint(Rd6502(I+0x07))?Rd6502(I+0x07):'_',
|
||||||
isprint(Rd6502(I+0x08))?Rd6502(I+0x08):'_',
|
isprint(Rd6502(I+0x08))?Rd6502(I+0x08):'_',
|
||||||
isprint(Rd6502(I+0x09))?Rd6502(I+0x09):'_',
|
isprint(Rd6502(I+0x09))?Rd6502(I+0x09):'_',
|
||||||
isprint(Rd6502(I+0x0A))?Rd6502(I+0x0A):'_',
|
isprint(Rd6502(I+0x0A))?Rd6502(I+0x0A):'_',
|
||||||
isprint(Rd6502(I+0x0B))?Rd6502(I+0x0B):'_',
|
isprint(Rd6502(I+0x0B))?Rd6502(I+0x0B):'_',
|
||||||
isprint(Rd6502(I+0x0C))?Rd6502(I+0x0C):'_',
|
isprint(Rd6502(I+0x0C))?Rd6502(I+0x0C):'_',
|
||||||
isprint(Rd6502(I+0x0D))?Rd6502(I+0x0D):'_',
|
isprint(Rd6502(I+0x0D))?Rd6502(I+0x0D):'_',
|
||||||
isprint(Rd6502(I+0x0E))?Rd6502(I+0x0E):'_',
|
isprint(Rd6502(I+0x0E))?Rd6502(I+0x0E):'_',
|
||||||
isprint(Rd6502(I+0x0F))?Rd6502(I+0x0F):'_');
|
isprint(Rd6502(I+0x0F))?Rd6502(I+0x0F):'_');
|
||||||
|
|
||||||
DumpMemoryState(fp);
|
DumpMemoryState(fp);
|
||||||
|
|
||||||
fprintf(stderr, "\nPlease join this informations when submiting crash report\n");
|
fprintf(stderr, "\nPlease join this informations when submiting crash report\n");
|
||||||
if (fp != stderr) fclose(fp);
|
if (fp != stderr) fclose(fp);
|
||||||
//getchar();
|
//getchar();
|
||||||
exit(-42);
|
exit(-42);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte Page40[256];
|
byte Page40[256];
|
||||||
|
|
||||||
void WrHook4000Multiplexer(byte addr, byte value)
|
void WrHook4000Multiplexer(byte addr, byte value)
|
||||||
{
|
{
|
||||||
static byte SQ1V = 0;
|
static byte SQ1V = 0;
|
||||||
static byte SQ2V = 0;
|
static byte SQ2V = 0;
|
||||||
static byte NOIV = 0;
|
static byte NOIV = 0;
|
||||||
|
|
||||||
static unsigned short SQ1P = 0;
|
static unsigned short SQ1P = 0;
|
||||||
static unsigned short SQ2P = 0;
|
static unsigned short SQ2P = 0;
|
||||||
static unsigned short TRIP = 0;
|
static unsigned short TRIP = 0;
|
||||||
static unsigned short NOIP = 0;
|
static unsigned short NOIP = 0;
|
||||||
|
|
||||||
static byte Sq1_reg0 = 0;
|
static byte Sq1_reg0 = 0;
|
||||||
static byte Sq1_reg1 = 0;
|
static byte Sq1_reg1 = 0;
|
||||||
static byte Sq1_reg2 = 0;
|
static byte Sq1_reg2 = 0;
|
||||||
static byte Sq1_reg3 = 0;
|
static byte Sq1_reg3 = 0;
|
||||||
|
|
||||||
static byte Sq2_reg0 = 0;
|
static byte Sq2_reg0 = 0;
|
||||||
static byte Sq2_reg1 = 0;
|
static byte Sq2_reg1 = 0;
|
||||||
static byte Sq2_reg2 = 0;
|
static byte Sq2_reg2 = 0;
|
||||||
static byte Sq2_reg3 = 0;
|
static byte Sq2_reg3 = 0;
|
||||||
|
|
||||||
double SQ = 0.0;
|
double SQ = 0.0;
|
||||||
|
|
||||||
switch(addr)
|
switch(addr)
|
||||||
{
|
{
|
||||||
#ifdef USE_SOUND
|
#ifdef USE_SOUND
|
||||||
case 0x00: /* DDLE NNNN */
|
case 0x00: /* DDLE NNNN */
|
||||||
Sq1_reg0 = value;
|
Sq1_reg0 = value;
|
||||||
if (Sq1_reg0 & 0x10)
|
if (Sq1_reg0 & 0x10)
|
||||||
{
|
{
|
||||||
SQ1V = 0x0F/*(0x04+(value&0x0F))& 0x0F*/;
|
SQ1V = 0x0F/*(0x04+(value&0x0F))& 0x0F*/;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SQ1V = value&0x0F;
|
SQ1V = value&0x0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 0x01: /* EPPP NSSS */
|
case 0x01: /* EPPP NSSS */
|
||||||
Sq1_reg1 = value;
|
Sq1_reg1 = value;
|
||||||
break;
|
break;
|
||||||
case 0x02:
|
case 0x02:
|
||||||
/*printf("Sq1 reg0: 0x%02X - duty:0x%X loop:0x%X env:0x%X vol:0x%X\n",
|
/*printf("Sq1 reg0: 0x%02X - duty:0x%X loop:0x%X env:0x%X vol:0x%X\n",
|
||||||
Sq1_reg0,
|
Sq1_reg0,
|
||||||
(Sq1_reg0&0xC0)>>6,
|
(Sq1_reg0&0xC0)>>6,
|
||||||
(Sq1_reg0&0x20)>>5,
|
(Sq1_reg0&0x20)>>5,
|
||||||
(Sq1_reg0&0x10)>>4,
|
(Sq1_reg0&0x10)>>4,
|
||||||
Sq1_reg0&0x0F);
|
Sq1_reg0&0x0F);
|
||||||
printf("Sq1 reg1: 0x%02X - sweep:0x%X period:0x%X neg:0x%X shift:0x%X\n",
|
printf("Sq1 reg1: 0x%02X - sweep:0x%X period:0x%X neg:0x%X shift:0x%X\n",
|
||||||
Sq1_reg1,
|
Sq1_reg1,
|
||||||
(Sq1_reg1&0x80)>>8,
|
(Sq1_reg1&0x80)>>8,
|
||||||
(Sq1_reg1&0x70)>>4,
|
(Sq1_reg1&0x70)>>4,
|
||||||
(Sq1_reg1&0x08)>>3,
|
(Sq1_reg1&0x08)>>3,
|
||||||
Sq1_reg1&0x07);
|
Sq1_reg1&0x07);
|
||||||
printf("Sq1 reg2: 0x%02X\n", value);
|
printf("Sq1 reg2: 0x%02X\n", value);
|
||||||
printf("Sq1 reg3: 0x%02X\n", Sq1_reg3);*/
|
printf("Sq1 reg3: 0x%02X\n", Sq1_reg3);*/
|
||||||
SQ1P = value | ((Sq1_reg3&0x7) << 8);
|
SQ1P = value | ((Sq1_reg3&0x7) << 8);
|
||||||
SQ = APU_BASEFREQ * 1000 * 1000 / (SQ1P+1 /*+
|
SQ = APU_BASEFREQ * 1000 * 1000 / (SQ1P+1 /*+
|
||||||
(Sq1_reg1&0x80)?0:( (Sq1_reg1&0x08)?(SQ1P>>(Sq1_reg1&0x07)):(SQ1P<<(Sq1_reg1&0x07)) )*/);
|
(Sq1_reg1&0x80)?0:( (Sq1_reg1&0x08)?(SQ1P>>(Sq1_reg1&0x07)):(SQ1P<<(Sq1_reg1&0x07)) )*/);
|
||||||
SetSound(0,SND_MELODIC);
|
SetSound(0,SND_MELODIC);
|
||||||
|
|
||||||
//printf("SQ1V = %d - SQ = %f - SQ1P = %d\n", SQ1V, SQ, SQ1P);
|
//printf("SQ1V = %d - SQ = %f - SQ1P = %d\n", SQ1V, SQ, SQ1P);
|
||||||
|
|
||||||
#ifdef SOUND_LOG
|
#ifdef SOUND_LOG
|
||||||
{ FILE *fp = fopen("sound.log", "at"); fprintf(fp, "%d %d %d\n", 0, SQ1P, SQ1V); fclose(fp); }
|
{ FILE *fp = fopen("sound.log", "at"); fprintf(fp, "%d %d %d\n", 0, SQ1P, SQ1V); fclose(fp); }
|
||||||
#endif
|
#endif
|
||||||
Sound(0, (int) SQ/22, (0xFF/0x0F) * SQ1V);
|
Sound(0, (int) SQ/22, (0xFF/0x0F) * SQ1V);
|
||||||
|
|
||||||
// printf("40%02X: 0x%02X (SQ1P:%d SQ:%f (%d))\n", addr, value, SQ1P, SQ, (int) SQ);
|
// printf("40%02X: 0x%02X (SQ1P:%d SQ:%f (%d))\n", addr, value, SQ1P, SQ, (int) SQ);
|
||||||
Sq1_reg2 = value;
|
Sq1_reg2 = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x03:
|
case 0x03:
|
||||||
Sq1_reg3 = value;
|
Sq1_reg3 = value;
|
||||||
SQ1P = Sq1_reg2 | ((value&0x7) << 8);
|
SQ1P = Sq1_reg2 | ((value&0x7) << 8);
|
||||||
SQ = APU_BASEFREQ * 1000 * 1000 / (SQ1P+1 /*+
|
SQ = APU_BASEFREQ * 1000 * 1000 / (SQ1P+1 /*+
|
||||||
(Sq1_reg1&0x80)?0:( (Sq1_reg1&0x08)?(SQ1P>>(Sq1_reg1&0x07)):(SQ1P<<(Sq1_reg1&0x07)) )*/);
|
(Sq1_reg1&0x80)?0:( (Sq1_reg1&0x08)?(SQ1P>>(Sq1_reg1&0x07)):(SQ1P<<(Sq1_reg1&0x07)) )*/);
|
||||||
#ifdef SOUND_LOG
|
#ifdef SOUND_LOG
|
||||||
{ FILE *fp = fopen("sound.log", "at"); fprintf(fp, "%d %d %d\n", 0, SQ1P, SQ1V); fclose(fp); }
|
{ FILE *fp = fopen("sound.log", "at"); fprintf(fp, "%d %d %d\n", 0, SQ1P, SQ1V); fclose(fp); }
|
||||||
#endif
|
#endif
|
||||||
Sound(0, (int) SQ/22, (0xFF/0x0F) * SQ1V);
|
Sound(0, (int) SQ/22, (0xFF/0x0F) * SQ1V);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
case 0x04:
|
case 0x04:
|
||||||
Sq2_reg0 = value;
|
Sq2_reg0 = value;
|
||||||
if (Sq2_reg0 & 0x10)
|
if (Sq2_reg0 & 0x10)
|
||||||
{
|
{
|
||||||
SQ2V = 0x0F;
|
SQ2V = 0x0F;
|
||||||
//SQ2V = (0x04+(value&0x0F))& 0x0F;
|
//SQ2V = (0x04+(value&0x0F))& 0x0F;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
SQ2V = value&0x0F;
|
SQ2V = value&0x0F;
|
||||||
}
|
}
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 0x05:
|
case 0x05:
|
||||||
Sq2_reg1 = value;
|
Sq2_reg1 = value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x06:
|
case 0x06:
|
||||||
Sq2_reg2 = value;
|
Sq2_reg2 = value;
|
||||||
|
|
||||||
SQ2P = Sq2_reg2 | ((Sq2_reg3&0x7) << 8);
|
SQ2P = Sq2_reg2 | ((Sq2_reg3&0x7) << 8);
|
||||||
|
|
||||||
SQ = APU_BASEFREQ * 1000 * 1000 / (SQ2P+1 /*+
|
SQ = APU_BASEFREQ * 1000 * 1000 / (SQ2P+1 /*+
|
||||||
(Sq2_reg1&0x80)?0:( (Sq2_reg1&0x08)?(SQ2P>>(Sq2_reg1&0x07)):(SQ2P<<(Sq2_reg1&0x07)) )*/);
|
(Sq2_reg1&0x80)?0:( (Sq2_reg1&0x08)?(SQ2P>>(Sq2_reg1&0x07)):(SQ2P<<(Sq2_reg1&0x07)) )*/);
|
||||||
|
|
||||||
/* printf("Sq2 reg0: 0x%02X - duty:0x%X loop:0x%X env:0x%X vol:0x%X\n",
|
/* printf("Sq2 reg0: 0x%02X - duty:0x%X loop:0x%X env:0x%X vol:0x%X\n",
|
||||||
Sq2_reg0,
|
Sq2_reg0,
|
||||||
(Sq2_reg0&0xC0)>>6,
|
(Sq2_reg0&0xC0)>>6,
|
||||||
(Sq2_reg0&0x20)>>5,
|
(Sq2_reg0&0x20)>>5,
|
||||||
(Sq2_reg0&0x10)>>4,
|
(Sq2_reg0&0x10)>>4,
|
||||||
Sq2_reg0&0x0F);
|
Sq2_reg0&0x0F);
|
||||||
printf("Sq2 reg1: 0x%02X - sweep:0x%X period:0x%X neg:0x%X shift:0x%X\n",
|
printf("Sq2 reg1: 0x%02X - sweep:0x%X period:0x%X neg:0x%X shift:0x%X\n",
|
||||||
Sq2_reg1,
|
Sq2_reg1,
|
||||||
(Sq2_reg1&0x80)>>8,
|
(Sq2_reg1&0x80)>>8,
|
||||||
(Sq2_reg1&0x70)>>4,
|
(Sq2_reg1&0x70)>>4,
|
||||||
(Sq2_reg1&0x08)>>3,
|
(Sq2_reg1&0x08)>>3,
|
||||||
Sq2_reg1&0x07);
|
Sq2_reg1&0x07);
|
||||||
printf("Sq2 reg2: 0x%02X\n", value);
|
printf("Sq2 reg2: 0x%02X\n", value);
|
||||||
printf("Sq2 reg3: 0x%02X\n", Sq2_reg3);
|
printf("Sq2 reg3: 0x%02X\n", Sq2_reg3);
|
||||||
printf("SQ2V = %d - SQ = %f - SQ2P = %d\n", SQ2V, SQ, SQ2P);*/
|
printf("SQ2V = %d - SQ = %f - SQ2P = %d\n", SQ2V, SQ, SQ2P);*/
|
||||||
#ifdef SOUND_LOG
|
#ifdef SOUND_LOG
|
||||||
{ FILE *fp = fopen("sound.log", "at"); fprintf(fp, "%d %d %d\n", 1, SQ2P, SQ2V); fclose(fp); }
|
{ FILE *fp = fopen("sound.log", "at"); fprintf(fp, "%d %d %d\n", 1, SQ2P, SQ2V); fclose(fp); }
|
||||||
#endif
|
#endif
|
||||||
Sound(1, (int) SQ/22, (0xFF/0x0F) * SQ2V);
|
Sound(1, (int) SQ/22, (0xFF/0x0F) * SQ2V);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x07:
|
case 0x07:
|
||||||
Sq2_reg3 = value;
|
Sq2_reg3 = value;
|
||||||
|
|
||||||
SQ2P = Sq2_reg2 | ((Sq2_reg3&0x7) << 8);
|
SQ2P = Sq2_reg2 | ((Sq2_reg3&0x7) << 8);
|
||||||
//SQ2P = (SQ2P & 0x00FF) | ((value&0x7) << 8);
|
//SQ2P = (SQ2P & 0x00FF) | ((value&0x7) << 8);
|
||||||
SQ = APU_BASEFREQ * 1000 * 1000 / (SQ2P+1 /*+
|
SQ = APU_BASEFREQ * 1000 * 1000 / (SQ2P+1 /*+
|
||||||
(Sq2_reg1&0x80)?0:( (Sq2_reg1&0x08)?(SQ2P>>(Sq2_reg1&0x07)):(SQ2P<<(Sq2_reg1&0x07)) )*/);
|
(Sq2_reg1&0x80)?0:( (Sq2_reg1&0x08)?(SQ2P>>(Sq2_reg1&0x07)):(SQ2P<<(Sq2_reg1&0x07)) )*/);
|
||||||
#ifdef SOUND_LOG
|
#ifdef SOUND_LOG
|
||||||
{ FILE *fp = fopen("sound.log", "at"); fprintf(fp, "%d %d %d\n", 1, SQ2P, SQ2V); fclose(fp); }
|
{ FILE *fp = fopen("sound.log", "at"); fprintf(fp, "%d %d %d\n", 1, SQ2P, SQ2V); fclose(fp); }
|
||||||
#endif
|
#endif
|
||||||
Sound(1, (int) SQ/22, (0xFF/0x0F) * SQ2V);
|
Sound(1, (int) SQ/22, (0xFF/0x0F) * SQ2V);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0A:
|
case 0x0A:
|
||||||
TRIP = (TRIP & 0xFF00) | value;
|
TRIP = (TRIP & 0xFF00) | value;
|
||||||
SQ = APU_BASEFREQ * 1000 * 1000 / TRIP;
|
SQ = APU_BASEFREQ * 1000 * 1000 / TRIP;
|
||||||
#ifdef SOUND_LOG
|
#ifdef SOUND_LOG
|
||||||
{ FILE *fp = fopen("sound.log", "at"); fprintf(fp, "%d %d %d\n", 2, TRIP, 127); fclose(fp); }
|
{ FILE *fp = fopen("sound.log", "at"); fprintf(fp, "%d %d %d\n", 2, TRIP, 127); fclose(fp); }
|
||||||
#endif
|
#endif
|
||||||
Sound(2, (int) SQ/22, 127);
|
Sound(2, (int) SQ/22, 127);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0B:
|
case 0x0B:
|
||||||
TRIP = (TRIP & 0x00FF) | ((value&0x7) << 8);;
|
TRIP = (TRIP & 0x00FF) | ((value&0x7) << 8);;
|
||||||
SQ = APU_BASEFREQ * 1000 * 1000 / TRIP;
|
SQ = APU_BASEFREQ * 1000 * 1000 / TRIP;
|
||||||
#ifdef SOUND_LOG
|
#ifdef SOUND_LOG
|
||||||
{ FILE *fp = fopen("sound.log", "at"); fprintf(fp, "%d %d %d\n", 2, TRIP, 127); fclose(fp); }
|
{ FILE *fp = fopen("sound.log", "at"); fprintf(fp, "%d %d %d\n", 2, TRIP, 127); fclose(fp); }
|
||||||
#endif
|
#endif
|
||||||
Sound(2, (int) SQ/22, 127);
|
Sound(2, (int) SQ/22, 127);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0C:
|
case 0x0C:
|
||||||
NOIV = value & 0x0F;
|
NOIV = value & 0x0F;
|
||||||
#ifdef SOUND_LOG
|
#ifdef SOUND_LOG
|
||||||
{ FILE *fp = fopen("sound.log", "at"); fprintf(fp, "%d %d %d\n", 3, NOIP, NOIV); fclose(fp); }
|
{ FILE *fp = fopen("sound.log", "at"); fprintf(fp, "%d %d %d\n", 3, NOIP, NOIV); fclose(fp); }
|
||||||
#endif
|
#endif
|
||||||
SetSound(3, SND_NOISE);
|
SetSound(3, SND_NOISE);
|
||||||
Sound(3, (int) SQ/22, (0xFF/0x0F) * NOIV);
|
Sound(3, (int) SQ/22, (0xFF/0x0F) * NOIV);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x0E:
|
case 0x0E:
|
||||||
NOIP = value & 0x0F;
|
NOIP = value & 0x0F;
|
||||||
SQ = APU_BASEFREQ * 1000 * 1000 / NOIP;
|
SQ = APU_BASEFREQ * 1000 * 1000 / NOIP;
|
||||||
#ifdef SOUND_LOG
|
#ifdef SOUND_LOG
|
||||||
{ FILE *fp = fopen("sound.log", "at"); fprintf(fp, "%d %d %d\n", 3, NOIP, NOIV); fclose(fp); }
|
{ FILE *fp = fopen("sound.log", "at"); fprintf(fp, "%d %d %d\n", 3, NOIP, NOIV); fclose(fp); }
|
||||||
#endif
|
#endif
|
||||||
SetSound(3, SND_NOISE);
|
SetSound(3, SND_NOISE);
|
||||||
Sound(3, (int) SQ/22, NOIV);
|
Sound(3, (int) SQ/22, NOIV);
|
||||||
break;
|
break;
|
||||||
case 0x0F:
|
case 0x0F:
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 0x15:
|
case 0x15:
|
||||||
/* DMC, Noise, Triangle, Sq 2, Sq 1 */
|
/* DMC, Noise, Triangle, Sq 2, Sq 1 */
|
||||||
//SetChannels(0, (value&0x01)?0x01:0);
|
//SetChannels(0, (value&0x01)?0x01:0);
|
||||||
/* printf("40%02X: 0x%02X [%c%c%c%c%c]\n", addr, value,
|
/* printf("40%02X: 0x%02X [%c%c%c%c%c]\n", addr, value,
|
||||||
(value&0x10)?'d':'.',
|
(value&0x10)?'d':'.',
|
||||||
(value&0x08)?'n':'.',
|
(value&0x08)?'n':'.',
|
||||||
(value&0x04)?'t':'.',
|
(value&0x04)?'t':'.',
|
||||||
(value&0x02)?'2':'.',
|
(value&0x02)?'2':'.',
|
||||||
(value&0x01)?'1':'.');*/
|
(value&0x01)?'1':'.');*/
|
||||||
|
|
||||||
break;
|
break;
|
||||||
#endif
|
#endif
|
||||||
case 0x14:
|
case 0x14:
|
||||||
ppu_fillSprRamDMA(value);
|
ppu_fillSprRamDMA(value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x16:
|
case 0x16:
|
||||||
WritePaddle(&P1, value);
|
WritePaddle(&P1, value);
|
||||||
//WritePaddle(&P2, value);
|
//WritePaddle(&P2, value);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x17:
|
case 0x17:
|
||||||
// printf("40%02X: 0x%02X\n", addr, value);
|
// printf("40%02X: 0x%02X\n", addr, value);
|
||||||
if (value == 0x00)
|
if (value == 0x00)
|
||||||
Int6502(&MainCPU,INT_IRQ);
|
Int6502(&MainCPU,INT_IRQ);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
// default:
|
// default:
|
||||||
//Page40[addr] = value;
|
//Page40[addr] = value;
|
||||||
// printf("40%02X: 0x%02X\n", addr, value);
|
// printf("40%02X: 0x%02X\n", addr, value);
|
||||||
// printf("pAPU: 0x%X @ 0x40%X\n", value, addr);
|
// printf("pAPU: 0x%X @ 0x40%X\n", value, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
byte RdHook4000Multiplexer(byte addr)
|
byte RdHook4000Multiplexer(byte addr)
|
||||||
{
|
{
|
||||||
byte ret;
|
byte ret;
|
||||||
switch(addr)
|
switch(addr)
|
||||||
{
|
{
|
||||||
case 0x16:
|
case 0x16:
|
||||||
ret = ReadPaddle(&P1);
|
ret = ReadPaddle(&P1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x17:
|
case 0x17:
|
||||||
ret = 0x40;
|
ret = 0x40;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 0x15:
|
case 0x15:
|
||||||
ret = 0x1F;
|
ret = 0x1F;
|
||||||
default:
|
default:
|
||||||
ret = 0x42;
|
ret = 0x42;
|
||||||
}
|
}
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
void printUsage(int argc, char *argv[])
|
void printUsage(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
printf("Usage : %s game.nes [-p number][-f][-b filename.pal][ filename.nes\n"
|
printf("Usage : %s game.nes [-p number][-f][-b filename.pal][ filename.nes\n"
|
||||||
" -p: to add plugin 'number'\n"
|
" -p: to add plugin 'number'\n"
|
||||||
" -f: to start in FDS mode\n"
|
" -f: to start in FDS mode\n"
|
||||||
" -d: to start directily into the debugguer\n"
|
" -d: to start directily into the debugguer\n"
|
||||||
" -b: to use palette file 'filename.pal'\n",
|
" -b: to use palette file 'filename.pal'\n",
|
||||||
argv[0]);
|
argv[0]);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
int main(int argc, char *argv[])
|
int main(int argc, char *argv[])
|
||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
unsigned char j, k;
|
unsigned char j, k;
|
||||||
unsigned char *MemoryPage;
|
unsigned char *MemoryPage;
|
||||||
|
|
||||||
/* Here we will fill the memory */
|
/* Here we will fill the memory */
|
||||||
/*
|
/*
|
||||||
--------------------------------------- $10000
|
--------------------------------------- $10000
|
||||||
Upper Bank of Cartridge ROM
|
Upper Bank of Cartridge ROM
|
||||||
--------------------------------------- $C000
|
--------------------------------------- $C000
|
||||||
@ -656,7 +656,7 @@ int main(int argc, char *argv[])
|
|||||||
--------------------------------------- $0000
|
--------------------------------------- $0000
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* Print the banner */
|
/* Print the banner */
|
||||||
printf("--------------------------------------------------------------------------------\n"
|
printf("--------------------------------------------------------------------------------\n"
|
||||||
"Welcome to TI-NESulator v%d.%d - by Godzil\n"
|
"Welcome to TI-NESulator v%d.%d - by Godzil\n"
|
||||||
"Copyright 2003-2008 TRAPIER Manoel (godzil@godzil.net)\n"
|
"Copyright 2003-2008 TRAPIER Manoel (godzil@godzil.net)\n"
|
||||||
@ -850,6 +850,12 @@ int main(int argc, char *argv[])
|
|||||||
for( i = 0x100 ; i < 0x200 ; i++ ) {
|
for( i = 0x100 ; i < 0x200 ; i++ ) {
|
||||||
Wr6502(i, 0x00);
|
Wr6502(i, 0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
for( i = 0x000 ; i < 0x800 ; i++ ) {
|
||||||
|
Wr6502(i, 0x00);
|
||||||
|
}
|
||||||
|
|
||||||
printf("[ OK ]\n");
|
printf("[ OK ]\n");
|
||||||
|
|
||||||
if (START_WITH_FDS)
|
if (START_WITH_FDS)
|
||||||
@ -1025,7 +1031,7 @@ int main(int argc, char *argv[])
|
|||||||
|
|
||||||
Reset6502(&MainCPU);
|
Reset6502(&MainCPU);
|
||||||
|
|
||||||
MainCPU.Trace = 1;
|
MainCPU.Trace = 0;
|
||||||
|
|
||||||
if (START_DEBUG)
|
if (START_DEBUG)
|
||||||
MainCPU.Trace = 1;
|
MainCPU.Trace = 1;
|
||||||
@ -1051,22 +1057,22 @@ END_OF_MAIN()
|
|||||||
/************************************ TO BE WRITTEN BY USER **/
|
/************************************ TO BE WRITTEN BY USER **/
|
||||||
void Wr6502(register word Addr, register byte Value)
|
void Wr6502(register word Addr, register byte Value)
|
||||||
{ /* Write to memory */
|
{ /* Write to memory */
|
||||||
WriteMemory((Addr&0xFF00)>>8,Addr&0x00FF, Value);
|
WriteMemory((Addr&0xFF00)>>8,Addr&0x00FF, Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
byte Rd6502(register word Addr)
|
byte Rd6502(register word Addr)
|
||||||
{ /* Read memory for normal use */
|
{ /* Read memory for normal use */
|
||||||
return ReadMemory((Addr&0xFF00)>>8,Addr&0x00FF);
|
return ReadMemory((Addr&0xFF00)>>8,Addr&0x00FF);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
extern byte *memory_pages[0xFF];
|
extern byte *memory_pages[0xFF];
|
||||||
byte Op6502(register word Addr)
|
byte Op6502(register word Addr)
|
||||||
{ /* Read OpCodes */
|
{ /* Read OpCodes */
|
||||||
byte *ptr;
|
byte *ptr;
|
||||||
return ((ptr = memory_pages[(Addr&0xFF00)>>8])>(byte*)1)?ptr[Addr&0x00FF]:0;
|
return ((ptr = memory_pages[(Addr&0xFF00)>>8])>(byte*)1)?ptr[Addr&0x00FF]:0;
|
||||||
|
|
||||||
//return ReadMemory((Addr&0xFF00)>>8,Addr&0x00FF);
|
//return ReadMemory((Addr&0xFF00)>>8,Addr&0x00FF);
|
||||||
}
|
}
|
||||||
|
|
||||||
/** Loop6502() ***********************************************/
|
/** Loop6502() ***********************************************/
|
||||||
@ -1107,7 +1113,7 @@ byte Loop6502(register M6502 * R)
|
|||||||
if (ScanLine == 241)
|
if (ScanLine == 241)
|
||||||
frame++;
|
frame++;
|
||||||
|
|
||||||
if (ScanLine >= 240 + VBLANK_TIME)
|
if (ScanLine >= (240 + VBLANK_TIME - 1))
|
||||||
{ /* End of VBlank Time */
|
{ /* End of VBlank Time */
|
||||||
/* Sync at 60FPS */
|
/* Sync at 60FPS */
|
||||||
/* Get current time in microseconds */
|
/* Get current time in microseconds */
|
||||||
@ -1125,8 +1131,8 @@ byte Loop6502(register M6502 * R)
|
|||||||
|
|
||||||
/* If we press Page Up, we dont we to accelerate "time" */
|
/* If we press Page Up, we dont we to accelerate "time" */
|
||||||
if (!key[KEY_PGUP])
|
if (!key[KEY_PGUP])
|
||||||
if ((WaitTime >= 0) && (WaitTime < 100000))
|
if ((WaitTime >= 0) && (WaitTime < 100000))
|
||||||
usleep(WaitTime);
|
usleep(WaitTime);
|
||||||
//usleep(WaitTime<0?0:(WaitTime>100000?0:WaitTime));
|
//usleep(WaitTime<0?0:(WaitTime>100000?0:WaitTime));
|
||||||
|
|
||||||
/* Now get the time after sleep */
|
/* Now get the time after sleep */
|
||||||
@ -1226,6 +1232,6 @@ byte Loop6502(register M6502 * R)
|
|||||||
/************************************ TO BE WRITTEN BY USER **/
|
/************************************ TO BE WRITTEN BY USER **/
|
||||||
byte Patch6502(register byte Op, register M6502 * R)
|
byte Patch6502(register byte Op, register M6502 * R)
|
||||||
{
|
{
|
||||||
//printf("Invalid Opcode : 0x%X @ 0x%04X !\n", Op, R->PC.W);
|
//printf("Invalid Opcode : 0x%X @ 0x%04X !\n", Op, R->PC.W);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
|
* Mapper manager - The TI-NESulator Project
|
||||||
* manager.c
|
* manager.c
|
||||||
* TI-NESulator.X
|
|
||||||
*
|
*
|
||||||
* Created by Manoël Trapier on 07/10/07.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright 2007-2008 986 Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
|
*
|
||||||
|
* $LastChangedDate$
|
||||||
|
* $Author$
|
||||||
|
* $HeadURL$
|
||||||
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-04-26 18:47:34 +0200 (jeu, 26 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/aorom.h $
|
* $HeadURL$
|
||||||
* $Revision: 46 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-04-26 18:47:34 +0200 (jeu, 26 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/aorom.h $
|
* $HeadURL$
|
||||||
* $Revision: 46 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-04-16 01:55:35 +0200 (lun, 16 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: godzil $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/cnrom.h $
|
* $HeadURL$
|
||||||
* $Revision: 39 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-04-16 01:55:35 +0200 (lun, 16 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: godzil $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/cnrom.h $
|
* $HeadURL$
|
||||||
* $Revision: 39 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-04-16 01:55:35 +0200 (lun, 16 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: godzil $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/genericmapper.h $
|
* $HeadURL$
|
||||||
* $Revision: 39 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-04-16 01:55:35 +0200 (lun, 16 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: godzil $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/iremh3001.h $
|
* $HeadURL$
|
||||||
* $Revision: 39 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-04-16 01:55:35 +0200 (lun, 16 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: godzil $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/iremh3001.h $
|
* $HeadURL$
|
||||||
* $Revision: 39 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-05-02 18:37:41 +0200 (mer, 02 mai 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/mmc1.h $
|
* $HeadURL$
|
||||||
* $Revision: 50 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-05-02 18:37:41 +0200 (mer, 02 mai 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/mmc1.h $
|
* $HeadURL$
|
||||||
* $Revision: 50 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-05-02 18:37:41 +0200 (mer, 02 mai 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/mmc3.h $
|
* $HeadURL$
|
||||||
* $Revision: 50 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-05-02 18:37:41 +0200 (mer, 02 mai 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/mmc3.h $
|
* $HeadURL$
|
||||||
* $Revision: 50 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2007-2008 986Corp. All rights reserved.
|
* Copyright (c) 2007-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-05-31 18:00:41 +0200 (jeu, 31 mai 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/mmc4.h $
|
* $HeadURL$
|
||||||
* $Revision: 56 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2007-2008 986Corp. All rights reserved.
|
* Copyright (c) 2007-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-05-31 18:00:41 +0200 (jeu, 31 mai 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/mmc4.h $
|
* $HeadURL$
|
||||||
* $Revision: 56 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-04-16 01:55:35 +0200 (lun, 16 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: godzil $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/unrom.h $
|
* $HeadURL$
|
||||||
* $Revision: 39 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-04-16 01:55:35 +0200 (lun, 16 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: godzil $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/unrom.h $
|
* $HeadURL$
|
||||||
* $Revision: 39 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-04-16 01:55:35 +0200 (lun, 16 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: godzil $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/unrom.h $
|
* $HeadURL$
|
||||||
* $Revision: 39 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-04-16 01:55:35 +0200 (lun, 16 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: godzil $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/unrom.h $
|
* $HeadURL$
|
||||||
* $Revision: 39 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,14 @@
|
|||||||
/*
|
/*
|
||||||
|
* Mapper list - The TI-NESulator Project
|
||||||
* mappers_list.h
|
* mappers_list.h
|
||||||
* TI-NESulator.X
|
|
||||||
*
|
*
|
||||||
* Created by Manoël Trapier on 25/10/07.
|
* Created by Manoel TRAPIER on 25/10/07.
|
||||||
* Copyright 2007-2008 986 Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
|
*
|
||||||
|
* $LastChangedDate$
|
||||||
|
* $Author$
|
||||||
|
* $HeadURL$
|
||||||
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-04-16 01:55:35 +0200 (lun, 16 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: godzil $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/genericmapper.h $
|
* $HeadURL$
|
||||||
* $Revision: 39 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-05-02 18:37:41 +0200 (mer, 02 mai 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/mmc1.h $
|
* $HeadURL$
|
||||||
* $Revision: 50 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
unsigned char MMC1_reg0;
|
unsigned char MMC1_reg0;
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-05-31 18:00:41 +0200 (jeu, 31 mai 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/mappers.c $
|
* $HeadURL$
|
||||||
* $Revision: 56 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -2,13 +2,13 @@
|
|||||||
* 6502 Memory manager - The TI-NESulator Project
|
* 6502 Memory manager - The TI-NESulator Project
|
||||||
* memory.c - Taken from the Quick6502 project
|
* memory.c - Taken from the Quick6502 project
|
||||||
*
|
*
|
||||||
* Created by Manoël Trapier on 18/09/06.
|
* Created by Manoel Trapier on 18/09/06.
|
||||||
* Copyright 2003-2008 986 Corp. All rights reserved.
|
* Copyright 2003-2008 986 Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-05-02 18:37:41 +0200 (mer, 02 mai 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/memory.c $
|
* $HeadURL$
|
||||||
* $Revision: 50 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-05-02 18:37:41 +0200 (mer, 02 mai 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/paddle.c $
|
* $HeadURL$
|
||||||
* $Revision: 50 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Code Breaker plugin - The TI-NESulator Project
|
||||||
|
* gamegenie.c: Hack your games with unlimited lives of add new powers!
|
||||||
|
*
|
||||||
|
* Created by Manoel Trapier.
|
||||||
|
* Copyright 2003-2008 986 Corp. All rights reserved.
|
||||||
|
*
|
||||||
|
* $LastChangedDate$
|
||||||
|
* $Author$
|
||||||
|
* $HeadURL$
|
||||||
|
* $Revision$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <allegro.h>
|
#include <allegro.h>
|
||||||
|
|||||||
@ -1,2 +1,16 @@
|
|||||||
|
/*
|
||||||
|
* Code Breaker plugin - The TI-NESulator Project
|
||||||
|
* gamegenie.h
|
||||||
|
*
|
||||||
|
* Created by Manoel Trapier.
|
||||||
|
* Copyright 2003-2008 986 Corp. All rights reserved.
|
||||||
|
*
|
||||||
|
* $LastChangedDate$
|
||||||
|
* $Author$
|
||||||
|
* $HeadURL$
|
||||||
|
* $Revision$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
int gg_Init();
|
int gg_Init();
|
||||||
int gg_Deinit();
|
int gg_Deinit();
|
||||||
|
|||||||
@ -1,3 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* Plugin Manager plugint list - The TI-NESulator Project
|
||||||
|
* plugins_list.h
|
||||||
|
*
|
||||||
|
* Created by Manoel Trapier.
|
||||||
|
* Copyright 2003-2008 986 Corp. All rights reserved.
|
||||||
|
*
|
||||||
|
* $LastChangedDate$
|
||||||
|
* $Author$
|
||||||
|
* $HeadURL$
|
||||||
|
* $Revision$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
/* This file could be generated from the plugins directory... */
|
/* This file could be generated from the plugins directory... */
|
||||||
|
|
||||||
#include "plugins/gamegenie.h"
|
#include "plugins/gamegenie.h"
|
||||||
|
|||||||
@ -1,3 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* PPU Debug utilities - The TI-NESulator Project
|
||||||
|
* ppu.debug.c
|
||||||
|
*
|
||||||
|
* Created by Manoel Trapier.
|
||||||
|
* Copyright 2003-2008 986 Corp. All rights reserved.
|
||||||
|
*
|
||||||
|
* $LastChangedDate$
|
||||||
|
* $Author$
|
||||||
|
* $HeadURL$
|
||||||
|
* $Revision$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|||||||
@ -9,10 +9,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-03-29 12:05:12 +0200 (jeu, 29 mar 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/oldppu.c $
|
* $HeadURL$
|
||||||
* $Revision: 28 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
#include <allegro.h>
|
#include <allegro.h>
|
||||||
|
|||||||
@ -7,10 +7,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-04-06 17:17:01 +0200 (ven, 06 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/ppu.c $
|
* $HeadURL$
|
||||||
* $Revision: 32 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -7,10 +7,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-05-31 18:02:16 +0200 (jeu, 31 mai 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/ppu.c $
|
* $HeadURL$
|
||||||
* $Revision: 58 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@ -757,7 +757,7 @@ E = HT
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (scanline >= (240 + VBLANK_TIME))
|
if (scanline >= (240 + VBLANK_TIME - 1))
|
||||||
{
|
{
|
||||||
/*for ( i = 0; i < 256; i++)
|
/*for ( i = 0; i < 256; i++)
|
||||||
for ( j = 0; j < 256; j++)
|
for ( j = 0; j < 256; j++)
|
||||||
@ -773,9 +773,9 @@ E = HT
|
|||||||
textprintf(Buffer, font, 260, 3, 4, "FPS : %d (CPU@~%2.2fMhz : %d%%)", FPS, (float) (((float) IPS) / 1000000.0), (int) ((((float) IPS) / 1770000.0) * 100.0));
|
textprintf(Buffer, font, 260, 3, 4, "FPS : %d (CPU@~%2.2fMhz : %d%%)", FPS, (float) (((float) IPS) / 1000000.0), (int) ((((float) IPS) / 1770000.0) * 100.0));
|
||||||
//printf("(SL:%d) FPS : %d IPS : %d\n", scanline, FPS, IPS);
|
//printf("(SL:%d) FPS : %d IPS : %d\n", scanline, FPS, IPS);
|
||||||
|
|
||||||
ppu_dumpPalette(0, 241);
|
//ppu_dumpPalette(0, 241);
|
||||||
ppu_dumpPattern(280, 150);
|
//ppu_dumpPattern(280, 150);
|
||||||
ppu_dumpNameTable(256,0);
|
//ppu_dumpNameTable(256,0);
|
||||||
//ppu_dumpAttributeTable(257, 0);
|
//ppu_dumpAttributeTable(257, 0);
|
||||||
|
|
||||||
blit(VideoBuffer, Buffer, 0, 0, 0, 0, 256, 240);
|
blit(VideoBuffer, Buffer, 0, 0, 0, 0, 256, 240);
|
||||||
|
|||||||
@ -5,10 +5,10 @@
|
|||||||
* Created by Manoël Trapier on 12/04/07.
|
* Created by Manoël Trapier on 12/04/07.
|
||||||
* Copyright 2003-2008 986 Corp. All rights reserved.
|
* Copyright 2003-2008 986 Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-05-24 15:11:55 +0200 (jeu, 24 mai 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/ppu/ppu.memory.c $
|
* $HeadURL$
|
||||||
* $Revision: 53 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -7,10 +7,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-04-04 18:46:30 +0200 (mer, 04 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/ppu.c $
|
* $HeadURL$
|
||||||
* $Revision: 30 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -7,10 +7,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-04-06 17:17:01 +0200 (ven, 06 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/ppu.c $
|
* $HeadURL$
|
||||||
* $Revision: 32 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -7,10 +7,10 @@
|
|||||||
* Created by Manoel TRAPIER.
|
* Created by Manoel TRAPIER.
|
||||||
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
* Copyright (c) 2003-2008 986Corp. All rights reserved.
|
||||||
*
|
*
|
||||||
* $LastChangedDate: 2007-04-06 17:17:01 +0200 (ven, 06 avr 2007) $
|
* $LastChangedDate$
|
||||||
* $Author: mtrapier $
|
* $Author$
|
||||||
* $HeadURL: file:///media/HD6G/SVNROOT/trunk/TI-NESulator/src/ppu.c $
|
* $HeadURL$
|
||||||
* $Revision: 32 $
|
* $Revision$
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|||||||
@ -1,3 +1,17 @@
|
|||||||
|
/*
|
||||||
|
* bin to header - Part of The TI-NESulator Project
|
||||||
|
* bin2h.c: Convert a binary file to a table of byte in a C header file.
|
||||||
|
*
|
||||||
|
* Created by Manoel Trapier.
|
||||||
|
* Copyright 2003-2008 986 Corp. All rights reserved.
|
||||||
|
*
|
||||||
|
* $LastChangedDate$
|
||||||
|
* $Author$
|
||||||
|
* $HeadURL$
|
||||||
|
* $Revision$
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user