Program to multiply 16 bit number by 8 bit number


13. Program to multiply 16 bit number by 8 bit number :

mov r0,#11h ;load r0 with immediate data 11h
mov r1,#22h ;load r1 with immediate data 22h
mov r2,#33h ;load r2 with immediate data 33h
clr c ;clear carry bit
mov a,r0 ;move data from r0 to a
mov b,r2 ;move data from r2 to b
mul ab ;multiply and b
mov dptr,#9000h ;Load dptr with 9000h
movx @dptr,a ; move data from external memory location to a
mov r0,b ;move data from b to r0
mov a,r2 ;move data from r2 to a
mov b,r1 ;move data from r1 to b
mul ab ;multiply and b
add a,r0 ;add a and r0
inc dptr ;increment dptr
movx @dptr,a ;move data from a to external memory location
inc dptr ;increment dptr
mov a,b ;move data from b to a
movx @dptr,a ;move data from a to external memory location
here:sjmp here
end
Input: 1122, 33
Output:369c6h


Web Statistics