Saturday, April 23, 2011

Write Assembly language program for 2-Digit BCD to Binary conversion


; NEED TO USE CONCEPT OF POSITIONAL 
; WEIGHTING
; EXAMPLE: 34
; 34 = 3X0A + 4
; 34 = 1E + 4
; 34 = 22
; 2000H = 34H
;
;
LDA 2000H ;
ANI F0 ; A = 30
RRC ; MAKE MSB LSB
RRC
RRC
RRC
MVI B, 0AH ; B = 0A
CONTI ADD A ;
DCR B ;
JNZ CONTI ;
MOV B, A ; B = 1E = A
LDA 2000H ;
ANI 0F ; A = 4
ADD B ; A = 22
STA 2001H ; STORE 22
HLT

No comments:

Post a Comment