Professional Documents
Culture Documents
CamScanner 05-31-2021 02.14
CamScanner 05-31-2021 02.14
=> Anything sften. the END dincotive. io ignored by fhe ansormble rt. a
Ss
TH Rules of Labals: “3
> Munk bo unique “8
as
=> Fins character. murs ba. alphabetic. Character
> Runemed words cant be ued
—> the permitted ane aiphabate lettons - digits @-9), (2), (), (@),(.).
cs)
be
2
La
[Ze] lag bits ang PEW Register: oP
12
7 5 : 23
2 Tw flag mgister In 8051 pe is called pow (Program. Stolus Word) rigistan. ¢2
—> Sh is s-vit =
+a
=. 2
Fo Jax! eso ov |- asi! eso! eq.) Addu 23
eee Bare Ge + keg
CX PSH. 7 Conny Glog a Of oy al
Do Penk. & Faring Caney. fag od Fa foemcru Y
poe let dy FO de ene
Fo Pow. 5 Avaitalle to wen fon general purpose. | J o' 2 : lone 7H ab
; ae ek ah —
RSF PSW. 4 Ragiolon. honk solectort bi 4 rorya, ).% rien-tea +t
*, : ?
REO POW. 1, Reqiston. bank selection bit : a
7 ’
ov Paw. 2 ovarctiow flag al
— Paw. © Parity Hog .
: o&od
wg «OB OFZ HOU, Fen, 28
OF 5g San”
Adder Data
0050 Fo 4
cost os H
0052 7
83 2s0/ jo4
loo 84 53 (Aseu of 5)
aces Ay (ase of AY
0056 4d (Aserr of M)
B5eH
# O5H 108
07 0605) ) 00
O11 Ono
+ Yoololor
hE Thole
B29 CVs O > thawd no canny
e-?
7 bee [sr meas o conny from. D340 04,
=?
> Auen 45 Olorwise o]
=O (Sn this Cone)
Peo [even numborrot 1’
£0, oltunwise J
2
2
{9
29
ee)
>
x
by
>
bo,
Exognple 2-2!
Mov A, HOCH
App A. #O4 4
1 r@!
07 po pb D4 0d % PI DO
too, 11a 0
by ot 100! 9 0
edt Ee al ase eke
06 00000
eye4
nc: 4 [o« hag J carey)
0-80ae
[Fa] RAM. memony allocation: o>
oF
> 178 bytes & RAMI in BOB! , having Ws oddrenes GOH ~ FE -TWis la6. : in
loyfay is clivided into & diftencnt groups. Foxparestion pai
ee
F 1 OOH > 1 byte a
3 22 'bytes: (0040 SF HD fon tegistn banks Xoo a ate ois
‘ S
+2 \Gbytes (20-10 2FH) for bir Add renabl 2 a4
yrrmony G
>
Ob on4o TAY ) Stores AA << Mbyte 3 eh bye &
> Bobylos ( 0 FFM) fom genera ae f “2
krown ag e+ Seraleh pad epee e-9
; oF
+ : e9
Fe ios
gO Senedeh. pad RAM oF?
buy © $0 8
see pe
'e i Bil. Addeumolde. RAY e:2
byte 20, _ ota
we : ooo
Register Bonk 3 ees
% mi
uu sh
Rogistor Bernk 2 a
32 to ree “7
12 OF .
re Register. Bonk 1 (tcek) : .
+ co +3
mt ic ~
oe Register bank O “¥
00 Ld ba
a?
els
of
ale
aa Ly
*%
oe128
bioghe,
ee
on
ent Banks Beenk 2 Ben. a naam
ant ee er we -
es ani, AG -fe
ees a6 -E. RE =e w e
es a5-9 RS -15 a = ND
ot RA 10
ais R40 aaa y
mee RO-b Rd 12 Re - 18
es R2-A a2 - 12 R2 - 1A
os Abe RI-9 ay-n RE 19
oF RO g RO-8 Ro -O RG - RIB
~—
et
=
>
> Default Registon Bank!
SF —pwhen oi is powered up, we have acoess to wagistere bomk O
a
Foy 7 Me can switeh to ote cuagistor bemks Using PW
>
= 2F Stock in G05!
2-9 Wy the ragiston ured 10 access “he lock. is called SP (Stocl< Pointer) wugisten.
We addrass
- i Tse 0 pe
3 De SP io 08 bit of next inherent]
S—> Wy win Go5! % powond up. SP conlaing the value 7.
.
or 3 Address
eF
eF se
2? # Pushing ontothe sioe
ee
2.7 PMedulais pied onto the. stock, the SP io inenemented by 4.
Ayan atten tien 4
e.> at
el > MOV Re aos 08 os job
-
* 2 Mov Rie 2H on on jon A DOFaH
el:
ele Mov pq HOF SH 0 oy) 992 [09-1 12.
. fo PUSH G ov Mo-905 [OB V26 335
ee EF Puss
aby Pung ee.et len 08 |op-09 [5P3 08Popping fram Skeek!
> with: every pop, the top byte of Was. atecke is copied +o Was mqistor. specified
toy the instruction: cmd SP is decnsoned toy 4
Spittal Pd POP
Por 3 cass | og-demply | 08 >
. OR FQ lon OAS
pop ys |, OR AFD 0
09576 [09 536 109776 |r
Fane 08 > 60 03 X6C Og 4 6e 0% 460
ge: 08 | er- on | SP2 om | SP. 0g
¥ ¥
RD = 54H RO-0F9H — RDe TE
Addren Conon! o
Mov SP, 4 4P HR pus 8 -- ep = ®
: ; 50 250 >
SETB Pow.d Pusn > -- ag a cas =
Mov Ro, #250 Push OAH --R@
52 O54 ®
Mov RI
# och PUSH OfoR -- A 5 oce eS
Moy R2, #O5H in
+
Mov A, #OCE =
oe Sereten fad ®
nna SER paroEon] | Ram
——_—.
SET B®. PSW.% Moons bei Bnd bit oF Pswas 4
Vy seeaee,|
Gor R504 (spate BO ¢
85140 fUnlemmnuntonid oltiunwise] t aa
2. Staak <4 Tron os}
~ - se éet
Chaplet -03
ort
no? Wann
o3 Tump.Loop & Cail Trsteeuetions
aa
en
a3
en (3) Looping in @051°
“> Ss
er > > eupeating 0 sequence of insinuctions & certain snumbon. of times.
er
aE
eye > Sywtax:
a
€-5 DIN QZ, reg Lebel > Deensane Rig cond Turnpto label iF
es ¥ :
els valut oF meq $0
es [Re aa
>
es Mov A, ron ed
Mov R2, # 10 P2=10
AGAIN: ADp a, 258 Ar954954--- 6.
DINZ. R2 , AanN RA 9B ,.. ++
Mov R5, A A (25x10) = 85
Mov A, #558 ee
Mov R3, 410 } aoe rahe.
Mov R2, #70
NEXT:
¢2 Commelina ar y
AGAIN: QPL A R2240rG3...
SNE... DaPANY Total loop time: 7OXKIO = Joo
OIN2, R3, NEKTRowse Conditional Jumps!
Retion.
Jump ik AO
-
IN2
eTNE a, data
rag
OINE Padeden
ane
Te
l
t
(
{
ge \
1
Jac :
1
Juomp if 0.40
‘sump if Af daker
Tump if byte # data
Jump it CY=O
dump if CY go
Turp th bite 1
Jump if bit-t amd clean bit
ae 2S
wove
et SPE
ooo
ee ee ETE TT
hepoleslamn
BE AN conditional jumps are short Jumps
Example 45! Multiply the numbers GECH by 254
Mov Ri #O 1 mee MEB= RY
Mov A , #0 1 AeO LSB RO
RO = 25, 24.
Mov RO , 45H
A204 FCN +O£0 H
AGAIN: ADD A, #OECH
inne Hruee’s a canny, RI is inereaoned:
dno were
Sna RV j This mecms Ie Uppare loifa cut srroms fora
HERE © DINZ RO, ANAIN ; to RL
Mov 80, A 1156 in RO. becaune) cf tant bine.
> 2 ae Unconditional eves!
3 ‘
Pe par io 2 jump fn whieh control ib io tramsferned uncondionelly “lo the Tomegeh
2 Long Twme:
ae
> S-byte instruction
op-code. » 2nd ond Sud byte reprnent 56 bi
addres allows ajump to cay memory logation-
—> First byle & the faddrnun of
athe target loention - 2 bye
5S
5 Bronk Jump:
3 Wy dvyte neinnction
2
3 =p Pinar byte ne op-cede K Second byte 6 address,Regioreg d= RANGE DYKE MeTHENEM PE YL
, a |. "e0
Vala te egy do douwle +9.
Exowmple 3°6!
tine 1 PQ | = Opoode =f Label F Mnemenie 7, Oporond
1 ;
! f \ '
a ; Owe. f 1 ORG ' 0000
'
2 i seme S| #309 ' Mov 1 RO, HO
Mou Vout. p :
SBE veer ; Mov 1A BW
4 oang 6 7 ' :
' 1 GOXK~ 6003" : fh i were
> ooe]
; | 6% 1 '
1 | ; twee, 1 RO
I { ’
ao
e i ORT feo | R@AIN we re
: ' :
7 ; 000% + o4 ea on
\ ' ;
2 4 :
. coke] | 2477 | Next: ADD | OR RATE
9 ; COB joes 5005 | tne OVER
10 1 oo] | £4 ' ae i.
‘ ' "evr i i
n OooE | Fg \ , Mev | RO, A
12 : OOOF LEO [ yo Mov (RY, 8
' f
1 1 C010 ' ER i mov auf
1 1 «
4 ¢ Gol. | FS ; Rov ae
{ ‘ ‘
orZ
: t ° ' a ' OVER * ADD ' Arey
1
Ve ool _ 3
: ee sua, Pawel
+ 1 ~ 1 1
7) OO | i
1 eT RORS MERE: simp! ere
' :
% ) ood |! gop } '
; ! ' ' END !
! f 1
HIweate. FRPP... ae sign bik. oles lant 2 bit nexr 09
“over: 12
: . : ee XX ID
“DA seine son eRe: Waa vests OHS
ARS FARA FD hao
PRRS WATS PEwh 25/63/2021
e Sa err
e-2
en
ea [BQ] Call Iroheuations’
PS _y 54g acottieol tremsfort Trshuetion
2
S13 DP Poallo a subroutine
BPP —¥ Thentant two Ceill Inctuttions: LeALL % ACALL
ets Rage
ef
Sed
e 4eLOALL:
,
TS 951 is & 4-ylo insiweton
e7 > > First byte for opcode amd rest te fore adduess
els
els
SF Example 85!
es
er '
ORO I
aaa ~ PL.03 10
e = tov A) ASSN 1PA> O1OLoto B
\ A ' Li-y ot
e3 Move, f
i ' “2 ro
®— > Lent CELAY t sa
> ova, HORAN i A= solo 1010 3
1 “410
e-> Mov pw. A 1 7
7 ome oELAY 5a
: 310
ROK
5 SMP B a
mal 1
@- > orm 2008 :
©? pe: Mov es, 4OFFH |p QB 25B
Lf t
ba 5 ARAIN: OFZ RS, AGAIN fad R520
ela ReT 4
el? END ‘
el> ‘
et >
a! > :
oe f
eu
ee
iB
|Heat fretwetion Khe rake of He Steck?
annie dues ear
Excomple 9!
Arron opecd.
po
ony 8 eee
nek: mov ArH SSH ager 485
mev PLA 9 - 0002 F590
Len oeLAy 4+ 0004 49.0300 — -B% byte opead:
70 Suemped
MOV A, # ORAL 5 - 0007 TARR
Moy Pt, A G - 9009 wage 2 Pr
wes
Lepit OcLAY F-00608 12.0300 13
18
stump BACK 3 - 000 sOFO by 5
H- oolo 2
oR B00 19-0300 a
Reaoro de
DELAY: MOV RS, OFFA ty - 0200 WORF “| 2
wy?
AGAIN _DIN2 RS, AGAIN Wy - 0302 pore 42
a
RET 7 e
1, - 0204 22 Mi
END q 0905 ae
12
sla
5
2
Stack * (se-07)
j. Le By dofastt /Th not given, la
These clook cyoley ara retfenned to cts meshing. yc €8,
Br Lp the length of Hat machine eyole depends on the frag, OF the enystad osaillation
=!
S39 —D One mochina ayote tants 12 eseillatoe perieds
5
ST Eeumple aid
Mie ta
ig a) & 6502 MHE
D- enystal oscillators
ete
22 b) le Mae
os
2) 10 Mie
v3 Sel!
els i"
os e) WO5224, soare ke, 2. Te r08s pS Tre 4]
ee % lelig = Leora ps
eis
1 ST 2 0°60 ps
6 ® 2p = A
>
T= 1085 pS
be T
O12 5 time dalay 7 Machine Cyole “Time delay= 403, x 1085 PS
5 :
eae = 437-955 pS
4. a DELAY: MoV p, #200
2 vere: panz. RS HERE | 2 ~ (2. x200)
: RET 2-2
Total = 40%| LAB-S Dolay Caloulation:
aeystal
yee
T= boss ps
me
Qi pELAY > Mov OF. HID +
La: MOV. RG, 4 loo A
La: Mov RB, 4100 +
LirpInz Rb, Ld ge! Seanion
DINZ RG.LA e
DINZ RF,19 2
RET 2
¥ Re, Ico
oon pore wou 7
7 (
foox2) +2 say KIO + @] eit oe
\ Tr :
owe yes
RGD oni
eet
pF NRChaplen-o4
wn
S10-Pant Preagicoemming
~D Total 4 pants for Ao, eportations
“P32 pins divided into foure ports + FO/Piy 2,93
op Each: pont takes % pind (@ bit porcis)
rtd on J fon input and 0 for output
ap
“Dd Pins oom be configu
pin pin,
saumbere numba t
# Ponts an output He Ponts an input’
oe eee sey i
€ Port 0 mov A, HORPH: