HP Forums

Full Version: HP-15C Software - Part II
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

Last October I asked about locating 15C software on the web and Karl Schneider responded:

Quote:

There is a meager assortment of Software Library programs for the HP-15C at the Forum's main page:

http://www.hpmuseum.org/software/software.htm

I have intended to add several of my own programs that might be practical:

HP-15C Library of complex-number utilities

HP-15C program to compute 3x3 complex matrix determinant

Valentin Albillo's clever program, found halfway through the following thread, solves a numerical puzzle posed by me:

A modest arithmetical challenge

With the new HP-15C announced, is there any update to Karl's list? This will help everyone get a fast, fresh start on the new calculator.

Thanks,
Gerry

I have mostly written for the HP42S, but here is a program that I adapted for my 15c:

/*Program to convert decimal fraction to a fraction readable on a tape measure.

Registers:

STO 0- ORIGINAL NUMBER

STO 1- NUMERATOR

STO 2- DENOMINATOR

*/

01 LBL A

02 STO 0

03 FRAC //Creates numerator x as a fraction with 16 as denominator: x/16

04 1 //Use 32 ON steps 04-05 if you want 32nds

05 6

06 STO 2

07 *

08 FIX 0

09 RND

10 FIX 3

11 INT

12 STO 1

13 LBL 7 //Can fraction be reduced?

14 2

15 /

16 FRAC

17 TEST 0 //Same as X#0

18 GTO 8 //If fraction can't be reduced, go to formatting subroutine

19 RCL 2 //Reduce fraction

20 2

21 /

22 STO 2

23 RCL 1

24 2

25 /

26 STO 1

27 GTO 7 //Try again

28 LBL 8 //Formatting subroutine

29 RCL 0 //Original number will be left in y register

30 RCL 1 //The next 7 steps put the fraction into the format Num.Deno:

31 RCL 2 //For Example, 1/16 will display as 1.16, 5/8 as 5.08

32 .

33 0

34 1

35 *

36 +

37 RTN

Comments are C++ style, obviously leave those out. Not sure of my use of the word "reduced" in the comments. This program can to take 5-10 sec to run- interesting to see how fast on the 15cLE.

Dwight

Gerry,

Not a very "heavyweight" program, but here is "CodeBreaker" for the 15C. Play is as described here. It runs painfully slow on a 15c classic. (I officially claim priority for first referring to the original 15c as the "15c classic".) It is quite fast on the 15c LE.

I have tried everything I can think of to make the program shorter. I had one idea that saved one step but would likely run slower, not that it matters on the 15c LE. Suggested improvments would be welcome!

