registers_alt.inc 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309
  1. (*
  2. $Id: registers_alt.inc 25 2007-12-10 21:06:46Z p4p3r0 $
  3. ------------------------------------------------------------------------------
  4. Copyright (C) 2005
  5. Jason Rogers (dovoto)
  6. Dave Murphy (WinterMute)
  7. This software is provided 'as-is', without any express or implied
  8. warranty. In no event will the authors be held liable for any
  9. damages arising from the use of this software.
  10. Permission is granted to anyone to use this software for any
  11. purpose, including commercial applications, and to alter it and
  12. redistribute it freely, subject to the following restrictions:
  13. 1. The origin of this software must not be misrepresented; you
  14. must not claim that you wrote the original software. If you use
  15. this software in a product, an acknowledgment in the product
  16. documentation would be appreciated but is not required.
  17. 2. Altered source versions must be plainly marked as such, and
  18. must not be misrepresented as being the original software.
  19. 3. This notice may not be removed or altered from any source
  20. distribution.
  21. ------------------------------------------------------------------------------
  22. Conversion by Legolas (http://itaprogaming.free.fr) for freepascal compiler
  23. (http://www.freepascal.org)
  24. Copyright (C) 2006 Francesco Lombardi
  25. Check http://sourceforge.net/projects/libndsfpc for updates
  26. ------------------------------------------------------------------------------
  27. $Log$
  28. *)
  29. {$ifdef NDS_INTERFACE}
  30. const
  31. REG_DISPCNT : pcuint32 = pointer($4000000);
  32. {$ifdef ARM9}
  33. WAIT_CR = REG_EXMEMCNT;
  34. {$else}
  35. WAIT_CR = REG_EXMEMSTAT;
  36. {$endif}
  37. DISP_SR = REG_DISPSTAT;
  38. DISP_Y = REG_VCOUNT;
  39. REG_BGCTRL : pcuint16 = pointer($4000008);
  40. REG_BG0CNT : pcuint16 = pointer($4000008);
  41. REG_BG1CNT : pcuint16 = pointer($400000A);
  42. REG_BG2CNT : pcuint16 = pointer($400000C);
  43. REG_BG3CNT : pcuint16 = pointer($400000E);
  44. REG_BGOFFSETS : pcuint16 = pointer($4000010);
  45. REG_BG0HOFS : pcuint16 = pointer($4000010);
  46. REG_BG0VOFS : pcuint16 = pointer($4000012);
  47. REG_BG1HOFS : pcuint16 = pointer($4000014);
  48. REG_BG1VOFS : pcuint16 = pointer($4000016);
  49. REG_BG2HOFS : pcuint16 = pointer($4000018);
  50. REG_BG2VOFS : pcuint16 = pointer($400001A);
  51. REG_BG3HOFS : pcuint16 = pointer($400001C);
  52. REG_BG3VOFS : pcuint16 = pointer($400001E);
  53. REG_BG2PA : pcuint16 = pointer($4000020);
  54. REG_BG2PB : pcuint16 = pointer($4000022);
  55. REG_BG2PC : pcuint16 = pointer($4000024);
  56. REG_BG2PD : pcuint16 = pointer($4000026);
  57. REG_BG2X : pcuint32 = pointer($4000028);
  58. REG_BG2X_L : pcuint16 = pointer($4000028);
  59. REG_BG2X_H : pcuint16 = pointer($400002A);
  60. REG_BG2Y : pcuint32 = pointer($400002C);
  61. REG_BG2Y_L : pcuint16 = pointer($400002C);
  62. REG_BG2Y_H : pcuint16 = pointer($400002E);
  63. REG_BG3PA : pcuint16 = pointer($4000030);
  64. REG_BG3PB : pcuint16 = pointer($4000032);
  65. REG_BG3PC : pcuint16 = pointer($4000034);
  66. REG_BG3PD : pcuint16 = pointer($4000036);
  67. REG_BG3X : pcuint32 = pointer($4000038);
  68. REG_BG3X_L : pcuint16 = pointer($4000038);
  69. REG_BG3X_H : pcuint16 = pointer($400003A);
  70. REG_BG3Y : pcuint32 = pointer($400003C);
  71. REG_BG3Y_L : pcuint16 = pointer($400003C);
  72. REG_BG3Y_H : pcuint16 = pointer($400003E);
  73. REG_WIN0H : pcuint16 = pointer($4000040);
  74. REG_WIN1H : pcuint16 = pointer($4000042);
  75. REG_WIN0V : pcuint16 = pointer($4000044);
  76. REG_WIN1V : pcuint16 = pointer($4000046);
  77. REG_WININ : pcuint16 = pointer($4000048);
  78. REG_WINOUT : pcuint16 = pointer($400004A);
  79. REG_MOSAIC : pcuint32 = pointer($400004C);
  80. REG_MOSAIC_L : pcuint32 = pointer($400004C);
  81. REG_MOSAIC_H : pcuint32 = pointer($400004E);
  82. REG_BLDMOD : pcuint16 = pointer($4000050);
  83. REG_COLV : pcuint16 = pointer($4000052);
  84. REG_COLY : pcuint16 = pointer($4000054);
  85. SERIAL_CR = REG_SPICNT;
  86. SERIAL_DATA = REG_SPIDATA;
  87. SIO_CR = REG_SIOCNT;
  88. R_CR = REG_RCNT;
  89. (* secondary screen *)
  90. REG_DISPCNT_SUB : pcuint32 = pointer($4001000);
  91. REG_BGCTRL_SUB : pcuint16 = pointer($4001008);
  92. REG_BG0CNT_SUB : pcuint16 = pointer($4001008);
  93. REG_BG1CNT_SUB : pcuint16 = pointer($400100A);
  94. REG_BG2CNT_SUB : pcuint16 = pointer($400100C);
  95. REG_BG3CNT_SUB : pcuint16 = pointer($400100E);
  96. REG_BGOFFSETS_SUB : pcuint16 = pointer($4001010);
  97. REG_BG0HOFS_SUB : pcuint16 = pointer($4001010);
  98. REG_BG0VOFS_SUB : pcuint16 = pointer($4001012);
  99. REG_BG1HOFS_SUB : pcuint16 = pointer($4001014);
  100. REG_BG1VOFS_SUB : pcuint16 = pointer($4001016);
  101. REG_BG2HOFS_SUB : pcuint16 = pointer($4001018);
  102. REG_BG2VOFS_SUB : pcuint16 = pointer($400101A);
  103. REG_BG3HOFS_SUB : pcuint16 = pointer($400101C);
  104. REG_BG3VOFS_SUB : pcuint16 = pointer($400101E);
  105. REG_BG2PA_SUB : pcuint16 = pointer($4001020);
  106. REG_BG2PB_SUB : pcuint16 = pointer($4001022);
  107. REG_BG2PC_SUB : pcuint16 = pointer($4001024);
  108. REG_BG2PD_SUB : pcuint16 = pointer($4001026);
  109. REG_BG2X_SUB : pcuint32 = pointer($4001028);
  110. REG_BG2Y_SUB : pcuint32 = pointer($400102C);
  111. REG_BG3PA_SUB : pcuint16 = pointer($4001030);
  112. REG_BG3PB_SUB : pcuint16 = pointer($4001032);
  113. REG_BG3PC_SUB : pcuint16 = pointer($4001034);
  114. REG_BG3PD_SUB : pcuint16 = pointer($4001036);
  115. REG_BG3X_SUB : pcuint32 = pointer($4001038);
  116. REG_BG3X_L_SUB : pcuint16 = pointer($4001038);
  117. REG_BG3X_H_SUB : pcuint16 = pointer($400103A);
  118. REG_BG3Y_SUB : pcuint32 = pointer($400103C);
  119. REG_BG3Y_L_SUB : pcuint16 = pointer($400103C);
  120. REG_BG3Y_H_SUB : pcuint16 = pointer($400103E);
  121. REG_WIN0H_SUB : pcuint16 = pointer($4001040);
  122. REG_WIN1H_SUB : pcuint16 = pointer($4001042);
  123. REG_WIN0V_SUB : pcuint16 = pointer($4001044);
  124. REG_WIN1V_SUB : pcuint16 = pointer($4001046);
  125. REG_WININ_SUB : pcuint16 = pointer($4001048);
  126. REG_WINOUT_SUB : pcuint16 = pointer($400104A);
  127. REG_MOSAIC_SUB : pcuint32 = pointer($400104C);
  128. REG_MOSAIC_L_SUB : pcuint32 = pointer($400104C);
  129. REG_MOSAIC_H_SUB : pcuint32 = pointer($400104E);
  130. REG_BLDMOD_SUB : pcuint16 = pointer($4001050);
  131. REG_COLV_SUB : pcuint16 = pointer($4001052);
  132. REG_COLY_SUB : pcuint16 = pointer($4001054);
  133. (*common*)
  134. REG_DMA : pcuint32 = pointer($40000B0);
  135. REG_DMA0SAD : pcuint32 = pointer($40000B0);
  136. REG_DMA0SAD_L : pcuint16 = pointer($40000B0);
  137. REG_DMA0SAD_H : pcuint16 = pointer($40000B2);
  138. REG_DMA0DAD : pcuint32 = pointer($40000B4);
  139. REG_DMA0DAD_L : pcuint16 = pointer($40000B4);
  140. REG_DMA0DAD_H : pcuint16 = pointer($40000B6);
  141. REG_DMA0CNT : pcuint32 = pointer($40000B8);
  142. REG_DMA0CNT_L : pcuint16 = pointer($40000B8);
  143. REG_DMA0CNT_H : pcuint16 = pointer($40000BA);
  144. REG_DMA1SAD : pcuint32 = pointer($40000BC);
  145. REG_DMA1SAD_L : pcuint16 = pointer($40000BC);
  146. REG_DMA1SAD_H : pcuint16 = pointer($40000BE);
  147. REG_DMA1DAD : pcuint32 = pointer($40000C0);
  148. REG_DMA1DAD_L : pcuint16 = pointer($40000C0);
  149. REG_DMA1DAD_H : pcuint16 = pointer($40000C2);
  150. REG_DMA1CNT : pcuint32 = pointer($40000C4);
  151. REG_DMA1CNT_L : pcuint16 = pointer($40000C4);
  152. REG_DMA1CNT_H : pcuint16 = pointer($40000C6);
  153. REG_DMA2SAD : pcuint32 = pointer($40000C8);
  154. REG_DMA2SAD_L : pcuint16 = pointer($40000C8);
  155. REG_DMA2SAD_H : pcuint16 = pointer($40000CA);
  156. REG_DMA2DAD : pcuint32 = pointer($40000CC);
  157. REG_DMA2DAD_L : pcuint16 = pointer($40000CC);
  158. REG_DMA2DAD_H : pcuint16 = pointer($40000CE);
  159. REG_DMA2CNT : pcuint32 = pointer($40000D0);
  160. REG_DMA2CNT_L : pcuint16 = pointer($40000D0);
  161. REG_DMA2CNT_H : pcuint16 = pointer($40000D2);
  162. REG_DMA3SAD : pcuint32 = pointer($40000D4);
  163. REG_DMA3SAD_L : pcuint16 = pointer($40000D4);
  164. REG_DMA3SAD_H : pcuint16 = pointer($40000D6);
  165. REG_DMA3DAD : pcuint32 = pointer($40000D8);
  166. REG_DMA3DAD_L : pcuint16 = pointer($40000D8);
  167. REG_DMA3DAD_H : pcuint16 = pointer($40000DA);
  168. REG_DMA3CNT : pcuint32 = pointer($40000DC);
  169. REG_DMA3CNT_L : pcuint16 = pointer($40000DC);
  170. REG_DMA3CNT_H : pcuint16 = pointer($40000DE);
  171. REG_TIME : pcuint16 = pointer($4000100);
  172. REG_TM0D : pcuint16 = pointer($4000100);
  173. REG_TM0CNT : pcuint16 = pointer($4000102);
  174. REG_TM1D : pcuint16 = pointer($4000106);
  175. REG_TM2D : pcuint16 = pointer($4000108);
  176. REG_TM2CNT : pcuint16 = pointer($400010A);
  177. REG_TM3D : pcuint16 = pointer($400010C);
  178. REG_TM3CNT : pcuint16 = pointer($400010E);
  179. REG_SIOCNT : pcuint16 = pointer($4000128);
  180. REG_SIOMLT_SEND : pcuint16 = pointer($400012A);
  181. KEYS = REG_KEYINPUT;
  182. KEYS_CR = REG_KEYCNT;
  183. //???
  184. REG_RCNT : pcuint16 = pointer($4000134);
  185. REG_HS_CTRL : pcuint16 = pointer($4000140);
  186. (* Interupt enable registers *)
  187. IE = REG_IE;
  188. _IF = REG_IF;
  189. IME = REG_IME;
  190. (*controls power 0x30f is all on *)
  191. POWER_CR = REG_POWERCNT;
  192. (* ram controllers 0x8 is enabled, other bits have to do with mapping *)
  193. REG_VRAM_A_CR : pcuint8 = pointer($4000240);
  194. REG_VRAM_B_CR : pcuint8 = pointer($4000241);
  195. REG_VRAM_C_CR : pcuint8 = pointer($4000242);
  196. REG_VRAM_D_CR : pcuint8 = pointer($4000243);
  197. REG_VRAM_E_CR : pcuint8 = pointer($4000244);
  198. REG_VRAM_F_CR : pcuint8 = pointer($4000245);
  199. REG_VRAM_G_CR : pcuint8 = pointer($4000246);
  200. REG_VRAM_H_CR : pcuint8 = pointer($4000248);
  201. REG_VRAM_I_CR : pcuint8 = pointer($4000249);
  202. REG_WRAM_CNT : pcuint8 = pointer($4000247);
  203. (*3D graphics suff*)
  204. REG_GFX_FIFO : pcuint32 = pointer($4000400);
  205. REG_GFX_STATUS : pcuint32 = pointer($4000600);
  206. REG_GFX_CONTROL : pcuint16 = pointer($4000060);
  207. REG_COLOR : pcuint32 = pointer($4000480);
  208. REG_VERTEX16 : pcuint32 = pointer($400048C);
  209. REG_TEXT_COORD : pcuint32 = pointer($4000488);
  210. REG_TEXT_FORMAT : pcuint32 = pointer($40004A8);
  211. REG_CLEAR_COLOR : pcuint32 = pointer($4000350);
  212. REG_CLEAR_DEPTH : pcuint16 = pointer($4000354);
  213. REG_LIGHT_VECTOR : pcuint32 = pointer($40004C8);
  214. REG_LIGHT_COLOR : pcuint32 = pointer($40004CC);
  215. REG_NORMAL : pcuint32 = pointer($4000484);
  216. REG_DIFFUSE_AMBIENT : pcuint32 = pointer($40004C0);
  217. REG_SPECULAR_EMISSION : pcuint32 = pointer($40004C4);
  218. REG_SHININESS : pcuint32 = pointer($40004D0);
  219. REG_POLY_FORMAT : pcuint32 = pointer($40004A4);
  220. REG_GFX_BEGIN : pcuint32 = pointer($4000500);
  221. REG_GFX_END : pcuint32 = pointer($4000504);
  222. REG_GFX_FLUSH : pcuint32 = pointer($4000540);
  223. REG_GFX_VIEWPORT : pcuint32 = pointer($4000580);
  224. REG_MTX_CONTROL : pcuint32 = pointer($4000440);
  225. REG_MTX_PUSH : pcuint32 = pointer($4000444);
  226. REG_MTX_POP : pcuint32 = pointer($4000448);
  227. REG_MTX_SCALE : pcint32 = pointer($400046C);
  228. REG_MTX_TRANSLATE : pcint32 = pointer($4000470);
  229. REG_MTX_RESTORE : pcuint32 = pointer($4000450);
  230. REG_MTX_STORE : pcuint32 = pointer($400044C);
  231. REG_MTX_IDENTITY : pcuint32 = pointer($4000454);
  232. REG_MTX_LOAD4x4 : ^f32 = pointer($4000458);
  233. REG_MTX_LOAD4x3 : ^f32 = pointer($400045C);
  234. REG_MTX_MULT4x4 : ^f32 = pointer($4000460);
  235. REG_MTX_MULT4x3 : ^f32 = pointer($4000464);
  236. REG_MTX_MULT3x3 : ^f32 = pointer($4000468);
  237. // Card bus
  238. REG_CARD_CR1 : pcuint32 = pointer($040001A0);
  239. REG_CARD_CR1H : pcuint8 = pointer($040001A1);
  240. REG_CARD_CR2 : pcuint32 = pointer($040001A4);
  241. REG_CARD_COMMAND : pcuint8 = pointer($040001A8);
  242. REG_CARD_DATA : pcuint32 = pointer($04100000);
  243. REG_CARD_DATA_RD : pcuint32 = pointer($04100010);
  244. REG_CARD_1B0 : pcuint32 = pointer($040001B0);
  245. REG_CARD_1B4 : pcuint32 = pointer($040001B4);
  246. REG_CARD_1B8 : pcuint16 = pointer($040001B8);
  247. REG_CARD_1BA : pcuint16 = pointer($040001BA);
  248. {$endif NDS_INTERFACE}