Post Reply 
Algebraic Operation System (AOS)
04-18-2022, 12:27 PM (This post was last modified: 04-18-2022 12:58 PM by Thomas Klemm.)
Post: #8
RE: Algebraic Operation System (AOS)
(04-18-2022 06:15 AM)C.Ret Wrote:  isn't the x√y function available on the red LED Ti-57 as the INV y^x keystrokes ?

I totally forgot about that and have since corrected it.
Thanks for the hint.
And also thanks to Didier for the confirmation.



(04-18-2022 07:01 AM)Ángel Martin Wrote:  1. in the HP-67 Games ROM, by Jim Horn

I found the ROM on TOS, downloaded it and unzipped it:
Code:
wget http://*****/file/HP67_FUN.zip

unzip HP67_FUN.zip
Archive:  HP67_FUN.zip
  inflating: HP67_FUN_20161213.ROM
  inflating: HP67_FUN.mod

Then I dowloaded rom2raw, compiled it on Mac and used it to extract the listing:
Code:
wget https://thomasokken.com/free42/download/rom2raw.zip

unzip rom2raw.zip
Archive:  rom2raw.zip
  inflating: rom2raw.c
  inflating: rom2raw.exe

cc -o rom2raw rom2raw.c

./rom2raw -l HP67_FUN_20161213.ROM > HP67_FUN.txt

Here is the listing:
Code:
01▸LBL "AOS"
02 SF 27
03▸LBL a
04 CF 01
05 CF 02
06 CF 22
07 12
08 STO 23
09 -1
10 STO 24
11 CLX
12 RTN
13▸LBL "+"
14▸LBL A
15 61
16 GTO 00
17▸LBL "-"
18▸LBL B
19 51
20 GTO 00
21▸LBL "*"
22▸LBL C
23 42
24 GTO 00
25▸LBL "/"
26▸LBL D
27 32
28 GTO 00
29▸LBL "YX"
30▸LBL b
31 14
32 GTO 00
33▸LBL "NEG"
34▸LBL c
35 23
36 GTO 00
37▸LBL "<"
38▸LBL d
39 5
40▸LBL 00
41 10
42 /
43 STO 22
44 INT
45 X≠0?
46 GTO 00
47 FS? 01
48 XEQ 03
49▸LBL 00
50 RDN
51 FS?C 22
52 XEQ 02
53 RCL 22
54 INT
55 X=0?
56 GTO 00
57▸LBL 07
58 RCL 24
59 X<0?
60 GTO 00
61 RCL IND 24
62 FRC
63 RCL 22
64 FRC
65 X>Y?
66 GTO 00
67 RCL IND 24
68 INT
69 X=0?
70 GTO 00
71 XEQ 01
72 GTO 07
73▸LBL 00
74 ISG 24
75 ENTER↑
76 RCL 24
77 13
78 X<=Y?
79 ASIN
80 RCL 22
81 STO IND 24
82 RCL IND 23
83 CF 01
84 GTO 99
85▸LBL ">"
86▸LBL e
87 1
88 STO 22
89 X<>Y
90 FS?C 22
91 XEQ 02
92 RCL 24
93 X<0?
94 SQRT
95 RCL IND 24
96 INT
97 X=0?
98 GTO 08
99 XEQ 01
100 GTO e
101▸LBL 08
102 DSE 24
103 ENTER↑
104 RCL IND 23
105 SF 01
106 GTO 99
107▸LBL E
108▸LBL "="
109 1
110 STO 22
111 X<>Y
112 FS?C 22
113 XEQ 02
114 RCL 24
115 X<0?
116 GTO 00
117 RCL IND 24
118 XEQ 01
119 GTO E
120▸LBL 00
121 RCL IND 23
122 XEQ a
123 RDN
124 RDN
125 SF 22
126 GTO 99
127▸LBL 02
128 ISG 23
129 ENTER↑
130 21
131 RCL 23
132 -
133 X<0?
134 SQRT
135 RDN
136 STO IND 23
137 RCL 22
138 INT
139 X≠0?
140 RTN
141▸LBL 03
142 ISG 24
143 ENTER↑
144 4.2
145 STO IND 24
146 RDN
147 RTN
148▸LBL 01
149 RCL IND 23
150 DSE 23
151 RCL IND 23
152 X<>Y
153 XEQ IND Z
154 FS?C 02
155 ISG 23
156 ENTER↑
157 RCL 23
158 13
159 -
160 X<0?
161 SQRT
162 X<>Y
163 STO IND 23
164 DSE 24
165 RTN
166 RTN
167▸LBL 01
168 Y↑X
169 RTN
170▸LBL 02
171 CHS
172▸LBL 00
173 SF 02
174 RTN
175▸LBL 03
176 /
177 RTN
178▸LBL 04
179 *
180 RTN
181▸LBL 05
182 CHS
183▸LBL 06
184 +
185▸LBL 99
186 RTN
187 SF 22
188 END

It appears that Free42 has a problem parsing this line:
Code:
153 XEQ IND Z

You better make sure to use the following instead:
Code:
153 XEQ IND ST Z



At first glimpse I noticed the following differences:

The power function is left-associative.
Thus we get:

9 YX 2 YX 3 =

531441

But then I noticed that this is apparently still the case with today's calculators from Texas Instruments.
From Solution 12705: Differences Between Algebraic Operating System (AOS) and Equation Operating System (EOS).:
Quote:The Algebraic Operating System (AOS) completes all operations according to their relative priorities, which are listed below:

1) Trigonometric and hyperbolic functions, square roots, cube roots, factorials, reciprocals (inverse), angle conversions, combinations, permutations, percents, logarithms, sign changes (+/-), metric conversions, logical "not".
2) Universal powers, exponents and roots.
3) Multiplication and division.
4) Addition and subtraction.
5) Logical "and".
6) Other logical functions, such as "or", "xor" and "xnor".
7) Close parenthesis.
8) Equals.

Operations of priority 1 are immediate functions which means they are performed as soon as the operation keys are pressed.

Operations in priorities 2, 3, and 4 are completed by any operation with the same priority or with a lower priority.

The [=] key completes all operations.

But for example Python does it right.
The power operation ** is actually right-associative, as it should:
Code:
>>> dis(lambda a, b, c: a ** b ** c)
  1           0 LOAD_FAST                0 (a)
              2 LOAD_FAST                1 (b)
              4 LOAD_FAST                2 (c)
              6 BINARY_POWER
              8 BINARY_POWER
             10 RETURN_VALUE

Code:
>>> dis(lambda a, b, c: a ** (b ** c))
  1           0 LOAD_FAST                0 (a)
              2 LOAD_FAST                1 (b)
              4 LOAD_FAST                2 (c)
              6 BINARY_POWER
              8 BINARY_POWER
             10 RETURN_VALUE

The other arithmetic operations like / are left-associative:
Code:
>>> dis(lambda a, b, c: a / b / c)
  1           0 LOAD_FAST                0 (a)
              2 LOAD_FAST                1 (b)
              4 BINARY_TRUE_DIVIDE
              6 LOAD_FAST                2 (c)
              8 BINARY_TRUE_DIVIDE
             10 RETURN_VALUE

Code:
>>> dis(lambda a, b, c: (a / b) / c)
  1           0 LOAD_FAST                0 (a)
              2 LOAD_FAST                1 (b)
              4 BINARY_TRUE_DIVIDE
              6 LOAD_FAST                2 (c)
              8 BINARY_TRUE_DIVIDE
             10 RETURN_VALUE

The NEG function is implemented.

The program is about twice as long and big.

Flag 22 is used to detect numeric input.
I still haven't figured out why this is necessary.
In my implementation, each operation always adds the current value of register X to the data stack.
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Algebraic Operation System (AOS) - Thomas Klemm - 04-18-2022 12:27 PM



User(s) browsing this thread: 1 Guest(s)