Вы находитесь на странице: 1из 8

chop S Arithmetic and Logic

ADD
-

we saw ADD Rot Rg ⇒ Rot = Rot t Rs


,

I Assure thot the RAM hooton ox Guo Contois

the Voth write hi find the


program
she
0×33 .
a

of RAM ox 400 with the Value o x Ss .


write

RI
result in Ulus of the
the
,
and
frid the

the stotts register


flogs in

Instructions
.

LDS RH 0×400 jry.MS

¥4400
S ,

L DI R 21
, ygg ① , 0×55 ; R2 I -95
.

¥7
ADD R2 I R 16
PCP ,


R2 ) I
l
I I I

o X 33 :
00 I I o o I I

I
O XSS i 01 01 0
ol

/
H -
- o
-

C = o L

N
I o

2=0
2=0

N = I
V =
C ⑤ Cp -

-
O ⑤ 1=1

S = U ⑦ N = I ① 1=0

ADI Apb with any
ADC Roi ,
Rs

⇒ Rot -

- Rutt Rs t c

used when we b- to wht 2×116 bit ) mb


write to
⇐ o -

progun owl 0×3 CE 't and

o x 3D 8D . wit the result in RA ( lowebgty

18=0×3
and RIP
( higher Byte)
soy

EI
ox 3
+
ox

32,07€
T
p
Rid Rtt
LD I RIG ,
ox Et

LD I
R 17 ,
o X 8D
L DI Rid ,
o X 3C

L DI RID ,
ox 3B

ADD R 17 RIG ; Rtt =


o XE 7 tox 8D
,
C =
- - - . .

AD R 18 RIS 173
BtcR
; c to
,
Roi Rs

SUI SUB ,

⇒ Pol = Rut -
Rs

Volver all
⇐ fit the
of Ryo and He
flags
the
often execute
, following program
L DI R2 o 0 X 3 F
,

L DI R2 ) 0×23
,

SUB R 20
,
R 21

soy ① ⇒ R2 o = ox3F

② ⇒ R2 I =
0×23

R 20 R2 R2 1--01131=-0×23

o
⇒ =
-

= o A 3F t 0112T t I

O X 23 i
0010 0011

0112T : I I 01 11 00

042T tl =
Il ol 1101 pH
I
C I
pay I I

ID
O X 3 F 00 Il I I I I
:

11
( 0×2-3+1 ) 01
t i
I I 01
-


O o I
I I 0
O

c I
/
-

-
-
H =L u

N =/ O =) 2=0
2=0

N '
o
0+00=0
-

I ④ 1=0 S =
N ① U =

✓ = Cto Cp
:

MUL Multiply
Rot Rs
MUL it
,
gsif If
Ro
Rot x Rs →


orbit 8kt 16 bit

wite to multiply by
ED aphgrm 0×12

ox AL ,
wit the result in Rio ( lowrbgty

and Rtl ( higher Byte )

self LDI Rtb


,
0412

L DJ R 17 ,
OXAL ,
H L

Ri Ru ← 4×14×6×4
MUL R 17 RIG ⇒
,
,

Mov RIO Ro i RIO = Ru


,

Mo U Rtl Rl i Ril
-

-
RI
,

Logicimtrnct.ro#
Rot Rd AND Bs
Rs
-

AND AND
-

R%

.

: ,

OR i OR Rd Rs ⇒ Rot -
Rotor Rs
,
.

XEOR : EOR Rot , Rs ⇒ Rot -


-
Rd to Rs

Com : COM Rot ⇒ Rot =RuT


)

the

RIE
ED Trace following program .

fit the
wtf of RIG '

LDI
-

]
RIG ,
ox A 7

L DI Rit ,
ox Sc

a) AND ,
R 17

OR Rtl R 17
b) ,

Eun RIG RA
c) ,

ol ) com RIG

NI :
old puts one independent .

SY
0111o
1010
o .

I RIG = oxA7 :

Any
0101 1100
R 17 .
-

o x SC :

=) R 16 = 0100
oooo -

o L
ul
)
= o X ,
RIG = to lo 0111

i÷÷
" on

:
'

⇒ R 16 = ox FF

to to ol I l
a
)
O I O I I I 00

I l I I I 0 I I

=3 RIG =
OX FB

shftondRotute_
ROR Rd : polite Risk

Ts so

Rot Rd :
Rotate Left

④ HO
←←€
L SL Rd :
Logic shift Left


€ao
LSR Rot : Logic shift Right

Asr Rot Anitta Rish


:
stiff

if .co

SWAP Rd

NI CLC Leon
Cory
: i
⇒ c
o
-

. -

set
SE c :
by ⇒ c - z

Volner of
ED f. ol the Rio .
All puts
one
independent :

L D I R 16 ,
o
"
A 3 ; Rk : uxA3

SEC s
'
c' - I

a) Ro R RIG

Role Rko
b)
c) LS L R 16

R RIG
ol
) L S

ASR R 16
e)
R 16
f) su -
AP

a) RIG = ox A 3 i

Hot
lolooollc.IT u o

⇒ RIG = o X D I ; c =L

b)
100%444
loloo#]
to a

RIG = o X 47 a .
-
I

I I o I o o o
I I

O to o o I I O ←

R 16=0×4 6
,
c
-

- I

01J

10 to 00 It
Ry 0×51
0510101 ) :

o o as I

e)
to
10 00 11

lol o O 01

RIG = ox D I c' -
I

f) 1010
✓ o

0011
# lolo

⇒ RIG -_ OX 3A

NI XI : LSL

0011 3
RIG =
83 = 0000 =

3×2/12
L SL RIG ⇒ oooo 0110 = 6

:
shift Right to

RIG = 8 = oooo 1000 = I

ASR RIG =
oo
% 0100 =
4 ( 812 )