Hot answers tagged

119 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 ...
user avatar
  • 1,204
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 ...
user avatar
  • 95.7k
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 ...
user avatar
  • 1,099
55 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
  • 56.8k
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. ...
user avatar
  • 168k
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 ...
user avatar
  • 27.4k
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 ...
user avatar
  • 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 ...
user avatar
  • 56.8k
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 ...
user avatar
  • 32.4k
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 ...
user avatar
46 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 ...
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 ...
user avatar
  • 21k
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 ...
user avatar
  • 3,011
42 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 ...
user avatar
  • 32.4k
42 votes

Why were there no 32-bit or 64-bit versions of the m68k & 65xx lines of 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, ...
user avatar
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 ...
user avatar
  • 17.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 ...
user avatar
  • 9,380
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 ...
user avatar
  • 34.3k
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 ...
user avatar
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 ...
user avatar
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 ...
user avatar
  • 168k
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 ...
user avatar
  • 168k
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 ...
user avatar
  • 9,396
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 ...
user avatar
  • 168k
32 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 ...
user avatar
  • 168k
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'...
user avatar
  • 771
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 ...
user avatar
  • 28.3k
30 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 ...
user avatar
  • 7,591
29 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 ...
user avatar
  • 551
29 votes
Accepted

Late 1970s and 6502 chip facilities for operating systems

For "home" computer systems such as the Apple II, the "operating system" wasn't anything like a modern one with processes and device drivers and so on; by the standards of modern ...
user avatar
  • 21k

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