Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Thanks! #1

Open
bsdphk opened this issue Mar 23, 2023 · 13 comments
Open

Thanks! #1

bsdphk opened this issue Mar 23, 2023 · 13 comments

Comments

@bsdphk
Copy link

bsdphk commented Mar 23, 2023

I just wanted to thank you a LOT for posting these sources!

I am working on a software emulation of the Rational R1000/s400 in datamuseum.dk, where all the programs on the 68K IO processor is compiled using this compiler.

Being able to study the internal logic of the compiler is a great aid to reverse-compiling those IO-programs.

Thanks a LOT!

@dhogaza
Copy link
Owner

dhogaza commented Mar 23, 2023 via email

@bsdphk
Copy link
Author

bsdphk commented Mar 27, 2023

If you want to follow along in my disassembly effort, or just want some example binaries compiled with your compiler:

https://datamuseum.dk/aa//r1k_dfs/M200.html

@dhogaza
Copy link
Owner

dhogaza commented Mar 27, 2023 via email

@dhogaza
Copy link
Owner

dhogaza commented Mar 27, 2023 via email

@dhogaza
Copy link
Owner

dhogaza commented Mar 27, 2023 via email

@bsdphk
Copy link
Author

bsdphk commented Mar 28, 2023

Apologies for not giving more detailed directions.

All the files in the link above are 68K binaries, but the top part of each page is the output from my "un-pascal'er" code, and the unadultered assembly follows below that.

The runtime "library",also known as "FS" is here: https://datamuseum.dk/aa//r1k_dfs/44/442c504ed.html - also written (mostly) in PASCAL

That again runs on top of there "KERNEL" which is here: https://datamuseum.dk/aa//r1k_dfs/f1/f1bf0e801.html - hand written assembler.

The "un-pascal'er" code does not exploit the information in the limit-checks yet, I'm still trying to model the stack-content correctly, but once I get to value tracking, they will provide valuable information.

Next step is to classify FP-relative data according to use, hoping to build first-order function prototypes from that, and then use those prototypes to identify the actual arguments to the calls. (All the prototypes you see now are created manually)

With that in place it will be time for type-propagation via calls to local variables to calls to other functions and so on.

The thing which confuse me most about the compiled PASCAL code is string literals: First the compiler outputs instructions to copy the string literal from the code "segment" onto the stack, and then it calls a function (FS@0x10ddc) which copies it from there to dynamically allocated memory. Why the detour over the stack ? Is that an artifact of the Rational-adaptation of the runtime, or is there a deeper reason ?

PS: R1000 assembly looks like this: https://datamuseum.dk/aa//r1k_dfs/SEG.html and it is really weird: The R1000 instructions are Ada primitives. Also: The machine is bit-oriented so types needing 13 bits only allocate 13 bits.

PPS: Based on the similarity of the generated code, and the use of A5 as "origin" pointer, I hypothesize that Hewlett-Packard used your C compiler for the HP3458A and HP3245A products ?

@dhogaza
Copy link
Owner

dhogaza commented Mar 28, 2023 via email

@dhogaza
Copy link
Owner

dhogaza commented Mar 28, 2023 via email

@dhogaza
Copy link
Owner

dhogaza commented Mar 28, 2023 via email

@bsdphk
Copy link
Author

bsdphk commented Mar 30, 2023

Do not let the names I have used for various functions confuse you: They are my best guesses, many from before I found out that this was PASCAL code.

@dhogaza
Copy link
Owner

dhogaza commented Mar 30, 2023 via email

@bsdphk
Copy link
Author

bsdphk commented Mar 30, 2023

I found error messages on the form "PASCAL error #" :-)

Recently I got hold of Wayne Meretsky and he told me they used "Oregon Software Pascal-1 or Pascal-2 (I don't recall) running on RSX-11 on a PDP-11 development system." and a bit of searching brought me here :-)

@dhogaza
Copy link
Owner

dhogaza commented Mar 31, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants