Hot answers tagged

118 votes
Accepted

Why would a NES game use an undocumented 1-byte or 2-byte NOP in production?

One use is as a copyright mechanism. Many distributors would steal/copy programs and sell pirate or derivative copies, by changing the text strings inside the code and reordering the blocks, it was ...
  • 1,202
84 votes

Could you reverse engineer silicon just by looking at it?

With a powerful enough microscope, you can see each transistor. Reverse-engineering silicon then boils down to carefully removing each layer (ceramic or plastic to expose the chip, then each metal ...
72 votes

Why would a NES game use an undocumented 1-byte or 2-byte NOP in production?

The NES was also from the era where some sound and graphics resources were also executable code. (Typically, this worked the other way around. Identify a needed sound and listen to chunks of the ...
  • 1,129
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
58 votes

Why were there no 32-bit versions of 65xx CPUs, or 64-bit versions of m68k CPUs?

The premise in the question is incorrect. There were such chips. The question also fails to allow for the way that the silicon-chip industry developed. Moore's Law basically said that every 18 months, ...
  • 1,135
53 votes

Could you reverse engineer silicon just by looking at it?

(More of a memory dump related to Stephen's answer) At a time when ICs were of low complexity (compared today), could you actually see each transistor on the silicon and reverse engineer it? Yes. ...
  • 196k
53 votes
Accepted

Why are old CPUs like MOS Technology 6502 and Motorola 68000 considered better for real time systems applications than modern x86 based CPUs?

On a typical 6502, Z80, or 68000 system, it's possible to predict very precisely exactly how long a piece of code will take to execute. The same is true, incidentally, of many small microcontrollers ...
  • 32.3k
50 votes
Accepted

Why are different emulators needed to run platforms that use 6502 assembly code?

The 6502 CPU is just one piece of the puzzle Emulators emulate entire machines, not merely CPUs. Even the likes of QEMU emulate an entire generic computer. It helps if you think of the Apple II and ...
  • 596
49 votes

Why did so many early microcomputers use the MOS 6502 and variants?

First, for Commodore's part, it should be obvious the reason for choosing the 6502 microprocessor for all their 8-bit machines (notwithstanding the dual-processor SuperPet and C128) - Commodore owned ...
  • 59.1k
49 votes
Accepted

Why does the 6502 have the BIT instruction?

Early MOS documentation (KIM-1 Programming Manual, Synertek SY6500/MCS6500 Microcomputer Programming manual, etc) states: The BIT instruction actually combines two instructions from the PDP-11 ...
47 votes

What happened to the SEV instruction on the 6502?

Setting and clearing carry, the decimal or interrupt flags is useful: the carry flag because the 6502 offers only add and subtract with carry; the decimal flag because it changes the mode of the ...
  • 33.8k
46 votes
Accepted

Why did Sinclair choose the Z80 for its range of home computers?

Sinclair didn't always use the Z80 for its computers. The MK14 computer, sold in kit form (like the ZX80 was), used a National Semiconductor INS8060. The ZX range of home computers have a video ...
46 votes
Accepted

How slow was the 6502 BASIC compared to Assembly

Yes, BASIC is much slower than assembly for many operations. For an easy example, try out this program on a Commodore 64 or emulator: for i = 1024 to 1984 : poke i,peek(i) or 128 : next You will see ...
  • 23k
45 votes

How did Elite do vertex transformation?

Like all games from that era, cheating and tables. Two 256 byte tables and logarithms gave a 10x speed boost on multiply and divide on Commodore 64 at least. Matrix operations using addition only for ...
  • 3,493
42 votes
Accepted

Did anyone ever run out of stack space on the 6502?

Unlike its main rival the Z80, the 6502 had a size limit of 256 bytes for the hardware stack. The 6502 stack is mainly meant as a return return stack and for register preservation - which usually isn'...
  • 196k
41 votes
Accepted

Comparing raw performance of the Z80 and the 6502

Both processors are cacheless. So the process is fetch instruction, decode instruction, execute instruction, forget what you saw. That provides a first line of comparison. The Z80's fastest memory ...
  • 33.8k
40 votes
Accepted

What is the purpose of mirrored memory regions in NES's CPU memory map?

It is not intentionally mirrored, it is just a side effect of making the address decoding hardware for RAM as simple and cheap as possible with a single common 74LS139 chip used for the task, when an ...
  • 24.2k
38 votes
Accepted

What is the relative code density of 8-bit microprocessors?

An instruction set can be considered as a Huffman coding of an idealised instruction stream. So the question is really asking which CPUs have a good balance of short encodings for common tasks to ...
  • 10.1k
38 votes

Was leaving all xxxxxx11 opcodes unused on the 6502 a deliberate design choice?

The instruction decode is quite simple on the 6502. If we call the bits in the opcode byte aaabbbcc, then one of the first things that happens is that cc, the two bits you're talking about, gets ...
36 votes

Why would a NES game use an undocumented 1-byte or 2-byte NOP in production?

I'm just speculating here, but one possible reason for using a 2-byte NOP would be if you wanted to change an existing 2-byte instruction into a NOP (to fix a bug, for instance), without changing the ...
36 votes

Why does the 6502 have the BIT instruction?

I'm having a hard time picturing a use for this [BIT] It's mainly an I/O issue. The 6502 is in many ways designed especially for control/embedded applications and BIT is a part of this. 6500 specific ...
  • 196k
35 votes

Why would a NES game use an undocumented 1-byte or 2-byte NOP in production?

A mistake? The instruction $89 on the 6502 is a two-byte NOP. Based on adjacent instructions in the opcode matrix, especially LDA #ii ($A9 ii), it would have been STA #ii, a store to an immediate ...
34 votes
Accepted

What does "jmp *" mean in 6502 assembly?

MADS uses * in three ways (See MADS "Manual") Using the current assembly address for calculation of an address, i.e. the one the actual statement is assembled to. Multiplying in expressions. Mark the ...
  • 196k
34 votes

Why are branches relative in many 8-bit CPUs?

TL;DR: It is all about making one of the most important instructions as performant as possible, while keeping everything manageable for tools at the time (plus a little bit of dogma). The branching is ...
  • 196k
33 votes

Late 1970s and 6502 chip facilities for operating systems

The simple answer is that early operating systems for the systems you mention did not provide those features. Apple DOS, for example, makes no use of interrupts, and has no concept of processes or ...
  • 12.8k
32 votes

Why are different emulators needed to run platforms that use 6502 assembly code?

There are many answers to this and none might satisfy you. First of all, an emulator doesn't just do a CPU, but a machine. The same way you can't run an NES game on an Apple II. So while one emulator ...
  • 196k
32 votes

Could you reverse engineer silicon just by looking at it?

It's worth noting what you can see, and what you can't. First, you cannot see any feature that is much smaller than the wavelength of light that you are using. In 1995 I designed a chip for my Master'...
  • 841
31 votes

Why does 6502 indexed LDA take an extra cycle at page boundaries?

The 6502 had 16-bit addressing but only an 8-bit adder. For an indexed load or store, the index register had to be added to the base address in two steps. As an optimization, the 6502 will load from ...
  • 8,280
31 votes
Accepted

Can the two CPUs in a Commodore 128 run at the same time?

No, they cannot. They share both the data and the address bus of the C128, so they can only run exclusively at any one point in time. The address bus is apparently directly connected, the data bus ...
  • 30.1k
30 votes

What are uses of the byte after BRK instruction on 6502?

On the BBC Micro, the byte after the BRK instruction held the error number, followed by the error message string terminated with 0x0D. CALLing the address of the BRK instruction would cause an error ...
  • 571

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