<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://wiki.intellivision.us/index.php?action=history&amp;feed=atom&amp;title=Rand.asm</id>
		<title>Rand.asm - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://wiki.intellivision.us/index.php?action=history&amp;feed=atom&amp;title=Rand.asm"/>
		<link rel="alternate" type="text/html" href="http://wiki.intellivision.us/index.php?title=Rand.asm&amp;action=history"/>
		<updated>2026-06-27T18:59:35Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.30.0</generator>

	<entry>
		<id>http://wiki.intellivision.us/index.php?title=Rand.asm&amp;diff=14882&amp;oldid=prev</id>
		<title>Mr z: Protected &quot;Rand.asm&quot; ([edit=autoconfirmed] (indefinite) [move=autoconfirmed] (indefinite))</title>
		<link rel="alternate" type="text/html" href="http://wiki.intellivision.us/index.php?title=Rand.asm&amp;diff=14882&amp;oldid=prev"/>
				<updated>2010-12-04T09:09:18Z</updated>
		
		<summary type="html">&lt;p&gt;Protected &amp;quot;&lt;a href=&quot;/index.php/Rand.asm&quot; title=&quot;Rand.asm&quot;&gt;Rand.asm&lt;/a&gt;&amp;quot; ([edit=autoconfirmed] (indefinite) [move=autoconfirmed] (indefinite))&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 09:09, 4 December 2010&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; style=&quot;text-align: center;&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Mr z</name></author>	</entry>

	<entry>
		<id>http://wiki.intellivision.us/index.php?title=Rand.asm&amp;diff=2961&amp;oldid=prev</id>
		<title>Mr z: /* Notes */</title>
		<link rel="alternate" type="text/html" href="http://wiki.intellivision.us/index.php?title=Rand.asm&amp;diff=2961&amp;oldid=prev"/>
				<updated>2008-09-07T02:55:21Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Notes&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 02:55, 7 September 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l17&quot; &gt;Line 17:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 17:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Also, consider calling this function periodically from idle loops, and/or mixing other random data into RNDHI/RNDLO to further increase randomness.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Also, consider calling this function periodically from idle loops, and/or mixing other random data into RNDHI/RNDLO to further increase randomness.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;#160;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;If this function is too bulky or slow, consider using [[randfast.asm]].&amp;lt;br /&amp;gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Source Code =&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Source Code =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Mr z</name></author>	</entry>

	<entry>
		<id>http://wiki.intellivision.us/index.php?title=Rand.asm&amp;diff=2957&amp;oldid=prev</id>
		<title>Mr z: /* Notes */</title>
		<link rel="alternate" type="text/html" href="http://wiki.intellivision.us/index.php?title=Rand.asm&amp;diff=2957&amp;oldid=prev"/>
				<updated>2008-09-07T00:32:15Z</updated>
		
		<summary type="html">&lt;p&gt;‎&lt;span dir=&quot;auto&quot;&gt;&lt;span class=&quot;autocomment&quot;&gt;Notes&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr style=&quot;vertical-align: top;&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: white; color:black; text-align: center;&quot;&gt;Revision as of 00:32, 7 September 2008&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l14&quot; &gt;Line 14:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 14:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Notes =&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;= Notes =&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This function requires 2 words of 16-bit memory.&amp;#160; Create two labels, RNDHI and RNDLO, for this function to store its random numbers &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;in&lt;/del&gt;.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color:black; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;This function requires 2 words of 16-bit memory.&amp;#160; Create two labels, RNDHI and RNDLO, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;that are set to the addresses &lt;/ins&gt;for this function to store its random numbers &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;state&lt;/ins&gt;.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Also, consider calling this function periodically from idle loops, and/or mixing other random data into RNDHI/RNDLO to further increase randomness.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;&amp;#160;&lt;/td&gt;&lt;td style=&quot;background-color: #f9f9f9; color: #333333; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #e6e6e6; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Also, consider calling this function periodically from idle loops, and/or mixing other random data into RNDHI/RNDLO to further increase randomness.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Mr z</name></author>	</entry>

	<entry>
		<id>http://wiki.intellivision.us/index.php?title=Rand.asm&amp;diff=2955&amp;oldid=prev</id>
		<title>Mr z at 00:27, 7 September 2008</title>
		<link rel="alternate" type="text/html" href="http://wiki.intellivision.us/index.php?title=Rand.asm&amp;diff=2955&amp;oldid=prev"/>
				<updated>2008-09-07T00:27:24Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;[[Category:Programming]] [[Category:Library]]&lt;br /&gt;
&lt;br /&gt;
= Functions Provided =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;CENTER&amp;gt;&amp;lt;TABLE BORDER&amp;gt;&amp;lt;TR&amp;gt;&amp;lt;TH&amp;gt;Entry point&amp;lt;/TH&amp;gt;&amp;lt;TH&amp;gt;Function provided&amp;lt;/TH&amp;gt;&amp;lt;TH&amp;gt;Notes&amp;lt;/TH&amp;gt;&amp;lt;/TR&amp;gt;&lt;br /&gt;
&amp;lt;TR&amp;gt;&amp;lt;TD&amp;gt;RAND&amp;lt;/TD&amp;gt;&amp;lt;TD&amp;gt;Generate an N-bit random number&amp;lt;/TD&amp;gt;&amp;lt;TD&amp;gt;N can be in the range 0..16&amp;lt;/TD&amp;gt;&amp;lt;/TR&amp;gt;&amp;lt;/TABLE&amp;gt;&amp;lt;/CENTER&amp;gt;&lt;br /&gt;
&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
See source code below for calling convention.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Examples =&lt;br /&gt;
&lt;br /&gt;
(todo... please contribute!)&lt;br /&gt;
&lt;br /&gt;
= Notes =&lt;br /&gt;
&lt;br /&gt;
This function requires 2 words of 16-bit memory.  Create two labels, RNDHI and RNDLO, for this function to store its random numbers in.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Also, consider calling this function periodically from idle loops, and/or mixing other random data into RNDHI/RNDLO to further increase randomness.&amp;lt;br /&amp;gt;&amp;lt;br /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
= Source Code =&lt;br /&gt;
&lt;br /&gt;
&amp;lt;pre&amp;gt;&lt;br /&gt;
;* ======================================================================== *;&lt;br /&gt;
;*  These routines are placed into the public domain by their author.  All  *;&lt;br /&gt;
;*  copyright rights are hereby relinquished on the routines and data in    *;&lt;br /&gt;
;*  this file.  -- Joseph Zbiciak, 2008                                     *;&lt;br /&gt;
;* ======================================================================== *;&lt;br /&gt;
&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
;;  GLOBAL VARIABLES USED BY THESE ROUTINES                                 ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;  This routine needs two 16-bit global variables as shown below.          ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;  Example declarations for these routines are shown, commented out.       ;;&lt;br /&gt;
;;  You should use declarations such as these, or perhaps use macros such   ;;&lt;br /&gt;
;;  as those in &amp;quot;dseg.mac&amp;quot; to define these variables.  Make sure to pick    ;;&lt;br /&gt;
;;  locations that aren't used for anything else.                           ;;&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
&lt;br /&gt;
                        ; Used by       Req'd Width     Description&lt;br /&gt;
                        ;-----------------------------------------------------&lt;br /&gt;
;RNDLO  EQU     $320    ; RAND          16-bit          Random number state&lt;br /&gt;
;RNDHI  EQU     $321    ; RAND          16-bit          Random number state&lt;br /&gt;
&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
;;  RAND                                                                    ;;&lt;br /&gt;
;;      Returns random bits in R0.                                          ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;  INPUTS:                                                                 ;;&lt;br /&gt;
;;      R0 -- Number of bits desired                                        ;;&lt;br /&gt;
;;      R5 -- Return address                                                ;;&lt;br /&gt;
;;      Random state in RNDLO, RNDHI                                        ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;  OUTPUTS:                                                                ;;&lt;br /&gt;
;;      R0 -- N random bits.                                                ;;&lt;br /&gt;
;;      R1, R2, R3, R4 -- Saved and restored                                ;;&lt;br /&gt;
;;      R5 -- trashed.                                                      ;;&lt;br /&gt;
;;                                                                          ;;&lt;br /&gt;
;;  NOTES:                                                                  ;;&lt;br /&gt;
;;      You are encouraged to add additional &amp;quot;randomness&amp;quot; by adding or      ;;&lt;br /&gt;
;;      XORing other values into RNDLO or RNDHI.  Also, to initialize       ;;&lt;br /&gt;
;;      the random number generator, ensure that RNDLO and RNDHI are        ;;&lt;br /&gt;
;;      non-zero.                                                           ;;&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
RAND    PROC&lt;br /&gt;
        PSHR    R5              ; Save return address and R1..R4&lt;br /&gt;
        PSHR    R4&lt;br /&gt;
        PSHR    R3&lt;br /&gt;
        PSHR    R2&lt;br /&gt;
        PSHR    R1&lt;br /&gt;
&lt;br /&gt;
        MVII    #1,     R1      ; Our initial mask word&lt;br /&gt;
        TSTR    R0              ; Is R0 &amp;gt; 0?&lt;br /&gt;
        BEQ     @@nobits&lt;br /&gt;
&lt;br /&gt;
        MVII    #$04C1, R5      ; period==(2**32 - 1) polynomial &lt;br /&gt;
        MVII    #$1DB7, R4      ; (this is the CRC-32 polynomial)&lt;br /&gt;
        MVI     RNDHI,  R3      ; Read in our 32-bit random number state&lt;br /&gt;
        MVI     RNDLO,  R2&lt;br /&gt;
&lt;br /&gt;
        TSTR    R3              ; If our random number generator is zero&lt;br /&gt;
        BNEQ    @@loop          ; jumpstart the process by forcing an XOR&lt;br /&gt;
        TSTR    R2              ; of our generator polynomal into R2/R3&lt;br /&gt;
        SETC                    ; up front.  Otherwise, we won't generate&lt;br /&gt;
        BEQ     @@forceit       ; any random numbers!&lt;br /&gt;
        &lt;br /&gt;
@@loop:&lt;br /&gt;
        SLLC    R2,     1       ; Shift our 32-bit random number left by 1&lt;br /&gt;
        RLC     R3,     1       ; ... by using the carry and an RLC.&lt;br /&gt;
@@forceit:&lt;br /&gt;
        SLL     R1,     1       ; Shift our mask bit left by 1&lt;br /&gt;
        BNC     @@nocarry&lt;br /&gt;
        XORR    R4,     R2      ; If the carry was set, XOR in our generator&lt;br /&gt;
        XORR    R5,     R3      ; polynomial.  &lt;br /&gt;
@@nocarry:&lt;br /&gt;
        DECR    R0              ; Keep generating bits.&lt;br /&gt;
        BNEQ    @@loop&lt;br /&gt;
&lt;br /&gt;
        MVO     R3,     RNDHI   ; Store our new random number state.&lt;br /&gt;
        MVO     R2,     RNDLO&lt;br /&gt;
&lt;br /&gt;
@@nobits:&lt;br /&gt;
        DECR    R1              ; Turn our mask bit into a mask word&lt;br /&gt;
        ANDR    R1,     R2      ; Mask the bits we actually want.&lt;br /&gt;
        MOVR    R2,     R0      ; Return our result in R0&lt;br /&gt;
&lt;br /&gt;
        PULR    R1              ; Retstore our registers and return.&lt;br /&gt;
        PULR    R2&lt;br /&gt;
        PULR    R3&lt;br /&gt;
        PULR    R4&lt;br /&gt;
        PULR    PC&lt;br /&gt;
&lt;br /&gt;
        ENDP&lt;br /&gt;
&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
;;  End of File:  rand.asm                                                  ;;&lt;br /&gt;
;; ======================================================================== ;;&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Mr z</name></author>	</entry>

	</feed>