![]() |
Another wishlist for 43s - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: Another wishlist for 43s (/thread-246297.html) |
Another wishlist for 43s - Andrew Nikitin - 07-10-2013 1) Literal constant command
2) Like skip/back pair, GTO should have "go backward" counterpart, say, GTB. Re: Another wishlist for 43s - Andrew Nikitin - 07-13-2013 Here is a wp34s example, demonstating the power and convenience of local symbols.
Anyway, back to the local symbols. In my proof of concept preprocessor the local symbols are labels of form 1H 2H 3H ... 9H. 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
Edited: 14 July 2013, 9:00 p.m. after one or more responses were posted
Re: Another wishlist for 43s - Marcus von Cube, Germany - 07-14-2013 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.
Re: Another wishlist for 43s - Andrew Nikitin - 07-14-2013 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.
|