HP48 program improvement. . .



#4

Hi, HP48 users!

I have a remote control program that includes a
lot of questions in this type of form:

j 6 == i 1 == AND IF THEN 7 'k' STO END
j 12 == i 23 == AND IF THEN 8 'k' STO END
j 17 == i 45 == AND IF THEN 9 'k' STO END
j 56 == i 67 == AND IF THEN 10 'k' STO END
j 34 == i 89 == AND IF THEN 11 'k' STO END
j 37 == i 111 == AND IF THEN 12 'k' STO END
.
.
.
.

I would appreciate it if you could convert these
questions so they will operate faster.

Best regards,
Tal


#5

Hello;

It seems, in a first look, a CASE...THEN... END structure would fit better. If you have problems implementing, send me an e-mail.

Cheers.

#6

Tal,

Assuming the local variables i and j are set elsewhere, the following code works. The original code has no default value or action if an i & j pair is not found, or if neither value is not within the tested values.

{ 7 8 9 10 11 12 }
{ 6 12 17 56 34 37 } j POS
{ 1 23 45 67 89 111 } i POS
OVER == OVER 0 /= AND
IF
THEN GET
ELSE DROP@
END

This simplifies the code, I'm not sure about the speed. The =/ above is the HP48 not equal test.

Joe


Possibly Related Threads...
Thread Author Replies Views Last Post
  HP Prime: run a program in another program Davi Ribeiro de Oliveira 6 607 11-11-2013, 08:28 PM
Last Post: Davi Ribeiro de Oliveira
  ANN: A MacOSX Kermit program for HP48/49/50 calculators Paul Onions 2 384 09-08-2013, 04:55 AM
Last Post: Paul Onions
  A suggestion for easy improvement of the HP17bII+ Jose Gonzalez Divasson 1 193 07-10-2011, 10:38 AM
Last Post: Tim Wessman
  HP-41 MCODE: Making an MCODE program call another MCODE program Geir Isene 10 762 01-13-2008, 05:58 AM
Last Post: Raymond Del Tondo
  For those saying that 35s screen is an improvement over 33s romeo_charlie 25 1,210 09-28-2007, 09:33 AM
Last Post: Chris Haltiner
  HP48 Program Development Link and Proper Fonts Les Wright 4 362 05-12-2006, 11:33 AM
Last Post: Les Wright
  Improvement on HP-45. r. d. bärtschiger. 13 736 09-25-2003, 06:45 PM
Last Post: dbrunell
  "NUM LOCK" program for the HP48... tal 0 191 04-09-2000, 05:32 AM
Last Post: Tal
  HP48 PROGRAM tal 0 159 03-28-2000, 06:41 AM
Last Post: Tal
  HP48 - PROGRAM HELP tal 0 163 03-26-2000, 03:21 AM
Last Post: Tal

Forum Jump: