hardware_constants.asm 4.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. ; From http://nocash.emubase.de/pandocs.htm.
  2. GBC EQU $11
  3. ; MBC1
  4. MBC1SRamEnable EQU $0000
  5. MBC1RomBank EQU $2000
  6. MBC1SRamBank EQU $4000
  7. MBC1SRamBankingMode EQU $6000
  8. SRAM_DISABLE EQU $00
  9. SRAM_ENABLE EQU $0a
  10. NUM_SRAM_BANKS EQU 4
  11. ; interrupt flags
  12. VBLANK EQU 0
  13. LCD_STAT EQU 1
  14. TIMER EQU 2
  15. SERIAL EQU 3
  16. JOYPAD EQU 4
  17. LY_VBLANK EQU 145
  18. ; OAM attribute flags
  19. OAM_PALETTE EQU %111
  20. OAM_TILE_BANK EQU 3
  21. OAM_OBP_NUM EQU 4 ; Non CGB Mode Only
  22. OAM_X_FLIP EQU 5
  23. OAM_Y_FLIP EQU 6
  24. OAM_PRIORITY EQU 7 ; 0: OBJ above BG, 1: OBJ behind BG (colors 1-3)
  25. ; serial
  26. START_TRANSFER_EXTERNAL_CLOCK EQU $80
  27. START_TRANSFER_INTERNAL_CLOCK EQU $81
  28. ; Hardware registers
  29. rJOYP EQU $ff00 ; Joypad (R/W)
  30. rSB EQU $ff01 ; Serial transfer data (R/W)
  31. rSC EQU $ff02 ; Serial Transfer Control (R/W)
  32. rSC_ON EQU 7
  33. rSC_CGB EQU 1
  34. rSC_CLOCK EQU 0
  35. rDIV EQU $ff04 ; Divider Register (R/W)
  36. rTIMA EQU $ff05 ; Timer counter (R/W)
  37. rTMA EQU $ff06 ; Timer Modulo (R/W)
  38. rTAC EQU $ff07 ; Timer Control (R/W)
  39. rTAC_ON EQU 2
  40. rTAC_4096_HZ EQU 0
  41. rTAC_262144_HZ EQU 1
  42. rTAC_65536_HZ EQU 2
  43. rTAC_16384_HZ EQU 3
  44. rIF EQU $ff0f ; Interrupt Flag (R/W)
  45. rNR10 EQU $ff10 ; Channel 1 Sweep register (R/W)
  46. rNR11 EQU $ff11 ; Channel 1 Sound length/Wave pattern duty (R/W)
  47. rNR12 EQU $ff12 ; Channel 1 Volume Envelope (R/W)
  48. rNR13 EQU $ff13 ; Channel 1 Frequency lo (Write Only)
  49. rNR14 EQU $ff14 ; Channel 1 Frequency hi (R/W)
  50. rNR21 EQU $ff16 ; Channel 2 Sound Length/Wave Pattern Duty (R/W)
  51. rNR22 EQU $ff17 ; Channel 2 Volume Envelope (R/W)
  52. rNR23 EQU $ff18 ; Channel 2 Frequency lo data (W)
  53. rNR24 EQU $ff19 ; Channel 2 Frequency hi data (R/W)
  54. rNR30 EQU $ff1a ; Channel 3 Sound on/off (R/W)
  55. rNR31 EQU $ff1b ; Channel 3 Sound Length
  56. rNR32 EQU $ff1c ; Channel 3 Select output level (R/W)
  57. rNR33 EQU $ff1d ; Channel 3 Frequency's lower data (W)
  58. rNR34 EQU $ff1e ; Channel 3 Frequency's higher data (R/W)
  59. rNR41 EQU $ff20 ; Channel 4 Sound Length (R/W)
  60. rNR42 EQU $ff21 ; Channel 4 Volume Envelope (R/W)
  61. rNR43 EQU $ff22 ; Channel 4 Polynomial Counter (R/W)
  62. rNR44 EQU $ff23 ; Channel 4 Counter/consecutive; Initial (R/W)
  63. rNR50 EQU $ff24 ; Channel control / ON-OFF / Volume (R/W)
  64. rNR51 EQU $ff25 ; Selection of Sound output terminal (R/W)
  65. rNR52 EQU $ff26 ; Sound on/off
  66. rLCDC EQU $ff40 ; LCD Control (R/W)
  67. rLCDC_ENABLE EQU 7
  68. rLCDC_ENABLE_MASK EQU 1 << rLCDC_ENABLE
  69. rSTAT EQU $ff41 ; LCDC Status (R/W)
  70. rSCY EQU $ff42 ; Scroll Y (R/W)
  71. rSCX EQU $ff43 ; Scroll X (R/W)
  72. rLY EQU $ff44 ; LCDC Y-Coordinate (R)
  73. rLYC EQU $ff45 ; LY Compare (R/W)
  74. rDMA EQU $ff46 ; DMA Transfer and Start Address (W)
  75. rBGP EQU $ff47 ; BG Palette Data (R/W) - Non CGB Mode Only
  76. rOBP0 EQU $ff48 ; Object Palette 0 Data (R/W) - Non CGB Mode Only
  77. rOBP1 EQU $ff49 ; Object Palette 1 Data (R/W) - Non CGB Mode Only
  78. rWY EQU $ff4a ; Window Y Position (R/W)
  79. rWX EQU $ff4b ; Window X Position minus 7 (R/W)
  80. rKEY1 EQU $ff4d ; CGB Mode Only - Prepare Speed Switch
  81. rVBK EQU $ff4f ; CGB Mode Only - VRAM Bank
  82. rHDMA1 EQU $ff51 ; CGB Mode Only - New DMA Source, High
  83. rHDMA2 EQU $ff52 ; CGB Mode Only - New DMA Source, Low
  84. rHDMA3 EQU $ff53 ; CGB Mode Only - New DMA Destination, High
  85. rHDMA4 EQU $ff54 ; CGB Mode Only - New DMA Destination, Low
  86. rHDMA5 EQU $ff55 ; CGB Mode Only - New DMA Length/Mode/Start
  87. rRP EQU $ff56 ; CGB Mode Only - Infrared Communications Port
  88. rBGPI EQU $ff68 ; CGB Mode Only - Background Palette Index
  89. rBGPD EQU $ff69 ; CGB Mode Only - Background Palette Data
  90. rOBPI EQU $ff6a ; CGB Mode Only - Sprite Palette Index
  91. rOBPD EQU $ff6b ; CGB Mode Only - Sprite Palette Data
  92. rUNKNOWN1 EQU $ff6c ; (FEh) Bit 0 (Read/Write) - CGB Mode Only
  93. rSVBK EQU $ff70 ; CGB Mode Only - WRAM Bank
  94. rUNKNOWN2 EQU $ff72 ; (00h) - Bit 0-7 (Read/Write)
  95. rUNKNOWN3 EQU $ff73 ; (00h) - Bit 0-7 (Read/Write)
  96. rUNKNOWN4 EQU $ff74 ; (00h) - Bit 0-7 (Read/Write) - CGB Mode Only
  97. rUNKNOWN5 EQU $ff75 ; (8Fh) - Bit 4-6 (Read/Write)
  98. rUNKNOWN6 EQU $ff76 ; (00h) - Always 00h (Read Only)
  99. rUNKNOWN7 EQU $ff77 ; (00h) - Always 00h (Read Only)
  100. rIE EQU $ffff ; Interrupt Enable (R/W)