variables.h 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. ; .include "routines/main.h"
  2. .ENUM $00 ;1byte direct page variables for kernel and game mechanics
  3. tmp ds 25
  4. tmpdma ds 4
  5. CurrentEvent db
  6. FrameCounterLo db
  7. FrameCounterHi db
  8. SetIni db
  9. ScreenMode db
  10. MainScreen db
  11. SubScreen db
  12. ScreenBrightness db
  13. BGTilesVram12 db
  14. BGTilesVram34 db
  15. BG1TilemapVram db
  16. BG2TilemapVram db
  17. BG3TilemapVram db
  18. BG4TilemapVram db
  19. SpriteTileOffsetVram dw
  20. ObjSel db
  21. BG1HOfLo db
  22. BG1HOfHi db
  23. BG1VOfLo db
  24. BG1VOfHi db
  25. BG2HOfLo db
  26. BG2HOfHi db
  27. BG2VOfLo db
  28. BG2VOfHi db
  29. HdmaFlags db
  30. HdmaPause db ;if msb is set, dont initiate further hdma transfers. this is useful when the rom hdma is trying to read from isnt present atm.
  31. ThreeBytePointerLo db
  32. ThreeBytePointerHi db
  33. ThreeBytePointerBank db
  34. ThreeBytePointerLo2 db
  35. ThreeBytePointerHi2 db
  36. ThreeBytePointerBank2 db
  37. BrightnessSpeed db
  38. LastFrameLo db
  39. LastFrameHi db
  40. CGWsel db
  41. CgadsubConfig db
  42. FixedColourR db
  43. FixedColourG db
  44. FixedColourB db
  45. InterruptEnableFlags db
  46. IrqRoutineNumber db
  47. IrqRoutineNumberBuffer db ;backup in case multiple irqs are executed per frame. nmi writes this number back to irq number every frame
  48. IrqVCounter dw
  49. IrqHCounter dw
  50. W12SEL db
  51. W34SEL db
  52. WOBJSEL db
  53. W1L db
  54. W1R db
  55. W2L db
  56. W2R db
  57. WBGLOG db
  58. WOBJLOG db
  59. WMS db
  60. WSS db
  61. Mosaic db
  62. BGTilesVram2 dw
  63. Bg3Status db
  64. PrintStringThreeBytePointerLo db
  65. PrintStringThreeBytePointerHi db
  66. PrintStringThreeBytePointerBank db
  67. VramBg1Tilemap dw
  68. VramBg2Tilemap dw
  69. VramBg3Tilemap dw
  70. VramBg4Tilemap dw
  71. VramBg1Tiles dw
  72. VramBg2Tiles dw
  73. VramBg3Tiles dw
  74. VramBg4Tiles dw
  75. SetBGThreeBytePointerLo db
  76. SetBGThreeBytePointerHi db
  77. SetBGThreeBytePointerBank db
  78. NMIOamUploadFlag db
  79. NMIPaletteUploadFlag db ;refresh palette during nmi?
  80. NMIBg1UploadFlag db ;refresh bg1 tilemap during nmi?
  81. NMIBg2UploadFlag db
  82. NMIBg3UploadFlag db ;UploadBg3Map db ;if this is not zero, upload tilemap to bg3
  83. CurrentMapNumber db ;number of currently loaded map
  84. CurrentMapPointer ds 3 ;24bit pointer to current map file
  85. CurrentColMapPointer ds 3 ;24 bit pointer to current collision map
  86. BgScrollCounterX db ;ranges from 0-7 inside one tile
  87. BgScrollCounterY db
  88. BgMapCurrentPositionX db ;current upper left tile on screen
  89. BgMapCurrentPositionY db
  90. ScreenPixelPositionX dw ;exact pixel position of upper left border for sprite position calculation
  91. ScreenPixelPositionY dw ;exact pixel position of upper left border for sprite position calculation
  92. BgScrollRowUploadDisplace db ;number of tiles to add/substract when uploading tilerows. this gets added to current position in map depending on the scrolling direction.(scroll right: add 28/scroll left: substract 1)
  93. BgScrollTilemapRowUploadDisplaceX db ;number of tiles to add/substract when uploading tilerows. this gets added to current position in map depending on the scrolling direction.(scroll right: add 28/scroll left: substract 1)
  94. BgScrollTilemapRowUploadDisplaceY db ;number of tiles to add/substract when uploading tilerows. this gets added to current position in map depending on the scrolling direction.(scroll right: add 28/scroll left: substract 1)
  95. BgScrollOffsetPointerTilesX db ;pointer to current vertical column that holds the leftmost tiles onscreen(goes from 0-27)
  96. BgScrollOffsetPointerTilesY db
  97. BgScrollOffsetPointerTilemapX db ;pointer to current vertical column that holds the leftmost tiles onscreen for tilemap (goes from 0-32)
  98. BgScrollOffsetPointerTilemapY db
  99. BgScrollTileSourcePointer ds 3 ;pointer to first tile of tileline to be uplodaded
  100. DmaFifoPointer dw ;relative pointer to current free entry in buffer
  101. DmaFifoPointerIrq dw
  102. DmaFifoSourcePointerLo dw
  103. DmaFifoSourcePointerBa db
  104. DmaFifoOverhang dw
  105. DmaFifoTotalBytesTransferred dw ;used to guesstimate how much time we have left for transfers
  106. ObjectListPointer dw ;pointer to next free object in object list
  107. ObjectListPointerCurrent dw ;pointer to current object in object list, used to set direct register
  108. CurrentObjectNumber db ;number of currently selected object in list
  109. OamBufferPointer dw ;pointer to current sprite in oam buffer
  110. OamZsortBufferPointer dw ;pointer to current sprite in oam zsort buffer
  111. OamZsortSpriteNumber db ;number of sprites to sort
  112. OamAniListStraightRepeatFlag dw
  113. FocusScreenFlags db ;flags for focus
  114. ;bit0=enable focus on object
  115. FocusScreenObject db ;number of object in object list to focus to
  116. FocusScreenSpline db ;number of preset table to use for scrolling depending on distance to object(linear,sine,exp etc)
  117. FocusScreenXWait db
  118. FocusScreenYWait db
  119. CollisionPixelX dw
  120. CollisionPixelY dw
  121. CollisionTemp dw
  122. PalTemp db ;used for object subroutine
  123. ExitCollisionPointer dw ;bits0-14 contain number of exit. old:;bits0-14 contain pointer to an entry in the exit list. if bit15 is set, this exit has been hit and needs to be procesed.
  124. R1 db ;random number generator buffers
  125. R2 db
  126. R3 db
  127. R4 db
  128. ColObjListPointer dw
  129. HdmaListPointer dw
  130. VwfFontPointerLo ds 3
  131. Spctmp ds 8 ;temp buffer for spc stuff
  132. SpcCurrentStreamSet db
  133. SpcHandlerState db
  134. SpcHandlerArgument0 db
  135. SpcHandlerArgument1 db
  136. SpcHandlerArgument2 db
  137. SpcCmdFifoStart db
  138. SpcCmdFifoEnd db
  139. PtPlayerDataPointerLo db ;assumes dreg: $0000
  140. PtPlayerDataPointerHi db ;assumes dreg: $0000
  141. PtPlayerDataPointerBa db ;assumes dreg: $0000
  142. PtPlayerCurrentSong db ;assumes dreg: $0000
  143. PtPlayerCurrentSamplePack db
  144. PtPlayerCurrentSoundEffect db
  145. PtPlayerSmplBufferPosLo db ;not needed at all
  146. PtPlayerSmplBufferPosHi db
  147. SpcUploadedFlag db ;msb set=song upload complete and playing. bit6 set=sample pack uploaded
  148. VideoHandlerState db
  149. CheckJoypadMode db ;0=1 player, 1=8 players, 2=instruments + 1 joypad
  150. FontSelector db
  151. FixedStringLength db
  152. PrintStringPalette db
  153. MenuFileThreeBytePointerLo db
  154. MenuFileThreeBytePointerHi db
  155. MenuFileThreeBytePointerBank db
  156. MenuRowsThreeBytePointerLo db
  157. MenuRowsThreeBytePointerHi db
  158. MenuRowsThreeBytePointerBank db
  159. MenuRowsThreeByteOptionPointerLo db
  160. MenuRowsThreeByteOptionPointerHi db
  161. MenuRowsThreeByteOptionPointerBank db
  162. MenuRowsThreeByteCodePointerLo db
  163. MenuRowsThreeByteCodePointerHi db
  164. MenuRowsThreeByteCodePointerBank db
  165. LoadMenuInitialOffset dw
  166. LoadMenuInitialOptionOffset dw
  167. LoadMenuVerticalSpacing dw
  168. LoadMenuNumberOfRows db
  169. LoadMenuCurrentRow db
  170. LoadMenuStringPosLo db
  171. LoadMenuStringPosHi db
  172. LoadMenuPalUnselSel db
  173. LoadMenuDoInit db
  174. ;BattleSubroutine db
  175. HdmaListCounter db ;counter used by hdma handler to switch through channels
  176. tmpIrq ds 8 ;Temporary Buffer for irq routines
  177. BattleMusicState db
  178. ;CurrentTablistPointer ds 3
  179. .ENDE
  180. .ENUM $200 ;2-byte adresses for game status stuff
  181. tmpTest ds 4
  182. Hdma3dScrollCountV db ;amount of lines to wait before hdma table
  183. CurrentBattleFile db
  184. MapStartPosX db ;map start position set by external routine
  185. MapStartPosY db
  186. MapSizeX db ;/must not be seperated cause they may be written to both at the same time in word-mode
  187. MapSizeY db ;\
  188. BGMapStartPosX db ;start position for bg upload(may differ from sprite location if near a border)
  189. BGMapStartPosY db
  190. CurrentStringTarget db ;current position in bg1 tilemap to write to, 2 bytes
  191. CurrentStringTargetHi db
  192. FixedColourRsave db
  193. FixedColourGsave db
  194. FixedColourBsave db
  195. CpuUsageScanline db
  196. SpcStreamVolume db
  197. SpcSEVolume db
  198. SpcSEPitch db
  199. SpcSongSpeed db ;default $a0
  200. SpcSongChMask db ;default $0f
  201. SpcReportType dw ;0=none 1=timecode 2=channel-levels(vol out) 3=special mod command
  202. SpcCmdFifo ds 64
  203. MessageDeleteCounter dw ;inactive when zero, delete message when 1(then set zero), decrease each frame when not 0 or 1
  204. HdmaFadeInOutState db ;bit7set=fade in/bit7clear=fade out,bit6set=done fading bit0-5=current state in LUT for window and mosiac size
  205. MainCharaObjectNumber db
  206. MainCharaXPos dw
  207. MainCharaYPos dw
  208. ExitMapTarget dw ;target map
  209. ExitXTarget dw ;target x-pos on map
  210. ExitYTarget dw ;target y-pos on map
  211. Pseudo3dScrollUpdateFlag db ;if this isnt zero, update scroll table
  212. CurrentLevel dw
  213. PlayerState db ;current mode of player characters. 0=active battle 1=player select menu(start sitting. when start pressed for that player, switch to subroutine that is similar to battle, but without being able to fight) 2=results screen.
  214. PlayersPresentFlags db ;flags to signalize players connected.
  215. ActivePlayers db ;number of alive players
  216. WinningPlayer db ;number of player that has won the match. $ff=invalid
  217. IrqBrightnessIncDec db ;just a flag. bit0 set=increase. bit1 clear=decrease. bit8=ack/done
  218. BrightnessEventBuffer db ;buffer event routine to jum p to after brightness inc/dec
  219. SpcStreamFrame dw
  220. SpcSoundEffectFlipFlag dw ;flag alternating between each sound effect upload so that spc doesnt trigger the same one twice.
  221. BattleFinished db ;$80 if battle is finished
  222. IntroScene3ScrollPoint dw
  223. VideoFrames db
  224. VideoFrameRate dw ;ANDed with framecounter. 0=60hz, 1=30hz, 3=15hz etc.
  225. CurrentVideo db
  226. CurrentVideoFrame db
  227. PlayerSelectScrollCounter dw
  228. WinningPlayerPointer dw
  229. RandomLevelCounter db ;msb=shuffle direction. bits0-3 level number
  230. RandomStreamCounter db ;msb=shuffle direction. bits0-3 Streamset number
  231. SpecialReportOld db
  232. HdmaScrollPointerBuffer dw
  233. GravityCutOffYPos dw ;y-pos of object(with 4bit precision) that triggers delete if bigger and gravity affected
  234. GravObjectCounter db ;counter of particle/gravity objects to create to prevent slowdown and such
  235. MaxGravObjCount db ;max allowed particles per frame. dont create new ones if exceeded
  236. EventJumper db ;variable to select which event to jump to in debug menu
  237. CollisionObjPointer dw ;pointer to object that just has collided with calling obj
  238. Reg3000WriteVar db
  239. VIrqCounter dw
  240. ExtIrqCounter dw
  241. CartChecksum dw
  242. QD16BankCount db ;number of rom banks
  243. Qd16LoadProgress dw ;percentage of banks loaded
  244. Qd16Flags db ;bit0=rom upload started
  245. ;bit1=header found
  246. ;bit2=irq-com mode entered
  247. Qd16Mbit dw
  248. VwfStringLineBreakCounter dw ;keeps track of the last <space>
  249. VwfStringPixelCounter dw ;keeps track of position in line
  250. VwfStringTileCounter dw ;keeps track of tile position in line
  251. VwfStringLineCounter dw ;keeps track of position in line
  252. VwfStringStringPointer dw ;pointer to current letter in string buffer
  253. VwfStringLineLength db ;length of line in tiles. must be set before stringprocessor is executed
  254. VwfStringLineNumber db ;number of lines. must be set before blablah.
  255. VwfStringCurrentFont db
  256. VwfEvent db ;which vwf routine to execute
  257. VwfCurrentString dw ;15bit, which string to load
  258. VwfTextBoxXPos db ;position of left, upper sprite of textbox
  259. VwfTextBoxYPos db ;position of left, upper sprite of textbox
  260. VwfTextBoxMenuPointer dw
  261. VwfCursorObjectNumber db ;number of object in object list
  262. VwfDrawSpeed db ;0=1 letter per frame. msb set: max speed, draw until string end command has been.
  263. VwfDrawSpeedCounter db
  264. VwfLineUpdateFlag ds 4
  265. VwfSubStringStackPointer dw
  266. ObjectFreezeFlag db ;if not zero, applicable objects should not be processed.
  267. TextWindowFadeStatus db
  268. TextWindow db
  269. PercentageBuff db ;buffer for percentage display
  270. PalEffectPointer dw ;pointer to current pal-effect
  271. EventBuffer db
  272. FrameWait db
  273. SpcReportInstrBuff dw
  274. .ENDE
  275. .ENUM $7e0300
  276. JoyPort1Data1Io0Buffer ds 4
  277. JoyPort1Data2Io0Buffer ds 4
  278. JoyPort2Data1Io0Buffer ds 4
  279. JoyPort2Data2Io0Buffer ds 4
  280. JoyPort1Data1Io1Buffer ds 4
  281. JoyPort1Data2Io1Buffer ds 4
  282. JoyPort2Data1Io1Buffer ds 4
  283. JoyPort2Data2Io1Buffer ds 4
  284. VectorAngleSMCode ds 9 ;8 inc/decs per frame + rtl
  285. LoadMenuStringBuffer ds 9
  286. PrintStringBuffer0 ds 16
  287. ;.ende
  288. JoyPortBuffer ds 16 ;8 joypads max, word entries.
  289. ;0=port1 joy 1
  290. ;2=port1 joy 2
  291. ;4=port1 joy 3
  292. ;6=port1 joy 4
  293. ;8=port2 joy 1
  294. ;a=port2 joy 2
  295. ;c=port2 joy 3
  296. ;e=port2 joy 4
  297. JoyPortBufferOld ds 16
  298. JoyPortBufferTrigger ds 16
  299. ;joypad buttons:
  300. ;15 14 13 12 11 10 9 8 7 6 5 4 3 2 1 0
  301. ;b y se st U D L R a x l r 0 0 0 0
  302. PaletteBuffer ds $0200 ;bg3 palettes: buffer $0-$20 (4 different 4-color palettes, for text
  303. Bg1MapBuffer ds $1000
  304. Bg2MapBuffer ds $800
  305. Bg3MapBuffer ds $0800
  306. Bg4MapBuffer ds $1
  307. OamZSortBuffer ds $0500 ;256 entries, each 6 bytes
  308. OamZSortObjList ds 128*2 ;prioritized list of objects that need priority processing(2 byte relative pointers)
  309. ;ZSortOamPriorityBuffer ds $0040
  310. OamBuffer ds $0200
  311. OamPriorityBuffer ds $0020
  312. DmaFifoBuffer ds $1000 ;DmaFifoEntryLength*256
  313. ObjectList ds $0800 ;32 entries, each 32 bytes
  314. ExitList ds $0080 ;16 entries, each 8 bytes
  315. ColObjList ds $00c0 ;32 entries, each 4 bytes
  316. HdmaBuffer ds $0340
  317. HdmaBuffer1 ds $0340
  318. HdmaBuffer2 ds $0340
  319. HdmaBuffer3 ds $0340
  320. HdmaBuffer4 ds $0340
  321. HdmaBuffer5 ds $0340
  322. HdmaDataBuffer1 ds $0400
  323. HdmaSpcBuffer ds 200 ;streaming table, uses channel 7
  324. TextBoxMenuBuffer ds $0040 ;8 entries * 8
  325. SpcReportBuffer ds 16 ;8 entries, each 2 bytes
  326. ;0=none
  327. ;2=timecode
  328. ;4=channel levels
  329. ;6=special mod cmd
  330. Hdma3dScrollBuffer ds 400 ;80 entries, each 5 bytes
  331. WinnerArray ds 8*1
  332. PalEffectBuffer ds $800
  333. VwfSubStringStack ds 16*8 ;can ne nested 16 times
  334. VwfSubstringBuffer ds 16 ;used for printing numbers
  335. VwfStringBuffer ds $0400
  336. VwfPlotBuffer ds $1000 ;28 tiles * 8 lines * 16bytes per tile
  337. .ENDE