Monday, April 4, 2011

Unpack the packed bcd numbers


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


LDA 2000H ; LOAD BCD NUMBER IN ACCUMULATOR
ANI F0H   ; MASK LOWER BYTE TO GET A = 40
RRC  ;
RRC  ;
RRC  ;
RRC  ; A = 04
STA 2001H ; STORE 04
LDA 2000H ; LOAD BCD NUMBER
ANI 0FH  ; MASK HIGHER BYTE TO GET A = 02
STA 2002H ; STORE 02
HLT  ;

No comments:

Post a Comment