The following warnings occurred:
Warning [2] Undefined array key 246297 - 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 246394 - 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 246419 - 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 246437 - 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 246437 - 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





Another wishlist for 43s



#5

1) Literal constant command

like # nnn, but for arbitrary length nnn with decimal point, sign, eex, etc. There are 10 digits plus sign, plus eex, plus decimal point. Literal constants are a staple of kind of programming calculators are ideal for, there must be a way to enter them in programs in less wasteful way than 1 digit = 1 program step.

2) Like skip/back pair, GTO should have "go backward" counterpart, say, GTB.
This will allow to reuse numeric labels more efficiently.
The system is known as "local symbols" and it is so convenient that I have no explanation why its implementation in actual assemblers is so rare.


#6

Here is a wp34s example, demonstating the power and convenience of local symbols.
This is a alternating series summation program from Valentin Albillo. I translated it verbatim without understanding the magic behind it and it worked on all the examples.

Anyway, back to the local symbols. In my proof of concept preprocessor the local symbols are labels of form 1H 2H 3H ... 9H.
The forward references to the label 1H is <1F> and back reference to the label is <1B>.

Note how all the loops and if/then/elses of the program required only one local symbol -- 1H, where it is being reused as the source unfolds. In contrast, regular labels have infinite scope and require severe mental effort to come up with random new ones and keep track of them to not reuse accidentally. In the languages where labels are primary means of flow control (like assemblers) this can be quite an advantage.

More so for calculators, where LBL labels are available in finite quantity.

// DatafileVA001.pdf
// by Valentin Albillo
// port by nsg, 2013-07-11 21:11:55

// Sum alternating series [SIGMA](-1)^i f(i), i=0..&#8734;
// LBL B defines f(i) (i in rX)
// Start:
// PSum [^] NDif [A]
// PSum -- integer >=0, may be >7, say 10
// NDif -- 1[<=]NDif[<=]7, integer

LBL'[SIGMA][infinity]±'
LBL A
CF 00
STO 11
x<> Y
STO 10
1
STO 08
0
STO 09
STO I

1H XEQ B
RCL 08
STO- 08
STO- 08
*
STO+ 09
INC I
RCL 10
RCL I
x[<=]? Y
BACK <1B>

STO 08
2
/
FP
x[!=]0?
SF 0
CLx
STO I

1H RCL 08
XEQ B
STO[->]I
INC I
1
STO+ 08
RCL 11
RCL I
x[<=]? Y
BACK <1B>
2
FS? 00
+/-
STO 08
ABS

1H -
STO I
STO 12

LBL 00
RCL[->]I
INC I
STO-[->]I
RCL 11
RCL I
x[!=]? Y
GTO 00
RCL 12
STO I
x=0?
SKIP <1F>
1
BACK <1B>

1H RCL[->]I
RCL 08
/
STO+ 09
2
+/-
STO* 08
INC I
RCL 11
RCL I
x[<=]? Y
BACK <1B>
RCL 09
RTN

// define ith element here (starting with 0-th)
LBL B
1
+
1/x
RTN

Edited: 14 July 2013, 9:00 p.m. after one or more responses were posted


#7

The forum software has translated some of your text to &...; codes :-(. Please use the ASCII character translations such as [->] for the right arrow.

The assembler allows to use symbolic labels with the -pp (preprocessor) switch. They are translated to SKIP/BACK commands (or GTO if out of range). This makes it hard to edit the code on the device but is handy for large projects which are better developed on the PC anyway.


#8

Marcus, I am aware of the preprocessor's labels feature.

What it is missing is the "local labels" (or local symbols as i referred them above), which, in my opinion, greatly improve readability and reduce mental effort of generating and tracking one-off random labels that are used to implement if/then/else and loops.

I implemented it in my own "proof of concept" preprocessor (which also translates utf8 to ascii, that is why my source contained all those &# characters) to demonstrate their advantage.

Here I reuse the "1H" local label 4 times. This is enabled by the fact that the direction of reference (forward or backward) is specified explicitly at the point of reference (as <1F> or <1B>, respectively). Now, in wp34s, the direction is encoded in the opcode (skip or back), so there is no need for specifying the direction in the label, but I did it anyway for demonstration purposes.

Also, same trick can be applied to LBL labels. If the backward version of GTO (say, GTB) is added, so they form a pair analogous to SKIP/BACK, this will allow reuse of numeric labels to a much greater extent. In my experience using local symbols, I never needed to use more than 6. So, the programmer can use and reuse LBL 00 .. LBL 09 for one-off flow control, LBL 80 .. 99 for internal subroutines, and the rest for keyboard handling. For example. Or whatever.

Writing JMP instead of SKIP or BACK actually reduces readability, since BACK, most likely, means a loop and SKIP is most likely a part of if/then/else and when you write JMP you leave the reader (human reader, that is) with need to investigate which of the 2 possibilities you actually meant.


Possibly Related Threads…
Thread Author Replies Views Last Post
  Trivial news of the 43S (no Prime) Walter B 117 28,686 11-22-2013, 03:26 AM
Last Post: Raymond Del Tondo
  What exactly is the WP 43S Harold A Climer 5 2,340 11-16-2013, 03:58 PM
Last Post: Jonathan Cameron
  Some random wish list items for the 43s Marcel Samek 18 5,048 07-11-2013, 05:35 PM
Last Post: Paul Dale
  News from the 43S Walter B 78 13,290 07-08-2013, 10:33 AM
Last Post: Victor Koechli
  [43S] Display and top row, refined Walter B 20 4,849 04-24-2013, 01:36 AM
Last Post: Walter B
  [43S] Display Walter B 67 12,678 03-17-2013, 09:22 AM
Last Post: Walter B
  [43s] : How the solver will be implemented Miguel Toro 3 1,558 03-14-2013, 06:09 PM
Last Post: Walter B
  [43S] Display myth crasher Walter B 46 10,395 02-06-2013, 01:07 AM
Last Post: Walter B
  [43S]Top row poll (until Monday, 4.2.13, 13:13 UTC) Walter B 175 37,294 02-04-2013, 09:38 AM
Last Post: Andrés C. Rodríguez (Argentina)
  [43s] General questions fhub 7 2,275 01-31-2013, 11:04 AM
Last Post: Walter B

Forum Jump: