-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTwoOperand.asm
More file actions
24 lines (22 loc) · 807 Bytes
/
TwoOperand.asm
File metadata and controls
24 lines (22 loc) · 807 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# all numbers in hex format
# we always start by reset signal
#this is a commented line
.ORG 0 #this means the the following line would be at address 0 , and this is the reset address
10
#you should ignore empty lines
.ORG 2 #this is the interrupt address
100
.ORG 10
in R1 #add 5 in R1
in R2 #add 19 in R2
in R3 #FFFF
in R4 #F320
MoV R3,R5 #R5 = FFFF , flags no change
ADD R1,R4 #R4= F325 , C-->0, N-->1, Z-->0
SUB R5,R4 #R4= 0CDA , C-->1, N-->0,Z-->0
AND R6,R4 #R4= 0000 , C-->no change, N-->0, Z-->1
OR R2,R1 #R1=1D , C--> no change, N-->0, Z--> 0
SHL R2,2 #R2=64 , C--> 0, N -->0 , Z -->0
SHR R2,3 #R2=0C , C -->1, N-->0 , Z-->0
MUL R2,R5 #R5= fff4 ,R2=0B (ffff*0c = Bfff4),N=0,Z=0, no change for carry
ADD R5,R2 #R2= FFFF (C,N,Z= 0)