Skip to main content

Questions tagged [binary-coded-decimal]

For questions about the binary-coded-decimal (BCD) numeric representation.

Filter by
Sorted by
Tagged with
15 votes
2 answers
4k views

Did the NES CPU save die area by omitting BCD?

The NES CPU was a copy of the 6502 with the BCD circuitry removed. As I understand it, this modification was motivated by a theory that BCD was the only part of the 6502 that was actually patented, so ...
rwallace's user avatar
  • 62.8k
11 votes
3 answers
2k views

Protecting 6502 decimal mode code from interrupts

A common idiom in 6502 assembly code is to protect sequences of code that rely on decimal mode from being interrupted. This because an interrupt handler typically clears decimal mode (cld), and thus ...
Brian H's user avatar
  • 60.8k
6 votes
2 answers
1k views

Were any decimal-based computers capable of handling text?

Many of the earliest computers stored and manipulated numbers in various decimal codings rather than in pure binary. Examples include the Mark I and ENIAC, as well as some UNIVAC and IBM models. ...
DrSheldon's user avatar
  • 16.3k
0 votes
1 answer
1k views

What does the DAA instruction do?

The 6502 has the decimal mode, which causes the ALU to always output valid BCD if it's given valid BCD. Of course, you can turn it off, as any sane person always does. I was just looking at the ...
Omar and Lorraine's user avatar
4 votes
3 answers
387 views

The 8086 has AAM (ASCII Adjust after Multiply), why not the same for packed BCD?

I'm just curious why the 8086 seems to be lacking in an adjust opcode for fixing up packed BCD multiplication. It seems like it would be a useful thing, and packed BCD seems to be more common to begin ...
8086fan's user avatar
  • 43
6 votes
4 answers
1k views

6502: is BCD *fundamentally* the same performance as non-BCD?

Furthering my reading of MS BASIC and Woz's FP code and comparing the two leads to another question specific to the 6502... From what I can see looking over the 6502 instruction guides, it appears ...
Maury Markowitz's user avatar
18 votes
3 answers
1k views

Did any micros use the 6502 BCD mode in their OS?

I know the Atari's FP package used BCD for rather dubious reasons, but does anyone know of other examples of basic "operating system" level code on common platforms that used BCD? I suspect BCD was ...
Maury Markowitz's user avatar
4 votes
3 answers
636 views

3 decimal digits per 10 bits

Early computers often had hardware support for decimal arithmetic. This was usually in the form of BCD, 1 decimal digit per 4 bits, e.g. the 6502 and Z80, tightly constrained by transistor count as ...
rwallace's user avatar
  • 62.8k
6 votes
1 answer
1k views

What instructions for the 8086 and subsequent x86 CPUs are not available in Long Mode?

I know from this answer that, Modern x86 CPUs are binary compatible with 8086. You can literally run 8086 binaries on a modern PC, in real mode. (The species analogy is a stretch here, but works ...
Evan Carroll's user avatar
  • 3,388
6 votes
4 answers
2k views

Reason behind "ASCII Adjust" instructions being ASCII and not BCD?

I'm just curious if there was ever other instructions that were more ASCII-centric than the CISC associated ones we're left with now? Specifically, all the Binary Coded Decimal (BCD) instructions ...
Evan Carroll's user avatar
  • 3,388
20 votes
5 answers
4k views

Why does the Z80 have a half-carry bit?

The Z80 apparently had a 4-bit ALU, and computes 8-bit values in two stages. The half-carry bit preserves the carry from bits 3 to 4. Why did the designers of this chip choose to preserve that value ...
Omar and Lorraine's user avatar
14 votes
1 answer
4k views

What is the relationship between the Ricoh 2A03 and the MOS 6502?

The Ricoh 2A03 (and the 2A07) is the CPU in the well-known Nintendo Entertainment System. Apparently, the die is very similar indeed, as the slides in this video suggest https://www.youtube.com/watch?...
Omar and Lorraine's user avatar