Questions tagged [compilers]

Historical compilers, or modern compilers targeting retro platforms.

Filter by
Sorted by
Tagged with
98 votes
9 answers
38k views

Why do C to Z80 compilers produce poor code?

When reading some other questions about compiling C for the Z80, How much benefit should be expected on a more advanced compiler for z80/r800 based computers? Native C compiler for Sinclair ZX ...
user avatar
  • 34.3k
66 votes
10 answers
15k views

How was C ported to architectures that had no hardware stack?

Thinking about machines such as the PDP-7, PDP-10, CDC-160 and so on1, these are machines which do not have a stack pointer which can quickly and easily change to point to a new stack frame, like the ...
user avatar
  • 34.3k
52 votes
7 answers
12k views

Did any compiler fully use Intel x87 80-bit floating point?

There is a paradox about floating point that I'm trying to understand. Floating point is an eternal struggle with the problem that real numbers happen to be both essential and incomputable. It's the ...
user avatar
  • 49.3k
50 votes
13 answers
8k views

What languages are better fit for generating efficient code for 8-bit CPU's than C?

I found Why do C to Z80 compilers produce poor code? very interesting as it pointed out that C (which was designed to be an abstraction of a CPU for porting Unix) was not a very easy language to ...
user avatar
50 votes
2 answers
24k views

Why were the /\ (min) and the \/ (max) operators abandoned in the C language?

