Monday, April 4, 2011

Pack the 2 unpacked bcd numbers


; GIVEN
; 2000H = 02H
; 2001H = 04H
; 2002H = 42H


LDA 2001H ; LOAD MSB IN ACCUMULATOR 04H
RLC  ;
RLC  ;
RLC  ;
RLC  ; A = 40H
ANI F0H   ; MAKE LSB ZERO
MOV B, A  ; TEMPORARY STORAGE
LDA 2000H ; LOAD LEAST SIGINIFICANT BIT
ADD B     ; ADD 40 AND 02
STA 2002H ; STORE RESULT 
HLT  ;

No comments:

Post a Comment