Pages

Program to find the square of an 8 bit number in 8051

mov dptr,#9000h ;load dptr with 9000h

movx a,@dptr ;move data from external memory location to a
mov b,a ;move data from a to b
mul ab ;multiply and b
inc dptr ;increment dptr
mov r0,a ;move data from a to r0
mov a,b ;move data from b to a
movx @dptr,a ;move data from a to external memory location
inc dptr ;increment dptr
mov a,r0 ;move data from r0 to a
movx @dptr,a ;move data from a to external memory location
here:sjmp here
end

0 comments:

Post a Comment