The following warnings occurred:
Warning [2] Undefined array key 148041 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 148046 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 148050 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 148055 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 148059 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 148072 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 148081 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 148085 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 148092 - Line: 275 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 275 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $thread - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $fid - Line: 295 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 295 errorHandler->error_callback
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 148046 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 148092 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined array key 148085 - Line: 331 - File: inc/plugins/threaded_mode.php PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php 331 errorHandler->error_callback
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 332 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 304 ThreadedMode::buildtree
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $theme - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Trying to access array offset on value of type null - Line: 3 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 3 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Undefined variable $lang - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks
Warning [2] Attempt to read property "messages_in_thread" on null - Line: 5 - File: inc/plugins/threaded_mode.php(305) : eval()'d code PHP 8.1.2-1ubuntu2.14 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/plugins/threaded_mode.php(305) : eval()'d code 5 errorHandler->error_callback
/inc/plugins/threaded_mode.php 305 eval
/inc/plugins/threaded_mode.php 23 ThreadedMode::showthread_threaded
/inc/class_plugins.php 142 threaded_mode_showthread_threaded
/showthread.php 918 pluginSystem->run_hooks





41 RPN LBL GTO rules



#3

Hello All,

I have a rather large 41CX program (not written by myself) that has a number of duplicate LBLs. I am trying to run this program using the 71B 41 Translator ROM, but it fails to run. I think it has to be an issue with the duplicate LBLs.

The manual states that when a GTO is encountered a scan is performed going down, then from top down, until found. But what if their are multiple local LBLs with the same name/number? It is the first or last? Furthermore the docs state that it is cached and not searched again. Is that only true for the original GTO or all GTOs to the LBL?

I'll admit I'm being a bit lazy and can setup an experiment to find the answer, but, well, I'm feeling lazy today. I am also looking for some insight as to why a person would code with duplicate LBLs. Is it a trick to be leveraged? Have others had issues with RPN code and duplicate LBLs on the 71B 41 Translator ROM?

Thanks.


#4

Local GTOs and XEQs jump to the first matching label following the instruction. This means that for non-overlapping forward jumps, you can reuse labels; in my HP-41 days, I usually reserved LBL 00-02 for forward jumps, and higher numbers for backward jumps.

Once the local label is found, the offset from the GTO or XEQ is stored in that GTO or XEQ, so subsequent executions of that same instruction don't have to perform the search again. The cached offset stays valid until you edit or PACK the program; editing causes all local GTO and XEQ offsets to be invalidated. Offsets in other programs are not affected.

Given that there are 115 local labels to work with in the 41, there may not seem to be much incentive for reusing them, but keep in mind that LBL 00-14 are "short form" labels, occupying one byte less than the regular variety. Likewise, GTOs to those LBLs are also one byte shorter (but they also have a smaller jump offset field, so you should avoid using LBL 00-14 as target for long-range jumps, where "long range" means more than 112 bytes.

Note that the rules for global labels (ALPHA) are different; those are searched for backwards, starting from the .END. You cannot use duplicate ALPHA labels; if you do, only the last one will ever be reached.

- Thomas

#5

Hello Egan,

re-using local labels inside a FOCAL program is a common technique.

You can save bytes (or reduce program size) if you manage

to use the one-byte local labels 00-14 more than once,

instead of local labels like LBL 22, which take two bytes of memory.

Also, the associated GTO's use two bytes for label 00-14,

but three bytes for numeric labels above 14.

As you know, the primary search direction is forward,

so when a GTO <local> is encountered the first time the program is

run (or after an edit or GTO..), the OS will search for a suitable label,

from the current PC ot the end, and then from the start of the prog.

If found, the offset will be noted in the label opcode,

so the next time the program is run a jump to the label will be faster.

Also note that the two-byte GTO's have a restricted offset field,

so farther jumps will have to be computed each time.

IIRC, the translator ROM produces at least an intermediate file

before actually compiling the FOCAL program.

This processing stage would be a point to jump in.

But for FOCAL programs of which you plan to convert them to FORTH anyway,

I'd replace the duplicate local labels on the HP-41 beforehand.

Just take care to adjust the correct GTO/XEQ statements.

Also be aware of another potential obstacle:

Many HP FOCAL programs make use of indirect addressing.

This feature works for jumps, too!

Something like XEQ IND X will jump to the label whose name or number is in X.

There may be more tricks to be aware of, but I don't have them handy right now:-)

HTH

Edit: Thomas' response was earlier and more precise in less words;-)


Edited: 7 Mar 2009, 7:57 p.m.


#6

Thomas, Raymond,

Thanks. This helps. I think I figured out this program and my confusion. LBLs were being used as NOPs. LBLs after ISG, DSE or conditionals make sense to me. But LBLs after ENTER do not and if I remove them I get incorrect results. What's up with that?

Thanks.


#7

The LBL after ENTER re-enables stack lift:

CLST 1 ENTER LBL 00 2 => T:0 Z:1 Y:1 X:2


CLST 1 ENTER 2 => T:0 Z:0 Y:1 X:2

Pretty obscure programming style IMHO. RCL X achieves the same result and is a lot more obvious... But maybe ENTER LBL 00 is faster?

- Thomas


#8

It's amazing that after all these years I can still learn something about HP41 programming! I didn't know this trick.

In that particular case, I would just do "1 ENTER ENTER 2".

J-F


#9

Hehe JF!
Never asked why the ZENROM has a NOP? In contrast to the 0-length text string NOP (F0) it preserves the stack lift en/dis-able state.

Ciao.....Mike


#10

I use the STO ST X as a NOP for the 41C.

Namir

Edited: 8 Mar 2009, 7:18 p.m.

#11

Thanks. Very obscure indeed.


Possibly Related Threads…
Thread Author Replies Views Last Post
  [PRIME] RPN: another attempt at returning more than one value to the RPN stack Marcus von Cube, Germany 5 2,377 11-05-2013, 02:44 AM
Last Post: Marcus von Cube, Germany
  Cleaning old slide rules aurelio 3 1,846 09-18-2013, 03:25 PM
Last Post: aurelio
  The Programming Rules from HP's Garage Patrice 9 2,296 09-19-2012, 08:08 PM
Last Post: db (martinez, ca.)
  go67c - cannot input "LBL a" in W/PRGM mode Federico Hanssen 7 2,195 05-07-2012, 08:15 PM
Last Post: Matt Agajanian
  HP Forum HHC Programming contest idea / possible rules Gene Wright 30 6,159 09-26-2011, 08:07 AM
Last Post: Gerson W. Barbosa
  NutStudio tools goes RPN (HP-41) Håkan Thörngren 5 1,635 05-31-2011, 07:45 AM
Last Post: Håkan Thörngren
  HP32s Relative GTO Mike T. 4 1,414 04-04-2011, 07:33 PM
Last Post: Don Shepherd
  Does anyone, in all earnest, still use slide rules for work? hecube 34 6,911 09-05-2009, 12:29 PM
Last Post: Ed Look
  Slide Rules Back in Production Les Bell 8 2,180 09-03-2009, 05:48 PM
Last Post: htom trites jr
  New Iphone & Itouch calculator - Access RPN and Active RPN Nigel Bamber 1 1,114 06-10-2009, 04:13 PM
Last Post: Jean-Michel

Forum Jump: