Write an 8051 Assembly Language Program for Finding Square Root of 8 Bit Number Having Integer...

1
OCT 21, 2008 Assembly language program to find square root of 8-bit number Following is the assembly language program to find square root of 8-bit number. In this program we initially load the index registers with specified values. We load the value of the number into SI Register. Then using a few logical steps as mentioned in the code i.e JMP insctructions we find the square root of a 8-bit number. Code: MOV SI,2000 MOV DI,4000 MOV CX,0001 MOV BX,0000 MOV AL,[SI] ; Load AL with the value given as at SI UP SUB AL,CL JL down ; jump to down label INC BL ADD CL,02 ; add 2 to contents of CL register JMP UP ; jump to up label DOWN MOV[DI],BL INT A5 Thus by implementing the above code we can find the square root of 8-bit number

description

4

Transcript of Write an 8051 Assembly Language Program for Finding Square Root of 8 Bit Number Having Integer...

Page 1: Write an 8051 Assembly Language Program for Finding Square Root of 8 Bit Number Having Integer Square Root

O C T 2 1 , 2 0 0 8

Assembly language program to find square root of 8-bit numberFollowing is the assembly language program to find square root of 8-bit number.In this program we initially load the index registers with specified values. We load the value of the number into SI Register. Then using a few logical steps as mentioned in the code i.e JMP insctructions we find the square root of a 8-bit number.

Code:MOV SI,2000MOV DI,4000MOV CX,0001MOV BX,0000MOV AL,[SI] ; Load AL with the value given as at SIUP SUB AL,CLJL down ; jump to down labelINC BLADD CL,02 ; add 2 to contents of CL registerJMP UP ; jump to up labelDOWN MOV[DI],BLINT A5

Thus by implementing the above code we can find the square root of 8-bit number