0% found this document useful (0 votes)
102 views9 pages

Arm Notes 2

This subroutine program sums values stored in successive memory

Uploaded by

R INI BHANDARI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
102 views9 pages

Arm Notes 2

This subroutine program sums values stored in successive memory

Uploaded by

R INI BHANDARI
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

Software Interrupt Inside Swt

It causes Software exception provides mechanism


for application to call operating system routines

Ir Svc A.d.de
of neut intr following SWI
spsr Svc Cpsr
PC OX 08

Cpsr I t Masks the IRB interrupt


When processor executes SWI instr for print operation
then register ro
to be printed is placed in
MOV ro A
S WI write's Operation is
print
SWI emit

Other Instructions
Loading constant DR Rd Coyest
A DR Rd label
f Places the given label using
afd of
PC relative add subtract

counts the bw
Countleadiero of zeros
most bit 1st bit
significant
Pre rt 0 00000001
CLZ ro rl

Post rO 31 d i n 0 00000001

Arithmetic Insth

ADD ro ri r2 ro rt R2
ADC ro ri r2 Cro rt 142 1C

SUB ro M r2 ro rt R2
SBC RO rl rz ro rt r2 C

RSBRO.ir r2Cro R2 Crl


Rse Il Cro r2 Cre C

Logical

AND ro il r2 Hot Cri CrD


ORR ro ri r2 ro GDI RD
EOR ro ri r2 to rl 042
Bic ro M R2 ro Cri crzT
MOI
MOV ro ri ro ri
NNN ro rl Cro CT

Compareth

CMP rl r2 Set carry clear rt R2


CMN rl r2 Set CarryClear CrDtCrD
TST rl r2 Set Carry Clear Crl CrD
TEG ri R2 Set CarryClear Cri l r2

Immediate
ADD r2 r3 1 827 637 11
AND 62,83 FFFFFFFF R2 e b

Shifteroperands
ADD r3 r2 rl LSL I
ADD r l R2 B Lrs

Multiplication

MUL rl r2 r 3
LDR rt r2
STR rl cry

ADR M Tablet rt Table 1 SRC


ADR 12 Tables 82 Table 2 Dost

LDR ro Cri ro ri

STR ro r2 627 to

ADD rt rt 4
ADD R2 r2 4
Base 1 offset Addressing

ADR rt Tabled
ADR 12 Tables

LDR ro Cri 44
Post Indexing
STR ro rz
Multiple Data RegisterTransfer

Ero RST
1Dr2
LDN IA Rl R2 ro Mem32C

rltqrs
rlt8B1ockCopyLDMIArOl.C
r2 rg
STMIA rt r2 rg

compare content
label Bypass
of ro with 5
if equaljump to
a
If
not equal
ADD and SUBTRACT and save data
then execute 2 in.s
in Fl
ns

CMP ro 5
BEG
Bypass
ADD rt rt ro
SUBM.tl

Chap ro 5
ADD NE r l M RO
SUB NE Pl r l r2
Write a program to display tent HELLO WORLD 0

using
SWI Irish
SWI write C GO 0
Sw I EXIT ESU 0

TEXT HELLO WORLD 0

start ADR rt TEXT


LOOP LDR B ro rt I
CMP RO 0
SWINE SWI write
BNE LOOP
SWI swI exit

5 2 2020
I Write a program to add 232 bit numbers
and store Do not ignore
carry
to Memory pointer 1
rt 11 2
Save the result in memory location pointed by r2

2 ADD 2 64 bit n.es as a subroutine program


4ps ro r l hold pointers to Q 64 bit s
Otp values sum ro pointer
Use rs r6 r7 for ADD and carry

3 NAP to sum of held in successive location in men


5n s

with a simple counter type delay routine to slow the program


r3 holds count i r4 holds total ir5 Afterpointer

I algorithm
1 Operand I Cro
2 operand 2 Cri
3 move operandito 52 means load
4 11 z to 23
5 Add 63 84 and save in 65
6 Store Ers men 32 r2
7 7
content of r5 Meng pointed by v2

7 use mnemonic Moves i e Move set


carry
Moves r7 1

Program
LDR 53 Cro
LDR 64 Eri
ADDS 5 63 84 status regs reflection
STR r5 GZ 4 Post indexing to not ignore
carry
Moves 87 l

STR s7 Gz Store
carry
Algorithm

ST MFD SP Crs M Ir

load first word from ro


Load 2nd word from RI
ADD and STORE
Load the rent word
ADDC and store
Check carry store
LDMFD SP rs n Pc
Program
ST MFD SP rs n Ir
LDR r5 Cro
LDR RG Eri 4
ADDS 17 r5 rb l Add lower word
STR M to i store lower word result
4
LDR r5 ro
LDR r6 Cri
ADCs r 7 r5 rb
t
Add higher word
STR r7 ro 4
Moves r7 i
STR r7 Cro
1 checking if carry exists

LD MFD SP rs n PC
MOV i3 5 I Count _s
Mov r4 0
LOOP LDR r6 GS
4ADDr4
r4 r6 i Add the loaded value
LDR ro 123456
BL
delayr3
SUBS 13 I
BNE LOOP

delay STMFD SP Ir
UP SUBS ro ro 1
BNE UP
LDMFD SP PC
Hw_i
l WAP to count n of 1s in a given 3zbitr.io
Il il 1
z l o's

You might also like