BCD Arithmetic - PowerPoint PPT Presentation

About This Presentation
Title:

BCD Arithmetic

Description:

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 ... – PowerPoint PPT presentation

Number of Views:1511
Avg rating:3.0/5.0
Slides: 10
Provided by: edie
Category:
Tags: bcd | arithmetic

less

Transcript and Presenter's Notes

Title: BCD Arithmetic


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 47H 01000111 7CH 01111100
35H 00110101 47H 01000111 82H 10000010
0000 B0 35 MOV AL,35H AL 35H 0002 04 47
ADD AL,47H AL AL47H 0004 27 DAA
Decimal adjust
5
BCD Subtraction
Binary
Decimal (BCD)
52H 01010010 -25H 00100101 2DH 00101101
52H 01010010 -25H 00100101 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 01 05 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 FF 07 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
ASCII
Binary(Hex)
8 x7 56
08 x07 05 06 AH AL
08 x07 38
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
Write a Comment
User Comments (0)
About PowerShow.com