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 ...
LOIS 16192's user avatar
  • 1,212
85 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 ...
Stephen Kitt's user avatar
71 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 ...
Eric Towers's user avatar
  • 1,119
59 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, ...
Liam Proven's user avatar
  • 1,165
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 ...
Brian H's user avatar
  • 60.1k
54 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 ...
Kelvin Sherlock's user avatar
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. ...
Raffzahn's user avatar
  • 213k
52 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 ...
Brian H's user avatar
  • 60.1k
52 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 ...
supercat's user avatar
  • 34.7k
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 ...
520's user avatar
  • 596
49 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 stack and for register preservation - which usually isn't a ...
Raffzahn's user avatar
  • 213k
48 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 ...
Tommy's user avatar
  • 36k
47 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 ...
mcleod_ideafix's user avatar
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 ...
cjs's user avatar
  • 24.7k
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 ...
Alan B's user avatar
  • 3,857
43 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 ...
Tommy's user avatar
  • 36k
42 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 ...
Justme's user avatar
  • 28.3k
40 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 ...
Raffzahn's user avatar
  • 213k
39 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 ...
pndc's user avatar
  • 10.8k
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 ...
Omar and Lorraine's user avatar
37 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 ...
Damian Yerrick's user avatar
37 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 ...
Mitchell Spector's user avatar
35 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 ...
Raffzahn's user avatar
  • 213k
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 ...
Raffzahn's user avatar
  • 213k
34 votes
Accepted

Why didn't the 6502 have increment/decrement opcodes for A?

The designers figured that you'd use X and Y for looping, indexing etc, and use A for adding and subtracting, shifts etc. So they saw a need for INX and INY, but didn't see a enough of a need for an ...
Omar and Lorraine's user avatar
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 ...
RETRAC's user avatar
  • 13.6k
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 ...
Raffzahn's user avatar
  • 213k
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'...
d3jones's user avatar
  • 891
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 ...
fadden's user avatar
  • 8,775
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 ...
tofro's user avatar
  • 33k

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