Program to find the square of a number (1 to 10) using Lookup Table

Write an Assembly Program to find the Square of a number (1 to 10) using a lookup table

Program:-

    AREA SQUARE,CODE,READONLY
    ENTRY
    LDR R0,=TABLE
    MOV R1,#6
    MOV R1,R1,LSL #0x2
    ADD R0,R0,R1
    LDR R3,[R0]
STOP B STOP
TABLE DCD 0x00000000
    DCD 0x00000001
    DCD 0x00000004
    DCD 0x00000009
    DCD 0x00000010
    DCD 0x00000019
    DCD 0x00000024
    DCD 0x00000031
    DCD 0x00000040
    DCD 0x00000051
    DCD 0x00000064
    END

Leave a Reply

Your email address will not be published. Required fields are marked *