1 / 9

BCD Arithmetic

BCD Arithmetic. Module M16.5 Section 10.4. BCD Arithmetic. BCD: Binary Coded Decimal Packed BCD Arithmetic BCD Addition BCD Subtraction Unpacked BCD Arithmetic ASCII Addition ASCII Subtracition BCD Multiplication BCD Division. Binary Coded Decimal.

masato
Télécharger la présentation

BCD Arithmetic

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. BCD Arithmetic Module M16.5 Section 10.4

  2. BCD Arithmetic • BCD: Binary Coded Decimal • Packed BCD Arithmetic • BCD Addition • BCD Subtraction • Unpacked BCD Arithmetic • ASCII Addition • ASCII Subtracition • BCD Multiplication • BCD Division

  3. Binary Coded Decimal Code decimal numbers using the binary digits, 0 - 9. That is, 0000 - 1001. Can NOT use the hex digits A - F. For example, the DECIMAL number 3582 would be coded in BCD as 0011 0101 1000 0010 While this looks like the HEX number 3582H in BCD we interpret it as the DECIMAL number 3582.

  4. BCD Addition Binary Decimal (BCD) 35H 00110101 +47H01000111 7CH 01111100 35H 00110101 +47H01000111 82H 10000010 0000 B0 35 MOV AL,35H ;AL = 35H 0002 04 47 ADD AL,47H ;AL = AL+47H 0004 27 DAA ;Decimal adjust

  5. BCD Subtraction Binary Decimal (BCD) 52H 01010010 -25H00100101 2DH 00101101 52H 01010010 -25H00100101 27H 00100111 0000 B0 52 MOV AL,52H ;AL = 52H 0002 2C 25 SUB AL,25H ;AL = AL-25H 0004 2F DAS ;Decimal adjust

  6. ASCII Addition Decimal ASCII 9 +6 15 39 +36 0105 AH AL 0000 B8 39 00 MOV AX,0039H ;AL = 39H 0003 04 36 ADD AL,36H ;AL = AL + 36H 0005 37 AAA ;ASCII adjust

  7. ASCII Subtraction Decimal ASCII 6 -9 7 36 -39 FF07 AH AL Borrow= 1 Carry flag = 1 0000 B8 36 00 MOV AX,0036H ;AL = 36H 0003 2C 39 SUB AL,39H ;AL = AL - 39H 0005 3F AAS ;ASCII adjust

  8. BCD Multiplication Decimal Binary(Hex) ASCII 8 x7 56 08 x07 38 08 x07 0506 AH AL 0000 B0 08 MOV AL,08H ;AL = 08H 0002 B3 07 MOV BL,07H ;BL = 07H 0004 F6 E3 MUL BL ;AL = AL x BL 0006 D4 0A AAM ;ASCII adjust

  9. BCD Division Decimal Hex 9 = quotient 6 56 54 2 = remainder 9 6 36 32 2 0000 B0 06 05 MOV AX,0506H ;AX = 0506H 0003 B3 06 MOV BL,06H ;BL = 06H 0005 D5 0A AAD ;Adjust AX for ; BCD div 0007 F6 F3 DIV BL ;divide

More Related