HP Forums

Full Version: A few HP-48 Questions
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

1) What is a good editor for writing and viewing programs and text that leaves the text in a format that looks like it was when it was created? I mean, when I create a program, I use spacing and new lines to format the program but when I go back to edit it again, it is all run together in a string. Is there a program that will leave it in the format that it was created in.

2) Does the HP-48 support bitwise logic functions? I don't see that capability. Say one wants to mask a number so that only the first 16 bits are ever relevant. One might take a number and AND it with # FFFFh but I don't see how that is done in the 48. It seems to only use logic ANDing.

3) Are there any functions that can operate on a string so that programs can, say, grab the first 2 characters of a string or last X characters of a string?

Mike,

Q1: If you're referring to UserRPL programs, the system does that, can't help. Otherwise, go to www.hpcalc.org and get a copy an editor from that site. I'm using ED from the Jazz library but you'll need more memory to store it.

Q2: Get an HP16 emulator from the aforementioned site.

Q3: Yes, several. Try one of the following built-in features:

String begin end SUB -> sub of string

String character POS -> position of character in string

String HEAD -> first character

Joe

You said:
Q1: If you're referring to UserRPL programs, the system does that, can't help. Otherwise, go to www.hpcalc.org and get a copy an editor from that site. I'm
using ED from the Jazz library but you'll need more memory to store it.

Followup:
So there is no way to view User programs in any format but a run together string?

You said:
Q2: Get an HP16 emulator from the aforementioned site.

Followup:
I need more than an HP16 emulator. I need the ability to use string searches etc, as in question 3 along with the ability to manipulate, mask, shift etc on the value of the string characters. I don't think an HP16 emulator can manipulate strings. So, what I need are functions for bitwise logic functions, and string manipulations in a User Program.

Mike,

I'm not certain about your first question as programs are entered not as strings but as commands delimited by white space. I know the operating system "beautifies" input - indents IF THEN structures, etc, etc.

As for the second part ... I'm don't have a direct answer but it is possible ... these things are programmable!

Joe

2) YEs, the HP48 (and HP49) machines support all the normal bitwise functions. The commands are what you'd expect -- AND, OR, NOT, etc
The 2 arguments to these commands _must_ be 'binary numbers' -- that is to say they must be #nnnn. If they're real numbers, it uses a true/false sort of logic (0 is false, anything else is true), which is not what you want.
If you want to mask off all but the bottom 16 bits of a number first use R->B to convert it to binary, and then #FFFFh AND . You can use B->R to turn it back into a real number if you want to.
(3). There's the SUB command. It takes 3 arguments off the stack. The string in level 3, the first character position in level 2 (leftmost character is 1), and the last character position in level 1.
The arguments are removed from the stack, and the result returned to the stack as with every other command. For example
"HELLO WORLD" 3 7 SUB returnes "LLO W". The SIZE command can be useful to find the number of characters in a string so as to be able to calculate first and last character positions.
All these commands (string handling and bitwise) can be used in programs.