基本 NES 仿真理论 - 我被困住了
提前,我为这个问题的开放性和普遍的软弱表示歉意,因为说实话,我对这个主题的了解非常零碎,我发现甚至很难描述我的问题。我真的不想发帖,但我完全被困住了。
我已经启动了 NES 模拟器。它被解释(所以没有动态重新压缩)。
Atm 它可以加载和映射 ROM(映射器 0 ROM)并执行初始化代码,直到我必须处理中断和 PPU 的位置。这就是我被困住的地方。
这是我的 emu atm 的输出示例。执行从 8000 开始,我在 800a 处陷入无限循环,我不知道如何从那里继续前进。
8002: LDA #$10 ; read immediate value to set PPU control registers
8004: STA $2000 ; store value
8007: LDX #$FF ; load immediate value into X register
8009: TXS ; store X register into stack
800a: LDA $2002 ; read PPU flags into accumulator (set N flag based on bit 7)
800d: BPL ; test N flag, branch to 800a if not positive, (N is set)
800a: LDA $2002
800d: BPL
800a: LDA $2002
800d: BPL
800a: LDA $2002
800d: BPL
etc, etc etc (inf loop)
所以我的问题是,有人可以为我解释一下通过 PPU 渲染进行 1 次迭代的基础知识,包括循环计数、中断等内容(即绘制整个 240 扫描线屏幕并移至下一个) 。
In advance, I apologize for the open endedness, and general wishy-washiness of this question, because to be honest my knowledge of the topic is very patchy and I'm finding it hard to even describe my problem. I really didn't want to post, but I'm completely and utterly stuck.
I have started a NES emulator. It's interpreted (so no dynamic recomp).
Atm it can load and map roms (mapper 0 roms) and execute the init code right up to where I have to deal with interrupts and the PPU. That's where I'm stuck.
Here is an example output from my emu atm. Execution begins at 8000, and I hit an infinite loop at 800a where I have no idea how to progress from there.
8002: LDA #$10 ; read immediate value to set PPU control registers
8004: STA $2000 ; store value
8007: LDX #$FF ; load immediate value into X register
8009: TXS ; store X register into stack
800a: LDA $2002 ; read PPU flags into accumulator (set N flag based on bit 7)
800d: BPL ; test N flag, branch to 800a if not positive, (N is set)
800a: LDA $2002
800d: BPL
800a: LDA $2002
800d: BPL
800a: LDA $2002
800d: BPL
etc, etc etc (inf loop)
So my question is, can someone please explain the basics of 1 iteration through a PPU render for me, including things like cycle count, interrupts etc (i.e. draw one whole 240 scanline screen and move onto the next).
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
那里有模拟器,您是否查看过它们的来源来寻找答案?通常这些都是为了性能而编写的,可读性不是很好,但您可能会找到一些花絮来帮助您继续。代码是否正在等待执行中断?您是否执行了该中断?可能是中断修改了返回地址,让程序继续执行?无限循环轮询寄存器中的某个位吗?或者它是自我的无条件分支?
There are emulators out there, have you looked at their sources for the answer? usually those are written for performance and not very readable but you might find a tidbit to get you going. is the code waiting for an interrupt to be executed and have you executed that interrupt? It may be that the interrupt modifies the return address and allows the program to continue? is the infinite loop polling a bit in a register? or is it an unconditional branch to self?