The following warnings occurred:
Warning [2] Undefined array key 12077 - 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 12078 - 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 12079 - 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 12082 - 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 12082 - 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 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





Register arithmetic: sometimes it uses MORE space?



#5

I tried the following on my HP 42S:

RCL 01
x

uses 2 bytes (one for each instruction).
Instead,

RCL x 01

uses 3 bytes!
Hence, it seems that RCL-arithmetic is not a good idea on the 42S. Instead, on the 32SII, I have:

RCL A
x

takes 3 bytes, while

RCL x A

takes only 1.5!
What are the trade-offs in other calculators?

Best,

Luca


#6

Luca, I've only just learned about register arithmetic so I may have misunderstood something. However, your comparisons don't appear to be valid. The non-register variant must be:

rcl A
x
sto A

Which is possibly longer than you calculated.

Cameron


#7

Hello Cameron. Not quite:

RCL x A;

is similar (except for stack effect) to RCL A; x;
(where ; separates instructions), while

STO x A

is similar (except for stack effect) to RCL A; x; STO A;

In the 42S, the RCL-arithmetic seems to be useful to conserve stack (in case T contains something useful),
but incurs a penalty in memory. I wonder about execution
time...

Cheers, Luca.


#8

Hello.

Register arithmetic in the HP42S is only two-bytes longer for numbered registers (the same in the 15C). When dealing with variables (as shown by Mr. Luca), each letter in the variable name will consume one extra byte; the instruction itself - STO <op> - needs 1 byte, plus one extra for the addressed object - in the basic set: stack registers, numbered registers AND indirect for both - . If the addressed objet is referred to by a string - variableĀ“s name -, the string will consume as much memory as it would in a program step. One single experiment: try

STO <op> ST X
STO <op> "X"

ST X is the stack register; so, STO <op> ST X needs 2 bytes. Instead, STO <op> "X" uses three.

The fact is that the variable addressing in the 32S is already the basic set; it does not have numbered registers AND the existence of any variable depends on its creation. The 42S expanded the concept for variables later, extending the basic 41's set, over the penalty of consuming more memory.

And the shortest instruction in the half/fullnuts is still based in a one-byte count. New generation Saturn-based machine count one-(byte+nible) program space for most data.

Best regards.


Possibly Related Threads…
Thread Author Replies Views Last Post
  Layout of arithmetic keys on early calculators Walter B 10 3,417 11-20-2013, 11:13 AM
Last Post: Jake Schwartz
  Little curiosity: why the fourth stack register is called "T"? Antlab 34 8,345 07-03-2013, 04:49 PM
Last Post: Walter B
  Arithmetic programs for HP39gII Mic 0 959 12-19-2012, 12:23 PM
Last Post: Mic
  HP50G Max SDcard Storage space?? mr-scorpio 9 2,747 08-22-2012, 09:57 AM
Last Post: Bart (UK)
  OT - Arduino In Space from HP41 Hacker PeterP 3 1,675 06-16-2012, 10:43 PM
Last Post: PeterP
  [WP34S] Register use by functions. Chris Tvergard 5 1,967 05-12-2012, 03:35 AM
Last Post: Walter B
  HP-34C Storage Register Arithmetic & Programming Matt Agajanian 14 4,011 05-08-2012, 11:04 AM
Last Post: Matt Agajanian
  OT: Space ship Michael Eckstein 18 3,989 04-04-2012, 12:31 PM
Last Post: Michael Eckstein
  Sleek approach to Register Exchange on HP-29C Matt Agajanian 8 2,606 03-16-2012, 01:04 PM
Last Post: Marcus von Cube, Germany
  Vintage HP15C Key Clicks but Doesn't Register Bruce Zastera 15 3,975 01-27-2012, 06:18 PM
Last Post: uhmgawa

Forum Jump: