Binary-coded decimal: Difference between revisions

Content deleted Content added
Use citation templates.
Get a new site for the 1401 etc. code chart. Use a citation template. Fix title.
Line 699:
IBM used the terms ''[[Binary-Coded Decimal Interchange Code]]'' (BCDIC, sometimes just called BCD), for 6-bit ''[[alphanumeric]]'' codes that represented numbers, upper-case letters and special characters. Some variation of BCDIC ''alphamerics'' is used in most early IBM computers, including the [[IBM 1620]] (introduced in 1959), [[IBM 1400 series]], and non-[[IBM 700/7000 series#Decimal architecture (7070/7072/7074)|decimal architecture]] members of the [[IBM 700/7000 series]].
 
The IBM 1400 series are character-addressable machines, each ___location being six bits labeled ''B, A, 8, 4, 2'' and ''1,'' plus an odd parity check bit (''C'') and a word mark bit (''M''). For encoding digits ''1'' through ''9'', ''B'' and ''A'' are zero and the digit value represented by standard 4-bit BCD in bits ''8'' through ''1''. For most other characters bits ''B'' and ''A'' are derived simply from the "12", "11", and "0" "zone punches" in the [[punched card]] character code, and bits ''8'' through ''1'' from the ''1'' through ''9'' punches. A "12 zone" punch set both ''B'' and ''A'', an "11 zone" set ''B'', and a "0 zone" (a 0 punch combined with any others) set ''A''. Thus the letter '''A''', which is ''(12,1)'' in the punched card format, is encoded ''(B,A,1)''. The currency symbol '''$''', ''(11,8,3)'' in the punched card, was encoded in memory as ''(B,8,2,1)''. This allows the circuitry to convert between the punched card format and the internal storage format to be very simple with only a few special cases. One important special case is digit ''0'', represented by a lone ''0'' punch in the card, and ''(8,2)'' in core memory.<ref name="Thelen_Van1401Van1401"/>
 
The memory of the IBM 1620 is organized into 6-bit addressable digits, the usual ''8, 4, 2, 1'' plus ''F'', used as a flag bit and ''C'', an odd parity check bit. BCD ''alphamerics'' are encoded using digit pairs, with the "zone" in the even-addressed digit and the "digit" in the odd-addressed digit, the "zone" being related to the ''12'', ''11'', and ''0'' "zone punches" as in the 1400 series. Input/output translation hardware converted between the internal digit pairs and the external standard 6-bit BCD codes.
Line 912:
<ref name="DEC_1985_VAX11">{{cite book |title=VAX-11 Architecture Handbook |publisher=[[Digital Equipment Corporation]] |date=1985}}</ref>
<ref name="ILE-RPG">{{cite web |url=http://publib.boulder.ibm.com/iseries/v5r2/ic2924/books/c0925083170.htm |title=ILE RPG Reference}}</ref>
<ref name="Thelen_Van1401Van1401">[http{{cite web |url=https://edibm-thelen1401.org/1401Projectinfo/Van1401-CodeChart.pdf |title=IBM BM 1401/1440/1460/1410/7010 Character Code Chart in BCD Order]{{dead link|date=November 2016 |bot=InternetArchiveBot |fix-attempted=yes}}</ref>
<ref name="Intel_2020_V1">{{cite book |title=Intel 64 and IA-32 Architectures Software Developer's Manual, Volume 1: Basic Architecture |chapter=4.7 BCD and packed BCD integers |volume=1 |version=Version 072 |pages=3-2, 4-9–4-11 [4-10] |date=2020-05-27 |orig-date=1997 |id=253665-072US |publisher=[[Intel Corporation]] |url=https://software.intel.com/content/dam/develop/public/us/en/documents/253665-sdm-vol-1.pdf |access-date=2020-08-06 |url-status=live |archive-url=https://web.archive.org/web/20200806110842/https://software.intel.com/content/dam/develop/public/us/en/documents/253665-sdm-vol-1.pdf |archive-date=2020-08-06 |quote-page=4-10 |quote=[…] When operating on BCD integers in [[general-purpose register]]s, the BCD values can be unpacked (one BCD digit per byte) or packed (two BCD digits per byte). The value of an unpacked BCD integer is the binary value of the low [[Nibble|halfbyte]] (bits 0 through 3). The high half-byte (bits 4 through 7) can be any value during addition and subtraction, but must be zero during multiplication and division. Packed BCD integers allow two BCD digits to be contained in one byte. Here, the digit in the high half-byte is more significant than the digit in the low half-byte. […] When operating on BCD integers in [[x87]] [[floating-point unit|FPU]] data registers, BCD values are packed in an 80-bit format and referred to as decimal integers. In this format, the first 9 bytes hold 18 BCD digits, 2 digits per byte. The [[least-significant digit]] is contained in the lower half-byte of byte 0 and the [[most-significant digit]] is contained in the upper half-byte of byte 9. The most significant bit of byte 10 contains the [[sign bit]] (0 = positive and 1 = negative; bits 0 through 6 of byte 10 are [[don't-care term|don't care]] bits). Negative decimal integers are not stored in [[two's complement]] form; they are distinguished from positive decimal integers only by the sign bit. The range of decimal integers that can be encoded in this format is −10<sup>18</sup> + 1 to 10<sup>18</sup> − 1. The decimal integer format exists in memory only. When a decimal integer is loaded in an x87 FPU data register, it is automatically converted to the [[double-extended-precision floating-point format]]. All decimal integers are exactly representable in double extended-precision format. […]}} [http://www.intel.com/content/www/us/en/processors/architectures-software-developer-manuals.html]</ref>
<ref name="Motorola_m68k">{{cite web |title=The 68000's Instruction Set |date= |url=http://www.tigernt.com/onlineDoc/68000.pdf |access-date=2023-11-21 |url-status=live |archive-url=https://web.archive.org/web/20231120233850/http://www.tigernt.com/onlineDoc/68000.pdf |archive-date=2023-11-20}} (58 pages)</ref>