REVERSE

Display

(HP-41CX, Hewlett Packard 1983 and DM41X, SwissMicros 2020)
 

Overview
Programs REX and REV are games that present the digits 0 through 9 in random order. By reversing the sequence of the numbers, they can be put in increasing order from 0 to 9. Program REX uses the specific HP-41CX feature REGSWAP on line 42 whilst REV implements that swap using standard instructions. The goal is to make the least number of moves while ordering a random pattern like:

      <:9480136257:>   into   <:0123456789:>

To enable a reversing move, type the number of digits, counting from left to right, and press R/S.
 

Example: REX or REV

 

Program Listing
The listing of REX and REV is given below with 2 XROM functions SEED and RNDM on lines 3 and 9. These can be taken as explicit calls to other programs in memory or to XROM functions in for example the CCD module. If replaced by these XROM functions (as in the RAW and TXT file) the total number of bytes will be 112 instead of 120 (for REX) and 114 instead of 122 (for REV).The listing of programs REX and REV is given below:

 

Registers, Labels and Flags

 

Downloads
PDF format of programs REX and REV.
RAW/TXT format of programs REX and REV (in zip file).
 

This program is copyright and is supplied without representation or warranty of any kind. The author assumes no responsibility and shall have no liability, consequential or otherwise, of any kind arising from the use of this program material or any part thereof

© 1999-2023 by Auke Hoekstra

 
Don`t copy text!