```Step	Function	Keycode		Comment
001	LBL C		42,21,13	Label C for "Code Breaker"
002	Cl REG		42 34		clears all registers, mostly to get zeroes in 1 - 4, .0
003	FIX 1		42, 7, 1	set display mode Fix 1 so scores are presented as x.x
004	1		1		enter 1 for first digit of 10
005	0		0		enter 0 for second digit of 10
006	STO 6		44  6		Store constant 10 in register 6
007	4		4		enter 4
008	STO I		44 25		Store for in I for loop index and indirect storage.
009	LBL 2		42,21, 2	Label 2
010	RAN#		42 36		generate random number
011	RCL x 6		45,20, 6	Multiply times 10 to get a digit left of decimal point
012	INT		43 44		drop fractional portion
013	RCL 1		45  1		Recall register 1
014	TEST 5		43,30, 5	compare randomly generated digit to existing secret number digit
015	GTO 2		22  2		go to random number generator if random number is equal to any existing digit of secret number
016	x<>y		34		swap if not equal to get randomly generated digit back for next test
017	RCL 2		45  2		Recall register 2
018	TEST 5		43,30, 5	compare randomly generated digit to existing secret number digit
019	GTO 2		22  2		go to random number generator if random number is equal to any existing digit of secret number
020	x<>y		34		swap if not equal to get randomly generated digit back for next test
021	RCL 3		45  3		Recall register 3
022	TEST 5		43,30, 5	compare randomly generated digit to existing secret number digit
023	GTO 2		22  2		go to random number generator if random number is equal to any existing digit of secret number
024	x<>y		34		swap if not equal to get randomly generated digit back for next test
025	RCL 4		45  4		Recall register 4
026	TEST 5		43,30, 5	compare randomly generated digit to existing secret number digit
027	GTO 2		22  2		go to random number generator if random number is equal to any existing digit of secret number
028	x<>y		34		swap if not equal to get randomly generated digit back for next test
029	STO (i)		44 24		If random number is not equal to any existing digit, store in register pointed to by I
030	DSE I		42, 5,25	Decrement index
031	GTO 2		22  2		Go back to random number generator to store next digit
032	LBL 3		42,21, 3	Label 3
033	RCL 8		45  8		Recall register 8 to get original guess back for guessing portion
034	RCL .0		45 .0		Recall .0, count of guesses for guessing portion
035	RCL 5		45  5		Recall 5, score of guess for guessing portion
036	STOP		31		Stop
037	STO 8		44  8		Store 4 digit guess in register 8
038	STO 9		44  9		Store 4 digit guess in register 9
039	Cl x		43 35		Clear x for 0 in x
040	STO 5		44  5		Store in register 5, which will hold score for the current guess
041	4		4		Enter 4
042	STO I		44 25		Store 4 in I for loop index and indirect recalling.
043	LBL 8		42,21, 8	Label 8
044	RCL 9		45  9		Recall guess
045	RCL / 6		45,10, 6	Divide guess by 10
046	STO 9		44  9		Store back in register 9
047	FRAC		42 44		Take fractional part
048	RCL x 6		45,20, 6	Multiply times 10 to get a digit left of decimal point
049	INT		43 44		drop fractional portion
050	RCL (i)		45 24		Recall register pointed to by I
051	TEST 5		43,30, 5	Compare to digit extracted from guess for the I position
052	GTO 4		22  4		If equal, go to scoring for correct digit in correct location
053	x<>y		34		Swap to get extracted digit back
054	RCL 4		45  4		Recall digit 4
055	TEST 5		43,30, 5	Compare to extracted digit from guess
056	GTO 5		22  5		if equal, go to scoring for correct digit in incorrect location
057	x<>y		34		Swap to get extracted digit back
058	RCL 3		45  3		Recall digit 3
059	TEST 5		43,30, 5	Compare to extracted digit from guess
060	GTO 5		22  5		if equal, go to scoring for correct digit in incorrect location
061	x<>y		34		Swap to get extracted digit back
062	RCL 2		45  2		Recall digit 2
063	TEST 5		43,30, 5	Compare to extracted digit from guess
064	GTO 5		22  5		if equal, go to scoring for correct digit in incorrect location
065	x<>y		34		Swap to get extracted digit back
066	RCL 1		45  1		Recall digit 1
067	TEST 5		43,30, 5	Compare to extracted digit from guess
068	GTO 5		22  5		if equal, go to scoring for correct digit in incorrect location
069	0		0		enter 0 to indicate digit not in number
070	GTO 6		22  6		Go to scoring
071	LBL 4		42,21, 4	Label 4
072	1		1		Enter 1 for correct digit in correct location
073	GTO 6		22  6		Go to scoring
074	LBL 5		42,21, 5	Label 5
075	.		48		enter decimal point
076	1		1		enter 1 (for .1) for guess digit in number in incorrect location
077	LBL 6		42,21, 6	Label 6
078	STO + 5		44,40, 5	Add 1, .1 or 0 to score
079	DSE I		42, 5,25	Decrement index
080	GTO 8		22  8		Go to Label 8 to extract next guess digit
081	1		1		Enter 1
082	STO + .0	44,40,.0	Add to register .0, count of guesses
083	GTO 3		22  3		Go to 3
```

Edited: 6 Sept 2011, 9:46 p.m.