79 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,...
user avatar
  • 906
76 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 -- ...
user avatar
  • 5,204
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 ...
user avatar
  • 173k
61 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]; ...
user avatar
  • 3,812
56 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 ...
user avatar
  • 28.4k
56 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 ...
user avatar
  • 57.3k
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 ...
user avatar
52 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 ...
user avatar
  • 2,231
49 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. ...
user avatar
  • 5,963
48 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 ...
user avatar
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 ...
user avatar
  • 1,896
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 ...
user avatar
  • 10.2k
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 ...
user avatar
39 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 ...
user avatar
  • 173k
38 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 ...
user avatar
  • 28.1k
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 ...
user avatar
  • 16.1k
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 ...
user avatar
  • 2,904
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 ...
user avatar
  • 1,485
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 ...
user avatar
  • 96.6k
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 ...
user avatar
  • 173k
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 ...
user avatar
  • 28.1k
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. ...
user avatar
  • 8,413
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 ...
user avatar
  • 173k
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 ...
user avatar
  • 5,155
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 (...
user avatar
  • 28.3k
22 votes

Early Forth for personal computers

I believe FORTH Inc. provided the first microcomputer version: FORTH, Inc.'s microFORTH was developed for the Intel 8080, Motorola 6800, and Zilog Z80 microprocessors starting in 1976. Ref It wasn'...
user avatar
  • 8,186
22 votes
Accepted

ZSPL language, anyone heard of it?

Page 198 of that Byte says ZSPL is by Pete Ridley, whose full name appears to be Peter D Ridley, resident at the time in San Diego, California. He and ZSPL are also briefly mentioned in the December ...
user avatar
  • 7,814
22 votes

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

Compilers started generating more efficient code than the average assembler programmer the moment that architectures became so complex that the assembler programmer wasn't been able to cope with all ...
user avatar
21 votes

How can I run COMIT code?

Old question, but: I've just shipped an interpreter for a large subset of COMIT. Here it is. http://www.catb.org/esr/comit/ Full documentation is included. There's a pretty good suite of ...
user avatar
  • 311

Only top scored, non community-wiki answers of a minimum length are eligible