Skip to content
This repository was archived by the owner on May 2, 2022. It is now read-only.

Commit 5e73c7e

Browse files
committed
整合了MMC及System,纯粹模拟器代码34KB
1 parent f1c1a9f commit 5e73c7e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

87 files changed

+49410
-6095
lines changed

InfoNES.c.bak

+3,422
Large diffs are not rendered by default.

InfoNES.cpp

+798-166
Large diffs are not rendered by default.

InfoNES.cpp.bak

+2,396-677
Large diffs are not rendered by default.
182 KB
Binary file not shown.

InfoNES.h

+55-11
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,32 @@
1515

1616
#include "InfoNES_Types.h"
1717

18+
//#define killsystem //用于LEON,不用InfoNES_System_LEON.cpp文件,现在定义在Makefile中
19+
20+
#define killstring //用于LEON,不使用string.h中提供的memcmp、memcpy和memset库函数。
21+
1822
#define PocketNES 1 //以查找数组的方式获取指令
1923

20-
//#define HACK //将各种可能只从RAM中读取的代码简化为只从RAM中读取
24+
#define HACK //将各种可能只从RAM中读取的代码简化为只从RAM中读取
25+
26+
#define splitIO //通过简化6502中的IO读写函数来提高速度
2127

22-
#define splitIO //通过简化6502种得IO读写函数来提高速度
28+
#define killif2 //以查找数据指针数组的方式代替6502代码中的条件分支语句
2329

24-
//#define killif //以查找函数指针数组的方式代替6502代码中的条件分支语句 //速度反而变慢,所以不用
30+
#define writeIO //设定使用K6502_WriteIO()代替K6502_WritePPU()K6502_WriteAPU()以减少Write6502RAM中的分支
31+
32+
//#define killwif //以查找函数指针数组的方式代替6502代码中Write6502RAM的条件分支语句 //速度会稍变慢,暂时不用
33+
#ifdef killwif
34+
#ifndef writefunc
35+
typedef /*static inline*/ void ( *writefunc )( BYTE byData );
36+
#endif
37+
extern writefunc PPU_write_tbl[ 8 ];
38+
//extern BYTE PPU_R( WORD wAddr );
39+
//extern void PPU_W( WORD wAddr, BYTE byData );
40+
#endif /* killwif */
41+
42+
43+
//#define killif //以查找函数指针数组的方式代替6502代码中的条件分支语句 //速度反而变慢,所以不用,速度变慢可能是由于新增的函数调用的开销引起的
2544
#ifdef killif
2645

2746
#ifndef readfunc
@@ -119,7 +138,15 @@ extern BYTE *memmap_tbl[8];
119138
/*-------------------------------------------------------------------*/
120139

121140
/* PPU RAM */
141+
#define splitPPURAM //把PPURAM分割成几块内存,如果游戏测试通过的话,这样做会加快速度和减少内存需求
142+
143+
#ifdef splitPPURAM
144+
extern BYTE PTRAM[];
145+
extern BYTE NTRAM[];
146+
extern BYTE PALRAM[];
147+
#else
122148
extern BYTE PPURAM[];
149+
#endif /* splitPPURAM */
123150

124151
/* VROM */
125152
extern BYTE *VROM;
@@ -160,8 +187,8 @@ extern BYTE PPU_R5;
160187
extern BYTE PPU_R6;
161188

162189
//FCEU
163-
extern BYTE PPUGenLatch;
164-
extern BYTE PPUSPL;
190+
//extern BYTE PPUGenLatch;
191+
//extern BYTE PPUSPL;
165192

166193
//extern BYTE PPU_Scr_V;
167194
//extern BYTE PPU_Scr_V_Next;
@@ -353,19 +380,23 @@ extern WORD PPU_Scanline;
353380
//extern BYTE PPU_ScanTable[];
354381

355382
/* Name Table Bank */
356-
extern BYTE PPU_NameTableBank;
383+
//extern BYTE PPU_NameTableBank;
357384

358385
///* BG Base Address */
359386
//extern BYTE *PPU_BG_Base;
360387

361388
//nesterJ
389+
#ifndef INES
362390
extern WORD bg_pattern_table_addr;
391+
#endif /* INES */
363392

364393
///* Sprite Base Address */
365394
//extern BYTE *PPU_SP_Base;
366395

367396
//nesterJ
397+
#ifndef INES
368398
extern WORD spr_pattern_table_addr;
399+
#endif /* INES */
369400

370401
/* Sprite Height */
371402
extern WORD PPU_SP_Height;
@@ -455,7 +486,7 @@ extern DWORD PAD2_Bit;
455486
/*-------------------------------------------------------------------*/
456487

457488
/* Initialize Mapper */
458-
extern void (*MapperInit)();
489+
//extern void (*MapperInit)();
459490
/* Write to Mapper */
460491
extern void (*MapperWrite)( WORD wAddr, BYTE byData );
461492
/* Write to SRAM */
@@ -467,7 +498,7 @@ extern void (*MapperWrite)( WORD wAddr, BYTE byData );
467498
/* Callback at VSync */
468499
//加速 extern void (*MapperVSync)();
469500
/* Callback at HSync */
470-
extern void (*MapperHSync)();
501+
//extern void (*MapperHSync)();
471502
/* Callback at PPU read/write */
472503
//加速extern void (*MapperPPU)( WORD wAddr );
473504
/* Callback at Rendering Screen 1:BG, 0:Sprite */
@@ -477,6 +508,14 @@ extern void (*MapperHSync)();
477508
/* ROM information */
478509
/*-------------------------------------------------------------------*/
479510

511+
#ifdef killsystem
512+
extern int RomSize;
513+
extern int VRomSize;
514+
extern int MapperNo;
515+
extern int ROM_Mirroring;
516+
517+
#else /* killsystem */
518+
480519
/* .nes File Header */
481520
struct NesHeader_tag
482521
{
@@ -499,11 +538,13 @@ extern BYTE ROM_Mirroring;
499538
extern BYTE ROM_SRAM;
500539
extern BYTE ROM_Trainer;
501540
extern BYTE ROM_FourScr;
541+
#endif /* killsystem */
502542

503543
/*-------------------------------------------------------------------*/
504544
/* Function prototypes */
505545
/*-------------------------------------------------------------------*/
506546

547+
#ifndef killsystem
507548
/* Initialize InfoNES */
508549
void InfoNES_Init();
509550

@@ -517,19 +558,22 @@ int InfoNES_Load( const char *pszFileName );
517558
int InfoNES_Reset();
518559

519560
/* Initialize PPU */
520-
void InfoNES_SetupPPU();
561+
//void InfoNES_SetupPPU();
521562

522563
/* Set up a Mirroring of Name Table */
523-
void InfoNES_Mirroring( int nType );
564+
//void InfoNES_Mirroring( int nType );
524565

525566
/* The main loop of InfoNES */
526567
void InfoNES_Main();
568+
#endif /* killsystem */
527569

570+
#ifndef AFS
528571
/* The loop of emulation */
529572
void InfoNES_Cycle();
573+
#endif /* AFS */
530574

531575
/* A function in H-Sync */
532-
int InfoNES_HSync();
576+
//int InfoNES_HSync();
533577

534578
/* Render a scanline */
535579
/* Current Scanline */

0 commit comments

Comments
 (0)