The Museum of HP Calculators

HP Forum Archive 19

[ Return to Index | Top of Index ]

HP-30b key assignment trick -- Sudoku helper revisited
Message #1 Posted by Katie Wasserman on 26 Sept 2010, 5:04 p.m.

I found a sort of tricky but useful way to temporarily reassign keys on the HP-30b. Normal key assignment is easy using program step 0, and all keys except a few critical ones (reset, ON/CE, INPUT,etc.) are reassignable, this includes the numeric keys. The 30b is a macro programmable machine in the sense that keys executed in a program act as if they were pressed on the keyboard. In particular there's no automatic ENTER for a numeric key, so a program can be used to enter a digit in the middle of a number, for example. Making use of the above two features along with a conditional that doesn't need to use the stack at all (DSE and ISG) allows for temporary reassignment of keys.

The following code demonstrates this for a program that was suggested in this thread

Mode:	RPN
Fix:	0

Shift-Hold 0 starts/resets Sudoku entry mode showing digits 1-9 available. Pressing digits 1-9 will remove that digit from the display. When all digits have been pressed 0 is shown and Sudoku mode ends allowing normal calculator use. Sudoku mode can also be ended by storing 0 in register 0, this is possible since the 0 key is not redefined.

Registers used:

0 - indicates mode, if greater than 1 then Sudoku mode else calculator mode 6 - 10 ^ (number of digits in new digit string) 7 - new digit string 8 - old digit string 9 - user entered digit

Prog 0: 0 SH0 1 2 2 STO 0 3 1 4 2 5 3 6 4 7 5 8 6 9 7 10 8 11 9 12 STO 8 13 Sudoku 14 RTN 15 Lbl 00 16 DSE 0 17 Gto 01 18 RTN 19 Lbl 01 20 STO 9 21 0 22 STO 7 23 1 24 STO 6 25 Lbl 02 26 RCL 8 27 Input 28 GF 03 29 1 30 0 31 / 32 Math | IP 33 Up | 34 Up | 35 = | 36 STO 8 37 Ans 38 Math | FP 39 Up | 40 = | 41 1 42 0 43 * 44 RCL 9 45 ?= 46 GT 02 47 Rv 48 STO + 7 49 1 50 0 51 STO / 7 52 STO * 6 53 Gto 02 54 Lbl 03 55 RCL 6 56 STO 0 57 RCL * 7 58 STO 8 59 Sudoku 60 RTN

bytes.checksum: 103.018

Prog 1: 0 1 1 1 2 Gto 00

Prog 2: 0 2 1 2 2 Gto 00

Prog 3: 0 3 1 3 2 Gto 00

Prog 4: 0 4 1 4 2 Gto 00

Prog 5: 0 5 1 5 2 Gto 00

Prog 6: 0 6 1 6 2 Gto 00

Prog 7: 0 7 1 7 2 Gto 00

Prog 8: 0 8 1 8 2 Gto 00

Prog 9: 0 9 1 9 2 Gto 00

-Katie

      
Re: HP-30b key assignment trick -- Sudoku helper revisited
Message #2 Posted by Marcus von Cube, Germany on 27 Sept 2010, 4:44 a.m.,
in response to message #1 by Katie Wasserman

Nice trick, but no more room for more programs. :(

            
Re: HP-30b key assignment trick -- Sudoku helper revisited
Message #3 Posted by Katie Wasserman on 27 Sept 2010, 11:25 a.m.,
in response to message #2 by Marcus von Cube, Germany

There's not a lot of room for program in this calculator at all. It's very close to the 12C in actual programming space because it's not space efficient in merging program steps.

However, in this case only about 50% of the total program space is used and you could add more programs to this code. Accessing them from arbitrarily reassigned keys wouldn't be possible but you could use the DSE/ISG mechanism as a means to branch to different programs by LBL. For example storing a 3 in register_0 could would indicate the program A should be run when Shift-0 was pressed, a 4 in register_0 would indicate program B, etc..


[ Return to Index | Top of Index ]

Go back to the main exhibit hall