MKC ES Units 3&4 ARM 1
MKC ES Units 3&4 ARM 1
LOGO
UNIT – 3 & 4
1
UNIT - III
COMPANY
LOGO
Interrupt Vector
3
ARM – Advanced RISC Machine
Introduction …
5
RISC - The Reduced Instruction Set Computers
RISC Architecture
RISC Organization
Hard-wired instruction decode logic.
Pipelined execution.
Single-cycle execution.
RISC Advantages
A smaller die size
A shorter development time
A higher performance
6
RISC vs CISC
RISC CISC
Fixed size instructions (32 bit) Variable size instructions
with few formats with many formats
7
ARM Basics…
8
ARM Basics… Naming rule of ARM
ARM {x} {y} {z} {T} {D} {M} {I} {E} {J} {F} {-S}
9
ARM - Advanced Features:
10
ARM Architecture
• 3 stage pipeline organization & its features
• Instruction Set Architecture (ISA)
• Operating Modes
• Register Set
• Mode Switching
• CPSR and SPSR
11
ARM-7 Architecture
12
ARM Features
1. ARM : 32-bit Embedded RISC processor with Instruction Set Architecture (ISA)
• ISA means it constitute the instruction set, addressing modes,
registers, etc.
3. More no. of registers are present to support load and store process of execution.
• Versions:
– 3-stage (ARM7TDMI and earlier)
– 5-stage (ARM8, ARM9)
– 6-stage (ARM10)
i Fetch Decode Execute
– 8-stage (ARM11-V6)
– 9-stage (ARM11-V6T2) i+1 Fetch Decode Execute
8 14
ARM ‐ Operating Modes
16
ARM Register Set
17
• Current Visible Registers : 17
18
ARM Registers/Programmer Model
ARM has 37 registers all of which are 32-bits long.
The current processor mode governs which of several banks is accessible. Each mode
can access
a particular set of r0-r12 registers
a particular r13 (stack pointer, sp) and r14 (link register, lr)
the program counter, r15 (pc)
the current program status register, cpsr
19
CPSR Format: (Current Program Status Register)
• Each privileged mode (except system mode) has associated with it a SPSR
• This SPSR is used to save the state of CPSR when the privileged mode is
entered
• User state can be fully restored when the user process is resumed
• Often the SPSR may be untouched from the time the privileged mode is
entered to the time it is used to restore the CPSR
• If the privileged supervisor calls to itself the SPSR must be copied into a
general register and saved
21
2
The ARM Register Set & Mode switching
Current Visible
Registers
User
Mode r0.
r1
Banked out
r2
r3 Registers
r4
r5
r6 Abort FIQ IRQ SVC Undef
r7
r8 r8
r9 r9
r10 r10
r11 r11
r12 r12 r13(SP)
r13 (sp) r13(sp) r13 (sp) r13(sp) r13(sp) r13(sp)
r14 (lr) r13(sp) r14 (lr) r14(lr) r14(lr) r14(lr)
r15 (pc)
cpsr
spsr spsr spsr spsr spsr
22
The ARM Register Set
Current Visible
Registers
FIQ
Mode r0.
r1
Banked out
r2
r3 Registers
r4
r5
r6 User Abort FIQ IRQ SVC Undef
r7
r8 r8
r9 r9
r10 r10
r11 r11
r12 r12 r13(SP)
r13 (sp) r13(sp) r13(sp) r13(sp) r13(sp) r13(sp)
r14 (lr) r14(lr) r13(sp) r14(lr) r14(lr) r14(lr)
r15 (pc)
cpsr
spsr spsr spsr spsr spsr
23
The ARM Register Set
Current Visible
Registers
User
Mode r0.
r1
Banked out
r2
r3 Registers
r4
r5
r6 Abort FIQ IRQ SVC Undef
r7
r8 r8
r9 r9
r10 r10
r11 r11
r12 r12 r13(SP)
r13 (sp) r13(sp) r13 (sp) r13(sp) r13(sp) r13(sp)
r14 (lr) r13(sp) r14 (lr) r14(lr) r14(lr) r14(lr)
r15 (pc)
cpsr
spsr spsr spsr spsr spsr
24
The ARM Register Set
Current Visible
Registers
IRQ
Mode r0.
r1
Banked out
r2
r3 Registers
r4
r5
r6 User Abort FIQ SVC Undef
r7
r8 r8
r9 r9
r10 r10
r11 r11
r12 r12 r13(SP)
r13 (sp) r13(sp) r13(sp) r13 (sp) r13(sp) r13(sp)
r14 (lr) r14(lr) r13(sp) r14 (lr) r14(lr) r14(lr)
r15 (pc)
cpsr
spsr spsr spsr spsr spsr
25
The ARM Register Set
Current Visible
Registers
User
Mode r0.
r1
Banked out
r2
r3 Registers
r4
r5
r6 Abort FIQ IRQ SVC Undef
r7
r8 r8
r9 r9
r10 r10
r11 r11
r12 r12 r13(SP)
r13 (sp) r13(sp) r13 (sp) r13(sp) r13(sp) r13(sp)
r14 (lr) r13(sp) r14 (lr) r14(lr) r14(lr) r14(lr)
r15 (pc)
cpsr
spsr spsr spsr spsr spsr
26
The ARM Register Set
Current Visible
Registers
SVC
Mode r0.
r1
Banked out
r2
r3 Registers
r4
r5
r6 User Abort FIQ IRQ Undef
r7
r8 r8
r9 r9
r10 r10
r11 r11
r12 r12
r13 (sp) r13(sp) r13(sp) r13 (sp) r13(sp) r13(sp)
r14 (lr) r14(lr) r13(sp) r14 (lr) r14(lr) r14(lr)
r15 (pc)
cpsr
spsr spsr spsr spsr spsr
27
The ARM Register Set
Current Visible
Registers
User
Mode r0.
r1
Banked out
r2
r3 Registers
r4
r5
r6 Abort FIQ IRQ SVC Undef
r7
r8 r8
r9 r9
r10 r10
r11 r11
r12 r12 r13(SP)
r13 (sp) r13(sp) r13 (sp) r13(sp) r13(sp) r13(sp)
r14 (lr) r13(sp) r14 (lr) r14(lr) r14(lr) r14(lr)
r15 (pc)
cpsr
spsr spsr spsr spsr spsr
28
The ARM Register Set
Current Visible
Registers
Abort
Mode r0.
r1
Banked out
r2
r3 Registers
r4
r5
r6 User FIQ IRQ SVC Undef
r7
r8 r8
r9 r9
r10 r10
r11 r11
r12 r12 r13(SP)
r13 (sp) r13(sp) r13 (sp) r13(sp) r13(sp) r13(sp)
r14 (lr) r14(lr) r14 (lr) r14(lr) r14(lr) r14(lr)
r15 (pc)
cpsr
spsr spsr spsr spsr spsr
29
The ARM Register Set
Current Visible
Registers
User
Mode r0.
r1
Banked out
r2
r3 Registers
r4
r5
r6 Abort FIQ IRQ SVC Undef
r7
r8 r8
r9 r9
r10 r10
r11 r11
r12 r12 r13(SP)
r13 (sp) r13(sp) r13 (sp) r13(sp) r13(sp) r13(sp)
r14 (lr) r13(sp) r14 (lr) r14(lr) r14(lr) r14(lr)
r15 (pc)
cpsr
spsr spsr spsr spsr spsr
30
The ARM Register Set
Current Visible
Registers
Undef
Mode r0.
r1
Banked out
r2
r3 Registers
r4
r5
r6 User Abort FIQ IRQ SVC
r7
r8 r8
r9 r9
r10 r10
r11 r11
r12 r12 r13(SP)
r13 (sp) r13(sp) r13(sp) r13 (sp) r13(sp) r13(sp)
r14 (lr) r14(lr) r13(sp) r14 (lr) r14(lr) r14(lr)
r15 (pc)
cpsr
spsr spsr spsr spsr spsr
31
ARM - Interrupts
32
Interrupts and Interrupt Vector:
• ARM supports 3 types of Interrupts.
1. Exceptions :
2. Software Interrupts (SWI):
3. Hardware Interrupts : will be activated by FIQ & IRQ
Exceptions :
• ARM has a no. of exception modes.
• The interrupts take the control, to an interrupt service routine (ISR) residing in a
specific location in memory.
Since multiple exceptions can arise at the same time it is necessary to define a
priority order to determine the order in which the exceptions are handled.
1. Reset (highest priority),
2. Data abort,
3. FIQ,
4. IRQ,
5. Prefetch abort,
6. SWI, Undefined inst. (lowest priority).
Interrupt handling Mechanism in ARM
Exception Entry:
When an exception arises, ARM completes the current instruction and
then to handle the exception.
Exception Return:
Once the exception has been handled the user task is normally resumed.
Any modified user registers must be restored from the handler's stack.
The CPSR must be restored from the appropriate SPSR.
The PC must be changed back to the relevant instruction address. (R14 R15)
Programming the ARM
36
Programming the ARM Processor (ALP vs C)
Writing, running and testing programs is the key to understand any processor.
• In ALP, we can understand about how registers, memory and flags act on data.
We get a total feel about the processing activity done inside the processor.
• In the embedded design world, high level languages are used in product design,
and C is a very popular language. 37
ARM Assembly Language
38
ARM Assembly Language
39
ARM Instruction set Features: (4)
40
ARM Instruction set Features: (4)
i) ARM is a RISC processor, in which every instruction has a maximum size of 32 bits.
Instructions are expected to be executed in one cycle.
This is true for most instructions, but not for all.
∴ ARM is a RISC processor with a few CISC type instructions as well.
iii) ARM ALU has a barrel shifter associated with one of its operands.
A barrel shifter can perform more than one bit of shift/rotation, on an operand.
The barrel shifter allows shifting and an arithmetic operation to be combined in the
same instruction.
iv) ‘Conditions’ can be appended to instructions: to ‘do or not do’ a particular operation
based on a status of a condition flag.
For most other processors, only branching operations depend on flag status.
Here we will see that data movement and data processing instructions can be made
41
‘conditional’.
Data Types
ARM can operate on three different types of operands.
Word : 32-bit data
Half word : 16-bit data
Byte : 8-bit data
Little Endian format: The lowest byte of the word is stored in the lowest address.
Big Endian format: The highest byte of the word is stored in the lowest address.
• If the data is Aligned, Storing (and loading also) of 4 bytes in memory can be done
in one cycle, bcz the processor has a 32-bit data bus.
• For 32-bit data, ‘alignment ’ implies that the last two bits of this address are zero.
• For example, the address 0x00001200 is an aligned address.
• For 16-bit data, ‘alignment ’ implies that the last bit of this address is zero.
43
Assembly Language Rules
An assembly language line has four fields, namely,
label, op-code, operand and comment.
e.g.,
Label : Bhargav
Opcode : ADD
Operands : R1, R2 and R3
Comment : the line after the semicolon is the comment.
44
Conditional Execution
Not only the branch instructions alone but also any data processing
instruction can be used in this way.
45
Conditional Execution
All ARM7TDMI instructions can be executed conditionally, based
on a 4-bit condition field in the instruction.
Prior to execution, processor tests the state of the condition flags
in the CPSR (N, Z, V, C), and
o If the condition flag state matches the condition, the instruction executes
normally.
o If the condition flag state does not match the condition, the instruction is
executed as a NOP (no operation).
List of Conditions, Codes and Corresponding Flag Status
Cond Mnemonic Meaning Condition Flag State
Conditions used for signed numbers and unsigned numbers are different.
The mnemonic ‘higher’ or ‘lower’ : for unsigned numbers
‘greater than’ or ‘lower than’ : for signed numbers.
47
ARM Instruction Set
S.No. Data Shift & Athemati Logical Compare
Transfer Rotate c
1 MOV LSL ADD AND CMP
2 MVN LSR ADC ORR CMN
3 ASR SUB EOR TST
4 ROR SBC BIC TEQ
5 RRX RSB
6 RSC
48
ARM Instruction Set
The instruction set can be broadly classified as follows:
• The ARM data processing instructions are used to move the data b/w
registers. i.e., to modify data values in registers.
• The general purpose registers R1 to R12 can be used.
• The MOV instruction is also used for copying immediate data into registers.
58
Examples
MOV R11, R2 ; copy the contents of R2 to R11
MOV R12, R10 ; copy the contents of R10 to R12
MVN R1, R9 ; move the complemented value of R9 to R0
; if R9 = 0xFFF00000, R1 = 0x000FFFFFF
• MOV r0 , r1 ; r0 = r1
• MVN r0 , r1 ; r0 = not r1
• Each 1-bit in r1 clears the corresponding bit in r0.
o MOVS R2,#10
o MVNEQ R1,#0 59
Barrel Shifter
Shift and Rotate instructions
60
Examples
LSL R2, #4 ; shift left logically, the content of R2 by 4 bit positions
ASR R5, #8 ; shift right arithmetically, the content of R2 by 4 bit positions
ROR R1, R2 ; rotate the content of R1, by the number specified in R2
PRE R5 = 5, R7 = 8
POST R5 = 5, R7 = 20
61
Example: The content of some of the registers are given as:
R1 = 0xEF00DE12, R2 = 0x0456123F, R5 = 4, R6 = 28.
Find the result (in the destination register), when the following instructions are executed.
i) LSL R1, #8 ii) ASR R1, R5 iii) ROR R2, R6 iv) LSR R2, #5
ii) R5 contains 4. Arithmetically right shifting R1 4 times, causes the MSB (1, for the given number) to
be replicated 4 times on the left, thus causing a sign extension of the shifted number. R1 now contains
0xFEF00DE1.
iii) R6 contains 28. Rotating R2 28 times to the right is equivalent to rotating it 32–28 = 4 times, to the
left. After rotation, R6 contains 0x456123F0.
iii) R2 is logically shifted right 5 times, and so 5 zeros enter through the left. R2 now has the value
62
0x0022B091.
Combining the Operations of Move and Shift
• This allows shifting and data processing to be done in the same instruction cycle.
1. The content of source operand (R2) is logically shifted twice and then moved to the
destination register R1.
2. The amount of ‘shifting’ is specified in register R3. After the shifting is done, the
result is moved to R1.
63
Example :
Find the content of the destination registers after the execution of each of the given
instructions, given that the content of R5 = 0x72340200 and R2 = 4
i) MOV R3, R5, LSL #3 ii) MOV R6, R5, ASR R2
Solution
0 1 1 1 0 0 1 0 0 0 11 0 1 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0
1 0 0 1 0 0 0 1 1 0 10 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0
9 1A0 1 0 0 0
The content of R5 is shifted left 3 times, and moved to R3. Now, R3 = 0x91A01000
65
Examples:
Here the move instruction is executed only if the result of the subtraction produces a
zero and sets the zero flag.
66
Find the result of the following instructions. What do these instructions accomplish?
i) ADD R1, R2, R2, LSL #3 ii) RSB R3, R3, R3, LSL #3 iii) RSB R3, R2, R2, LSL #4
iv) SUB R0, R0, R0, LSL #2 v) RSB R2, R1, #0
Solution
69
Example 1: ORR R0,R1,R2
This example shows a logical OR operation between registers R1
and R2. R0 holds the result.
PRE: R0 = 0x00000000, R1 = 0x02040608, R2 = 0x10305070
POST: R0 = 0x12345678
70
Compare Instructions
71
Multiplication
MUL Rd, Rm, Rs
72
73
66
• What do the following instructions mean and what is accomplished?
MOVAL R7, R5
List of Conditions, Codes and Corresponding Flag Status
MOVGT R2, R5 Mnemonic Meaning Condition Flag State
ADDHI R2, R4, R2
EQ Equal Z=1
ADDLT R5, R6, R7 NE Not Equal Z=0
CS/HS Carry set/unsigned > = C=1
SUBNE R1, R2, R7 CC/LO Carry clear/unsigned < C=0
CMP R1, R2 MI Minus/Negative N=1
PL Plus/Positive or Zero N=0
ANDEQ R1, R2, R4 VS Overflow O= 1
VC No overflow O= 0
TEST R1, R3 HI Unsigned higher C=1&Z =0
LS Unsigned lower or same C=0|Z=1
GE Signed > = N==V
LT Signed < N! = V
GT Signed > Z = = 0, N = = V
LE Signed < = Z = = 1 or N! = V
AL Always
(NV ) Unpredictable
68
End of Unit 3
Thank You
74
16CS402 – Embedded Systems- UNIT 3 COMPANY
LOGO
UNIT –IV
70
UNIT - IV
COMPANY
LOGO
Branch Instructions
Assembly Programming
73
Load and Store Instructions
Memory
Load
Rn
Rm
Store
75
76
Syntax for load or store
LDR R1, [R2, #4] ;copy into R1 the content of memory specified in [R2+4]
STR R1, [R2] ;store the content of R1 into the memory address
specified in R2
77
Example:
How is the effective memory address calculated in the following load and store instructions?
i) LDR R3, [R2, LSL #2] ii) STR R9, [R1, R2, ROR #2]
iii) LDR R4, [R3, R2] iv) STR R5, [R4, R3, ASL #4]
Solution:
80
Types of Indexed Addressing Modes
1. Pre-index Addressing Mode :
• Effective address is calculation is done before the execution of load/store.
• Effective address is not stored in base register .
• LDR r1, [r2, #4]
81
Pre or Post Indexed Addressing …(Cont’d)
82
Pre-indexed Addressing Mode
Note: After the load/store is done, the base address content remains unchanged,
the effective address is not copied to the base register.
! : Write back
Effective address is copied to the base register,
In this, after the loading operation is done, R6 has the effective address written back
into it.
83
Assume Little Endian process
R1= 0x0000 0000 ; R2= 0x0000 9000. Find the content of registers of the execution.
Address Data
1. LDR R1, [R2] 2. LDR R1, [R2]! 0x00009007 04
0x00009006 03
EA= 0x 0000 9000 EA= 0x 0000 9000
0x00009005 02
R1= 0x 5040 3020 R1=0x 5040 3020
0x00009004 01
R2= 0x 0000 9000 R2= EA= 0x 0000 9000
0x00009003 50
0x00009002 40
3. LDR R1, [R2,#4] 4. LDR R1, [R2,#4]! 0x00009001 30
0x00009000 20
EA= 0x 0000 9004 EA= 0x 0000 9004
R1=0x 0403 0201 R1=0x 0403 0201 5. LDR R1, [R2],#4
R2=0x 0000 9000 R2= EA= 0x 0000 9004 R1=0x 5040 3020
EA= 0x 0000 9004
R2= EA= 0x 0000 9004
84
Assume r0=0x00000000, r1=0x00009000, [0x00009000]=0x03030303,
[0x00009004]=0x 0x05050505. Find the register and memory contents after the
following instructions execution.
STR r0, [r1, #4]
STR r0, [r1, #4]!
STR r0, [r1], #4
STR r0, [r1]
i) STR r0, [r1, #4] ii) STR r0, [r1, #4]! iii) STR r0, [r1], #4
EA= 0x 0000 9004 EA= 0x 0000 9004
R0 [EA] R0 [EA] R0 [R1]
[EA] = 0x 0000 0000 [EA] = 0x 0000 0000 R0 [0x0000 9000]
R0= 0x 0000 0000 R0= 0x 0000 0000 [0x0000 9000] = 0000 000
R1= 0x 0000 9000 R1= 0x 0000 9004
[EA] = 0x 0000 0004
R0= 0x 0000 0000
iv) STR r0, [r1] R1= 0x 0000 9004
EA= 0x 0000 9000
R0 [EA]
[0x0000 0000] = 0x 0000 0000
R0= 0x 0000 0000
R1= 0x 0000 9000 85
Assume r0=0x00000000, r1=0x00009000, [0x00009000]=0x03030303,
[0x00009004]=0x 0x05050505. Find the register and memory contents after the
following instructions execution. i) STR r0, [r1, #4] ii) STR r0, [r1, #4]!
STR r0, [r1, #4] EA= 0x 0000 9004 EA= 0x 0000 9004
STR r0, [r1, #4]! R0 [EA] R0 [EA]
STR r0, [r1], #4 R0= 0x 0000 0000 R0= 0x 0000 0000
STR r0, [r1] R1= 0x 0000 9000 R1= 0x 0000 9004
0x0000 9007 05 00 00 05 05
86
Assume r1=0x00000000, r2=0x00009000, [0x00009000]=0x03030303,
[0x00009004]=0x05050505. Find the register contents of r1 and r2 after the following
instructions execution.
LDR r1, [r2, #4]
LDR r1, [r2, #4]!
LDR r1, [r2], #4
LDR r1, [r2]
87
LDM / STM Instructions:
• LoaD Multiple Registers / STore Multiple Registers
• Allow the data transfer between ARM registers (1 and 16 registers) and
memory (to or from).
• Multiple Registers are involved.
• It is equivalent to multiple LDR/ STR
• LDM/STM instructions can be used only for words (32 bits).
• Here the base address is in R5, and after each data transfer, it is incremented by 4.
• In the destination register list, though R9 is specified first, the lowest register will
always be loaded from the lowest address in memory, and the highest register
from the highest address.
• Here R0 gets the data in the address pointed by R5.
89
4 addressing modes:
90
Swap Instructions:
Swap Memory and Register Instructions (SWP)
Swap instructions combine a load and a store of a word or an
unsigned byte in a single instruction.
Syntax: SWP {Cond} {B} Rd, Rm, [Rn]
Binary Encoding:
Binary Encoding:
Swap Instruction…… (Cont’d) Example
Branch Instructions
• Unconditional B
• Conditional B
Example 1
Shows a forward and backward branch.
The forward branch skips three instructions.
The backward branch creates an infinite loop.
95
Branch with Link Instruction BL
• Branch with Link (BL) instruction is similar to CALL instruction
(need to return)
This example shows a simple part of code that branches to a subroutine using
the BL instruction.
To return from a subroutine, move the link register to the pc.
96
General Structure of an Assembly Language Line
i) Label Space: Extreme left of the line
iv) Directives:
AREA ENTRY END
DCB DCW DCD
EQU
RN
Constants 97
ARM- Starting Assembly Language Programming
1. AREA Directive
• In ARM ALP, initially we define an area, using the directive named ‘AREA’.
• This directive names the area and sets its attributes.
• The attributes are placed after the name, separated by commas.
Example
AREA SORT, CODE, READ ONLY * (*optional)
AREA TABLE, DATA
2. ENTRY Directive
• It marks the first instruction to be executed within a program.
3. END Directive
• It is the END of ALP module.
• It tells the assembler to stop reading.
• Anything written after the END directive will be ignored by the assembler. 98
Directives for defining Data:
The RN Directive
100
Constants Allowed
• Decimal : e.g., 346, 6748, etc.
• Hexadecimal. e.g., 0x12345678, 0xFCE45, etc.
• n_xxx where:
n is a base between 2 and 9 and
xxx is a number in that base
• Characters: enclosed within single quotes, e.g., ‘e’, ‘R’, etc.
• Strings: enclosed within double quotes. e.g., “mine”, “non”, etc.
• Boolean: TRUE or FALSE
101
1. Write a program to find factorial of a given number
12 2 24 1
REPT MUL R2, R1, R2 ;R2 = R1 xR2
24 1 24 0
SUBS R1, R1, #1 ;R1 = R1- 1
BNE REPT ;branch to REPT if Z! = 0
STOP B STOP ;last line
END
102
2. Perform division by repeated subtraction using ARM.
R4 R2 R4 R3 --> Q Reminder
AREA DIV, CODE 7 2 5 1
5 2 3 2
3 2 1 3
ENTRY 1 2 -1 1
AREA PROCED,CODE
ENTRY
MOV R2,#8 ;to calculate 3X2 +5Y2
BL SQUARE ;call the SQUARE procedure
ADD R1,R3,R3,LSL #1 ;3X2
MOV R2,#5 ;R2 = 5
BL SQUARE ;call the SQUARE procedure
ADD R0,R3,R3,LSL #2 ;5Y2
ADD R4,R1,R0 ;R4 = R1+R0 i.e 3X2 +5Y2
STOP B STOP ;last line in the execution
SQUARE MUL R3,R2,R2 ;the SQUARE procedure
MOV PC,LR ;return LR back to PC
END
104
4. Write a program to find the sum of 3X + 4Y + 9Z, where X = 2, Y = 3 and Z = 4
AREA SUMM, CODE ;READONLY
X RN 1 ;register R1 is named X
Y RN 2 ;register R2 is named Y
Z RN 3 ;register R3 is named Z
ENTRY
MOV X,#2 ;load X = 2 into register R1
MOV Y,#3 ;load Y = 3 into register R2
MOV Z,#4 ;load Z = 4 into register R3
ADD R1,R1,R1,LSL#1 ;R1 = 3X
MOV R2,R2,LSL#2 ;R2 = 4Y
ADD R3,R3,R3,LSL#3 ;R3 = 9Z
ADD R1,R1,R2 ;R1 = R1+R2 i.e. 3X+4Y
ADD R1,R1,R3 ;R1 = R1+R3 i.e. 3X+4Y+9Z
STOP B STOP ;continue branching at STOP
END ;end of the assembly fi le 105