Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Tetris NES
- Almost completely random, except for a single dupe check. If the normal logic pulls a duplicate piece, a second logic chooses another after manipulating rng. There is no second check for a duplicate, so they obviously still happen. Just not as often.
- 00:9907:E6 1A INC $001A = #$02 ; increase piece counter
- 00:9909:A5 17 LDA $0017 = #$FA ; Load value from rng
- 00:990B:18 CLC
- 00:990C:65 1A ADC $001A = #$02 ; Add piece counter to rng value (more randomness?)
- 00:990E:29 07 AND #$07 ; AND with 7 (0-6 are pieces)
- 00:9910:C9 07 CMP #$07 ; if 7,
- 00:9912:F0 08 BEQ $991C ; goto $991C
- 00:9914:AA TAX ; Copy our piece to X register
- 00:9915:BD 4E 99 LDA $994E,X @ $9958 = #$02 ; Load A with our piece's PieceID for correct orientation
- 00:9918:C5 19 CMP $0019 = #$0E ; Compare with the last piece we had
- 00:991A:D0 1C BNE $9938 ; If different, goto $9938 (Done)
- 00:991C:A2 17 LDX #$17 ; We landed here on a 7 or a duplicate
- 00:991E:A0 02 LDY #$02
- 00:9920:20 47 AB JSR $AB47
- This subroutine manipulates RNG to pull a different value by rotating the bits right of each rng byte.
- Not sure what it is doing to the carry flag.
- 00:AB47:B5 00 LDA $00,X @ $0017 = #$AC
- 00:AB49:29 02 AND #$02
- 00:AB4B:85 00 STA $0000 = #$8E
- 00:AB4D:B5 01 LDA $01,X @ $0018 = #$EF
- 00:AB4F:29 02 AND #$02
- 00:AB51:45 00 EOR $0000 = #$8E
- 00:AB53:18 CLC
- 00:AB54:F0 01 BEQ $AB57
- 00:AB56:38 SEC
- 00:AB57:76 00 ROR $00,X @ $0017 = #$AC
- 00:AB59:E8 INX
- 00:AB5A:88 DEY
- 00:AB5B:D0 FA BNE $AB57
- 00:AB5D:60 RTS -----------------------------------------
- 00:9923:A5 17 LDA $0017 = #$FA ; Reload from manipulated rng
- 00:9925:29 07 AND #$07 ; AND with 7 again
- 00:9927:18 CLC
- 00:9928:65 19 ADC $0019 = #$0E ; Add piece counter
- 00:992A:C9 07 CMP #$07 ; If less than 7,
- 00:992C:90 06 BCC $9934 ; goto $9934, we're done
- 00:992E:38 SEC ; If 7 or more,
- 00:992F:E9 07 SBC #$07 ; Subtract 7
- 00:9931:4C 2A 99 JMP $992A ; goto check again, loop until we have < 7
- 00:9934:AA TAX ; Copy our piece to X register
- 00:9935:BD 4E 99 LDA $994E,X @ $9958 = #$02 ; Load A with our piece's PieceID for correct orientation
- 00:9938:85 19 STA $0019 = #$0E ; Our piece is chosen, store it in NEXT
- 00:993A:60 RTS -----------------------------------------
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement