Sharp PC-1500A Compiler
|
11-21-2024, 06:05 AM
Post: #1
|
|||
|
|||
Sharp PC-1500A Compiler
Has anyone tried this program? Unfortunately, it doesn't work for me, and after running RUN, some initialization takes place without error, but the program exits and DEF commands don't work.
http://www.pc1500.com/abc-compiler.html |
|||
11-21-2024, 03:34 PM
Post: #2
|
|||
|
|||
RE: Sharp PC-1500A Compiler
No, have not used that one. I use the TASM extension I wrote for VS Code:
https://github.com/Jeff-Birt/TASM_vsCode_Extension Also helpful is the PC-1500 library builder: https://github.com/Jeff-Birt/Sharp_PC-1500_Lib_Builder |
|||
11-22-2024, 05:49 AM
Post: #3
|
|||
|
|||
RE: Sharp PC-1500A Compiler
Thank you for the info. The program as such works, in fact all commands work, only the IF...GO command doesn't work, strange. But GO itself works.
|
|||
11-27-2024, 08:25 PM
Post: #4
|
|||
|
|||
RE: Sharp PC-1500A Compiler
Heureka, I figured it out!
In line 6510, it should not be &B5 but must be &BE (SJP i,j) instruction at address D0D2H, where two variables are compared. The program actually couldn't work for anyone all the time, there were two errors. 3500:POKE P,&B5,&79,&AE,&38,&D2,&B5,X,&AE,&38,&D3,&B5,&79,&AE,&38,&D0,&B5,Y 6510:POKE P+18,&BE,&3A,&C4,&B5,ZZ,&BE,&D0,&D2,&89,2,&8E,3,&BA,Y,Z I would stress to users that the _STOP function is absolutely necessary, otherwise the program will "wander" in RAM. I will improve the program with other functions like SIN, COS, TAN or LOG. |
|||
11-30-2024, 06:31 PM
(This post was last modified: 12-01-2024 12:57 PM by Josef.)
Post: #5
|
|||
|
|||
RE: Sharp PC-1500A Compiler
Version 1.4 is ready, SIN, COS, TAN, LOG and ABS functions are added. Instructions and program is attached. This is how the solution of the Kepler equation looks like. Assembler tends to be much faster, especially in common mathematical operations. A bin file is basically a text file that can be converted to WAV, for example, or uploaded using the CE-158 (X) interface from a computer using RS232. The program after translation by the compiler occupies 391 Bytes in RAM.
*L=(M+180*I/pi* SIN(E) - E)/(1-I*COS (E)) IF ABS(L) > 1E-3 THEN E = E + L: GOTO * 0 M=E 1*F=ESX 2 F=F*I 3 F=F*D 4 F=F-E 5 F=F+M 6 C=ECX 7 C=C*I 8 C=K-C 9 L=F/C 10 E=E+L 11 L=LAX 12 IFL>RGO* 13 PRE 14 WE 15 STOP 16 END M= Mean Anomaly, I= Eccentricity, D= 180/3.14, K=1, R=0.0001 |
|||
12-01-2024, 12:32 PM
Post: #6
|
|||
|
|||
RE: Sharp PC-1500A Compiler
The author of the program made another mistake, and the GO command did not work. I didn't think to check all the instructions. I am attaching the corrected version.
|
|||
Yesterday, 08:41 PM
Post: #7
|
|||
|
|||
RE: Sharp PC-1500A Compiler
I must admit that I have absolutely no experience with this calculator, but it reminds me how we can use this Python to RPN - source code converter to translate a corresponding Python program:
Code: def kepler(M): The generated program for the HP-42S can be simplified a bit to: Code: 00 { 72-Byte Prgm } Example RAD 0.5 XEQ "kepler" 0.50813 RCL "E" RCL "I" RCL "E" SIN × - 0.50000 (11-30-2024 06:31 PM)Josef Wrote: 0 M=E I could be wrong, but shouldn't that rather be: Code: 0 E=M |
|||
Yesterday, 10:35 PM
Post: #8
|
|||
|
|||
RE: Sharp PC-1500A Compiler
Nice.
Yes, in the description, I stated M= Mean Anomaly; it should have been E= Mean Anomaly. So if we add M, then 0 must be E=M. |
|||
Yesterday, 11:49 PM
Post: #9
|
|||
|
|||
RE: Sharp PC-1500A Compiler
(Yesterday 08:41 PM)Thomas Klemm Wrote: I must admit that I have absolutely no experience with this calculator, but it reminds me how we can use this Python to RPN - source code converter I just tried that converter. It chokes on the Python function sqrt! Calculators have a square root function, no? Tom L Cui bono? |
|||
Today, 03:09 AM
Post: #10
|
|||
|
|||
RE: Sharp PC-1500A Compiler
(Yesterday 11:49 PM)toml_12953 Wrote: It chokes on the Python function sqrt! Calculators have a square root function, no? Python doesn't provide a sqrt function. It has to be imported from a library. From Help & User Guide: Quote:What is not supported From List of HP42S Commands Reference: \( \begin{array}{|c|c|} \hline \text{HP42S Command} & \text{Supported in Python to RPN} & \text{Comments Parameters} & \text{Description (original HP42S)} \\ \hline \text{SQRT} & \text{✓} & \text{(n)} & \text{Square root. Returns √x.} \\ \hline \end{array} \) The following Python program works: Code: def radius(x, y): The generated code for the HP-42S can be optimized to: Code: LBL "radius" You could also use the built-in function →POL instead: Code: r, phi = toPol(x, y) |
|||
Today, 03:41 AM
Post: #11
|
|||
|
|||
RE: Sharp PC-1500A Compiler
(Today 03:09 AM)Thomas Klemm Wrote:(Yesterday 11:49 PM)toml_12953 Wrote: It chokes on the Python function sqrt! Calculators have a square root function, no? True but even if you import the math library, the converter should know that sqrt is the same as SQRT and tan is the same as TAN, etc. Tom L Cui bono? |
|||
Today, 04:55 AM
(This post was last modified: Today 06:38 AM by Thomas Klemm.)
Post: #12
|
|||
|
|||
RE: Sharp PC-1500A Compiler
If you want to run the code in a Jupyter notebook or a Python REPL you can import the functions and alias them with their uppercase names:
Code: from math import sqrt as SQRT 5.0 (Today 03:41 AM)toml_12953 Wrote: (…) the converter should know that sqrt is the same as SQRT and tan is the same as TAN, etc. Andy Bulka provides this converter as a free service. He describes its use and limitations. If that's not what you want, you have a few options:
|
|||
« Next Oldest | Next Newest »
|
User(s) browsing this thread: 1 Guest(s)