如何在 N64 模拟器中构造内存映射?

发布于 2024-08-13 07:35:23 字数 1323 浏览 5 评论 0原文

根据维基百科,N64 只有 4 MB 的 RDRAM(扩展包为 8 MB),其他数量也同样较小(L1 缓存约为 4 KB)。然而,我在 Google 上找到的技术文档指出,其内存地址范围从 $0000:0000 到 $FFFF:FFFF —— 即 4 GB!由于现有的 N64 模拟器(例如 Project64)不会使用 4 GB RAM,那么模拟内存映射如何工作?我尝试过查看各种文件等,所有这些似乎至少略有不同。有人对这个问题有一些建议吗?

具体来说,这是我找到的内存映射:

0x0000 0000 to 0x03EF FFFF RDRAM Memory
0x03F0 0000 to 0x03FF FFFF RDRAM Registers
0x0400 0000 to 0x040F FFFF SP Registers
0x0410 0000 to 0x041F FFFF DP Command Registers
0x0420 0000 to 0x042F FFFF DP Span Registers
0x0430 0000 to 0x043F FFFF MIPS Interface (MI) Registers
0x0440 0000 to 0x044F FFFF Video Interface (VI) Registers
0x0450 0000 to 0x045F FFFF Audio Interface (AI) Registers
0x0460 0000 to 0x046F FFFF Peripheral Interface (PI) Registers
0x0470 0000 to 0x047F FFFF RDRAM Interface (RI) Registers
0x0480 0000 to 0x048F FFFF Serial Interface (SI) Registers
0x0490 0000 to 0x04FF FFFF Unused
0x0500 0000 to 0x05FF FFFF Cartridge Domain 2 Address 1
0x0600 0000 to 0x07FF FFFF Cartridge Domain 1 Address 1
0x0800 0000 to 0x0FFF FFFF Cartridge Domain 2 Address 2
0x1000 0000 to 0x1FBF FFFF Cartridge Domain 1 Address 2
0x1FC0 0000 to 0x1FC0 07BF PIF Boot ROM
0x1FC0 07C0 to 0x1FC0 07FF PIF RAM
0x1FC0 0800 to 0x1FCF FFFF Reserved
0x1FD0 0000 to 0x7FFF FFFF Cartridge Domain 1 Address 3
0x8000 0000 to 0xFFFF FFFF External SysAD Device

According to Wikipedia, the N64 only has 4 MB of RDRAM (8 MB with the Expansion Pack), and the other quantities are similarly small (4 KB or so of L1 cache). However, technical documents I have found on Google state that its memory addresses range from $0000:0000 to $FFFF:FFFF -- that's 4 GB! Since existing N64 emulators like Project64 don't use up 4 GB of RAM, how does emulating the memory map work? I have tried looking through various documents and such, and all of them seem to differ at least slightly. Does anybody have some advice on this issue?

Specifically, here's the memory map I found:

0x0000 0000 to 0x03EF FFFF RDRAM Memory
0x03F0 0000 to 0x03FF FFFF RDRAM Registers
0x0400 0000 to 0x040F FFFF SP Registers
0x0410 0000 to 0x041F FFFF DP Command Registers
0x0420 0000 to 0x042F FFFF DP Span Registers
0x0430 0000 to 0x043F FFFF MIPS Interface (MI) Registers
0x0440 0000 to 0x044F FFFF Video Interface (VI) Registers
0x0450 0000 to 0x045F FFFF Audio Interface (AI) Registers
0x0460 0000 to 0x046F FFFF Peripheral Interface (PI) Registers
0x0470 0000 to 0x047F FFFF RDRAM Interface (RI) Registers
0x0480 0000 to 0x048F FFFF Serial Interface (SI) Registers
0x0490 0000 to 0x04FF FFFF Unused
0x0500 0000 to 0x05FF FFFF Cartridge Domain 2 Address 1
0x0600 0000 to 0x07FF FFFF Cartridge Domain 1 Address 1
0x0800 0000 to 0x0FFF FFFF Cartridge Domain 2 Address 2
0x1000 0000 to 0x1FBF FFFF Cartridge Domain 1 Address 2
0x1FC0 0000 to 0x1FC0 07BF PIF Boot ROM
0x1FC0 07C0 to 0x1FC0 07FF PIF RAM
0x1FC0 0800 to 0x1FCF FFFF Reserved
0x1FD0 0000 to 0x7FFF FFFF Cartridge Domain 1 Address 3
0x8000 0000 to 0xFFFF FFFF External SysAD Device

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

