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.

815 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. jmp 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. jmp -
  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. jmp 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. jmp UpdateShotY
  428. UpdateShotY:
  429. ; Add to the y-coordinate.
  430. lda playerShotArray + 4, X ; y-velocity.
  431. sta $00
  432. bit #%10000000 ; Check whether the velocity is negative.
  433. bne UpdateShotWithNegativeYVelocity
  434. lda playerShotArray + 2, X
  435. clc
  436. adc $00
  437. cmp #224
  438. bcs DisableShot
  439. sta playerShotArray + 2, X ; Store new y-coord.
  440. jmp ShotDone
  441. UpdateShotWithNegativeYVelocity:
  442. lda playerShotArray + 2, X ; Current y.
  443. cmp #224
  444. bcs + ; If the shot was "off the top" before moving, maybe we'll reap it.
  445. adc $00 ; Otherwise, just update it,
  446. sta playerShotArray + 2, X ; save the result,
  447. jmp ShotDone ; and we know it shouldn't be reaped.
  448. +
  449. clc
  450. adc $00
  451. cmp #224
  452. bcc DisableShot ; If it's now wrapped around, reap it.
  453. sta playerShotArray + 2, X
  454. jmp ShotDone
  455. DisableShot:
  456. stz playerShotArray, X
  457. ShotDone:
  458. ; TODO(mcmillen): in places where we .rept inx (etc), is it faster to use
  459. ; actual addition?
  460. .rept shotSize
  461. inx
  462. .endr
  463. cpx #(playerShotArrayLength * shotSize)
  464. bne UpdateShot
  465. rts
  466. UpdateBackgroundScroll:
  467. ; Make the background scroll. Horizontal over time; vertical depending on
  468. ; player's y-coordinate.
  469. lda vBlankCounter
  470. sta BG3HOFS
  471. lda vBlankCounter + 1
  472. sta BG3HOFS
  473. lda playerY
  474. .rept 3
  475. lsr
  476. .endr
  477. sta BG3VOFS
  478. stz BG3VOFS
  479. rts
  480. UpdateSprites:
  481. ; This page is a good reference on SNES sprite formats:
  482. ; http://wiki.superfamicom.org/snes/show/SNES+Sprites
  483. ; It uses the same approach we're using, in which we keep a buffer of the
  484. ; sprite tables in RAM, and DMA the sprite tables to the system's OAM
  485. ; during VBlank.
  486. ; Sprite table 1 has 4 bytes per sprite, laid out as follows:
  487. ; Byte 1: xxxxxxxx x: X coordinate
  488. ; Byte 2: yyyyyyyy y: Y coordinate
  489. ; Byte 3: cccccccc c: Starting tile #
  490. ; Byte 4: vhoopppc v: vertical flip h: horizontal flip o: priority bits
  491. ; p: palette #
  492. ; Sprite table 2 has 2 bits per sprite, like so:
  493. ; bits 0,2,4,6 - High bit of the sprite's x-coordinate.
  494. ; bits 1,3,5,7 - Toggle Sprite size: 0 - small size 1 - large size
  495. ; Setting all the high bits keeps the sprites offscreen.
  496. ; Zero out the scratch space for the secondary sprite table.
  497. ldx #0
  498. -
  499. stz spriteTableScratchStart, X
  500. inx
  501. cpx #numSprites
  502. bne -
  503. ldx #0 ; Index into sprite table 1.
  504. ldy #0 ; Index into sprite table 2.
  505. ; Copy player coords into sprite table.
  506. lda playerX
  507. sta spriteTableStart, X
  508. lda playerY
  509. sta spriteTableStart + 1, X
  510. lda #0
  511. sta spriteTableStart + 2, X
  512. ; Set priority bits so that the sprite is drawn in front.
  513. lda #%00110000
  514. sta spriteTableStart + 3, X
  515. lda #%11000000 ; Enable large sprite.
  516. sta spriteTableScratchStart, Y
  517. .rept 4
  518. inx
  519. .endr
  520. iny
  521. ; Now add shots.
  522. sty $00 ; Save sprite table 2 index.
  523. ldy #0 ; Index into playerShotArray.
  524. -
  525. lda playerShotArray, Y
  526. cmp #0
  527. beq + ; If not enabled, skip to next shot.
  528. ; Update sprite table 1.
  529. sta spriteTableStart + 2, X ; sprite number
  530. lda playerShotArray + 1, Y
  531. sta spriteTableStart, X ; x
  532. lda playerShotArray + 2, Y
  533. sta spriteTableStart + 1, X ; y
  534. ; Update secondary sprite table.
  535. phy ; Save playerShotArray index.
  536. ldy $00
  537. lda #%11000000
  538. sta spriteTableScratchStart, Y
  539. iny
  540. sty $00
  541. ply ; Restore playerShotArrayIndex.
  542. .rept 4
  543. inx
  544. .endr
  545. +
  546. .rept shotSize
  547. iny
  548. .endr
  549. cpy #(playerShotArrayLength * shotSize)
  550. bne -
  551. ; Now clear out the unused entries in the sprite table.
  552. -
  553. cpx #spriteTable1Size
  554. beq +
  555. lda #1
  556. sta spriteTableStart, X
  557. .rept 4
  558. inx
  559. .endr
  560. +
  561. rts
  562. FillSecondarySpriteTable:
  563. ; The secondary sprite table wants 2 bits for each sprite: one to set the
  564. ; sprite's size, and one that's the high bit of the sprite's x-coordinate.
  565. ; It's annoying to deal with bitfields when thinking about business logic,
  566. ; so the spriteTableScratch array contains one byte for each sprite, in
  567. ; which the two most significant bits are the "size" and "upper x" bits.
  568. ; This function is meant to be called after UpdateWorld, and packs those
  569. ; bytes into the actual bitfield that the OAM wants for the secondary
  570. ; sprite table.
  571. ;
  572. ; The expected format of every byte in the scratch sprite table is:
  573. ; sx------ s = size (0 = small, 1 = large)
  574. ; x = flipped high x-coordinate (so 1 behaves like "enable").
  575. ldx #0 ; Index into input table.
  576. ldy #0 ; Index into output table.
  577. -
  578. stz $00 ; Current byte; filled out by a set of 4 input table entries.
  579. .rept 4
  580. ; For each byte, the lower-order bits correspond to the lower-numbered
  581. ; sprites; therefore we insert the current sprite's bits "at the top"
  582. ; and shift them right for each successive sprite.
  583. lsr $00
  584. lsr $00
  585. lda spriteTableScratchStart, X
  586. ora $00
  587. sta $00
  588. inx
  589. .endr
  590. lda $00
  591. eor #%01010101
  592. sta spriteTable2Start, Y
  593. iny
  594. cpx #numSprites
  595. bne -
  596. rts
  597. SetBackgroundColor:
  598. ; The background-color bytes are (R, G, B), each ranging from [0-31].
  599. ; The palette color format is 15-bit: [0bbbbbgg][gggrrrrr]
  600. ; Set the background color.
  601. ; Entry 0 corresponds to the SNES background color.
  602. stz CGADDR
  603. ; Compute and the low-order byte and store it in CGDATA.
  604. lda backgroundGreen
  605. .rept 5
  606. asl
  607. .endr
  608. ora backgroundRed
  609. sta CGDATA
  610. ; Compute the high-order byte and store it in CGDATA.
  611. lda backgroundBlue
  612. .rept 2
  613. asl
  614. .endr
  615. sta $00
  616. lda backgroundGreen
  617. .rept 3
  618. lsr
  619. .endr
  620. ora $00
  621. sta CGDATA
  622. rts
  623. VBlankHandler:
  624. jsr VBlankCounter
  625. jsr DMASpriteTables
  626. rti
  627. VBlankCounter:
  628. ; Increment a counter of how many VBlanks we've done.
  629. ; This is a 24-bit counter. At 60 vblanks/second, this will take
  630. ; 77 hours to wrap around; that's good enough for me :)
  631. inc vBlankCounter
  632. bne +
  633. inc vBlankCounter + 1
  634. bne +
  635. inc vBlankCounter + 2
  636. +
  637. rts
  638. DMASpriteTables:
  639. ; Store at the base OAM address.
  640. ldx #$0000
  641. stx OAMADDR
  642. ; Default DMA control; destination $2104 (OAM data register).
  643. stz DMA0CTRL
  644. lda #$04
  645. sta DMA0DST
  646. ; Our sprites start at $0100 in bank 0 and are #$220 bytes long.
  647. ldx #spriteTableStart
  648. stx DMA0SRC
  649. stz DMA0SRCBANK
  650. ldx #spriteTableSize
  651. stx DMA0SIZE
  652. ; Kick off the DMA transfer.
  653. lda #%00000001
  654. sta DMAENABLE
  655. rts
  656. .ENDS
  657. ; Bank 1 is used for our graphics assets.
  658. .BANK 1 SLOT 0
  659. .ORG 0
  660. .SECTION "GraphicsData"
  661. SpriteData:
  662. .INCBIN "sprites32.pic"
  663. SpritePalette:
  664. .INCBIN "sprites32.clr"
  665. TileData:
  666. .INCBIN "tiles.pic"
  667. TilePalette:
  668. .INCBIN "tiles.clr"
  669. .ENDS
  670. ; Fill an entire bank with random numbers.
  671. .SEED 1
  672. .BANK 2 SLOT 0
  673. .ORG 0
  674. .SECTION "RandomBytes"
  675. .DBRND 32 * 1024, 0, 255
  676. .ENDS