ARM PROGRAM [ Acorn RISC Machine] - Sushmitashivashimpi/ARM GitHub Wiki

1]ARM CODE TO FIND THE SUM OF TWO 32 BIT NUMBERS:

AREA ADD, CODE, READONLY

ENTRY

LDR R0,=0X12345678

LDR R1,=0X11223344

ADD R2,R0,R1

STOP B STOP

END

2]Write ALP to add 2 64 bit number

AREA aa,CODE,READONLY

entry

ldr r0,=0xF2345678;Lower byte of 1st number

ldr r1,=0x20000001;Higher byte of 1st number

ldr r2,=0x00000012;Lower byte of 2nd number

ldr r3,=0x00000022;Higher byte of 2nd number

adds r4,r1,r0 ;r4 stores the lower byte of answer

adc r5,r2,r3 ;r5 stores the higher byte of answer

stop b stop

end

3]Write an ALP to add two numbers without using add instruction

AREA aa,CODE,READONLY

entry

ldr r0,0x00001234

ldr r1,0x00001111

stop b stop

end

4]Write an ALP to clear the bits 20-24 of the register r4

AREA aa,CODE,READONLY

entry

ldr r4,=0xFFFFFFFF

ldr r1,=0xFF0FFFFF

and r4,r4,r1

stop b stop

end