暗恋未遂 2024-08-20 07:35:23

您拥有的映射是抽象的,如果您查看更详细的内存映射,您会请注意未映射内存的大间隙。不包括映射的外部盒式ROM(等),将可用内存的各部分相加。您最终将分配超过 4MB 的空间,包括 RDRAM。另请注意,超过 0x80000000 的地址实际上是较低地址的镜像,区别在于有些是直接映射的(物理内存),有些是 TLB 映射的(虚拟内存)。

0x00000000 - 0x7fffffff  KUSEG  TLB mapping
0x80000000 - 0x9fffffff  KSEG0  Direct map, cache
0xa0000000 - 0xbfffffff  KSEG1  Direct map, non-cache
0xc0000000 - 0xdfffffff  KSSEG  TLB mapping
0xe0000000 - 0xffffffff  KSEG3  TLB mapping

另请注意,盒式磁带内存映射到 0xb0000000。这在内存映射中没有明确显示。

The map you have is abstract, if you look at a more detailed memory map, you will notice large gaps of unmapped memory. Not including mapped external cartridge ROM (etc), add up each part of usable memory. You will end up allocating just over 4MB including the RDRAM. Also note that addresses over 0x80000000 are effectively mirrors of lower addresses, with the distinction that some is directly mapped (physical memory), and some is TLB mapped (virtual memory).

0x00000000 - 0x7fffffff  KUSEG  TLB mapping
0x80000000 - 0x9fffffff  KSEG0  Direct map, cache
0xa0000000 - 0xbfffffff  KSEG1  Direct map, non-cache
0xc0000000 - 0xdfffffff  KSSEG  TLB mapping
0xe0000000 - 0xffffffff  KSEG3  TLB mapping

Also, note that cartridge memory is mapped in at 0xb0000000. This isn't explicitly shown in the memory map.

懒的傷心 2024-08-20 07:35:23

无论您模拟多少内存,您都不需要主机上有那么多可用内存(您不需要 4 GB,甚至不需要 4 MB)。相反,请使用可以通过地址值访问模拟内存的数据结构。仅当您需要在模拟内存中存储某些内容时,才在真实内存中分配空间。

然而,实际分配上述内部存储器的量可能是微不足道的。

和西蒙一样,我也会首先假设段:偏移理论,但是您上面列出的地址范围似乎与该理论完全矛盾。另外,整个“64”位地址空间的事情。

请注意,大部分地址空间分配给外部接口(盒式磁带等),而不是内部硬件资源。

Regardless of how much memory you're emulating, you don't need that much memory available on the host machine (you don't need 4 GB, and you don't even need 4 MB). Instead, use a data structure where you can access your emulated memory by address value. Only allocate space in your real memory when you need to store something in your emulated memory.

However, it may be trivial to actually allocate the amount of internal memory described above.

Like Simon, I would also first assume the segment:offset theory, but the address ranges you list above seem to entirely contradict that theory. Also, the whole "64"-bit address space thing.

Notice that the majority of the address space is allocated to external interfaces (cartridges, etc), not internal hardware resources.

绝影如岚 2024-08-20 07:35:23

AFAIK 系统的处理器最多可以有 4 GB 没有任何问题,但 n64 本身并没有使用此功能。所以我认为如果处理器从该区域请求数据,它只会返回 00。

AFAIK The processor of the system can have up to 4 GB without any problems, but the n64 itself wasn't using this feauture. So I think if the processor requested data from that region, it would just return 00.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文