97
votes
Accepted
Why do C to Z80 compilers produce poor code?
Quite often people don't know how to use the compilers or don't understand fully the consequences of code they write. There is optimization going on in the Z80 C compilers but it's not as complete as,...
- 1,086
77
votes
Accepted
Is it possible to make a ROM converter?
Note: This answer mainly focuses on the NES, since that's what I'm most familiar with.
Yes; this is called static recompilation or static binary translation, and it is theoretically possible -- ...
- 5,334
75
votes
Accepted
How was C ported to architectures that had no hardware stack?
How was C ported to architectures that had no hardware stack?
Simply by implementing a dynamic memory management for subroutine calling, parameter passing and local memory.
If there is a known ...
- 195k
65
votes
Why do C to Z80 compilers produce poor code?
If you try translating C into Z80, you'll see that Z80 index registers and stack don't behave quite as you expect. So, let us begin with
Arrays
Suppose you have a standard C construction
int c[10];
...
- 4,012
58
votes
Why do C to Z80 compilers produce poor code?
The main downside of "historic" CPU's (non?)-suitability for C programs is the lack of capability to form more than one register into an address without using the ALU.
Most more modern CPUs can use ...
- 30.1k
58
votes
What languages are better fit for generating efficient code for 8-bit CPU's than C?
One language that was popular on early 8-bit micros, including those that used the 6502 CPU, was Forth. Forth is exceptionally good for this use case, and superior to a C compiler, because Forth can ...
- 59.1k
55
votes
When if ever was the C language 'int' size altered from the host machine word (register) size into a literal 32 bit size?
The C standard of the language doesn't mandate a 32-bit int. It defines
sizeof(char) = 1
and
sizeof(long long) ≥ sizeof(long) ≥ sizeof(int) ≥ sizeof(short) ≥ sizeof(char)
It also mandates that the ...
- 2,301
53
votes
Accepted
Did any compiler fully use Intel x87 80-bit floating point?
Yes. For example, the C math library has had full support for long double, which on x87 was 80 bits wide, since C99. Previous versions of the standard library supported only the double type. ...
- 7,703
53
votes
Did any compiler fully use Intel x87 80-bit floating point?
TL:DR: Yes, most C/C++ compilers other than MSVC expose an 80-bit IEEE754 Extended Precision format (x87, 68881) as long double, and some implementations of other languages have it as REAL10 or ...
- 2,350
49
votes
Accepted
When did compilers start generating optimized code that runs faster than an average programmer's assembly code?
As a former professional assembly language programmer I would say that by the late 1980s a number of C compilers had become available whose output was as good as something a skilled assembler ...
- 672
46
votes
Accepted
Which tools were used to create the C language?
C didn't spring into being suddenly, but was created by slowly modifying the B language--which was written in itself. Therefore you might say that C was always written in itself, but at first it was ...
- 2,211
43
votes
How to get started writing C for the IBM PC in 1980-81
So you want to write a C program for the IBM PC before the first C compiler for the PC is released. How do you go about it?
There are three options I can see:
Write your own C compiler
Use a cross ...
- 10.9k
42
votes
Why do C to Z80 compilers produce poor code?
Simple answers one easily gets to this question are The Z80 Sucks and C Sucks - depending on the side someone is on. While they are of course, untrue (*1), there are real issues. A major argument for ...
- 195k
40
votes
When and why did high-level language compilers start targeting assembly language rather than machine code?
why did high-level language compilers start targeting assembly language rather than machine code
Well, the answer is probably: to avoid developing a high level language to binary converter for each ...
- 10.2k
39
votes
Why couldn't early C compilers handle variable declarations between statements?
Some early compilers, such as the ones described in the 1974 C reference manual, required that all automatic object declarations within a function precede the first executable code therein. Imposing ...
- 32.3k
36
votes
When did compilers start generating optimized code that runs faster than an average programmer's assembly code?
For a start, it is widely known that FORTRAN II for the IBM 1401 series was specifically designed to generate high enough quality object code to make assembly programming of numerical routines ...
- 16.4k
34
votes
Accepted
Were Windows 3.x applications dependent upon 80286 instructions?
Windows 3.x wasn’t “stuck to the 80286 platform”: Windows 3.0 still supported real mode on 8086 processors. The requirement for a 286 at the platform level only came with Windows 3.1.
As far as ...
- 111k
31
votes
Accepted
How to get started writing C for the IBM PC in 1980-81
One option might have been using “Small C,” which was published in 1980 in Dr. Dobb's Journal magazine.
Initially it generated code for the 8080, but was adapted for a few other CPU's. It was adapted ...
- 3,254
30
votes
How to get started writing C for the IBM PC in 1980-81
The BDS C compiler was released in 1979, ran on CP/M, and was capable of generating code for the Intel 8080 microprocessor. (It also ran on and generated code for the Zilog Z80, but that's not ...
- 1,494
30
votes
Why were nested functions excluded from B and C?
Keeping all functions as a flat array/list that can simply be iterated over does make life a lot simpler for a compiler writer. No nested functions allows that, and also resolves some forms of the ...
- 12.8k
29
votes
Accepted
How were bugs reported for compilers that were shipped on floppy disks?
In the early PC days, letter-writing was still common, and that was at first the main channel of communication to report issues. When CompuServe took off that became the preferred forum, at least in ...
- 111k
27
votes
Accepted
Native C compiler for Sinclair ZX Spectrum
If you want it contemporary, use HiSoft C. Back then the standard compiler and compatible with other HiSoft Tools.
For a more up to date and rather comfortable (cross) compiler Z88dk with its ...
- 195k
27
votes
What languages are better fit for generating efficient code for 8-bit CPU's than C?
C can be greatly improved as a language for the 6502 and Z80, as well as micros like the PIC and 8051, if one abandons the notion that implementations must provide for recursive subroutine calls, and ...
- 32.3k
26
votes
Accepted
Were there cross-compiler online services for the public?
I too doubt the premise of the question, on several counts:
The notion of using a teletype for access to remote compiling services seems ill-advised, since punching the object module on paper tape (...
- 31.3k
25
votes
Accepted
What was the first Lisp implementation that could generate machine code?
The first LISP compiler was implemented very early in the life of
the first LISP, LISP I for the IBM 704.
The LISP I Compiler
From the LISP I Programmer's Manual (March 1, 1960)
section 4.2, "...
- 23k
24
votes
Accepted
How much benefit should be expected on a more advanced compiler for z80/r800 based computers?
Places where LLVM will provide no benefit, and may reduce performance:
The Z80 has no CPU cache, accessing memory directly instead. Any optimizations based around increasing cache efficiency (eg. ...
- 8,462
24
votes
What languages are better fit for generating efficient code for 8-bit CPU's than C?
I know that the Z80 and the 6502 are very different, but I was wondering if there are any languages on a higher level than assembly which can generate compact and efficient 8-bit machine code by ...
- 195k
23
votes
How were bugs reported for compilers that were shipped on floppy disks?
I worked for Borland in the UK doing support for Turbo C 1 to 1.5. Most contact was via mail or telephone in those days. Bugs were sent over to the US after we did some triage to check if they could ...
- 5,175
23
votes
Did compilers ever give error messages without line numbers?
In some sense, the question is ill-defined. Error messages themselves often did not need to include line numbers, because the typical paper-to-paper compile-and-run cycle would already be producing a (...
- 31.3k
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
compilers × 63c × 19
programming × 15
history × 14
z80 × 5
assembly × 4
unix × 4
fortran × 4
ms-dos × 3
6502 × 3
zx-spectrum × 3
design-choices × 3
pascal × 3
emulation × 2
software-development × 2
x86 × 2
floating-point × 2
windows-3.x × 2
software-recommendation × 2
commodore-64 × 1
apple-ii × 1
ibm-pc × 1
amiga × 1
gaming × 1
software × 1