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

Commit bbcd2d1

Browse files
committed
优化了主循环和绘制函数
1 parent 2893774 commit bbcd2d1

Some content is hidden

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

69 files changed

+3418
-2825
lines changed

ARM/InfoNES.mcp

0 Bytes
Binary file not shown.
0 Bytes
Binary file not shown.

ARM/InfoNES_Data/DebugRel/InfoNES.axf

-6.88 KB
Binary file not shown.

ARM/InfoNES_Data/DebugRel/InfoNES.bin

-1.26 KB
Binary file not shown.
-4.96 KB
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
-3.37 KB
Binary file not shown.
-4.12 KB
Binary file not shown.
0 Bytes
Binary file not shown.

InfoNES.cpp

+984-1,109
Large diffs are not rendered by default.

InfoNES.cpp.bak

+891-524
Large diffs are not rendered by default.

InfoNES.h

+72-10
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,11 @@ extern BYTE PPU_R2;
8888
extern BYTE PPU_R3;
8989
extern BYTE PPU_R7;
9090

91+
//lizheng
92+
//extern BYTE PPU_R4;
93+
extern BYTE PPU_R5;
94+
extern BYTE PPU_R6;
95+
9196
//FCEU
9297
extern BYTE PPUGenLatch;
9398
extern BYTE PPUSPL;
@@ -168,6 +173,64 @@ extern BYTE PPU_UpDown_Clip;
168173
PPU_Scr_H_Bit_Next = PPU_Scr_H_Next & 0x07; \
169174
}
170175

176+
//nesterJ
177+
/*
178+
在一条扫描开始绘制时(如果背景或Sprite允许显示):
179+
v:0000010000011111=t:0000010000011111
180+
*/
181+
#define LOOPY_SCANLINE_START(v,t) \
182+
{ \
183+
v = (v & 0xFBE0) | (t & 0x041F); \
184+
}
185+
/*
186+
第12-14位是tile的Y补偿量。
187+
你可以把第5、6、7、8、9位当作“y卷轴值”(*8)。这项功能
188+
与X稍有不同。当它增加到29而不是31时就绕回到0同时切换第11
189+
位。在这里有一些古怪的边缘效果。如果你将该值人为设置为超
190+
过29(通过2005或者2006),则很明显从29绕回的现象不会发生,
191+
并且AT的数据会被当作NT的数据来用。“y卷轴值”仍旧会从31绕
192+
回到0,但是不会切换第11位。这可以解释为什么通过2005向“Y”
193+
写入的值超过240会表现得像一个负的卷轴值一样。
194+
*/
195+
#define LOOPY_NEXT_LINE(v) \
196+
{ \
197+
if((v & 0x7000) == 0x7000) /* is subtile y offset == 7? */ \
198+
{ \
199+
v &= 0x8FFF; /* subtile y offset = 0 */ \
200+
if((v & 0x03E0) == 0x03A0) /* name_tab line == 29? */ \
201+
{ \
202+
v ^= 0x0800; /* switch nametables (bit 11) */ \
203+
v &= 0xFC1F; /* name_tab line = 0 */ \
204+
} \
205+
else \
206+
{ \
207+
if((v & 0x03E0) == 0x03E0) /* line == 31? */ \
208+
{ \
209+
v &= 0xFC1F; /* name_tab line = 0 */ \
210+
} \
211+
else \
212+
{ \
213+
v += 0x0020; /* next name_tab line */ \
214+
} \
215+
} \
216+
} \
217+
else \
218+
{ \
219+
v += 0x1000; /* next subtile y offset */ \
220+
} \
221+
}
222+
#define VRAM(addr) PPUBANK[ ( addr ) >> 10 ] [ ( addr ) & 0x3FF ]
223+
//#define DRAW_BG_PIXEL() \
224+
// col = attrib_bits; \
225+
// \
226+
// if(pattern_lo & pattern_mask) col |= 0x01; \
227+
// if(pattern_hi & pattern_mask) col |= 0x02; \
228+
// if(col & 0x03) \
229+
// *p = PalTable[col]; \
230+
// else \
231+
// *p = PalTable[0]; \
232+
// p++;
233+
171234
/* Current Scanline */
172235
extern WORD PPU_Scanline;
173236

@@ -221,16 +284,15 @@ extern WORD DoubleFrame[ 2 ][ NES_DISP_WIDTH * NES_DISP_HEIGHT ];
221284
extern WORD *WorkFrame;
222285
extern WORD WorkFrameIdx;
223286
#else
224-
extern WORD WorkFrame[ NES_DISP_WIDTH * NES_DISP_HEIGHT ];
287+
//extern WORD WorkFrame[ NES_DISP_WIDTH * NES_DISP_HEIGHT ];
225288

226-
////nesterJ
227-
//extern WORD WorkFrame[ NES_BACKBUF_WIDTH * NES_DISP_HEIGHT ];
228-
//extern BYTE solid_buf[ NES_DISP_WIDTH ];
289+
//nesterJ
290+
extern WORD WorkFrame[ NES_BACKBUF_WIDTH * NES_DISP_HEIGHT ];
229291

230-
#endif
292+
////颜色
293+
//extern BYTE WorkFrame[ NES_BACKBUF_WIDTH * NES_DISP_HEIGHT ];
231294

232-
//nesterJ
233-
extern BYTE solid_buf[ NES_DISP_WIDTH ];
295+
#endif
234296

235297
extern BYTE ChrBuf[];
236298

@@ -343,13 +405,13 @@ void InfoNES_Cycle();
343405
int InfoNES_HSync();
344406

345407
/* Render a scanline */
346-
void InfoNES_DrawLine();
408+
//void InfoNES_DrawLine();
347409
void InfoNES_DrawLine2();
348410

349411
/* Get a position of scanline hits sprite #0 */
350-
void InfoNES_GetSprHitY();
412+
//void InfoNES_GetSprHitY();
351413

352414
/* Develop character data */
353-
void InfoNES_SetupChr();
415+
//void InfoNES_SetupChr();
354416

355417
#endif /* !InfoNES_H_INCLUDED */

0 commit comments

Comments
 (0)