existencial problem STO/RCL ok, but EXISTS (?)

Post here to share useful tips and tricks, to ask questions about using your DM42 or to report software-related problems
Post Reply
User avatar
ab_normall
Posts: 16
Joined: Sat Sep 07, 2019 11:50 pm
Location: geneva

existencial problem STO/RCL ok, but EXISTS (?)

Post by ab_normall » Sun Sep 08, 2019 11:27 pm

Bonjour,

(in english: Good Morning/Day/Evening/not_Night) <--- don't worry we are so many in my head talking and chatty in all corners of a tubular bell.

And sorry to ask as single fresh user of DM42, but some thing basic (bdw, after checking in free42-master/common nothing seems so "obvious"), so just an EXISTENCIAL problem: How can I know IN_PROGRAM(DM42), before using it, if an "external/virtual?" variable exists ? it seems somebody have made a special/external "variable space" useful in HP-42S mode of programming, so... case-study:

Code: Select all

...
STO "F00" @ // or not to "STO" could be the question :)
...
...interruption, etc. ... @ // whatever it goes in between... STOP ~ R/S, SST, CLV, etc.
...
RCL "Foo" @ // But let's "Foo" does'nt EXISTS in this "external variable space" (HEAP?)
...
I just know it could many ways to deal with this existencial case. (except hang myself?)
... "REGS" (?)
... vars_exist(...) ?
... switch (vars[ix].value->type) ...
... default: ? if "a" <TYPE> exists so there is something out there in the SPACE? ./common

~ Seems like there is a TYPING issue here which is broking my old-school heart <3

But I just will stay in single user of DM-42S programming "space" for instance, lol :oops:
  • - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
:?: RESUME: How can I know IN_PROGRAM(DM42), before using it,
if an "external/virtual(?)/HEAP(?)" variable exists?
:?:

Uhh... I mean without rewriting all Free42?
(I'm too old to make some "code refactoring" now, so...)
I'm too brainwashed to not ask something about this. #calmdown (says all my doctors)

User avatar
ijabbott
Posts: 157
Joined: Fri Dec 15, 2017 1:34 pm
Location: GB-MAN

Re: existencial problem STO/RCL ok, but EXISTS (?)

Post by ijabbott » Mon Sep 09, 2019 7:48 am

Flag 25 is the key to the problem. If flag 25 is set, then if an instruction cause an error, the instruction that causes the error is not executed and the flag is cleared. So you can do something like this:

Code: Select all

SF 25
RCL "Foo"
FC?C 25
GTO "missing" @ or any other instruction
If "Foo" exists, its value will be recalled to the stack and the instruction after "FC?C 25" will be skipped.

If "Foo" does not exist, nothing is recalled to the stack and the instruction after "FC?C 25" will be executed. You could put a number there to use as a default value.

User avatar
ab_normall
Posts: 16
Joined: Sat Sep 07, 2019 11:50 pm
Location: geneva

Re: existencial problem STO/RCL ok, but EXISTS (?)

Post by ab_normall » Mon Sep 09, 2019 8:43 pm

Ok, thanks a lot ijabbott, this seems to be a more general way of focusing exceptions capture/catch on just a problem of entity existence.

Thank you, it is very practical and I had not yet understood the meaning of the very short definition of embedded in HELP {dm42help.htm} easy readable from the machine DM42 and having the aspect of a summary practical datasheet but only if we know more about the original machine itself which is ot my case, I don't even knew the existence of HP-42S, after my SE studies I was on work on IBM s/26 /38 and IBM as/400 and does'nt having any more time to play with pocket computers in those time.

About documentations (spread into many PDF/HP or PDF/any or HTM[L] here and out there (...) I simply point out that HP's official documentations on these topics are certainly complete, but they are in IMAGES (JPG/BMP/PNG/SVG anyway) those format and therefore impossible to do conventional string search into HP's document as PDF of "FAX" pictures.

So thanks a lot, about this USEFULL FLAG #25 in the DM42's try-catch[-finally] (like in ADA, C++ or Java, etc.) I'm learning know some other more specific FLAGs like "ignore_range_errors", and probably more surprises are waiting for me about this [STO/RCL/LBL/GTO] langage... Don't even know his name except "the HP-42S programming langage" (?) lol.

Thank you with a nice fresh bee #Bzzzz

Image

[refs]
https://www.swissmicros.com/dm42/fat/HE ... .htm#Flags
https://www.hpmuseum.org/forum/thread-9944.html #ReservedFlags/DM42
https://perso.telecom-paristech.fr/paut ... c17_p1.ada

It seems the structure 'flags_struct' is {extern} of Free42/common

Code: Select all

core_globals.h:extern flags_struct flags; // C or C++ ... 
I suppose its machine-dependent issue, but just for a bitset(?)
...anyway I will investigate for pleasure...

Thank again :shock: F25
Last edited by ab_normall on Tue Sep 10, 2019 4:18 pm, edited 1 time in total.
I'm too brainwashed to not ask something about this. #calmdown (says all my doctors)

Thomas Okken
Posts: 600
Joined: Tue May 02, 2017 3:48 pm
Location: New Jersey, USA
Contact:

Re: existencial problem STO/RCL ok, but EXISTS (?)

Post by Thomas Okken » Tue Sep 10, 2019 9:11 am

ab_normall wrote:
Mon Sep 09, 2019 8:43 pm
It seems the structure 'flags_struct' is {extern} of Free42/common

Code: Select all

core_globals.h:extern flags_struct flags; // C or C++ ... 
I suppose its machine-dependent issue, but just for a bitset(?)
...anyway I will investigate for pleasure...
You may find this useful, too: https://thomasokken.com/free42/#doc

The flags are covered in the HP-42S Owner's Manual, Appendix C, pages 273-282.

User avatar
ab_normall
Posts: 16
Joined: Sat Sep 07, 2019 11:50 pm
Location: geneva

Re: existencial problem STO/RCL ok, but EXISTS (?)

Post by ab_normall » Tue Sep 10, 2019 5:40 pm

Don't forget I love so much ALL your Team's production and passion for those wonderful machines
Many thanks to you Thomas Okken, thanks for your response Too. And in fact I have online access to this manual in PDF from your sebsite, many thanks to have keeping alive those wonderful machines, And also I have to notice, they (PDF) are only photocopies/FAX_LIKE (FR?) in "bitmap" format (or whatever) no search for substrings can be produced in this kind of format (without indexing by the application of any OCR ~ Optical Character Recognition).

By the way I recognize that always H.P. Manuals have been extremly usefull even in paper release(s) (working OFFLINE in my past, Internet does'nt exists for citizen as today, I was from 60's), so especially for my HP- 41CV/X original including the doc "paper" of his "synthetic language" that had amused me formerly.

Today I am having fun with these machines produced with the same spirit, with a very engaged passion to which I agree more than it is reasonable :shock:

So in any case, I just should thank you and all THE TEAM for making all this possible (!)

And have given me some good pages oriented "use of flags" (as user) in one part of my FUN with those but I would also be interested to know a little more about the definition in Free42 (?) for the data structure given as "extern" without any other indication (?... or not), because I am also interested in finding some computational behaviours within the same code that seems to be globalized in the repertory /common (?)

By pure pleasure (too) to understand all the machinery involved here. I read both C "pure" and/or C++ although I have fun today more than ADA2005 (GPL not seems to get GPL from free ADACORE) but regardless of the languages used, all rigth ;)

In any case I have fun (with some Mathematics like with Computer Sciences) with those pieces of technological jewelery that are already well beyond my expectations as my original pieces which are, for some, already in agony after 20 to 35 years past.

And I don't have "IR-Printer" but I suppose I could "print" into the "FlashDisk"/DM42 into a file if I've understood some readings (?) #not-so-important

About this code in Free42, I'm just curious to know where are implemented some "final" Data Structures about 'flags_struct' which seem to contain an sub 'f' structure in which we could found... Ok I've just found it now :D

(* quotes
I just forget I do love any bees... LOL (I do MACRO TOO)
Imageprivate image upload
unquotes *)

core_globals.h: LOL something else I was seek for ... was just under my nose, so Ok! and lol (never feel alone by myself)

C-pure UNION datastructure...

Code: Select all

/* FLAGS
 * Note: flags whose names start with VIRTUAL_ are named here for reference
 * only; they are actually handled by virtual_flag_handler(). Setting or
 * clearing them in 'flags' has no effect.
 * Flags whose names are the letter 'f' followed by two digits have no
 * specified meaning according to the HP-42S manual; they are either user flags
 * or reserved.
 */
typedef union { // UNION structure ok which seems to be 100[c] length
    char farray[100];
    struct {
        char f00; char f01; char f02; char f03; char f04;
        char f05; char f06; char f07; char f08; char f09;
        char f10;
        char auto_exec;
        char double_wide_print;
        char lowercase_print;
        char f14;
        char trace_print; /* 'normal_print' ignored if this is set */
        char normal_print;
        char f17; char f18; char f19; char f20;
        char printer_enable;
        char numeric_data_input;
        char alpha_data_input;
        char range_error_ignore; <------------  F24 should interest me too for "exceptions managment", etc.
        char error_ignore;   // ----------------  F25 the which one I was seeking for :-)
        char audio_enable;
        char VIRTUAL_custom_menu;
        char decimal_point;
        char thousands_separators;
        char stack_lift_disable;
        char dmy; /* Time Module DMY mode */
        char f32; char f33;
        char agraph_control1; /* 0 (default): dst = dst | src, 1: dst = src, */
        char agraph_control0; /* 2: dst = dst & ~src, 3: dst = dst ^ src */
        char digits_bit3;
        char digits_bit2;
        char digits_bit1;
        char digits_bit0;
        char fix_or_all;
        char eng_or_all;
        char grad;
        char rad;
        char continuous_on;
        char VIRTUAL_solving;
        char VIRTUAL_integrating;
        char VIRTUAL_variable_menu;
        char VIRTUAL_alpha_mode;
        char VIRTUAL_low_battery;
        char message;
        char two_line_message;
        char prgm_mode;
        char VIRTUAL_input;
        char f54;
        char printer_exists;
        char lin_fit;
        char log_fit;
        char exp_fit;
        char pwr_fit;
        char all_sigma;
        char log_fit_invalid;
        char exp_fit_invalid;
        char pwr_fit_invalid;
        char f64;
        char VIRTUAL_matrix_editor;
        char grow;
        char ymd; /* Programming extension YMD mode; overrides dmy flag */
        char base_bit0; /* Note: dec=0, bin=1, oct=7, hex=15 */
        char base_bit1;
        char base_bit2;
        char base_bit3;
        char local_label;
        char polar;
        char real_result_only;
        char VIRTUAL_programmable_menu;
        char matrix_edge_wrap;
        char matrix_end_wrap;
        char f78; char f79; char f80; char f81; char f82;
        char f83; char f84; char f85; char f86; char f87;
        char f88; char f89; char f90; char f91; char f92;
        char f93; char f94; char f95; char f96; char f97;
        char f98; char f99;
    } f; // <-------- what I was seeking for, lol
} flags_struct;
extern flags_struct flags;

Thanks a lot I feel like in my youth period of Software Engineering studying in 80's at Geneva, and I thought I would be "like" the only last one in the world, who could be fascinated by these marvels of technologies. I am glad to see that even today there are indeed specialists of this honorable passion.

This is finally NOT A QUESTION (I've found many response also in Free42's code), also first I seek in HP's manuals or your [Free]42s.pdf manual in my role of just using things.

Code: Select all

00 { 109-Byte Prgm }
01▸LBL "qtest"
02 STO 00
03 ".fault" @ // default behaviour sub_routine char[6] or something...
04 XEQ ".try"
05 RCL 00
06 1/X
07 XEQ ".check"
08 RTN
09▸LBL ".fault"
10 99909990999 @ // default for Infinite (ok this machine already does that... just e.g.)
11 RTN

// external/global summary try-catch with also implementing other exceptions, etc.
12▸LBL "$except" @ // global primitives for try-catch (e.g.) 
13▸LBL ".check"
14 FC?C 25 @ // could +also 24 or any other++ concern
15 XEQ IND "$CATCH" @// should short named but ok...
16 RTN @ // return in any case if 'divide by zero occurs", etc.
17▸LBL ".try"
18 ASTO "$CATCH"
19 CLA @ // could be avoid this but. (groumpf!)
20 SF 25
21 RTN

21 END

And finally a song: One world is enough for all of us #Sting/ThePolice .... I just love "The Police and Sting in all his career as musician #MyLife
I'm too brainwashed to not ask something about this. #calmdown (says all my doctors)

User avatar
ab_normall
Posts: 16
Joined: Sat Sep 07, 2019 11:50 pm
Location: geneva

Re: existencial problem STO/RCL ok, but EXISTS (?)

Post by ab_normall » Sat Sep 14, 2019 4:38 am

in two words: thanks you (all)
I'm too brainwashed to not ask something about this. #calmdown (says all my doctors)

Post Reply