Can a text file contain a formula?

If I have a text file that contains a library of ASM instruction names, equations, and description, can my app load and use the equation?

Example library.txt

cmp wc=1 wz = 1

compares the unsigned values of Value1 and Value2. If the WZ effect is specified, the Z flag is set (1) if Value1 equals Value2. If the WC effect is specified, the C flag is set (1) if Value1 is less than Value2.

If val1 < val2 then
wc = 1
elseif val1 = val2 then
wz = 1

The idea being that forum members for the certain processor can contribute library parts and accumulate a nice dictionary for ASM reference and learning. Each instruction to be listed in a dropdown menu. The user puts in val1 AND val2, and sees the result of the flags.

You would definitely have to (a) parse the text file and most likely have to (b) parse the formulas and do the calculations yourself. Both are possible, and having the calculations done for your might be possible using RBScript/XojoScript, but I’ve found this to cause strange problems in built apps (though that was years ago last I tried).

I literally just an hour ago wrote a function to do basic processing of a static group of variables, perform +,-.*,/, and to have conditional returns based on >, <, =, >=, <= operators. Would be fine sharing it if you’re interested in starting from there and expanding.

Thanks Tom. Maybe what is best then is to find a way to load in a lot of equations, and have drop downs to select an equation, then save the ASM instruction as a preset with it’s equation behind the scenes.

add value1, value2

Show result:

value1 = 0000
value2 = 0001

I will explore the use of case statements in s drop down menu and a method to store presets with a series of drop downs selected per instruction name.

Actually I think I will punt on the text file approach, and just collect instructions and equations that can be illustrated in a line or two, then park the equations in a case statement, select case based on the instruction selected in a drop down. Press RUN, the case will take the values manually loaded and run the equation per the instruction.