Post Reply 
Detect number entry on HP-35s?
03-06-2015, 04:27 PM (This post was last modified: 03-09-2015 05:09 AM by mbrethen.)
Post: #28
RE: Detect number entry on HP-35s?
This performs most of the computations using just the stack. The A, I and T named variables are used for input, indirect register access and temporary storage, respectively. It is based on a program for the HP-41 by Jean-Marc Baillard. I have translated it for the HP-35s. In addition to the HP-41 Flag 22 issue, there were other parts of the code I had to work around: "sign" of zero results in 1 on the HP-41 (0 on the 35s) , ISG loop counter and STO arithmetic on the stack (e.g. STOx Y). As Dieter pointed out, the program isn't fail safe but I like the fact that it does all the bookkeeping for you.

Thanks to all who participated in this topic.

Code:
W001 LBL W
W002 SF 1                   // set flag 1 to indicate first column
W003 ABS
W004 IP
W005 STO I                  // start with entered base register
W006 1.001
W007 STO* I
W008 ENTER
W009 FP
W010 1E3
W011 *
W012 EQN [IP(REGY),IP(REGX)]
W013 STO A
W014 R^
W015 R^
W016 ALL
W017 INPUT A                // display A? [line, column]
W018 ABS                    // check if x is scalar or vector
W019 [1,0]
W020 RCL* A
W021 ABS
W022 X<>Y?                  // is x a vector?
W023 GTO W051               // next column
W024 RDN
W025 X<> A
W026 STO(I)                 // store input in register (i)
W027 CLX
W028 1E-5
W029 FS? 1
W030 GTO W032
W031 GTO W033
W032 STO+ I                 // increment # of rows
W033 SGN
W034 STO+ I                 // increment register#
W035 +
W036 FS? 1                  // enter another element in the first column?
W037 GTO W008
W038 RCL I
W039 FP
W040 STO T
W041 ISG T
W042 IP                     // skipped if base register is zero
W043 X<> T
W044 REGY
W045 IP
W046 -
W047 X<0?
W048 GTO W058
W049 RDN
W050 GTO W008
W051 R^
W052 R^
W053 FS? 1                  // first column is stored?
W054 GTO W056
W055 GTO W066               // all the elements are stored
W056 CF 1                   // the next column indexes will be automatically incremented
W057 ENTER
W058 CLX
W059 1E-3
W060 +
W061 FP
W062 STO T
W063 ISG T
W064 X<> T
W065 GTO W008
W066 SGN                    // get the control number of the matrix
W067 +/-
W068 RCL+ I
W069 IP
W070 STO I
W071 LASTX
W072 FP
W073 1E3
W074 *
W075 FP
W076 STO+ I
W077 RDN
W078 LASTX
W079 IP
W080 RCL I
W081 1E3
W082 /
W083 +
W084 RTN

CK=6CA0
LN=302

Revision History
3/6/15 – Fixed an issue with the loop counter at line 42.
3/7/15 – Shortened the control # routine.
3/8/15 - Added line W025 so that absolute value isn't stored.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Detect number entry on HP-35s? - mbrethen - 02-25-2015, 03:37 AM
RE: Detect number entry on HP-35s? - d b - 02-26-2015, 06:31 AM
RE: Detect number entry on HP-35s? - mbrethen - 03-06-2015 04:27 PM



User(s) browsing this thread: 1 Guest(s)