In the UNIX V7 version of the C language (but not yet in the V6 version), there were the /\ (min) and the \/ (max) operators. In the source of the scanner part of the compiler, case BSLASH: if (...
user avatar
  • 15.8k
38 votes
5 answers
6k views

Is it possible to make a ROM converter?

Based on my understanding, an emulator is necessary because the machine with the emulator on it (say Windows), doesn't execute the same machine code as the target platform (6502, for example). So what ...
user avatar
  • 3,733
38 votes
6 answers
7k views

Why couldn't early C compilers handle variable declarations between statements?

In modern C, you may place variable declarations between statements: do_something(); int x; x = something_else(); However, older C compilers required that variables are declared before all statements:...
user avatar
  • 13.9k
37 votes
9 answers
8k views

When and why did high-level language compilers start targeting assembly language rather than machine code?

From what I've read, the first FORTRAN compiler built a machine-code program entirely in memory; it was, in fact, designed to read the entire source code of the program, and then sequentially load ...
user avatar
  • 27.4k
32 votes
2 answers
8k views

Which tools were used to create the C language?

Was the original C compiler written in some old assembly language and now later flex and bison are used instead?
user avatar
30 votes
13 answers
10k views

When did compilers start generating optimized code that runs faster than an average programmer's assembly code?

It is highly unrecommended to write your own code in assembly now since, in most cases, gcc -O3 does magic. But in the ‘80s it was believed that compiled C code takes 4(?) times or more than a well-...
user avatar
  • 2,438
28 votes
10 answers
16k views

How to get started writing C for the IBM PC in 1980-81

Suppose it's late 1980 to early 1981, you've got some software you want to write for the IBM PC which will be released later in 1981, want to get started ASAP, and believe C is the right language for ...
user avatar
  • 49.3k
24 votes
5 answers
2k views

How much benefit should be expected on a more advanced compiler for z80/r800 based computers?

I am self studying about compilers, and get hands on very good textbooks about the subject. I am thinking in develop a compiler using the almighty llvm infrastructure to cross compile to old computers,...
user avatar
  • 580
21 votes
5 answers
3k views

Early Forth for personal computers

What were the earliest Forth programming language implementations for 8-bit personal computers? Was it FIG Forth? Or a predecessor? Or some other development? Why did Forth lose its relative ...
user avatar
  • 7,684
21 votes
4 answers
5k views

Would a C compiler for the Apollo Guidance Computer be plausible?

The Apollo Guidance Computer was used to control the command/service module and lunar module on the missions to the moon. (Definitely a retrocomputer!) As noted in this answer, programs were written ...
user avatar
  • 13.9k
19 votes
10 answers
7k views

When if ever was the C language 'int' size altered from the host machine word (register) size into a literal 32 bit size?

From the earliest K&R reference manuals I read, 'int' was synonymous with machine word and it seemed to raise adverse reactions in various user domains. With the UNIX crowd, they minimally ...
user avatar
  • 389
19 votes
3 answers
6k views

Native C compiler for Sinclair ZX Spectrum

I am looking for a native C compiler for the Spectrum 128. I would like one which: Has good support for the latest C standard at the time. Is not limited to compiling ridiculously short source code. ...
user avatar
  • 1,770
19 votes
0 answers
1k views

Oxford C compiler for Commodore 64

I kept one floppy from my Commodore 128 (which I used mostly in C64 mode), labelled ‘Oxford C compiler’. It is a 5.25″ floppy. Don't ask me why I kept just this one; probably because I thought I ...
user avatar
18 votes
9 answers
2k views

How were bugs reported for compilers that were shipped on floppy disks?

Take the Microsoft C 1.0 compiler for example. It shipped on multiple 5.25" 360K disks, and when it ran on machines without internal hard disk, so users had to switch floppies between the editor, ...
user avatar
  • 9,162
17 votes
4 answers
658 views

How can I run COMIT code?

I recently learned about the existence of COMIT, which was the first string processing language. It's very old (1957), but it was used a lot in the first 10 years it was around, mainly in academic ...
user avatar
  • 1,600
17 votes
1 answer
2k views

ZSPL language, anyone heard of it?

While reading the Byte sieve article (Gilbreath 1981), I came across a language I have never heard of, ZSPL. I suspected this was actually a specific version of another language, perhaps PL/1. ...
user avatar
17 votes
1 answer
790 views

Where and when did the ".s" suffix for assembly-language source files originate?

The closest I was able to find on StackOverflow is What are .S files?, in which no answerer addresses why we use .s for assembly. (And .S for preprocessor/macro assembly; and gcc -S to produce ...
user avatar
14 votes
7 answers
3k views

Do any mainframe emulators exist with a functional FORTRAN compiler?

Similar to this question, but generalized to any mainframe computer from before the microprocessor era, does there exist an emulator and OS for a vintage mainframe computer that will run the output ...
user avatar
  • 7,684
14 votes
1 answer
2k views

Did any compilers hash long symbol names when truncating them?

Many early compilers and interpreters had maximum length for variable and function names. Usually you could use longer names but everything beyond e.g. the first 8 characters was discarded. This ...
user avatar
  • 908
14 votes
1 answer
2k views

How can I set up the Microsoft C compiler to make it prefer immediate-mode push instructions?

I started a project to get a better understanding on how to compile a game for Windows 3.x. I tried to set up the build workflow so that it produce the byte-exact clone of a great open sourced Win16 ...
user avatar
13 votes
6 answers
696 views

Are there any primary sources for the “passing constant by reference” behavior in old Fortran compilers?

Occasionally I have heard references to a peculiarity of certain (old) Fortran compilers, with regards to subprogram argument passing. Here is an example, from an answer to a Stack Overflow question: ...
user avatar
  • 3,082
11 votes
7 answers
4k views

Did compilers ever give error messages without line numbers?

I'm having an argument with my friend, who told me that when she was learning programming in the 1980s, the compiler gave errors without line numbers. I'm pretty sure that compilers have always given ...
user avatar
  • 1,703
11 votes
1 answer
554 views

How much time and how many people were required to develop Delphi version 1?

I would guess the compiler was primarily a modification of Borland's Turbo Pascal, while the Integrated Development Environment and Visual Component Library required a lot more development from ...
user avatar
  • 111
10 votes
1 answer
316 views

What sort of intermediate representation did the first Fortran compiler use?

Proebsting's Law asserts that improvements to compiler technology double the performance of typical programs every 18 years, but even granted that this is somewhat tongue-in-cheek, it's not really ...
user avatar
  • 49.3k
9 votes
1 answer
2k views

What was the first LISP compiler?

LISP is generally considered an interpreted language, but compilers have been made for it. What was the first compiler? To be clear, this is about compilers that compile LISP code stored for ...
user avatar
  • 21k
9 votes
1 answer
635 views

What was the first compiler/interpreter/assembler to indicate problematic columns in diagnostic messages?

These days, most compilers and interpreters seem to provide the following in diagnostics: A description of the problem The name of the source file A line number A relevant position within the line ...
user avatar
  • 3,082
8 votes
3 answers
738 views

How was dataflow analysis performed before SSA?

If we look at something like LLVM or the GNU Compiler Collection, Dalvik and many others, their intermediate representation (IR) uses SSA (Static Single Assignment form), as part of their Data-Flow ...
user avatar
  • 34.3k
7 votes
1 answer
331 views

When was a compiler first used to generate code to be placed in ROM?

In the early days of compilers, it was expected that programs would generally be stored in an inexpensive medium (such as punched cards or magnetic tape) when not in use. Although it was possible to ...
user avatar
  • 27.4k
7 votes
1 answer
518 views

BCC LD86 file has bad magic number

I wanted to write a simple hello world program in DOSBox, so I downloaded Bruce's C Compiler from here. And wrote this program (using edit.exe): #include <stdio.h> int main() { printf("...
user avatar
  • 73
7 votes
1 answer
464 views

P′′ Language Interpreter/Compiler Resources

According to Wikipedia, P′′ is a "primitive computer programming language created by Corrado Böhm in 1964 to describe a family of Turing machines." P′′ contains only four instructions has influenced ...
user avatar
  • 9,162
7 votes
1 answer
531 views

What libraries do I need in order to compile for Windows 98?

I am attempting to compile John Burger's StdTel for Windows 98. I am using Pelles C, because it has Windows 98 support, but it appears that I don't have the necessary libraries. This is the compiler's ...
user avatar
  • 17k
7 votes
1 answer
444 views

Was dynamic type check in Pascal commonplace?

The BESM-6 Pascal compiler I'm experimenting with has a notable difference from Standard Pascal: formal arguments of formal parameters-procedures or functions are not specified, but are checked at ...
user avatar
  • 15.8k
6 votes
1 answer
656 views

On the use of the "Code Improver"

Very early C compilers, (mostly K&R C, as seen in UNIX V6, or this compiler for the Atari ST called "Megamax C") came with a "code improver". This was apparently a separate binary, named c2, and ...
user avatar
  • 34.3k
6 votes
2 answers
352 views

Why isn't the 'restrict' keyword useful in SDCC when compiling for Z80 target? [closed]

Context SDCC claims to support C11. I use it to write games on Z80 target (for fun and experience). C11 defines restrict C11 specifies the restrict keyword on pointers, which can improve generated ...
user avatar
6 votes
2 answers
455 views

Why is the following p-Code generated by the Apple 3 pascal compiler?

On an Apple 3 the following pascal function function randu( High: integer): integer; begin randu:= random mod High end; will be translated to Proc = 06 Typ = P-Code codeBeg = 02A6 Exitcode=...
user avatar
  • 156
5 votes
1 answer
193 views

Which extant ALGOL-60 compilers fully support numeric labels?

This question is prompted by a related one by texdr.aft. It turns out that the Revised report on Algol-60 allowed numeric labels (3.5.1, page 15), <label> ::= <identifier> | <unsigned ...
user avatar
  • 15.8k
5 votes
0 answers
228 views

How did the template cache in CFront work?

I've seen some discussion of how templates were historically implemented in CFront around the web, including here. The link describes the Borland model, which is familiar, and the CFront model with a ...
user avatar
5 votes
0 answers
346 views

Link N64 object file while preserving relocation data

The N64 SDK provides the makerom tool to create a ROM image given a file describing the ROM layout called spec and the various object files it refers to such as the N64 OS, RCP microcode, and the game'...
user avatar
  • 51
4 votes
5 answers
823 views

Z88DK ZX Spectrum "%f" printf not working

I'm attempting to compile a program in C for the ZX Spectrum using Z88DK. However, I'm facing an issue when trying to use printf to print out the value of a float. The code I'm trying to compile: #...
user avatar
  • 81
3 votes
4 answers
865 views

Was there ever a compiler type that was just large enough to contain a memory segment?

From this answer, Hark back to the days of segmented 16-bit architectures for example: an array might be limited to a single segment (so a 16-bit size_t would do) BUT you could have multiple ...
user avatar
  • 3,178
3 votes
1 answer
172 views

How to remove ___EXPORTEDSTUB statement from a NE (Win16) program's MAP?

I started a project to get a better understanding on how to compile a game for Windows 3.x. I tried to set up the build workflow so that it produce the byte-exact clone of a great open sourced Win16 ...
user avatar
3 votes
1 answer
195 views

Where can I find a copy of the HiSoft C compiler manual for ZX Spectrum?

I've been able to find the manual for the CPC version of HiSoft C, but not for the ZX. The only ones I could find appeared to have been OCRed, so virtually all of the necessary information was lost. ...
user avatar
  • 1,770
3 votes
3 answers
330 views

How can I get cl65 to include its subroutines, like pushax and tosmulax?

This question is about cc65, which is a toolkit including a C compiler, assembler, linker, etc. All targeting various 6502 computers, like the various 8 bit commodores, the Apple II and whatever else. ...
user avatar
  • 34.3k
3 votes
0 answers
366 views

How do Apple II BASIC compilers compare? [closed]

Programs like The Beagle Compiler allow AppleSoft BASIC or other Apple II BASIC variants to be compiled. How do the compilers compare in terms of compatibility with AppleSoft language features? Eg how ...
user avatar
2 votes
3 answers
378 views

Was parsing or operating systems the first user of dollar sign as end of string/input?

According to the question Why did DOS use dollar-terminated strings? DOS uses dollar-terminated strings, inherited from CP/M which used them because DEC also used dollar as the string terminator. ...
user avatar
  • 953
1 vote
1 answer
216 views

When did cross-platform C start assuming function prototypes? [closed]

The most important difference between the original 'K&R' C, and ANSI/ISO C89/90, was function prototypes. These started being supported by some compilers in the mid-eighties, were formally ...
user avatar
  • 49.3k