Geekboy

Untitled

Mar 31st, 2013
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ;Starting point for CaDan
  2. ;
  3. ;
  4. ;
  5.  
  6.  
  7. ;VARIABLE EQUATES STARTING AT APPBACKUPSCREEN ($9872)
  8. stack         = appbackupscreen ;2b Saved location of the stack
  9. saveiy        = stack+2         ;2b Saved contents of IY
  10. islotcount    = saveiy+2        ;1b Number of interrupt slots
  11. islotbank     = islotcount+1    ;36b 3*12 interrupt slot data available.
  12. scorefilebase = islotbank+36    ;2b Start of scoring file data
  13. myflags       = scorefilebase+2 ;8b Flags. Defined far below.
  14. itemp1        = myflags+8       ;2 bytes, temporary memory 1
  15. itemp2        = itemp1+2        ;2 bytes, temporary memory 2
  16. itemp3        = itemp2+2        ;2 bytes, temporary memory 3
  17. itemp4        = itemp3+2        ;2 bytes, temporary memory 4
  18. gametimer1    = itemp4+2        ;1 byte, running game timer for each
  19. intcount      = gametimer1+1    ;1 byte, interrupt cycle count
  20. keyread       = intcount+1      ;1 byte, key that was immediately read
  21. keywait       = keyread+1       ;1 byte, waiting until held key hits again
  22. keyoutput     = keywait+1       ;1 byte, value that keywaited routines read.
  23. texty         = keyoutput+1     ;1 byte, current y position of text
  24. textx         = texty+1         ;1 byte, current x position of text
  25. textxbase     = textx+1         ;1 byte, starting x on new line
  26. textxlim      = textxbase+1     ;1 byte, right edge limiter of text
  27. prevchar      = textxlim+1      ;1 byte, previous character used
  28. screenbuf     = prevchar+1      ;2 byte, moveable screen buffer for menusys
  29. lineheight    = screenbuf+2     ;1 byte, distance between tops of two strings
  30. curmenu       = lineheight+1    ;2 byte, address of currently running menu
  31. curscore      = curmenu+2       ;4 byte, current score
  32. tempscore     = curscore+4      ;4 byte, pool for score adding to curscore
  33. scorediv      = tempscore+4     ;1 byte, bit to start with div by 8 (cycle ud)
  34. scoretime     = scorediv+1      ;1 byte, timeframe until score done updating
  35. characterID   = scoretime+1     ;1 byte, given character ID
  36. charbombs     = characterID+1   ;1 byte, number of bombs the character has
  37. charcurbombs  = charbombs+1     ;1 byte, number of bombs character has now
  38. charpower     = charcurbombs+1  ;1 byte, power behind each shot
  39. charweapon1   = charpower+1     ;1 byte, unfocused weapon for character
  40. charweapon2   = charweapon1+1   ;1 byte, focused weapon for character
  41. charweapondat = charweapon2+1   ;1 byte, temporary variable for player state
  42. charbolad     = charweapondat+1 ;1 byte, character max BoLaD
  43. charcurbolad  = charbolad+1     ;1 byte, character current BoLaD counter
  44. chardu        = charcurbolad+1  ;1 byte, character movement delta for unfocus
  45. chardf        = chardu+1        ;1 byte, character movement delta for focused
  46. curstage      = chardf+1        ;1 byte, current stage number. 1=first, 7=ext
  47. curdiff       = curstage+1      ;1 byte, current difficulty setting.
  48. menuchoice    = curdiff+1       ;2 byte, menu item chosen ($FF=none). 1b slack
  49. chary         = menuchoice+2    ;1 byte, current character y position
  50. charx         = chary+1         ;1 byte, current character x position
  51. charlives     = charx+1         ;1 byte, number of lives character has.
  52. rectimer      = charlives+1     ;1 byte, timer dedicated for player recovery
  53. curkills      = rectimer+1      ;1 byte, # of kills achieved. Used as money
  54. saveix        = curkills+1      ;2 bytes, used in script system for data ptr
  55. overflow      = saveix+2        ;1 byte, stores MSB of mult, or remainder.
  56. curpos        = overflow+2      ;2 bytes, current Y,X of script obj selected
  57. freebullet1   = curpos+2        ;1 byte, half pointer to FBT. (MSB is $8C)
  58. freebullet2   = freebullet1+1   ;1 byte, points to other half of FBT (b7 set)
  59. pbtfreebullet = freebullet2+1   ;1 byte, pointer to PBT's FBT (0-63)
  60. firedelay     = pbtfreebullet+1 ;1 byte, delay in firing, by creator routines
  61. bossHP        = firedelay+1     ;2 bytes, boss HP value
  62. bossArmor     = bossHP+2        ;1 byte, resistance to normal fire
  63. bossShell     = bossArmor+1     ;1 byte, resistance to spellcards
  64. bossTimer     = bossShell+1     ;1 byte, multipurpose boss timer
  65. initseed      = bossTimer+1     ;2 bytes, initial seed for... well... seeding
  66. lfsrseed1     = initseed+2      ;1 byte, seed for the 1 byte LFSR routine
  67. lfsrseed2     = lfsrseed1+1     ;2 bytes, seed for the 2 byte LFSR routine
  68. ramfree       = lfsrseed2+2     ;2 bytes, amount of memory free for resources
  69.  
  70. endofdefs1    = ramfree+2
  71. #ifdef main_build
  72. .echo "ABS varspace left: ",(appbackupscreen+(767-(564-6)))-endofdefs1
  73. #endif
  74.  
  75. ;VARIABLE EQUATES STARTING AT APPBACKUPSCREEN ($9340)
  76. endvars equ plotsscreen  ;do not use this area for anything else in project!
  77. itemp5        = plotsscreen  ;long temporary variable. Used for buffering text
  78. escPu         = plotsscreen
  79. OutPtr        = escPu+1
  80. lzpos         = OutPtr+2
  81. EscBits       = lzpos+2
  82. Esc8Bits      = EscBits+1
  83. MaxGamma      = Esc8Bits+1
  84. Max1Gamma     = MaxGamma+1
  85. Max2Gamma     = Max1Gamma+1
  86. Max8Gamma     = Max2Gamma+1
  87. ExtraBits     = Max8Gamma+1
  88. tablePu       = ExtraBits+1
  89. regy          = tablePu+31
  90. decompstack   = regy+1
  91. decompinadr   = decompstack+2
  92. decompinpage  = decompinadr+2
  93. decompoutadr  = decompinpage+1
  94. decompcount   = decompoutadr+2
  95. decompreturn  = decompcount+2  ;return address on resume (set at suspend)
  96.  
  97. dstackstart   = (plotsscreen+(767-691))
  98. #ifdef main_build
  99. .echo "PSR varspace left: ",(plotsscreen+(767-691))-decompreturn
  100. #endif
  101.  
  102. ;VARIABLE EQUATES FOR ROUTINES LOCATED AT $9D95
  103. ;Yes, we know they are not in order. No, we are not changing it back.
  104. ramseg1       = $9D95 ;0107b Common routines for multipage app management
  105. ramseg2       = $9E00 ;0256b Common data resource tables
  106. ramseg9       = $9F00 ;0256b Spillover data area
  107. ramseg8       = $A000 ;0256b | Menu system text data | Decompression buffer  |
  108. ramseg5       = $A100 ;0512b | Menu system text data | Spellcard background  |
  109. ramseg7       = $A300 ;0256b | Menu system text data |  Bullet script data   |
  110. ramseg4       = $A400 ;1024b | Menu system text data |  Second bullet table  |
  111. ramseg3       = $A800 ;2048b | Menu system text data | Stg background buffer |
  112. ramseg6       = $B000 ;4096b |Menu system img buffer |Script resource buffer |
  113. ramsegend     = $C000 ;8811t No more memory may be allocated.
  114.  
  115. ;Note: ramseg4 MUST NOT be moved from $A400, unless it is to any address
  116. ;satisfying $x4xx or $xCxx
  117.  
  118. ;VARIABLE EQUATES FOR RAM SEGMENT STARTING AT RAMSTART ($8000)
  119. ;Formatted for informational purposes only. Magic numbers are used.
  120. ;-----------------------------------------------------------------------------
  121. ;AD-ST | Usage during menu system run     | Usage during danmaku engine run
  122. ;------+----------------------------------+-----------------------------------
  123. ;$8000 | Black screen buffer (1/3)        | * Black screen buffer (1/2)
  124. ;$8100 | Black screen buffer (2/3)        | * Black screen buffer (2/2)
  125. ;$8200 | Black screen buffer (3/3)        | * 8-bit sine/cosine table
  126. ;$8300 | Unused                           | Player portrait buffer
  127. ;$8400 | Gray screen buffer (1/3)         | * Gray screen buffer (1/2)
  128. ;$8500 | Gray screen buffer (2/3)         | * Gray screen buffer (2/2)
  129. ;$8600 | Gray screen buffer (3/3)         | * Enemy portrait buffer
  130. ;$8700 | Unused                           | 8x8 sprite rotation buffer
  131. ;$8800 | Unused                           | Primary bullet data table (1/4)
  132. ;$8900 | Unused                           | Primary bullet data table (2/4)
  133. ;$8A00 | Unused                           | Primary bullet data table (3/4)
  134. ;$8B00 | Unused                           | Primary bullet data table (4/4)
  135. ;$8C00 | Unused                           | Bullet allocation table
  136. ;$8D00 | Unused                           | Player bullet table
  137. ;$8E00 | Menu system recordkeeping        | Enemy script data area
  138. ;-----------------------------------------------------------------------------
  139. ;EQUATES FOR CADAN SCRIPTS
  140. enemyscript0 = $8E00
  141. enemyscript1 = $8E14
  142. enemyscript2 = $8E28
  143. enemyscript3 = $8E3C
  144. enemyscript4 = $8E50
  145. enemyscript5 = $8E64
  146. enemyscript6 = $8E78
  147. enemyscript7 = $8E8C
  148. enemyscript8 = $8EA0
  149. enemyscript9 = $8EB4
  150. bossscript0  = $8EC8
  151. stagescript0 = $8EE4
  152.  
  153.  
  154. ;GAME FLAGS FOR APPLICATION USE
  155. sysflags            equ 0
  156. immtemp               = 0 ;temporary variable for immediate use
  157. keyprimed             = 1 ;set if first time using the keyreading system
  158. menureturn            = 2 ;set to enable return function for menu
  159. smalltext             = 3 ;set to enable small text rendering
  160. ;========================
  161. gamesettings        equ 1
  162. practicemode          = 0 ;set to enable practice mode (255 lives/bombs)
  163. setexternals          = 1 ;set to enable external level choice
  164. setdebugmode          = 2 ;set to enable debug mode. Wheeee~!
  165. hexscoremode          = 4 ;set to enable hexadecimal scoreboard mode
  166. binscoremode          = 5 ;set to enable binary scoring. Used with hex scoring
  167. ;========================
  168. danmakuflags        equ 2
  169. gotomenu              = 0 ;set to go to minimenu mode (from danmaku mode)
  170. isfocused             = 1 ;set if the character is in focused mode
  171. isrecovering          = 2 ;set to make char sprite flash. Also invincible.
  172. isdying               = 3 ;set to block movement and run the BoLaD timer
  173. isbombing             = 4 ;set to indicate bombing mode. Invincible. Timer run
  174. isspellcard           = 5 ;set to indicate enemy spellcard mode. Timer 4 init
  175. isbossrunning         = 6 ;set to run boss mode. Timer for init.
  176. slowmode              = 7 ;set to enable slowmode (and all that it entails)
  177. ;========================
  178. stateflags            equ 3
  179. fbt1full              = 0 ;set if the first bullet table is full
  180. fbt2full              = 1 ;set if the second bullet table is full
  181. noreplay              = 2 ;set if replay save disabled. Only temporary.
  182. isdecomp              = 3 ;set if decompressor is running
  183. isdecompdone          = 4 ;set when decompressor is finished
  184. iswriting             = 5 ;set while decompressor writing to a buffer
  185. decompsuspend         = 6 ;reset to undo suspend state for loader routine
  186.  
  187. ;FLAGS DIRECT ACCESS SHORTHAND:
  188. msysflg   equ myflags+sysflags
  189. mgameset  equ myflags+gamesettings
  190. mdanmaku  equ myflags+danmakuflags
  191.  
  192.  
  193. ;VARIABLES FOR EXTERNAL USE. ALL POINTERS REFER TO APP PAGE OFFSET ZERO.
  194. startBattleField      = $4082
  195.  
  196. ;EQUATES FOR KEYPRESSES
  197. KEY_DEL   = 7
  198. KEY_MODE  = 6
  199. KEY_2ND   = 5
  200. KEY_YEQU  = 4
  201. KEY_UP    = 3
  202. KEY_RIGHT = 2
  203. KEY_LEFT  = 1
  204. KEY_DOWN  = 0
  205. .echo "Curscore location: ",curscore
Advertisement
Add Comment
Please, Sign In to add comment