Geekboy

Untitled

Feb 1st, 2012
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 41.74 KB | None | 0 0
  1. Script system outline:
  2.  
  3. Internal notes:
  4. Warning: Do not use the following for names of a script system command
  5. "db", "dw", "end", "org", "byte", "word", "fill", "block", "addinstr",
  6. "echo", "error", "list", "nolist", "equ", "show", "option", "seek"
  7. These are reserved by SPASM
  8.  
  9. (*) In the command name box means that the function was personally tested and
  10. verfied to work (after much work was done). These ought not be messed with and
  11. yeah. Something like that.
  12.  
  13. Naming conventions:
  14. rx = virtual register 0-7
  15. nn = 1 byte value
  16. ww = 2 byte value
  17. b = Some value between 0-7
  18. s = Some value between 0-15
  19.  
  20. Some names will have a more descriptive label for its use. If one is used,
  21. read the description to determine the data's size.
  22.  
  23. VERY IMPORTANT NOTE: ALL SCRIPT NAMES HAVE A PERIOD (.) PRECEDING THE NAMES
  24. EVEN THOUGH THEY DO NOT SHOW IN THIS LIST. ALWAYS REMEMBER.
  25.  
  26. COMMANDSET AND NAME
  27. ==============================================================================
  28. ------------------------------------------------------------------------------
  29. - NORMAL EVERYDAY USE --------------------------------------------------------
  30. ------------------------------------------------------------------------------
  31. 000 | No operation. The script system halts on encountering this.
  32. NOP | Used for filler or something.
  33. ------------------------------------------------------------------------------
  34. 001-008 *| LOAD(rx,nn)
  35. LOAD | Stores a constant (1 byte) into a register.
  36. 2 bytes |
  37. ------------------------------------------------------------------------------
  38. 009-016 *| ADD(rx,nn)
  39. ADD | Adds a constant (1 byte) with a register, then stores the
  40. 2 bytes | results back to the register. Affects zero and carry flags.
  41. | There's no subtract operand for this mode. Use a negative
  42. | constant for doing that. There is no add with carry.
  43. ------------------------------------------------------------------------------
  44. 017-024 *| CLEAR(rx)
  45. CLEAR | Sets a register to zero.
  46. 1 byte |
  47. ------------------------------------------------------------------------------
  48. 025-032 *| AND(rx,nn)
  49. AND | Do a bitwise AND operation between a register and a constant
  50. 2 bytes | and store the result back into the register.
  51. | Affects the zero flag. Does not affect the carry flag.
  52. ------------------------------------------------------------------------------
  53. 033-040 *| XOR(rx,nn)
  54. XOR | Do a bitwise XOR operation between a register and a constant
  55. 2 bytes | and store the result back into the register.
  56. | Affects the zero flag. Does not affect the carry flag.
  57. ------------------------------------------------------------------------------
  58. 041-048 *| OR(rx,nn)
  59. OR | Do a bitwise OR operation between a register and a constant
  60. 2 bytes | and store the result back into the register.
  61. | Affects the zero flag. Does not affect the carry flag.
  62. ------------------------------------------------------------------------------
  63. 049-056 *| CPL(rx)
  64. CPL | Inverts all bits in a register.
  65. 1 byte | Affects the zero flag.
  66. | If you want to do NEG instead, just CPL, then INC it.
  67. ------------------------------------------------------------------------------
  68. 057-064 *| WAIT(rx)
  69. WAIT | Makes the script system wait for the number of game cycles
  70. 1 byte | that is stored in a register. Remember that 24 cycles is
  71. | about one second's worth of time in normal gameplay mode.
  72. | You should be setting that register to some known value
  73. | before using this instruction. Feeding in 0 is using 256.
  74. ------------------------------------------------------------------------------
  75. 065-072 *| CMP(rx,nn)
  76. CMP | Performs subtraction between a register and a constant in
  77. 2 bytes | the form: register-constant. The result is NOT stored back,
  78. | but instead, used to affect the zero and carry flags.
  79. | Good for use with conditional jumps.
  80. ------------------------------------------------------------------------------
  81. 073-080 *| TEST(rx,nn)
  82. TEST | Performs a bitwise AND operation between a register and a
  83. 2 bytes | constant, but does NOT store the results back to the
  84. | register. Instead, it's used to affect the zero flag.
  85. | Used when you need to figure out which bits are set in a
  86. | register, perhaps for conditional jumps?
  87. ------------------------------------------------------------------------------
  88. 081-088 *| TRACK(rx)
  89. TRACK | Output-only. Sets the given register to an angle that would,
  90. 1 byte | when used with the SHOOT command, fire a bullet directly
  91. | toward the player.
  92. ------------------------------------------------------------------------------
  93. 089-096 *| SHOOT(rx)
  94. SHOOT | Fires a shot at the angle given in a register. 'nuff said.
  95. 1 byte |
  96. ------------------------------------------------------------------------------
  97. 097-104 *| SETSTATS(rx,nn)
  98. SETSTATS | Stores rx to an external variable. If you need to define
  99. 2 bytes | your own variables, look in the code developer's guide for
  100. | more information.
  101. ------------------------------------------------------------------------------
  102. 105-112 *| GETSTATS(rx,nn)
  103. GETSTATS | Retrieves rx from an external variable. Again, if you need
  104. 2 bytes | to define your own variables, look in the code developer's
  105. | guide for more information.
  106. ------------------------------------------------------------------------------
  107. 113-120 *| MULT(rx,nn)
  108. MULT | Multiplies a register by a constant, then stores the least
  109. 2 bytes | significant byte (LSB) of the result back into the register.
  110. | NOTE: If it's possible, try to use the rotate/shift
  111. | commands if you're dividing or multiplying by
  112. | multiples of 2. It's much friendlier that way.
  113. | The most significant byte (MSB) is stored in "sta.overflow"
  114. | be accessed by the getstats command. Flags are affected as
  115. | follows: Carry is set if the MSB is not zero. Zero is set if
  116. | the result in the LSB was zero (even if the whole isn't)
  117. ------------------------------------------------------------------------------
  118. 121-128 | DIVIDE(rx,nn)
  119. DIVIDE | Dividend (rx) / Divisor (nn) -> Quotient to (rx)
  120. 2 bytes | This is a slow operation. See if you can't use right shifts
  121. | instead.
  122. BROKEN. | The remainder is stored in "sta.overflow", which is accessed
  123. FIX LATER. | via getstats command. Flags are affected as follows:
  124. | Carry is set if there is a remainder. Zero is set if the
  125. | quotient is zero (does not check remainder).
  126. |
  127. ------------------------------------------------------------------------------
  128. 129-136 *| INC(rx)
  129. INC | Increments rx by one. Same as ADD(rx,1) but much faster and
  130. 1 byte | uses less memory. Affects only the zero flag, to remain
  131. | consistent with how the Z80 does things.
  132. ------------------------------------------------------------------------------
  133. 137-144 *| DEC(rx)
  134. DEC | Decrements rx by one. Same as ADD(rx,-1) but much faster and
  135. 1 byte | uses less memory. Affects only the zero flag, to remain
  136. | consistent with how the Z80 does things.
  137. ------------------------------------------------------------------------------
  138. 145-152 *| DJNZ(rx,label)
  139. DJNZ | Automatically decrements the given register and takes the
  140. 2 bytes | specified relative jump while the register does not become
  141. | zero that cycle. Just like Z80's djnz instruction, except
  142. | you can use any register.
  143. ------------------------------------------------------------------------------
  144. ------------------------------------------------------------------------------
  145. 153 *| MOVE(rxa,rxb)
  146. MOVE | Copies the contents of register B over to register A.
  147. 2 bytes | Register A is overwritten with B and B stays the same.
  148. ------------------------------------------------------------------------------
  149. 154 *| SWAP(rxa,rxb)
  150. SWAP | The values in register A and register B are swapped.
  151. 2 bytes | Nothing is destroyed in this operation.
  152. ------------------------------------------------------------------------------
  153. 155 *| ADDRX(rxa,rxb)
  154. ADDRX | Adds register A and register B, then stores the result
  155. 2 bytes | back into register A. Affects both the zero and carry flags.
  156. ------------------------------------------------------------------------------
  157. 156 *| SUBRX(rxa,rxb)
  158. SUBRX | Subtracts register B from register A in the form of
  159. 2 bytes | rxa-rxb, then stores the result back into register A.
  160. | Affects both the zero and the carry flags.
  161. |
  162. ------------------------------------------------------------------------------
  163. 157 *| ROTR(rx,b) / ROTL(rx,b)
  164. ROTR/ROTL | Rotates a given register a number of bits right or left
  165. 2 bytes | (respectively). All bits that leave one side of the register
  166. | Immediately appears on the other side of the register.
  167. | Flags are NOT affected.
  168. | INTERNAL NOTE: Distinguishing between ROTR and ROTL is done
  169. | with bit 7 of the data byte. (1=ROTL)
  170. ------------------------------------------------------------------------------
  171. 158 *| SHIFTR(rx,b) / SHIFTL(rx,b)
  172. SHIFTR/SHIFTL | Shifts a given register a number of bits right or left
  173. 2 bytes | (respectively. All bits that leave are gone forever. Bits
  174. | shifted in will always be zero.
  175. | Flags are NOT affected.
  176. | INTERNAL NOTE: Distinguishing between ROTR and ROTL is done
  177. | with bit 7 of the data byte. (1=SHIFTL)
  178. ------------------------------------------------------------------------------
  179. 159 *| MULTRX(rxa,rxb)
  180. MULTRX | Multiplies register A with register B, then stores the
  181. 2 bytes | LSB of the result back to register A. Both registers are
  182. | assumed to be unsigned.
  183. ------------------------------------------------------------------------------
  184. 160 | DIVIDERX(rxa,rxb)
  185. DIVIDERX | Divides register A with register B in the form of rxa/rxb,
  186. 2 bytes | then stores the quotient to register A. Both registers are
  187. (AVOID. BROKEN.)| assumed to be unsigned.
  188. ------------------------------------------------------------------------------
  189. 161 *| ANDRX(rxa,rxb)
  190. ANDRX | Performs the bitwise AND function between register A and
  191. 2 bytes | register B, then stores the result to register A. Affects
  192. | the zero flag.
  193. ------------------------------------------------------------------------------
  194. 162 *| ORRX(rxa,rxb)
  195. ORRX | Performs the bitwise OR function between register A and
  196. 2 bytes | register B, then stores the result to register A. Affects
  197. | the zero flag.
  198. ------------------------------------------------------------------------------
  199. 163 *| XORX(rxa,rxb)
  200. XORRX | Performs the bitwise XOR function between register A and
  201. 2 bytes | register B, then stores the result to register A. Affects
  202. | the zero flag.
  203. ------------------------------------------------------------------------------
  204. 164 | CMPRX(rxa,rxb)
  205. CMPRX | Performs virtual subtraction between register A and register
  206. 2 bytes | B. Does NOT store the result anywhere, but the carry and
  207. | zero flags are affected as though subtraction took place.
  208. | Useful for testing conditions.
  209. ------------------------------------------------------------------------------
  210. 165 | TEXTRX(rxa,rxb)
  211. TESTRX | Performs a virtual AND function between register A and
  212. 2 bytes | register B. Does NOT store the result anywhere, but the
  213. | zero flag is affected as though an AND function was done.
  214. | Useful for testing bits to see if they're set.
  215. ------------------------------------------------------------------------------
  216. 166 | JUMPNC(label) [+ or - 127 bytes in either direction]
  217. JUMPNC | Sets the script's execution pointer to wherever you defined
  218. 2 bytes | the label only if the result of flag altering command prior
  219. | to this instruction stayed between 0 and 255 (carry flag
  220. | reset)
  221. ------------------------------------------------------------------------------
  222. 167 | JUMPC(label) [+ or - 127 bytes in either direction]
  223. JUMPC | Sets the script's execution pointer to wherever you defined
  224. 2 bytes | the label only if the result of flag altering command prior
  225. | to this instruction crossed zero. (Carry flag set)
  226. ------------------------------------------------------------------------------
  227. 168 *| JUMPNZ(label) [+ or - 127 bytes in either direction]
  228. JUMPNZ | Sets the script's execution pointer to wherever you defined
  229. 2 bytes | the label only if the result of flag altering command prior
  230. | to this instruction was NOT zero. (Zero flag reset)
  231. ------------------------------------------------------------------------------
  232. 169 | JUMPZ(label) [+ or - 127 bytes in either direction]
  233. JUMPZ | Sets the script's execution pointer to wherever you defined
  234. 2 bytes | the label only if the result of flag altering command prior
  235. | to this instruction was zero. (Zero flag set)
  236. ------------------------------------------------------------------------------
  237. 170 *| JUMP(label) [+ or - 127 bytes in either direction]
  238. JUMP | Unconditionally sets the script's execution pointer to
  239. 2 bytes | wherever the label is defined. Just like Z80's JR.
  240. ------------------------------------------------------------------------------
  241. 171 *| NEWPOSRT(rx_angle,rx_radius)
  242. NEWPOSRT | Changes the firing position from the center of the enemy to
  243. 3 bytes | radius away from that center at some angle, both of which
  244. | are stored in registers. ANGLE is between 0 and 255, and
  245. | RADIUS can be anything, just note that 90 is the length of
  246. | the longest possible line on the screen. Keep that in mind
  247. | so you don't clip.
  248. | NOTE: Position is reset to center after a pause, or another
  249. | use of the NEWPOSRT command.
  250. ------------------------------------------------------------------------------
  251. 172 *| NEWPOSXY(rx_x,rx_y)
  252. NEWPOSXY | Changes the firing position from the center of the enemy to
  253. 3 bytes | some offset X,Y away from the enemy. You MUST understand
  254. | that Y is reversed (positive values move down, negative
  255. | moves upward). To obtain negative values of a certain number
  256. | you should CPL/INC it. Or store a negative number to the
  257. | register to begin with. The screen is 64 by 64 pixels.
  258. | NOTE: Position is reset to center after a pause, or another
  259. | use of the NEWPOSRT command.
  260. ------------------------------------------------------------------------------
  261. 173 | USESPRITE(rx_resourceID,rx_locationID)
  262. SETSPRITE | Sets a sprite found in resourceID to an active enemy sprite
  263. 3 bytes | found in locationID. resourceID refers to a place on the
  264. | current script's resource table, which should be set at
  265. | "codegen"-time. locationID refers to a number 0-3, which
  266. | refers to which sprite slot to use (there are four).
  267. ------------------------------------------------------------------------------
  268. 174 | JUMPTABLE(rx_offset,s_table_length) \ JUMPDATA(LabelX)...
  269. JUMPTABLE | Allows you branch to different routines depending on what
  270. 2+n bytes | is in a register. You MUST put the table immediately after
  271. | this instruction. Example:
  272. |
  273. | LOAD(r1,0) ;sets r1 to zero
  274. | JUMPTABLE(r1,4) ;r1 is the offset, 4 is the number of labels
  275. | JUMPDATA(Label_0) ;<--0th one. Will be taken.
  276. | JUMPDATA(Label_1) ;If r1=1, then this is taken.
  277. | JUMPDATA(Label_2) ;If r1=2...
  278. | JUMPDATA(Label_3) ;If r1=3...
  279. |
  280. | Note: If r1 is a value outside the bounds, the table is
  281. | skipped over and code beneath is will run.
  282. | Note: The labels are relative addresses, + or - 127 bytes
  283. | in either direction. This makes it prohibitive to use
  284. | very large tables. If you need to make tables that
  285. | large, use jump nodes as intermediaries.
  286. | IMPORTANT NOTE: THE TABLE CANNOT BE LARGER THAN 16 LABELS!
  287. | If you try to make it larger anyway, garden
  288. | gnomes will (likely) invade your home.
  289. | A typical use for this routine is retrieving the built-in
  290. | difficulty level, and then branching to different attacks
  291. | based on the difficulty, so one script does many things.
  292. | See how *you* can abuse this sucker. I won't be stopping you
  293. ------------------------------------------------------------------------------
  294. 175 *| CALL(ww_relativelabel)
  295. CALL | Lets you run a subroutine so you can save precious space by
  296. 3 bytes | not having to replicate redudnant code. The spacing for this
  297. | label is double-wide, so it can reach anywhere you need it
  298. | to. DO NOT TRY TO CALL ANYTHING WHILE IN A SUBROUTINE.
  299. | Endless loops and never getting back to the main code will
  300. | result. It's safe this time around to do a PAUSE or a WAIT
  301. | while you're in a subroutine, however. It's safe this time
  302. | around to do a PAUSE/WAIT combination while in a subroutine.
  303. | Note: If you are foolish enough to try to use CALL while in
  304. | a subroutine, the instruction will be ignored
  305. ------------------------------------------------------------------------------
  306. 176 *| RETURN
  307. RETURN | Exits a subroutine. Don't try to use this if you're not in
  308. 1 byte | a subroutine. Main script code all have exit points, and
  309. | using this command is NOT one of them. You might end up
  310. | crashing your calc or something.
  311. | Note: If you try to use RETURN if you aren't in a subroutine
  312. | then this command will be ignored.
  313. ------------------------------------------------------------------------------
  314. 177 | XYTORT(rxa_x,rxb_y,rxc_r,rxd_t)
  315. XYTORT | Takes of the x,y coordinates found in registers A and B
  316. 3 bytes | (respectively), then uses the position given by the center
  317. | of the enemy in use (or whereever newposxy/newposrt has
  318. | changed it to) to output a distance and an angle in
  319. | registers C and D, respectively.
  320. ------------------------------------------------------------------------------
  321. 178 | RTTOXY(rxa_r,rxb_t,rxc_x,rxd_y)
  322. RTTOXY | Similar to above, except it takes a distance and an angle,
  323. 3 bytes | then converts it to its corresponding x,y coordinates,
  324. | outputting to registers C and D, respectively.
  325. | The starting position is the center of the enemy in use or
  326. | wherever you changed it to via newposxy/newposrt.
  327. |
  328. ------------------------------------------------------------------------------
  329. 179 | GETPLAYERXY(rxa_x,rxb_y)
  330. GETPLAYERXY | Outputs the player's X,Y coordinates to registers A and B,
  331. 2 bytes | respectively. If you only need an angle, you should be using
  332. | the TRACK command instead. Much faster that way.
  333. ------------------------------------------------------------------------------
  334. 180 *| PAUSE() [NO ARGUMENTS]
  335. PAUSE | Same as WAIT except it is set for exactly one game cycle.
  336. | Does not destroy or alter any registers.
  337. ------------------------------------------------------------------------------
  338. |
  339. |
  340. |
  341. ------------------------------------------------------------------------------
  342. - BOSS-SPECIFIC COMMANDS -----------------------------------------------------
  343. ------------------------------------------------------------------------------
  344. 000 | INITBOSS(nn_HP,nn_TIME,nn_Shld,nn_Shll,ww_JID)
  345. INITBOSS | Used in two ways:
  346. | (1) Initialize the boss for starting it up
  347. | (2) Reset statistics after the boss dies. Gotta use it then.
  348. | Explanation of constants:
  349. | nn_HP: 32*nn=HP. If nn_HP=4, boss will have 4*32= 52 HP
  350. | nn_HP may be up to 255 (HP=8160)
  351. | nn_TIME: Length of action/spellcard in seconds. The boss
  352. | dies after this expires, either removing the boss
  353. | or continuing on to the next attack.
  354. | nn_Shld: Set shield value. Will reduce the damage a bullet
  355. | inflicts by this value. Starter bullets do 1 damage
  356. | Set to 255 to make boss immune to bullets.
  357. | nn_Shll: Set shell value. Will reduce damage from bombs by
  358. | this value. Set to 255 to make boss immune to bombs
  359. | NOTE: Setting both shield and shell values to 255 will
  360. | enable transparency mode, which turns that boss's
  361. | cycle into a "survival" spell, which the only way
  362. | to win is to timeout the boss (let TIME run to 0)
  363. | ww_JID: Jump If Dead. Use a LABEL here so the script knows
  364. | where to jump the instant the boss dies, be it to
  365. | the boss's next life, or to the boss termination
  366. | sequence.
  367. ------------------------------------------------------------------------------
  368. 000 | LOADPAT(nn_patternID)
  369. LOADPAT | Loads a bullet script (pattern) given its resource ID. You
  370. | *have* been checking on how to set up resources for a given
  371. | script, haven't you?
  372. ------------------------------------------------------------------------------
  373. 000 | FIREPAT(s_patternNum,rxa,[rxb],[rxc])
  374. FIREPAT | Uses a specified pattern from the loaded pattern table to
  375. | shoot a bullet given a variety of inputs. The number of
  376. | inputs will vary depending on the bullet pattern that is
  377. | used. If it doesn't need that many inputs, just set the
  378. | unused registers to zero. Or something, just so SPASM
  379. | won't complain.
  380. ------------------------------------------------------------------------------
  381. 000 | SPELLINTRO(nn_SpellTitleID,nn_BonusMultiple,
  382. SPELLINTRO | nn_NewBackgroundID)
  383. | Starts up a spellcard's fancy background and pictures and
  384. | whatnot. Also starts the spellcard bonus. The bonus drain
  385. | will reflect whatever mode the boss is in (no drain for
  386. | survival cards). Boss portraits are implied in the general
  387. | game resource area.
  388. | nn_SpellTitleID : Resource ID for spellcard title
  389. | nn_BonusMultiple : nn * 1,000,000 is the bonus multiple.
  390. | nn_NewBackgroundID: Resource for new spellcard background
  391. |
  392. | It's just fancy and flashy stuff going on.
  393. ------------------------------------------------------------------------------
  394. 000 | PROCD(nn_EffectCode)
  395. PROCD | Don't bother with this one right now. It's designed to make
  396. | the boss go 'splodey when it dies. You run this little
  397. | sucker and off it goes!
  398. | Always use the example code given for each instance. Don't
  399. | try using this command on your own unless you can read
  400. | source, since I guarantee you. You will likely destabilize
  401. | (hehe. de stab il ize. lol.) THE GAME.
  402. |
  403. | And like the boss, you just lost.
  404. ------------------------------------------------------------------------------
  405. 000 | MAKEOPTION(rxa_x,rxy_y,nn_hp,nn_expires,nn_scriptID)
  406. MAKEOPTION | Allows the boss to create enemies. The X,Y coordinates used
  407. | differ from the coordinates used by the bullet system in
  408. | that the top-left of the screen is 64,64, and the bottom-
  409. | right of the screen is 128,128. This is to allow off-screen
  410. | generation of enemies so they can fly on/offscreen.
  411. |
  412. | nn_hp: Some value between 0 and 255. If set to zero, then
  413. | the enemy is invincible. It dies only when its time
  414. | runs out. Speaking of time...
  415. | nn_expires: Number of game cycles the enemy has to live.
  416. | There's about 24 game cycles in a second, so an
  417. | enemy will live for a bit longer than 10 seconds
  418. | If they need to last longer than that, then you
  419. | should be making better bosses. Or get creative.
  420. | nn_scriptID: The ID for the script that the newly-created
  421. | enemy should be using. These IDs are defined
  422. | with the stage, and you shouldn't be worrying
  423. | about what resources these scripts are taking.
  424. | Unless you are tight on resources and you have
  425. | a level pack larger than CaDan itself.
  426. ------------------------------------------------------------------------------
  427. - STAGE SCRIPTING ------------------------------------------------------------
  428. ------------------------------------------------------------------------------
  429. 000 |
  430. |
  431. |
  432. |
  433. |
  434. |
  435. ------------------------------------------------------------------------------
  436. 000 |
  437. |
  438. |
  439. |
  440. |
  441. |
  442. ------------------------------------------------------------------------------
  443. 000 |
  444. |
  445. |
  446. |
  447. |
  448. |
  449. ------------------------------------------------------------------------------
  450. 000 |
  451. |
  452. |
  453. |
  454. |
  455. |
  456. ------------------------------------------------------------------------------
  457. 000 |
  458. |
  459. |
  460. |
  461. |
  462. |
  463. ------------------------------------------------------------------------------
  464. 000 |
  465. |
  466. |
  467. |
  468. |
  469. |
  470. ------------------------------------------------------------------------------
  471. 000 |
  472. |
  473. |
  474. |
  475. |
  476. |
  477. ------------------------------------------------------------------------------
  478. 000 |
  479. |
  480. |
  481. |
  482. |
  483. |
  484. ------------------------------------------------------------------------------
  485. 000 |
  486. |
  487. |
  488. |
  489. |
  490. |
  491. ------------------------------------------------------------------------------
  492. 000 |
  493. |
  494. |
  495. |
  496. |
  497. |
  498. ------------------------------------------------------------------------------
  499. 000 |
  500. |
  501. |
  502. |
  503. |
  504. |
  505. ------------------------------------------------------------------------------
  506. 000 |
  507. |
  508. |
  509. |
  510. |
  511. |
  512. ------------------------------------------------------------------------------
  513. 000 |
  514. |
  515. |
  516. |
  517. |
  518. |
  519. ------------------------------------------------------------------------------
  520. 000 |
  521. |
  522. |
  523. |
  524. |
  525. |
  526. ------------------------------------------------------------------------------
  527. 000 |
  528. |
  529. |
  530. |
  531. |
  532. |
  533. ------------------------------------------------------------------------------
  534. 000 |
  535. |
  536. |
  537. |
  538. |
  539. |
  540. ------------------------------------------------------------------------------
  541. 000 |
  542. |
  543. |
  544. |
  545. |
  546. |
  547. ------------------------------------------------------------------------------
  548. 000 |
  549. |
  550. |
  551. |
  552. |
  553. |
  554. ------------------------------------------------------------------------------
  555. 000 |
  556. |
  557. |
  558. |
  559. |
  560. |
  561. ------------------------------------------------------------------------------
  562. 000 |
  563. |
  564. |
  565. |
  566. |
  567. |
  568. ------------------------------------------------------------------------------
  569. 000 |
  570. |
  571. |
  572. |
  573. |
  574. |
  575. ------------------------------------------------------------------------------
  576. 000 |
  577. |
  578. |
  579. |
  580. |
  581. |
  582. ------------------------------------------------------------------------------
  583. 000 |
  584. |
  585. |
  586. |
  587. |
  588. |
  589. ------------------------------------------------------------------------------
  590. 000 |
  591. |
  592. |
  593. |
  594. |
  595. |
  596. ------------------------------------------------------------------------------
  597. 000 |
  598. |
  599. |
  600. |
  601. |
  602. |
  603. ------------------------------------------------------------------------------
  604. 000 |
  605. |
  606. |
  607. |
  608. |
  609. |
  610. ------------------------------------------------------------------------------
  611. 000 |
  612. |
  613. |
  614. |
  615. |
  616. |
  617. ------------------------------------------------------------------------------
  618. 000 |
  619. |
  620. |
  621. |
  622. |
  623. |
  624. ------------------------------------------------------------------------------
  625. 000 |
  626. |
  627. |
  628. |
  629. |
  630. |
  631. ------------------------------------------------------------------------------
  632. 000 |
  633. |
  634. |
  635. |
  636. |
  637. |
  638. ------------------------------------------------------------------------------
  639. 000 |
  640. |
  641. |
  642. |
  643. |
  644. |
  645. ------------------------------------------------------------------------------
  646. 252 | INITENEMY(nn_rxbase)
  647. INITENEMY | Complicated. You'd better be paying CLOSE attention now, as
  648. 2 bytes | this command is among the most important in CaDan.
  649. | nn_rxbase should be a number between 0 and 8, indicating
  650. | which register to start reading input arguments from. The
  651. | input arguments are as follows:
  652. |
  653. | rx+0: Enemy script resourceID - Dictates which CaDan script
  654. | to use for a given enemy. Affects enemy actions.
  655. | rx+1: Enemy path resourceID - Dictates which MovePath script
  656. | to use for a given enemy. Affects enemy movements.
  657. | rx+2: Enemy Y position. Coordinates may start offscreen and
  658. | be a negative number.
  659. | rx+3: Enemy X position. Coordinates may start offscreen and
  660. | be a negative number.
  661. | rx+4: Enemy HP. Set to zero for an invincible enemy.
  662. | rx+5: Enemy TTL (Time To Live). Set to 255 (max) for about
  663. | 10 seconds of enemy life. Internal enemy scripts may
  664. | modify this value, though.
  665. |
  666. | Enemies are given the following values automatically:
  667. | SpriteID=1, zeroed out condition/return/registers.
  668. |
  669. | If there are no more slots left to create an enemy with,
  670. | this command silently fails. Up to 10 enemies simultaneously
  671. | existing is planned. Make good use of that and ensure that
  672. | TTL is set high enough to give good challenge but low enough
  673. | to not clog up the enemy tables.
  674. ------------------------------------------------------------------------------
  675. 253 | FILLBANK(nn0,nn1,nn2,nn3,nn4,nn5,nn6,nn7)
  676. FILLBANK | Fills r0 through r7 with one byte immediates as defined
  677. 9 bytes | above. This command may be safely called by enemiy scripts
  678. | as well as boss and stage scripts, but its use was found to
  679. | be much better as a stage type command for mass
  680. | register initializations.
  681. ------------------------------------------------------------------------------
  682. 254 | SWAPBANK
  683. SWAPBANK | Swaps the r0-r7 bank with the r8-r15 bank. Allows for
  684. 1 byte | extended register use beyond the original 8 registers. Only
  685. | the stage and boss scripts may be able to use this command.
  686. | You can try it for normal enemies but you'll more than
  687. | likely get horrible results. Unless you're hackish.
  688. ------------------------------------------------------------------------------
  689. 255 | RUNASM(EndLabel)
  690. RUNASM | Executes a stretch of Z80 ASM code between the command and
  691. 1+n bytes | wherever the "EndLabel" happens to be. Special care needs to
  692. | be taken from within the Z80 assembly routine that you are
  693. | writing.
  694. | While HL,BC,DE,and AF may be destroyed, you CANNOT mess with
  695. | IX, nor the RAM area (itemp1) since DE is kept safe in that
  696. | location. The stack is fully available so you can do your
  697. | normal push and pops, but you've got to exit the routine at
  698. | the same stack level as you entered.
  699. |
  700. | To exit the Z80 ASM routine, you must jump to the following
  701. | label: r.runasm.ret
  702. |
  703. | The size of the ASM stub must be no larger than 255 bytes.
  704. | The total size of this command is 1 plus the ASM stub size.
  705. ------------------------------------------------------------------------------
  706. |
  707. |
  708. |
  709. |
  710. |
  711. |
  712. |
  713. |
  714. |
  715. |
  716.  
  717.  
  718. ------------------------------------------------------------------------------
  719.  
  720. In the deepest, darkest portions of the house, where mold grows and the
  721. programmers, likewise, there sits one curious nearly balded, pasty-faced
  722. person. Not quite a man, not quite a child, but full of the sort of energy
  723. that you'd only find when chatting it up on IRC or some odd obscure chat
  724. medium like that. A total IRC junkie and a programmer all rolled into one. a
  725. disasterous combination, if you were to ask anyone. Just give the wretch some
  726. Mountain Dew (since we all know they love the stuff), and watch the fingers
  727. rap away on the keyboard, working on the next big thing. The next graping
  728. calculator game. Except today is different for this person, for today,
  729. something gets added into his beautiful, yet incomplete game.
  730.  
  731. "Compile... compile dammit! Compile!" the programmer screams at the monitor.
  732. The black box of a command prompt flicker in and out of the desktop as he
  733. repeatedly hits the batch script's icon, hoping for a good, error-free
  734. compile. No word yet on whether or not there's a success, but that red text
  735. on the screen screaming "ERROR" ought to be a heads-up on how "well" things
  736. are going.
  737.  
  738. A few more edits into the vast number of lines in the file, a few more sips
  739. of that cool elixier known as Mtn Dew. A few more curse words screeched at the
  740. computer shortly before something appears to go right. And out on the screen
  741. flows the beautiful words and numbers of a successful compile job. The sort
  742. that tells its own little tale of all the bits and bytes that pass through its
  743. scrupulous, ever-gazing eyes. The statistics of the compile job, the little
  744. echoes that remind the programmer of those little quirks in the source, all
  745. of which are found on that black screen, just shortly before it disappears
  746. into nothingness, leaving only a newly-minted file containing the fruits of
  747. all the hard work over the past years.
  748.  
  749. "YES! And now... to test this program out..."
  750.  
  751. Meanwhile, on another timeline, on another galaxy, far far away from the alien
  752. homeworld this coder belonged to, here on Earth at around god-knows-what-year,
  753. the Vikings Berk celebrated in full Hiccup and Toothless' victory over the
  754. Red Death. There won't be any real description, since we've all seen the movie
  755. but as Toothless flew straight up with Hiccup with his friends, something odd,
  756. something completely out of the blue happened.
  757.  
  758. Everywhere around the teens and their dragons, small fairy-like creatures
  759. popped out of nowhere. Everyone stopped what they were doing and hovered in
  760. mid-air, completely stunned from the sudden appearance of these... things.
  761. Time seemed to stand still as they hovered right above Berk, trying to
  762. identify these foriegn things. And then, one by one, they started shooting
  763. slow-moving glowing orbs at the dragons in an eerily syncrhonized patter,
  764. filling the area around them in these energy-filled spheres, floating, if not
  765. flying straight at them!
  766.  
  767. It just wasn't their day, was it? Snotlout and Fishlegs got shot right out of
  768. the sky the second the gang was attacked. The twins made a move to try to
  769. save the two but they also got shot out. All that's left now is Hiccup riding
  770. his Night Fury.
  771.  
  772. Toothless and Hiccup, working as one, weaved in and out and between the
  773. patterns of incoming lights, almost expertly, almost... almost like someone
  774. else was watching above them and controlling their exact movements. There was
  775. just no way in hell they could know where everything was simultaneously...
  776. until they too got hit from the neverending torrent of lights.
  777.  
  778. The pair fell sharply, like a rock, to ... well. A bigger rock. The Earth. To
  779. their doom. "Toothless! Hang on buddy! We're gonna make it!" Hiccup tried to
  780. reassure his best bud, but he knows they aren't going to make it. They were
  781. all going to die... right about... now? Whoa! Wait a second. They're back up
  782. in the clouds...
  783.  
  784. And now, back on the alien planet, the crazy-mad overlord... erh. Programmer.
  785. Has decided to give that game of his a nice run-through.
  786.  
  787. "Mwahaha! I've done it! I've finally made a game that combines my favorite
  788. movie with my favorite type of game! I've finally made a HTTYD Danmaku!"
  789.  
  790. Swiftly, he raps the keys on his calculator, trying to get his little avatar
  791. of what was supposed to be Toothless to dodge the ever-increasing patterns
  792. of bullets on the screen. For a moment, things were going well. Side step,
  793. side step, back, forward, side step, back, side... aww, crap. He saw his
  794. favorite character eat a bullet and die. "Nooooooooo! Toooooothleeeees!"
  795.  
  796. The crazed coder straightens his face and puts on a mask of false seriousness.
  797.  
  798. "Oh, well. Two lives left."
Advertisement
Add Comment
Please, Sign In to add comment