Post Reply 
Detect number entry on HP-35s?
02-25-2015, 07:12 PM (This post was last modified: 02-26-2015 12:36 PM by Dieter.)
Post: #9
RE: Detect number entry on HP-35s?
(02-25-2015 02:49 PM)mbrethen Wrote:  Here was the thought process:
1. User enters the starting register number on the stack
2. Execute Program W
3. Flash array [column,row] (using two stack registers as counters)
4. Input value in variable A
5. Store in (I), beginning with starting register.
6. Increment counters and indirect register number
7. Go to step 3 until first column is filled
8. Start next column (Flag 0)
9. Exit program

So you want to enter a matrix. How does the program know its dimensions (#columns, #lines), resp. when is a line in step 7 considered "filled"? Do you want to enter line by line or column by column?

Or do you assume one line is complete as soon as no entry occurs? How do you then handle lines with different dimensions (# of columns)? If the first line had 3 values and the second one 5, how do you plan to access the, say, 4th element of the 2nd line?

While this is not what you're looking for, the following example shows my approach on entering a n x n matrix:

Code:
N001 LBL N
N002 INPUT N
N003 ABS
N004 IP
N005 STO N
N006 1E3
N007 /
N008 ENTER
N009 SIGN
N010 STO I   // address pointer := 1
N011 +
N012 STO D   // save 1.nnn in D for later use
N013 STO B   // store 1.nnn in B (line counter)
N014 RCL N
N015 RCLx N
N016 RCL+ I  // first address beyond last used register = n*n + 1
N017 STO J   // the "+1" is needed because the last value may be zero
N018 STO (J) // store some non-zero value there to allocate memory

N019 RCL D <-------------+   // recall 1.nnn
N020 STO C               |   // store in C (column counter)
                         |
N021 [IP(B), IP(C)] <-+  |
N022 STO A            |  |
N023 ALL              |  |
N024 INPUT A          |  |  // display A? [line, column]
N025 STO(I)           |  |
N026 ISG I            |  |  // increment index (address)
N027 ENTER            |  |
N028 ISG C            |  |  // increment column#
N029 GTO N021 --------+  |  // next column
                         |
N030 ISG B               |  // increment line#
N031 GTO N019 -----------+  // next line
N032 VIEW N
N033 RTN

While the program waits for input, it displays a vector like [1, 1] with line# and column# in X. Now, getting back to your request, if the user does not enter anything the entry will be a vector. If you now could check whether X holds a simple real (=entry) or a vector (=no entry), your problem was solved.

Dieter
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? - Dieter - 02-25-2015 07:12 PM
RE: Detect number entry on HP-35s? - d b - 02-26-2015, 06:31 AM



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