Instructions for building the Hi-Tech C v3.09 Cross Compiler

191 views
Skip to first unread message

Андрей Никитин

unread,
Jul 22, 2022, 12:12:54 PM7/22/22
to
Instructions for building the Hi-Tech C v3.09 Cross Compiler for Linux, MacOS, or Windows can be found at https://github.com/nikitinprior/Cross_compiler_z80

Andrey Nikitin

David Given

unread,
Aug 17, 2022, 11:28:51 AM8/17/22
to
On Friday, 22 July 2022 at 18:12:54 UTC+2, nikiti...@gmail.com wrote:
> Instructions for building the Hi-Tech C v3.09 Cross Compiler for Linux, MacOS, or Windows can be found at https://github.com/nikitinprior/Cross_compiler_z80

I may have missed it, but where do you actually get the source code from?

Андрей Никитин

unread,
Aug 18, 2022, 9:50:20 AM8/18/22
to
среда, 17 августа 2022 г. в 20:28:51 UTC+5, david...@gmail.com:
> On Friday, 22 July 2022 at 18:12:54 UTC+2, nikiti...@gmail.com wrote:
> > Instructions for building the Hi-Tech C v3.09 Cross Compiler for Linux, MacOS, or Windows can be found at https://github.com/nikitinprior/Cross_compiler_z80
> I may have missed it, but where do you actually get the source code from?

C source code is obtained by disassembling executable programs into assembly language. After that, the resulting assembly language program is examined and C code is obtained from it. The resulting code is then compiled and compared with the disassembled code. If necessary, the C code is modified to better match the original binary image. In a similar way it was possible to restore almost all compiler programs. Naturally, the restored code is not the original code, but it is very close to it. The resulting source code can already be compiled by modern compilers. The result is a cross compiler for modern operating systems that generates code almost identical to the original compiler for CP/M.

David Given

unread,
Aug 18, 2022, 11:30:31 AM8/18/22
to
I understand, but there's no reference to a repository of the converted source code or to the tools needed to do the conversion.

Андрей Никитин

unread,
Aug 18, 2022, 12:10:30 PM8/18/22
to
четверг, 18 августа 2022 г. в 20:30:31 UTC+5, david...@gmail.com:
in the repository https://github.com/nikitinprior/dcgen
files with .asm extension are Disassembled version and After compiling C source code. This repository is the first attempt to get the source code in C language. Further work has been done to fix bugs and fix the code. Especially for recovery, no special tools were used. All work was done by hand, relying on common sense. The compiler generates code using some rules. These rules were noticed and using them an attempt was made to recreate the source code. Completely documenting the re-creation process is quite a big and quite complex job. When recreating the compiler code, the task was not to describe the entire algorithm of the actions performed and teach someone to do such transformations. To solve such a problem requires desire, a lot of free time and painstaking work. For the compiler, this work is done. It may contain errors, which, having the source code, are now easier to detect and fix. The main result is the availability of source code, which prolongs the life of a good compiler and allows interested people to see how it was implemented. From my point of view, the task has been completed completely.

Андрей Никитин

unread,
Aug 18, 2022, 12:20:25 PM8/18/22
to
четверг, 18 августа 2022 г. в 21:10:30 UTC+5, Андрей Никитин:
https://github.com/nikitinprior/ contains the source code for almost all compiler utilities. The descriptions for each program provide instructions on how this code must be compiled to obtain the final result.

David Given

unread,
Aug 19, 2022, 8:42:08 AM8/19/22
to
On Thursday, 18 August 2022 at 18:20:25 UTC+2, nikiti...@gmail.com wrote:
> четверг, 18 августа 2022 г. в 21:10:30 UTC+5, Андрей Никитин:
[...]
> https://github.com/nikitinprior/ contains the source code for almost all compiler utilities. The descriptions for each program provide instructions on how this code must be compiled to obtain the final result.

Thanks --- that looks great. I did actually try that myself a couple of years ago but I was using Ghidra, which doesn't produce runnable C code from Z80 machine code. I did manage to identify most of the libc, though.

I will note that the projects are marked as having the GPL license when actually the Hitech C license still applies!

Андрей Никитин

unread,
Aug 19, 2022, 9:00:25 AM8/19/22
to
пятница, 19 августа 2022 г. в 15:42:08 UTC+3, david...@gmail.com:
Thanks for the kind words.
HI-TECH SOFTWARE has allowed the free use of its software product with the obligatory requirement to indicate copyright. The restored C code is released to the public under the GPL, but in several places I remind you that
"All copyrights to the restored code still belong to HI-TECH SOFTWARE."
Reply all
Reply to author
Forward
0 new messages