Created
November 25, 2012 01:30
-
-
Save thentenaar/4142031 to your computer and use it in GitHub Desktop.
Disassembly of TI BASIC's RND function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4F00: ST @>834A,>3F ; Zero loop counter: >3F (63) | |
4F03: ST @>8310,>4B ; Number buffer address: >834B | |
4F06: RAND >63 ; Get a pseudo-random number (using 100 as the divisor) | |
4F08: CZ @>8378 ; If then number isn't zero, goto >4F16 | |
4F0A: BR >4F16 | |
4F0C: DEC @>834A ; Decrement the zero loop counter | |
4F0E: CZ @>834A ; If the zero loop counter is 0, goto >4F23 (return 0) | |
4F10: BS >4F23 | |
4F12: BR >4F06 ; Otherwise, continue the loop | |
4F14: RAND >63 ; Get the next pseudo-random number | |
4F16: ST @>8378,*>8310 ; Store it at *>8310 | |
4F1A: CEQ @>8310,>51 ; if the number buffer address is >8351 | |
4F1D: BS >4F25 ; Exit the routine | |
4F1F: INC @>8310 ; Otherwise, prepare to store the next number | |
4F21: BR >4F14 ; Loop to generate it | |
4F23: CLR @>834B | |
4F25: CONT ; Return |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment