PSL = $FF;
gosub B4D7; // print "READY?"
do
{   r1++; // increment random number
} while (IOPORT($05) == 0); // while we wait for a keypress
*(B44C+1) = r1; // operand for LODI,r1 statement below
for (;;)
{   r1 = *(B44C+1) - 1;
    if (r1 != 0)
    {   r2 = FOO; // initially 8
        r2 = DAR(r2) + 1;
        r2 &= $0F; // keep number part
        FOO = r2;
        gosub B472; // do the rotation
    } else
    {   for (;;)
        {   gosub B4A6; // print numbers
            gosub B4D7; // write "ROTATION-"
            gosub B46F; // wait for keystroke then do the rotation
            gosub B48E; // check whether game has been won
}   }   }
Subroutine B46F (and B472)------------------------------------------------
gosub B4C4 (or, gosub B4FD); // get keystroke
B472: // alternate entry point
r0 = r2;
r1 = 1;
for (;;)
{   r0 -= r1;
    if (r0 < 1)
    {   return;
    } // implied else
    r3 = NUMBERS[r1];
    r0 = NUMBERS[r2];
    NUMBERS[r1] = r0;
    NUMBERS[r2] = r3;
    r0 = r3;
    r1++;
    r2--;
    r0 = r2; 
}
Subroutine B48E-----------------------------------------------------------
for (r1 = 9; r1 >= 1; r1--)
{   r0 = one of '987654312' for r1 of 1..9, respectively
    r0 &= $0F; // keep number part
    if (r0 != r1)
    {   return; // haven't won yet
}   }
gosub B4D7; // write "YES!"
gosub B4A6; // print numbers
goto B440; // restart game
Subroutine B4A6-----------------------------------------------------------
gosub CRLF;
gosub CRLF;
for (r1 = 1; r1 <= 9; r1++)
{   r0 = one of '987654312' for r1 of 1..9, respectively
    gosub COUT(r0);
    if (r1 < 9)
    {   COUT(' ');
}   }
return;
Subroutine B4D7-----------------------------------------------------------
r1 is passed as an argument.
for (;;)
{   r0 = *(W4DF-1+r1);
    if (r0 == 0) return;
    COUT(r0);
}
Subroutine B4FD-----------------------------------------------------------
do
{   r0 = CHIN(); // get keystroke from user
    if (r0 == ESC) goto WDOS; // quit to DOS if ESCape was pressed
} while (r0 < '1' || r0 > '9');
COUT(r0);
r0 &= $0F; // keep number part
r0 = r2;
return; // return code is in r0 and r2
