HP-41C "W" function, what was it intended for?



#2

The HP-41C has a synthetic function (byte 31D, 1FH) that is displayed as "W'ALPHA STRING" (The ' is the small superscripted 't' that denotes text on the HP-41). It can only be entered into a program through synthetic means, and Keith Jarret's Synthetic Programming Made Easy says that it simply sends the HP-41 into a lockup state, requiring battery removal. I tried it out last night, and on my -CV from 1982, only get a "NONEXISTENT" after a delay, indicating that the HP-41 is searching for the Alpha Label specified as part of the command. "NONEXISTENT" is eventually displayed even if a the label specified (Cat 1, 2, or 3) exists.

Any ideas as to what this function was originally indended to be? It is grouped with the global label GTO and XEQ functions, and also assumes a text label follows in program memory, just like GTO and XEQ. Could it have been a provision for a 'Write' function, a programmable function to write a program, perhaps to the card reader?

Since there are several HP-41C emulators available now, I thought someone may have figured out what it may have been intended for.

Just curious...


#3

It wasn't intended for anything. It's a left over instruction code, and the "W" name and the execution address are just artifacts of what data happens to be at the locations that would be used for its entry, if it had one.

It's sort of like eG0BEEP, except that in that case only the name is an artifact.


#4

Often I considered patching the OS in a few places, and this would definitely be one - a pole position in the byte table can be put to a good use, won´t you think? Having an unused entry is a wasted opportunity...


#5

Text 0 get used in synthetics. The other three should be clear but what for? Function launchers of some kind I guess.


- Pauli


#6

Dunno, the RCL Math feels like a good choice to fill that gap - but it'd need at least four entries. There's space in page 3 for the additional code but I'm not clear on where exactly apply the scalpo yet... nice project for the holidays it seems. Suggestions anyone?


#7

I was going to suggest RCL arithmetic, and it would be possible to use just one of the instruction bytes, I believe, assuming that it could be turned into a three byte instruction; e.g. RCL+01 would be (in decimal) 31,64,01, RCL-T would be 31,65,112, RCL*IND01 would be 31,66,129, and RCL/INDY would be 31,67,242.

Another use for them would be for a random number function, Combinations/Permutations, a Gamma function, a y-intercept / slope function, or a linear estimate / correlation coefficent function. These are all on the HP-15C and are missed on the HP-41C.

#8

The place to intercept this bytecode is in the XROW1 routine at address 0074. There obviously isn't room to patch it there, but you can replace a few bytes by a jump to somewhere else to expand the code. XROW1 starts with a test for <13 to branch to the digit entry routine. If you then insert a test for 15 you can branch to new code to interpret the new functionality. If the test isn't true return to 007A to handle the 13/14 cases. Just be sure to guarantee that the pointer is positioned properly if continuing on to XCUTEB.

Edited: 27 Dec 2012, 12:17 p.m.


#9

...but be aware that I used the empty locations 507F-5084 in the Timer ROM in the CL for a short power-on routine, so you'll need to find a different "blank spot" to use.

Edited: 27 Dec 2012, 12:48 p.m.

#10

That handles execution, but it will still try to display (in PRGM mode) a W with an inline ALPHA argument. It takes more extensive patching to fix that. And if you want your new function to be listed in CATALOG 3, even more patching.

#11

There are a couple of other unused instruction bytes. On the Synthetix HP-41C Quick Reference Card for Synthetic Programming they are listed as "Spare". Decimal 175 and 176 (also 'pole positions'). Instruction 175 appears just like 174 (GTO/XEQ IND) when inserted into a program, but it does not seem to do anything when executed. Instruction 176 shows up as a short form GTO (specifically GTO 15), but it doesn't appear to do anything when executed, either.

So in summary, (along with instruction 240, the 'Text 0' instruction) it appears that there are 4 (out of 256) instruction bytes that were never used in the HP-41C.

Thanks!

#12

Hi Eric, I'm at a loss trying to identify where in the OS exactly is the "mapping" done, I guess it's somewhere in page 2 but really don't have a clear picture. Could you give me some pointers? Thanks much in advance.


#13

Patching to change something like W is very tricky, because there isn't any space dedicated to a table entry for it. It's been a few years since I studied it, but I'll take another look.


#14

Sounds promising - just sent you a separate mail with a "tool" - maybe it helps us find "W"(aldo).

Cheers,
ÁM


Possibly Related Threads…
Thread Author Replies Views Last Post
  HP50g: Writing a function that returns a function Chris de Castro 2 2,153 12-10-2013, 06:49 PM
Last Post: Han
  IFERR function on HP Prime Mic 2 1,862 12-02-2013, 01:33 AM
Last Post: cyrille de Brébisson
  HP Prime: Dirichlet's eta function recognized but not numerically evaluated Helge Gabert 0 1,167 11-16-2013, 03:41 PM
Last Post: Helge Gabert
  Possible bug with sqrt function in the HP prime Michael de Estrada 6 2,563 11-15-2013, 12:49 PM
Last Post: Michael de Estrada
  HP-41 MCODE: The Last Function - at last! Ángel Martin 0 1,094 11-08-2013, 05:11 AM
Last Post: Ángel Martin
  HP Prime 'where' function bluesun08 11 3,468 10-29-2013, 06:56 PM
Last Post: Joe Horn
  HP Prime - Defining a function bluesun08 5 2,336 10-23-2013, 02:43 PM
Last Post: Han
  HP PRIME Function parameters steindid 2 1,469 10-11-2013, 10:20 AM
Last Post: steindid
  HP Prime can't find how to use partfrac function ! dg1969 3 1,672 10-04-2013, 09:25 PM
Last Post: Joe Horn
  HP Prime function APP - Strange limitation ! :o( dg1969 2 1,621 10-04-2013, 12:10 PM
Last Post: dg1969

Forum Jump: