Simple SNES shoot-'em-up game.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

814 lines
18 KiB

9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
9 years ago
  1. .INCLUDE "header.asm"
  2. .INCLUDE "init.asm"
  3. .INCLUDE "registers.asm"
  4. .INCLUDE "memory.asm"
  5. ; Sets A to 8-bit (& enables 8-bit "B" register).
  6. .MACRO SetA8Bit
  7. sep #%00100000 ; 8-bit A/B.
  8. .ENDM
  9. ; Sets A to 16-bit.
  10. .MACRO SetA16Bit
  11. rep #%00100000 ; 16-bit A.
  12. .ENDM
  13. ; Sets X/Y to 16-bit.
  14. .MACRO SetXY16Bit
  15. rep #%00010000 ; 16-bit X/Y.
  16. .ENDM
  17. ; Stores result to A.
  18. ; Assumes 16-bit X & 8-bit A.
  19. ; Modifies X.
  20. ; Updates randomBytePtr.
  21. .MACRO GetRandomByte
  22. ldx randomBytePtr
  23. lda $028000, X ; $028000: beginning of ROM bank 2.
  24. inx
  25. cpx #$8000 ; This is the size of the entire ROM bank.
  26. bne +++
  27. ldx #0
  28. +++
  29. stx randomBytePtr
  30. .ENDM
  31. .BANK 0 SLOT 0
  32. .ORG 0
  33. .SECTION "MainCode"
  34. Start:
  35. InitSNES
  36. ; By default we assume 16-bit X/Y and 8-bit A.
  37. ; If any code wants to change this, it's expected to do so itself,
  38. ; and to change them back to the defaults before returning.
  39. SetXY16Bit
  40. SetA8Bit
  41. jsr LoadPaletteAndTileData
  42. jsr InitWorld
  43. ; Set screen mode: 16x16 tiles for backgrounds, mode 1.
  44. lda #%11000001
  45. sta BGMODE
  46. ; Set sprite size to 16x16 (small) and 32x32 (large).
  47. lda #%01100000
  48. sta OAMSIZE
  49. ; Main screen: enable sprites & BG3.
  50. lda #%00010100
  51. sta MSENABLE
  52. ; Turn on the screen.
  53. ; Format: x000bbbb
  54. ; x: 0 = screen on, 1 = screen off, bbbb: Brightness ($0-$F)
  55. lda #%00001111
  56. sta INIDISP
  57. jmp MainLoop
  58. LoadPaletteAndTileData:
  59. ; For more details on DMA, see:
  60. ; http://wiki.superfamicom.org/snes/show/Grog%27s+Guide+to+DMA+and+HDMA+on+the+SNES
  61. ; http://wiki.superfamicom.org/snes/show/Making+a+Small+Game+-+Tic-Tac-Toe
  62. ;
  63. ; A lot of the graphics-related registers are explained in Qwertie's doc:
  64. ; http://emu-docs.org/Super%20NES/General/snesdoc.html
  65. ; ... but be careful, because there are some errors in this doc.
  66. ;
  67. ; bazz's tutorial (available from http://wiki.superfamicom.org/snes/) is
  68. ; quite helpful with palette / sprites / DMA, especially starting at
  69. ; http://wiki.superfamicom.org/snes/show/Working+with+VRAM+-+Loading+the+Palette
  70. ; Initialize the palette memory in a loop.
  71. ; We could also do this with a DMA transfer (like we do with the tile data
  72. ; below), but it seems overkill for just a few bytes. :)
  73. ; TODO(mcmillen): do it with a DMA transfer.
  74. ; First, sprite palette data:
  75. ldx #0
  76. lda #128 ; Palette entries for sprites start at 128.
  77. sta CGADDR
  78. -
  79. lda.l SpritePalette, X
  80. sta CGDATA
  81. inx
  82. cpx #32 ; 32 bytes of palette data.
  83. bne -
  84. ; Now, BG3 palette data.
  85. ; Palette entries for BG3 start at 0.
  86. ldx #0
  87. lda #0
  88. sta CGADDR
  89. -
  90. lda.l TilePalette, X
  91. sta CGDATA
  92. inx
  93. cpx #8 ; 8 bytes of palette data.
  94. bne -
  95. ; TODO(mcmillen): make the "DMA stuff into VRAM" a macro or function.
  96. ; Set VMADDR to where we want the DMA to start. We'll store sprite data
  97. ; at the beginning of VRAM.
  98. ldx #$0000
  99. stx VMADDR
  100. ; DMA 0 source address & bank.
  101. ldx #SpriteData
  102. stx DMA0SRC
  103. lda #:SpriteData
  104. sta DMA0SRCBANK
  105. ; DMA 0 transfer size. Equal to the size of sprites32.pic.
  106. ldx #2048
  107. stx DMA0SIZE
  108. ; DMA 0 control register.
  109. ; Transfer type 001 = 2 addresses, LH.
  110. lda #%00000001
  111. sta DMA0CTRL
  112. ; DMA 0 destination.
  113. lda #$18 ; The upper byte is assumed to be $21, so this is $2118 & $2119.
  114. sta DMA0DST
  115. ; Enable DMA channel 0.
  116. lda #%00000001
  117. sta DMAENABLE
  118. ; Store background tile data at byte $2000 of VRAM.
  119. ; (VMADDR is a word address, so multiply by 2 to get the byte address.)
  120. ldx #$1000
  121. stx VMADDR
  122. ; DMA 0 source address & bank.
  123. ldx #TileData
  124. stx DMA0SRC
  125. lda #:TileData
  126. sta DMA0SRCBANK
  127. ; DMA 0 transfer size. Equal to the size of tiles.pic.
  128. ldx #512
  129. stx DMA0SIZE
  130. ; DMA 0 control register.
  131. ; Transfer type 001 = 2 addresses, LH.
  132. lda #%00000001
  133. sta DMA0CTRL
  134. ; DMA 0 destination.
  135. lda #$18 ; The upper byte is assumed to be $21, so this is $2118 & $2119.
  136. sta DMA0DST
  137. ; Enable DMA channel 0.
  138. lda #%00000001
  139. sta DMAENABLE
  140. ; Tell the system that the BG3 tilemap starts at $4000.
  141. lda #%00100000
  142. sta BG3TILEMAP
  143. ; ... and that the background tile data for BG3 starts at $2000.
  144. lda #%00000001
  145. sta BG34NBA
  146. ; Set up the BG3 tilemap.
  147. ; VRAM write mode: increments the address every time we write a word.
  148. lda #%10000000
  149. sta VMAIN
  150. ; Set word address for accessing VRAM.
  151. ldx #$2000 ; BG 3 tilemap starts here. (Byte address $4000.)
  152. stx VMADDR
  153. ; Now write entries into the tile map.
  154. ldy #0
  155. -
  156. GetRandomByte
  157. sta $00
  158. ldx #$0000 ; This is a blank tile.
  159. ; 1 in 8 chance that we choose a non-blank tile.
  160. bit #%00000111
  161. bne +
  162. ldx #$0002
  163. bit #%10000000
  164. bne +
  165. ldx #$8002 ; Flip vertically.
  166. +
  167. stx VMDATA
  168. iny
  169. ; The tile map is 32x32 (1024 entries).
  170. cpy #1024
  171. bne -
  172. rts
  173. InitWorld:
  174. ; Start the background color as a dark blue.
  175. lda #4
  176. sta backgroundBlue
  177. ; Player's initial starting location.
  178. lda #(256 / 4)
  179. sta playerX
  180. lda #((224 - 32) / 2)
  181. sta playerY
  182. ; (x-velocity, y-velocity) of 4 different player shot patterns.
  183. lda #6
  184. sta shotVelocityTable
  185. lda #0
  186. sta shotVelocityTable + 1
  187. lda #3
  188. sta shotVelocityTable + 2
  189. lda #3
  190. sta shotVelocityTable + 3
  191. lda #0
  192. sta shotVelocityTable + 4
  193. lda #6
  194. sta shotVelocityTable + 5
  195. lda #-3
  196. sta shotVelocityTable + 6
  197. lda #3
  198. sta shotVelocityTable + 7
  199. lda #-6
  200. sta shotVelocityTable + 8
  201. lda #0
  202. sta shotVelocityTable + 9
  203. lda #-3
  204. sta shotVelocityTable + 10
  205. lda #-3
  206. sta shotVelocityTable + 11
  207. lda #0
  208. sta shotVelocityTable + 12
  209. lda #-6
  210. sta shotVelocityTable + 13
  211. lda #3
  212. sta shotVelocityTable + 14
  213. lda #-3
  214. sta shotVelocityTable + 15
  215. rts
  216. MainLoop:
  217. lda #%10000001 ; Enable NMI interrupt & auto joypad read.
  218. sta NMITIMEN
  219. wai ; Wait for interrupt.
  220. lda #%00000001 ; Disable NMI interrupt while processing.
  221. sta NMITIMEN
  222. jsr JoypadRead
  223. jsr JoypadHandler
  224. jsr UpdateWorld
  225. jsr UpdateSprites
  226. jsr FillSecondarySpriteTable
  227. jsr SetBackgroundColor
  228. bra MainLoop
  229. JoypadRead:
  230. ; Load joypad registers into RAM for easy inspection & manipulation.
  231. -
  232. lda HVBJOY
  233. bit #$01 ; If auto-joypad read is happening, loop.
  234. bne -
  235. ldx JOY1L
  236. stx joy1
  237. ldx JOY2L
  238. stx joy2
  239. rts
  240. JoypadHandler:
  241. JoypadUp:
  242. lda joy1 + 1
  243. bit #$08 ; Up
  244. beq JoypadDown ; Button not pressed.
  245. lda playerY
  246. cmp #0
  247. beq JoypadDown ; Value saturated.
  248. dec playerY
  249. dec playerY
  250. JoypadDown:
  251. lda joy1 + 1
  252. bit #$04 ; Down
  253. beq JoypadLeft ; Button not pressed.
  254. lda playerY
  255. cmp #(224 - 32)
  256. beq JoypadLeft ; Value saturated.
  257. inc playerY
  258. inc playerY
  259. JoypadLeft:
  260. lda joy1 + 1
  261. bit #$02 ; Left
  262. beq JoypadRight ; Button not pressed.
  263. lda playerX
  264. cmp #0
  265. beq JoypadRight ; Value saturated.
  266. dec playerX
  267. dec playerX
  268. JoypadRight:
  269. lda joy1 + 1
  270. bit #$01 ; Right
  271. beq JoypadStart ; Button not pressed.
  272. lda playerX
  273. cmp #(256 - 32)
  274. beq JoypadStart ; Value saturated.
  275. inc playerX
  276. inc playerX
  277. JoypadStart:
  278. lda joy1 + 1
  279. bit #$10 ; Start
  280. beq JoypadSelect ; Button not pressed.
  281. lda backgroundRed
  282. cmp #31
  283. beq JoypadSelect ; Value saturated.
  284. inc backgroundRed
  285. JoypadSelect:
  286. lda joy1 + 1
  287. bit #$20 ; Select
  288. beq JoypadY ; Button not pressed.
  289. lda backgroundRed
  290. cmp #0
  291. beq JoypadY ; Value saturated.
  292. dec backgroundRed
  293. JoypadY:
  294. lda joy1 + 1
  295. bit #$40 ; Y
  296. beq JoypadX ; Button not pressed.
  297. lda backgroundGreen
  298. cmp #0
  299. beq JoypadX ; Value saturated.
  300. dec backgroundGreen
  301. JoypadX:
  302. lda joy1
  303. bit #$40 ; X
  304. beq JoypadL ; Button not pressed.
  305. lda backgroundGreen
  306. cmp #31
  307. beq JoypadL ; Value saturated.
  308. inc backgroundGreen
  309. JoypadL:
  310. lda joy1
  311. bit #$20 ; L
  312. beq JoypadR ; Button not pressed.
  313. lda backgroundBlue
  314. cmp #0
  315. beq JoypadR ; Value saturated.
  316. dec backgroundBlue
  317. JoypadR:
  318. lda joy1
  319. bit #$10 ; R
  320. beq JoypadB ; Button not pressed.
  321. lda backgroundBlue
  322. cmp #31
  323. beq JoypadB ; Value saturated.
  324. inc backgroundBlue
  325. JoypadB:
  326. lda joy1 + 1
  327. bit #$80 ; B
  328. beq JoypadDone
  329. jsr MaybeShoot
  330. JoypadDone:
  331. rts
  332. MaybeShoot:
  333. ; If the cooldown timer is non-zero, don't shoot.
  334. lda shotCooldown
  335. cmp #0
  336. bne MaybeShootDone
  337. ; Find the first empty spot in the shots array.
  338. ldx #playerShotArray
  339. -
  340. lda 0, X
  341. cmp #0
  342. beq +
  343. .rept shotSize
  344. inx
  345. .endr
  346. ; If we went all the way to the end, bail out.
  347. cpx #(playerShotArray + playerShotArrayLength * shotSize)
  348. beq MaybeShootDone
  349. bra -
  350. +
  351. ; Enable shot; set its position based on player position.
  352. ; TODO(mcmillen): it might be easier/faster to keep N arrays: one for each
  353. ; field of shot (shotSpriteArray, shotXArray, shotYArray, ...)
  354. lda #8 ; Sprite number.
  355. sta 0, X
  356. lda playerX
  357. clc
  358. adc #20
  359. sta 1, X
  360. lda playerY
  361. sta 2, X
  362. ; Get x- and y-velocity out of shotVelocityTable.
  363. lda nextShotState
  364. and #%00000111 ; 8 possibilities.
  365. ldy #0
  366. -
  367. cmp #0
  368. beq +
  369. .rept 2
  370. iny
  371. .endr
  372. dec A
  373. bra -
  374. +
  375. inc nextShotState
  376. ; x-velocity.
  377. lda shotVelocityTable, Y
  378. sta 3, X
  379. ; y-velocity.
  380. lda shotVelocityTable + 1, Y
  381. sta 4, X
  382. ; Set cooldown timer.
  383. lda #8
  384. sta shotCooldown
  385. MaybeShootDone:
  386. rts
  387. UpdateWorld:
  388. jsr UpdateShotCooldown
  389. jsr UpdateShotPositions
  390. jsr UpdateBackgroundScroll
  391. rts
  392. UpdateShotCooldown:
  393. ; Update shot cooldown.
  394. lda shotCooldown
  395. cmp #0
  396. beq +
  397. dec A
  398. sta shotCooldown
  399. +
  400. rts
  401. UpdateShotPositions:
  402. ldx #0
  403. UpdateShot: ; Updates position of one shot.
  404. lda playerShotArray, X
  405. cmp #0
  406. beq ShotDone
  407. ; Add to the x-coordinate. If the carry bit is set, we went off the edge
  408. ; of the screen, so disable the shot.
  409. lda playerShotArray + 3, X ; x-velocity.
  410. sta $00
  411. bit #%10000000 ; Check whether the velocity is negative.
  412. bne UpdateShotWithNegativeXVelocity
  413. lda playerShotArray + 1, X
  414. clc
  415. adc $00
  416. bcs DisableShot
  417. sta playerShotArray + 1, X ; Store new x-coord.
  418. bra UpdateShotY
  419. UpdateShotWithNegativeXVelocity:
  420. ; TODO(mcmillen): wrap sprites when they go negative here, like we do
  421. ; with y-velocities.
  422. lda playerShotArray + 1, X ; Current x.
  423. clc
  424. adc $00
  425. bcc DisableShot
  426. sta playerShotArray + 1, X
  427. UpdateShotY:
  428. ; Add to the y-coordinate.
  429. lda playerShotArray + 4, X ; y-velocity.
  430. sta $00
  431. bit #%10000000 ; Check whether the velocity is negative.
  432. bne UpdateShotWithNegativeYVelocity
  433. lda playerShotArray + 2, X
  434. clc
  435. adc $00
  436. cmp #224
  437. bcs DisableShot
  438. sta playerShotArray + 2, X ; Store new y-coord.
  439. bra ShotDone
  440. UpdateShotWithNegativeYVelocity:
  441. lda playerShotArray + 2, X ; Current y.
  442. cmp #224
  443. bcs + ; If the shot was "off the top" before moving, maybe we'll reap it.
  444. adc $00 ; Otherwise, just update it,
  445. sta playerShotArray + 2, X ; save the result,
  446. bra ShotDone ; and we know it shouldn't be reaped.
  447. +
  448. clc
  449. adc $00
  450. cmp #224
  451. bcc DisableShot ; If it's now wrapped around, reap it.
  452. sta playerShotArray + 2, X
  453. bra ShotDone
  454. DisableShot:
  455. stz playerShotArray, X
  456. ShotDone:
  457. ; TODO(mcmillen): in places where we .rept inx (etc), is it faster to use
  458. ; actual addition?
  459. .rept shotSize
  460. inx
  461. .endr
  462. cpx #(playerShotArrayLength * shotSize)
  463. bne UpdateShot
  464. rts
  465. UpdateBackgroundScroll:
  466. ; Make the background scroll. Horizontal over time; vertical depending on
  467. ; player's y-coordinate.
  468. lda vBlankCounter
  469. sta BG3HOFS
  470. lda vBlankCounter + 1
  471. sta BG3HOFS
  472. lda playerY
  473. .rept 3
  474. lsr
  475. .endr
  476. sta BG3VOFS
  477. stz BG3VOFS
  478. rts
  479. UpdateSprites:
  480. ; This page is a good reference on SNES sprite formats:
  481. ; http://wiki.superfamicom.org/snes/show/SNES+Sprites
  482. ; It uses the same approach we're using, in which we keep a buffer of the
  483. ; sprite tables in RAM, and DMA the sprite tables to the system's OAM
  484. ; during VBlank.
  485. ; Sprite table 1 has 4 bytes per sprite, laid out as follows:
  486. ; Byte 1: xxxxxxxx x: X coordinate
  487. ; Byte 2: yyyyyyyy y: Y coordinate
  488. ; Byte 3: cccccccc c: Starting tile #
  489. ; Byte 4: vhoopppc v: vertical flip h: horizontal flip o: priority bits
  490. ; p: palette #
  491. ; Sprite table 2 has 2 bits per sprite, like so:
  492. ; bits 0,2,4,6 - High bit of the sprite's x-coordinate.
  493. ; bits 1,3,5,7 - Toggle Sprite size: 0 - small size 1 - large size
  494. ; Setting all the high bits keeps the sprites offscreen.
  495. ; Zero out the scratch space for the secondary sprite table.
  496. ldx #0
  497. -
  498. stz spriteTableScratchStart, X
  499. inx
  500. cpx #numSprites
  501. bne -
  502. ldx #0 ; Index into sprite table 1.
  503. ldy #0 ; Index into sprite table 2.
  504. ; Copy player coords into sprite table.
  505. lda playerX
  506. sta spriteTableStart, X
  507. lda playerY
  508. sta spriteTableStart + 1, X
  509. lda #0
  510. sta spriteTableStart + 2, X
  511. ; Set priority bits so that the sprite is drawn in front.
  512. lda #%00110000
  513. sta spriteTableStart + 3, X
  514. lda #%11000000 ; Enable large sprite.
  515. sta spriteTableScratchStart, Y
  516. .rept 4
  517. inx
  518. .endr
  519. iny
  520. ; Now add shots.
  521. sty $00 ; Save sprite table 2 index.
  522. ldy #0 ; Index into playerShotArray.
  523. -
  524. lda playerShotArray, Y
  525. cmp #0
  526. beq + ; If not enabled, skip to next shot.
  527. ; Update sprite table 1.
  528. sta spriteTableStart + 2, X ; sprite number
  529. lda playerShotArray + 1, Y
  530. sta spriteTableStart, X ; x
  531. lda playerShotArray + 2, Y
  532. sta spriteTableStart + 1, X ; y
  533. ; Update secondary sprite table.
  534. phy ; Save playerShotArray index.
  535. ldy $00
  536. lda #%11000000
  537. sta spriteTableScratchStart, Y
  538. iny
  539. sty $00
  540. ply ; Restore playerShotArrayIndex.
  541. .rept 4
  542. inx
  543. .endr
  544. +
  545. .rept shotSize
  546. iny
  547. .endr
  548. cpy #(playerShotArrayLength * shotSize)
  549. bne -
  550. ; Now clear out the unused entries in the sprite table.
  551. -
  552. cpx #spriteTable1Size
  553. beq +
  554. lda #1
  555. sta spriteTableStart, X
  556. .rept 4
  557. inx
  558. .endr
  559. +
  560. rts
  561. FillSecondarySpriteTable:
  562. ; The secondary sprite table wants 2 bits for each sprite: one to set the
  563. ; sprite's size, and one that's the high bit of the sprite's x-coordinate.
  564. ; It's annoying to deal with bitfields when thinking about business logic,
  565. ; so the spriteTableScratch array contains one byte for each sprite, in
  566. ; which the two most significant bits are the "size" and "upper x" bits.
  567. ; This function is meant to be called after UpdateWorld, and packs those
  568. ; bytes into the actual bitfield that the OAM wants for the secondary
  569. ; sprite table.
  570. ;
  571. ; The expected format of every byte in the scratch sprite table is:
  572. ; sx------ s = size (0 = small, 1 = large)
  573. ; x = flipped high x-coordinate (so 1 behaves like "enable").
  574. ldx #0 ; Index into input table.
  575. ldy #0 ; Index into output table.
  576. -
  577. stz $00 ; Current byte; filled out by a set of 4 input table entries.
  578. .rept 4
  579. ; For each byte, the lower-order bits correspond to the lower-numbered
  580. ; sprites; therefore we insert the current sprite's bits "at the top"
  581. ; and shift them right for each successive sprite.
  582. lsr $00
  583. lsr $00
  584. lda spriteTableScratchStart, X
  585. ora $00
  586. sta $00
  587. inx
  588. .endr
  589. lda $00
  590. eor #%01010101
  591. sta spriteTable2Start, Y
  592. iny
  593. cpx #numSprites
  594. bne -
  595. rts
  596. SetBackgroundColor:
  597. ; The background-color bytes are (R, G, B), each ranging from [0-31].
  598. ; The palette color format is 15-bit: [0bbbbbgg][gggrrrrr]
  599. ; Set the background color.
  600. ; Entry 0 corresponds to the SNES background color.
  601. stz CGADDR
  602. ; Compute and the low-order byte and store it in CGDATA.
  603. lda backgroundGreen
  604. .rept 5
  605. asl
  606. .endr
  607. ora backgroundRed
  608. sta CGDATA
  609. ; Compute the high-order byte and store it in CGDATA.
  610. lda backgroundBlue
  611. .rept 2
  612. asl
  613. .endr
  614. sta $00
  615. lda backgroundGreen
  616. .rept 3
  617. lsr
  618. .endr
  619. ora $00
  620. sta CGDATA
  621. rts
  622. VBlankHandler:
  623. jsr VBlankCounter
  624. jsr DMASpriteTables
  625. rti
  626. VBlankCounter:
  627. ; Increment a counter of how many VBlanks we've done.
  628. ; This is a 24-bit counter. At 60 vblanks/second, this will take
  629. ; 77 hours to wrap around; that's good enough for me :)
  630. inc vBlankCounter
  631. bne +
  632. inc vBlankCounter + 1
  633. bne +
  634. inc vBlankCounter + 2
  635. +
  636. rts
  637. DMASpriteTables:
  638. ; Store at the base OAM address.
  639. ldx #$0000
  640. stx OAMADDR
  641. ; Default DMA control; destination $2104 (OAM data register).
  642. stz DMA0CTRL
  643. lda #$04
  644. sta DMA0DST
  645. ; Our sprites start at $0100 in bank 0 and are #$220 bytes long.
  646. ldx #spriteTableStart
  647. stx DMA0SRC
  648. stz DMA0SRCBANK
  649. ldx #spriteTableSize
  650. stx DMA0SIZE
  651. ; Kick off the DMA transfer.
  652. lda #%00000001
  653. sta DMAENABLE
  654. rts
  655. .ENDS
  656. ; Bank 1 is used for our graphics assets.
  657. .BANK 1 SLOT 0
  658. .ORG 0
  659. .SECTION "GraphicsData"
  660. SpriteData:
  661. .INCBIN "sprites32.pic"
  662. SpritePalette:
  663. .INCBIN "sprites32.clr"
  664. TileData:
  665. .INCBIN "tiles.pic"
  666. TilePalette:
  667. .INCBIN "tiles.clr"
  668. .ENDS
  669. ; Fill an entire bank with random numbers.
  670. .SEED 1
  671. .BANK 2 SLOT 0
  672. .ORG 0
  673. .SECTION "RandomBytes"
  674. .DBRND 32 * 1024, 0, 255
  675. .ENDS