Questions tagged [binary-coded-decimal]

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

Filter by
Sorted by
Tagged with
11
votes
3answers
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 ...
5
votes
2answers
966 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. ...
0
votes
1answer
391 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 ...
4
votes
3answers
225 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 ...
4
votes
3answers
479 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 ...
15
votes
3answers
828 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 ...
5
votes
4answers
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 ...
18
votes
5answers
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 ...
13
votes
1answer
3k 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?...
6
votes
1answer
901 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 ...
7
votes
4answers
1k 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 ...