Escolar Documentos
Profissional Documentos
Cultura Documentos
1 Add the bytes in RAM locations 34h and 35h; put the result in register R5 (LSB) and R6 (MSB).
MOV A,34h
ADD A,35H
MOV 05H,A
CLR A
ADDC A,#00H
MOV R6,A
END
2 Add the bytes in registers R3 and R4; put the result in RAM location 4Ah(LSB) and 4Bh(MSB).
MOV R3,#4H
MOV R4,#5H
MOV A,R3
ADD A,R4
MOV 4AH,A
CLR A
ADDC A,#00H
MOV 4BH,A
END
3 Add the number 84h to RAM locations 17h and 18h.
MOV 17h,#4H
MOV 18h,#5H
MOV A,17h
ADD A,#84h
MOV 17h,A
MOV A,18H
ADDC A,#84H
MOV 18H,A
END
4 Add the bytes in external RAM location 02CDh to the internal RAM location 19h; Put the result
into external RAM location 00C0h (LSB) and 00C1h (MSB).
MOV DPTR,#02CDH
MOVX A,@DPTR
ADD A,19H
MOV DPTR,#00C0H
MOVX @DPTR.A
INC DPTR
CLR A
ADDC A,#00H
MOVX @DPTR,A
END
5 Add the bytes in RAM locations 34h and 35h; put the result in register R5 (LSB) and R6
(MSB).Assume the numbers in BCD format.
MOV A,34h
ADD A,35H
DA A
1
MOV 05H,A
CLR A
ADDC A,#00H
MOV R6,A
END
6 Add the bytes in registers R3 and R4; put the result in RAM location 4Ah(LSB) and 4Bh(MSB).
Assume the numbers in BCD format.
MOV R3,#4H
MOV R4,#5H
MOV A,R3
ADD A,R4
DA A
MOV 4AH,A
CLR A
ADDC A,#00H
MOV 4BH,A
END
2
11 Subtract the contents of r1 from r0; put the result in r7.
MOV A,R0
SUBB A,R1
MOV R7,A
END
12 Subtract the contents of RAM location 13h from RAM location 2bh; put the result in ram
location 3ch.
MOV A,2BH
SUBB A,13H
MOV 3CH,A
END.
13 Subtract the contents of TH0 from TH1:put the result in TL0
MOV A,TH1
SUBB A,TH0
MOV TL0,A
END
14 Increment TL1 by 05h
MOV A,TL1
ADD A,#5H
OR
MOV A,TL1
INC A
INC A
INCA
INC A
INC A
MOV R0,#00H
INC @R0
INC R0
INC @R0
INC R0
INC @R0
INC R0
INC @R0
3
INC R0
INC @R0
INC R0
INC @R0
21 Multiply the data in RAM location 22h by the data in RAM location 15h; put the result in RAM
location 19h(low byte) and 1Ah(high byte).
MOV A,22H
MOV 0F0H,15H
MUL AB
4
MOV 19H,A
MOV 1AH,19H
22 Square the contents of r5; put result in r0 (high byte) and r1(low byte)
MOV A,R5
MOV 0F0H,R5
MUL AB
MOV R1,A
MOV R0,0F0H
END
23 Divide the data in RAM location 3Eh by number 12h; put the quotient in R4 and remainder in
R5.
MOV A,3EH
MOV 0F0H,#12H
DIV AB
MOV R4,A
MOV R5,0F0H
END
24 Divide the data in RAM location 15h by data in RAM location 16h: put the resulting quotient
external RAM location 7ch
MOV A,15H
MOV 0F0H,16H
MOV R0,#7CH
MOVX @R0,A
END.
25 Divide the data in RAM location 13h by the data in RAM location 14h, then restore the original
data in 13h by multiplying the answer by data in 14h.
MOV 13H,#5
MOV 14H,#2
MOV A,13h
MOV 0F0H,14H
MOV R1,14H
DIV AB
MOV R0,0F0H
MOV 0F0H,R1
MUL AB
ADD A,R0
END