The Museum of HP Calculators

HP Forum Archive 10

[ Return to Index | Top of Index ]

HP42S programming (text editor)
Message #1 Posted by Christof on 15 Jan 2003, 12:55 p.m.

Well, I'm working on some text editor and "file utility" fucntions for the 42S, limited to what I cna code on the machine (menaing I'm not doing simulator and saturn assembly..... yet.)

So far I've got two systems running side by side- one uses an x row by 8 column array to hold the alpha data in groups of 6 letters per element. one problem with this is that you need to somehow control the display of empty elements to prevent excessive numerics. (I generally have my machine set to fix 5 and end up with 42 0s in the alpha register if I have a >7 character string, for example)

The other method is to make an x by 44 matrix and use individual character codes, but this seems to just add a problem of taking more memory (not everyone has ~31500 bytes to play with)

I also have not found a way around the need to use the r/s key after doing alpha entry. The best I've done (and found int he programming guide that this is what they do as well) is:


anyone have anyhting better? There are two main uses, one is to type in the [programmer restricted] 6 character "filename" with then gets ASTO 40 (I use registers 40-49 thus far to prevent overwriting other regs, we shall see) the other main use is the actual editing and entering of textual data (44 character line limit) which then gets stored in 6 character chunks into the various columns of the current row of a matrix.

I'm doing this all fairly conventionally, using the 42S manual and the PDF of the Programming guide as references. If I'm missing anything important, someone holler up :)

The matrix system for forming "text files" seems to be the only way I can do this given the 42S system...

the other functions I'm working on (or in a few cases have done) include newfl (making a new "file"), cat (straight concat file x into file y), merge (take files z and y & create a new file x), list (list matrixes identified as "files"), copy (done within TXTED to keep the file listing straight), delete (same reason), and I've got the menu hooks for an encryption and decryption method for fun (but that is lower priority than the rest and not started beyond having blank labels.)


Re: HP42S programming (text editor)
Message #2 Posted by Vieira, Luiz C. (Brazil) on 15 Jan 2003, 2:03 p.m.,
in response to message #1 by Christof

Hi, Christof;

have you thought about a running program that would stop and scan the keyboard with GETKEY? This way, everything will be automated, you will not insert characters directly to ALPHA register, instead ALPHA contents would be "re-assembled" each time a key is pressed. You should terminate the "writing" process if an specific key is keyed in. Each key has a code for GETKEY, and you need to convert the code to ASCII and use XTOA to add the keyed-in character to ALPHA. You can simulate the ALPHA input already existing in the HP42S or create your own. Also, you would verify ALENG (ALPHA Length) for each key pressed and when it reaches 22 you would ASTO ST X and ASHF (ALPHA shift).

Many things can be done out of the ALPHA environment and you would simulate an actual editor, even with specific softkeys. And the HP42S is fast enough to allow the program to run and build the LCD fastly.

I thought about an editor for the HP42S, but I remember at that time I thought it would be a lot usefull if the HP42S had I/O capabilities to save and retrieve matrices with ALPHA data.

As you asked about suggestions, my US$ 0.05

Cheers and success.

Luiz C. Vieira

Re: HP42S programming (text editor)
Message #3 Posted by Christof on 15 Jan 2003, 2:58 p.m.,
in response to message #2 by Vieira, Luiz C. (Brazil)


not a bad idea...

I/O would help a lot, I started out just looking for something to keep some notes with when I'm out.

And I had thought of doing something that would allow for straight alpha entry, though I'd have to make some sort of overlay to know which keys were which in "alpha keyboard mode"

Typing with the two level alpha menu isn't really that slow for notes once you get used to it, though. (I bet I could make an easily memorizable system that would use only the first 12 keys in combinations of two, which is a 144 character space.Btu that is another topic entirely.)

I'll look at a getkey based system for entry, if I am manually drawing the display from user code it might get a bit large as a codebase for a stock 42S..

could be *really* useful if we get to a point where we can add in a rom on that second pad, though....

I'll look at the getkey based possibilities this afternoon.

Would people be willing to muck with their keyboards to have a "proper" alpha input system?

(and how best to handle lower case when you need the shift key to handle numbers and such)

Re: HP42S programming (text editor)
Message #4 Posted by Vieira, Luiz C. (Brazil) on 15 Jan 2003, 4:38 p.m.,
in response to message #3 by Christof

Hi, Christof;

If you use GETKEY, you can use a flag to signalize shifted (lower-case) letters, so you would not need to keep [SHIFT] keey pressed, it would act as a toggle key. The problem is that the [SHIFT] key itself does not generate a code, instead it shifts the code for the next key (if I am not wrong). Also, if you think the keyboard is not good for signaling all keys, you can use [^] (up) and [v] (down) keys to build two keyboards in the same key set, each one with half the keys in the alphabet.

Jus ideas...


Re: HP42S programming (text editor)
Message #5 Posted by Christof on 15 Jan 2003, 6:41 p.m.,
in response to message #4 by Vieira, Luiz C. (Brazil)

I was htinking more of the need to use the numeric and "4 banger" keys for parts of the alphabet, so needing to shift to do numeric and other symbols.

Simulating shift keys with the arrows is possible... I'm going to start worrying about how many changes to the "normal" interface that creates. (functionally having 3 shift keys gives you an insane amount of keyspace that it is possible to assign keys to- 165 in the most efficient double shifting combination, 99 with only single shifting)

I think ideally I would like to keep the standard alpha entry mode, though. At leas tin one version. it's scary to think of modifying the keyboard on these even to just add in alpha characters in paint.

But who knows which answer will work best in the end?

[ Return to Index | Top of Index ]

Go back to the main exhibit hall