Ppu.h
上传用户:luhy168
上传日期:2022-01-10
资源大小:240k
文件大小:3k
源码类别:

模拟服务器

开发平台:

Visual C++

  1. //------------------------------------------------------------------------------
  2. // Name: Ppu.h
  3. // Desc: Holds the definition of the PPU structure.
  4. //------------------------------------------------------------------------------
  5. #ifndef __PPU_H__
  6. #define __PPU_H__
  7. /* 
  8.  * The following is cut from yoshi's NES document NESTECH.txt
  9.  *
  10.   B. Memory Map
  11.   -------------
  12.     Included here are two (2) memory maps. The first is a "RAM Memory
  13.     Map," which despite being less verbose describes the actual regions
  14.     which point to physical RAM in the NES itself. The second is a
  15.     "Programmer Memory Map" which is quite verbose and describes the
  16.     entire memory region of the NES and how it's used/manipulated.
  17.         RAM Memory Map
  18.       +---------+-------+--------------------+
  19.       | Address | Size  | Description        |
  20.       +---------+-------+--------------------+
  21.       | $0000   | $1000 | Pattern Table #0   |
  22.       | $1000   | $1000 | Pattern Table #1   |
  23.       | $2000   | $800  | Name Tables        |
  24.       | $3F00   | $20   | Palettes           |
  25.       +---------+-------+--------------------+
  26.         Programmer Memory Map
  27.       +---------+-------+-------+--------------------+
  28.       | Address | Size  | Flags | Description        |
  29.       +---------+-------+-------+--------------------+
  30.       | $0000   | $1000 | C     | Pattern Table #0   |
  31.       | $1000   | $1000 | C     | Pattern Table #1   |
  32.       | $2000   | $3C0  |       | Name Table #0      |
  33.       | $23C0   | $40   |  N    | Attribute Table #0 |
  34.       | $2400   | $3C0  |  N    | Name Table #1      |
  35.       | $27C0   | $40   |  N    | Attribute Table #1 |
  36.       | $2800   | $3C0  |  N    | Name Table #2      |
  37.       | $2BC0   | $40   |  N    | Attribute Table #2 |
  38.       | $2C00   | $3C0  |  N    | Name Table #3      |
  39.       | $2FC0   | $40   |  N    | Attribute Table #3 |
  40.       | $3000   | $F00  |   R   |                    |
  41.       | $3F00   | $10   |       | Image Palette #1   |
  42.       | $3F10   | $10   |       | Sprite Palette #1  |
  43.       | $3F20   | $E0   |    P  |                    |
  44.       | $4000   | $C000 |     F |                    |
  45.       +---------+-------+-------+--------------------+
  46.                           C = Possibly CHR-ROM
  47.                           N = Mirrored (see Subsection G)
  48.                           P = Mirrored (see Subsection H)
  49.                           R = Mirror of $2000-2EFF (VRAM)
  50.                           F = Mirror of $0000-3FFF (VRAM)
  51. */
  52. // The structure for the PPU of the Nintendo.
  53. typedef struct tagNESPPU
  54. {
  55. BYTE* apbyPatternTables[2]; // The 2 pointers to the pattern tables.
  56. BYTE* apbyNameTables[4];    // The 4 pointers to the name tables.
  57. BYTE  abyNameTables[0x800]; // The actual memory for the name tables.
  58.                             // Since the NES only has enough physical RAM
  59.                             // for 2 name tables, the rest must be stored
  60.                             // on the Cart; this is mapper specific.
  61. BYTE  abyPalettes[0x20];    // Memory for the palettes.
  62. } NESPPU;
  63. #endif