
522 EMBEDDED SYSTEMS
ORG 0040H ;origin of the procedure
ASCII: ANL A,#0FH ;mask the upper byte of A
ORL A,#30H ;OR it with 30H for ASCII
RET ;return
END
e salient points of this program are as follows:
i) e BCD digit is got from por
t 0 and stored in R1. en the lower nibble is pro-
cessed. For this, the procedure ASCII is called.
ii) e procedure fi rst masks the upper byte—if the BCD no is 89H, 09 is got
iii) en it is ORed with 30H to get 39H, the ASCII of 9.
iv) On returning to the main program, the no is again brought to A and its nibbles are
swapped, to get the upper nibble in the lower nibble position, that is, 89H becomes ...