You are on page 1of 61

SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE

DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING


(JUNE 2014-NOV 2014)
LANGUAGE TRANSLATORS
V SEMSTER
P a g e | 1 LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
SYLLABUS
UNIT I
Intr!"#t$n t S%&t'( S)t*+r' +n! M+#,$n' Str"#t"r'- System prgrams !
Assem"#er$ I%terpreter$ Operat&%g system' Ma()&%e Str*(t*re ! &%str*(t&% set a%+
a++ress&%g m+es'
A&&'(./'r&- ,as&( assem"#er -*%(t&%s$ ma()&%e ! +epe%+e%t a%+ ma()&%e
&%+epe%+e%t assem"#er -eat*res' Assem"#er +es&g% ! T./pass assem"#er .&t)
0er#ay str*(t*re$ %e ! pass assem"#er a%+ m*#t&/pass assem"#er'
UNIT II
L+!'r& +n! L$n0'r&- ,as&( #a+er -*%(t&%s$ ma()&%e ! +epe%+e%t a%+ ma()&%e !
&%+epe%+e%t #a+er -eat*res' La+er +es&g% ! L&%1age e+&trs$ +y%am&( #&%1&%g a%+
"tstrap #a+ers'
UNIT III
S"r#' Pr1r+( An+/%&$&- Cmp&#ers ! A%a#ys&s - t)e S*r(e Prgram ! P)ases -
a Cmp&#er ! C*s&%s - Cmp&#er ! Gr*p&%g - P)ases ! Cmp&#er C%str*(t&% T#s'
L'2$#+/ An+/%&$&- R#e - Le2&(a# A%a#y3er ! I%p*t ,*4er&%g ! Spe(&5(at&% - T1e%s
! Re(g%&t&% - T1e%s !A La%g*age -r Spe(&-y&%g Le2&(a# A%a#y3er'
UNIT IV
P+r&$n1- R#e - Parser ! C%te2t -ree Grammars ! 6r&t&%g a Grammar ! Pre+&(t&0e
Parser ! LRParser' Int'r('!$+t' C!' G'n'r+t$n- I%terme+&ate La%g*ages !
De(#arat&%s ! Ass&g%me%t Stateme%ts ! ,#ea% E2press&%s ! Case Stateme%ts !
,a(1 Pat()&%g ! Pr(e+*re Ca##s'
UNIT V
B+&$# O3t$($4+t$n- C%sta%t/E2press&% E0a#*at&% ! A#ge"ra&( S&mp#&5(at&%s a%+
Reass(&at&%! Cpy Prpagat&% ! Cmm% S*"/e2press&% E#&m&%at&% ! Lp/
I%0ar&a%t C+e Mt&% ! I%+*(t&% Var&a"#e Opt&m&3at&%'
C!' G'n'r+t$n- Iss*es &% t)e Des&g% - C+e Ge%eratr ! T)e Target Ma()&%e !
R*%t&me Strage ma%ageme%t ! Ne2t/*se I%-rmat&% ! A s&mp#e C+e Ge%eratr !
DAG Represe%tat&% - ,as&( ,#(1s ! Peep)#e Opt&m&3at&% ! Ge%erat&%g C+e -rm
DAGs'
TE5T BOO6S
1' A#-re+ A)$ V' Ra0& Set)&$ a%+ D' 7e4ery U##ma%$ 8Cmp&#ers Pr&%(&p#es$ Te()%&9*es
a%+ T#s:$ A++&s%/6es#ey$ 1;<<' =UNITs III$ IV > V?
@' Le#a%+ L' ,e(1$ 8System S-t.are ! I% I%tr+*(t&% t System Prgramm&%g:$
A++&s%/6es#ey$ 1;;A =UNITs I > II / C)aptersB 1$ @ > C?'
REFERENCES
1' A##e% D#*"$ 8Cmp&#er Des&g% &% C:$ Pre%t&(e/Da## - I%+&a$ 1;;A'
P a g e | @ LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
@' C)ar#es N' F&s()er a%+ R&()ar+ 7' Le"#a%($ 8Cra-t&%g a Cmp&#er .&t) C:$ ,e%Eam&%
C*mm&%gs$ 1;;1'
C' Ste0e% S' M*()%&(1$ 8A+0a%(e+ Cmp&#er Des&g% Imp#eme%tat&%:$ Mrga%
K4ma%$1;;F'
G' Dam+)are$ 8I%tr+*(t&% t System S-t.are:$ M(Gra. D&##$ 1;<H'
DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING
SUBJECT NAME- LANGUAGE TRANSLATORS SUBJECT CODE-
CST72
Pr'3+r'! B%-
I8GOVIND9ARAJ: AP;CSE
M8S9ANMUGAM: AP;CSE
D8D9ANASE6ARAN: AP;CSE
V'r$<'! .%- A33r='! .%-
UNIT I
Intr!"#t$n t S%&t'( S)t*+r' +n! M+#,$n' Str"#t"r'- System prgrams !
Assem"#er$ I%terpreter$ Operat&%g system' Ma()&%e Str*(t*re ! &%str*(t&% set a%+
a++ress&%g m+es'
A&&'(./'r&- ,as&( assem"#er -*%(t&%s$ ma()&%e ! +epe%+e%t a%+ ma()&%e
&%+epe%+e%t assem"#er -eat*res' Assem"#er +es&g% ! T./pass assem"#er .&t)
0er#ay str*(t*re$ %e ! pass assem"#er a%+ m*#t&/pass assem"#er'
P a g e | C LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
2 MAR6S
18 >,+t $& /+n1"+1' tr+n&/+tr?
A #a%g*age tra%s#atr &s a prgram t)at ta1es as &%p*t a prgram .r&tte% &% %e
#a%g*age a%+ pr+*(es as *tp*t a prgram &% a%t)er #a%g*age' I% prgram tra%s#at&%$
t)e tra%s#atr per-rms a%t)er 0ery &mprta%t r#e$ t)e errr/+ete(t&%' A%y 0&#at&% -
t)e D&g) Le0e# La%g*age =DLL? spe(&5(at&% .*#+ "e +ete(te+ a%+ reprte+ t t)e
prgrammers'
28 >,+t +r' t,' r/'& ) tr+n&/+tr&?
Imprta%t r#e - tra%s#atr areB
18 Tra%s#at&%g t)e DLL prgram &%p*t &%t a% e9*&0a#e%t Ma()&%e La%g*age =ML?
prgram'
28 Pr0&+&%g +&ag%st&( messages .)ere0er t)e prgrammer 0&#ates spe(&5(at&% -
t)e DLL'
@8 >,+t +r' t,' t%3'& ) tr+n&/+tr&I
Cmp&#er
Assem"#er
I%terpreter
Pre/prssessr
48 D'<n' &%&t'( &)t*+r'8 (MAY 2012) (NOV 2012)
System s-t.are (%s&sts - 0ar&ety - prgrams t)at s*pprts t)e perat&% - t)e
(mp*ter' T)&s s-t.are ma1es &t pss&"#e -r t)e *ser t -(*s % t)e t)er pr"#ems t "e
s#0e+ .&t)*t %ee+&%g t 1%. ). t)e ma()&%e .r1s &%ter%a##y'
EgB perat&%g system$ assem"#er$ a%+ #a+er'
78 >,+t +r' t,' .+&$# #(3n'nt& ) t,' &%&t'( &)t*+r'?
Operat&%g system
Cmp&#er
P a g e | G LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
Assem"#er
Ma(r pr(essr
La+er r #&%1er
De"*gger
Te2t e+&tr
Data"ase ma%ageme%t
S-t.are e%g&%eer&%g t#s
A8 D$B'r'n#' .'t*''n S%&t'( &)t*+r' +n! A33/$#+t$n S)t*+r'8
S%&t'( &)t*+r' A33/$#+t$n S)t*+r'
System prgramm&%g % t)e "as&(
ma()&%e ar()&te(t*re'
It &s &%+epe%+e%t - t)e ma()&%e
ar()&te(t*re'
Its "as&( a&m &s t ma1e t)e
prgramm&%g e%0&r%me%t eas&er'
T)&s e%0&r%me%t -(*ses % t)e pr"#em -
t)e e%+ *sers'
E2+(3/'- (mp&#er$ #a+er E2+(3/'- payr##$ "a%1&%g
C8 D'<n' O3'r+t$n1 &%&t'(&8
Operat&%g system a(ts as a% &%ter-a(e "et.ee% t)e *ser - a (mp*ter a%+ t)e
(mp*ter )ar+.are'
T)e perat&%g system &s t)e mst &mprta%t prgram t)at r*%s % a (mp*ter' E0ery
ge%era#/p*rpse (mp*ter m*st )a0e a% perat&%g system t r*% t)er prgrams'
E1- 6&%+.s$ L&%*2$ UNIJ$ Ds
D8 G$=' &(' +33/$#+t$n& ) 3'r+t$n1 &%&t'(8
t ma1e t)e (mp*ter eas&er t *se
M*t&/tas1&%g $M*#t&/Prgramm&%g
Para##e# Pr(ess&%g
Sp#&%g
,*4er&%g
t ma%age t)e res*r(es &% (mp*ter
pr(ess ma%ageme%t
+ata a%+ memry ma%ageme%t
t pr0&+e se(*r&ty t t)e *ser

E8 D'<n' A&&'(./'r? (MAY 2012)
A% assem"#er &s a type - (mp*ter prgram t)at &%terprets s-t.are prgrams
.r&tte% &% assem"#y #a%g*age &%t ma()&%e #a%g*age$ (+e a%+ &%str*(t&%s t)at
(a% "e e2e(*te+ "y a (mp*ter'
P a g e | K LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
A% assem"#er e%a"#es s-t.are a%+ app#&(at&% +e0e#pers t a((ess$ perate a%+
ma%age a (mp*terLs )ar+.are ar()&te(t*re a%+ (mp%e%ts'
A% assem"#er &s smet&mes re-erre+ t as t)e (mp&#er - assem"#y #a%g*age' It
a#s pr0&+es t)e ser0&(es - a% &%terpreter'
108 D'<n' $nt'r3r't'r8 (NOV 2011) (NOV 2012)
I%terpreter &s a set - prgrams .)&() (%0erts )&g) #e0e# #a%g*age prgram t
ma()&%e #a%g*age prgram #&%e "y #&%e'
It (a% &mme+&ate#y e2e(*te )&g)/#e0e# prgrams' Fr t)&s reas%$ &%terpreters are
smet&mes *se+ +*r&%g t)e +e0e#pme%t - a prgram$ .)e% a prgrammer .a%ts
t a++ sma## se(t&%s at a t&me a%+ test t)em 9*&(1#y'
,ASIC a%+ LISP are espe(&a##y +es&g%e+ t "e e2e(*te+ "y a% &%terpreter' I%
a++&t&%$ page +es(r&pt&% #a%g*ages$ s*() as PstS(r&pt$ *se a% &%terpreter'
118 St+t' t,' !$B'r'n#' .'t*''n +&&'(./'r +n! Int'r3r't'r? (NOV 201@)
A&&'(./'r Int'r3r't'r
A% assem"#er &s a type - (mp*ter
prgram t)at &%terprets s-t.are
prgrams .r&tte% &% assem"#y #a%g*age
&%t ma()&%e #a%g*age$ (+e a%+
&%str*(t&%s t)at (a% "e e2e(*te+ "y a
(mp*ter'
I%terpreter &s a set - prgrams .)&()
(%0erts )&g) #e0e# #a%g*age prgram
t ma()&%e #a%g*age prgram #&%e "y
#&%e'
A% assem"#er &s smet&mes re-erre+ t as
t)e (mp&#er - assem"#y #a%g*age' It
a#s pr0&+es t)e ser0&(es - a%
&%terpreter'
,ASIC a%+ LISP are espe(&a##y
+es&g%e+ t "e e2e(*te+ "y a%
&%terpreter' I% a++&t&%$ page
+es(r&pt&% #a%g*ages$ s*() as
PstS(r&pt$ *se a% &%terpreter'
128 9* #"/! /$t'r+/& .' $(3/'('nt'! $n n' 3+&& +&&'(./'r? (MAY 201@)
Ea() #&tera# pera%+ &s re(g%&3e+ +*r&%g pass1$ t)e assem"#er sear()es LITTA, -r
t)e spe(&5e+ #&tera# %ame r 0a#*e'
I- t)e #&tera# &s a#rea+y prese%t &% t)e ta"#e$ % a(t&% &s %ee+e+M &- &t &s %t prese%t$
t)e #&tera# &s a++e+ t LITTA,'
6)e% Pass1 e%(*%ters a LTORG stateme%t r t)e e%+ - t)e prgram$ t)e
assem"#er ma1es a s(a% - t)e #&tera# ta"#e'
1@8 >,+t +r' t,' !$B'r'nt M+#,$n' Ar#,$t'#t"r'&?
P a g e | H LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
T)ere are t. 0ers&%s - S&mp#&5e+ I%str*(t&%a# Cmp*ter =SIC? ma()&%es Ar()&te(t*res
are
Sta%+ar+ m+e# =SIC?
JE 0ers&% =SICNJE?
=8JE: eJtra E9*&pme%t r eJtra E2pe%s&0e?'
148 L$&t t,' SIC (+#,$n' +r#,$t'#t"r' <'/!&?
SIC (%s&sts -
Memry
Reg&sters
Data Frmats
I%str*(t&% Frmats
A++ress&%g M+es
I%str*(t&% Set
I%p*t a%+ O*tp*t
178 >,+t +r' t,' !$B'r'nt r'1$&t'r& $n SIC Ar#,$t'#t"r'?
Mn'(n$
#
N"(.'r S3'#$+/ "&'
A A A((*m*#atrM *se+ -r ar&t)met&( perat&%s
J 1 I%+e2 reg&sterM *se+ -r a++ress&%g
L @
L&%1age reg&sterM E*mp t s*"r*t&%e =7SU,? &%str*(t&% stres t)e
ret*r% a++ress &% t)&s reg&ster
PC <
Prgram C*%ter =PC?M (%ta&%s t)e a++ress - t)e %e2t &%str*(t&%
t "e -et()e+ -r e2e(*t&%
S6 ;
Stat*s .r+M (%ta&%s a 0ar&ety - &%-rmat&%$ &%(#*+&%g a
C%+&t&% C+e =CC?
1A8 >,+t +r' t,' t%3'& ) A!!r'&&$n1 (!'& $n SIC?
D&re(t a++ress&%g m+e
I%+e2e+ a++ress&%g m+e
M!' In!$#+t$n T+r1't +!!r'&& #+/#"/+t$n
D&re(t JOA TAOa++ress
I%+e2e+ JO1 TAOa++ressP=J?
1C8 D'<n' In&tr"#t$n &'t8 (MAY 201@)
A% $n&tr"#t$n &'t$ r $n&tr"#t$n &'t +r#,$t'#t"r' =ISA?$ &s t)e part - t)e
(mp*ter ar()&te(t*re re#ate+ t prgramm&%g$ &%(#*+&%g t)e %at&0e +ata types$
&%str*(t&%s$ reg&sters$ a++ress&%g m+es$ memry ar()&te(t*re$ &%terr*pt a%+ e2(ept&%
)a%+#&%g$ a%+ e2ter%a# INO'
P a g e | F LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
1D8 >,+t +r' t,' t%3'& ) In&tr"#t$n &'t $n SIC?
La+ a%+ stre reg&stersB LDA$ LDJ$ STA$ STJ$ et('
I%teger ar&t)met&( I%str*(t&%sB ADD$ SU,$ MUL$ DIV$ et('
Cmpar&s% I%str*(t&%sB COMP
COMP (mpares t)e 0a#*e &% reg&ster A .&t) a .r+ &% memry$ t)&s &%str*(t&% sets
a
C%+&t&% C+e =CC? t &%+&(ate t)e res*#t =Q$ O$R?'
C%+&t&%a# E*mp &%str*(t&%sB 7LT$ 7ES$ 7GT
S*"r*t&%e #&%1ageB 7*mps t t)e S*"r*t&%e =7SU,?$ RSU,
1E8 >,+t +r' t,' !$B'r'nt r'1$&t'r& $n SIC;5E Ar#,$t'#t"r'?
Mn'(n$# N"(.'r S3'#$+/ "&'
, C ,ase reg&sterM *se+ -r a++ress&%g
S G Ge%era# .r1&%g reg&ster
T K Ge%era# .r1&%g reg&ster
F H
F#at&%g/p&%t a((*m*#atr .)&() &s G<
"&ts
208 >,+t +r' t,' !$B'r'nt $n&tr"#t$n )r(+t& $n SIC;5E?
218 >,+t +r' t,' t%3'& ) +!!r'&&$n1 (!'& $n SIC;5E?
,ase re#at&0e a++ress&%g m+e
Prgram C*%ter =PC? re#at&0e a++ress&%g m+e
+&re(t a++ress&%g m+e
I%+e2e+ a++ress&%g m+e
&mme+&ate a++ress&%g m+e
&%+&re(t a++ress&%g m+e
228 D$B'r'n#'& .'t*''n .+&' r'/+t$=' +n! 3r1r+( #"nt'r r'/+t$=' +!!r'&&$n1
"&'! $n SIC;5E8
M!' In!$#+t$n T+r1't +!!r'&& #+/#"/+t$n
P a g e | < LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
,ase re#at&0e "O1$pOA TAO=,?P +&sp =A T +&sp T GA;K?
Prgram C*%ter =PC?
re#at&0e
"OA$pO1 TAO=PC?P +&sp =/@AG< T +&sp T@AGF?
2@8 D'<n' $n!$r'#t +!!r'&&$n1
I% &%+&re(t a++ress&%g m+e t)e 0a#*e &OA$ %O1B
T)e .r+ at t)e TA &s -et()e+
Va#*e &% t)&s .r+ &s ta1e% as t)e a++ress - t)e pera%+ 0a#*e
E1- ADD R7: FA00G
Dere t)e se(%+ pera%+ &s g&0e% &% &%+&re(t a++ress&%g m+e' F&rst t)e .r+ &% memry
#(at&% HAA &s -et()e+ a%+ .)&() .&## g&0e t)e a++ress - t)e pera%+'
248 D'<n' $(('!$+t' +!!r'&&$n18
I% t)&s a++ress&%g m+e t)e pera%+ 0a#*e &s g&0e% +&re(t#y' T)ere &s % %ee+ t
re-er memry' T)e &mme+&ate a++ress&%g &s &%+&(ate+ "y t)e pre52 UVW'
I% (ase & O 1$ % O A t)e a++ress &tse#- &s t)e pera%+$ % memry re-ere%(e
E1- ADD H7
I% t)&s &%str*(t&% %e pera%+ &s &% a((*m*#atr a%+ t)e se(%+ pera%+ &s a%
&mme+&ate 0a#*e t)e 0a#*e K &s +&re(t#y a++e+ .&t) t)e a((*m*#atr (%te%t a%+ t)e res*#t &s
stre+ &% a((*m*#atr'
278 L$&t t,' $n&tr"#t$n &'t& $n SIC;5E?
La+ a%+ stre t)e %e. reg&stersB LD,$ ST,$ et('
F#at&%g/p&%t ar&t)met&( perat&%sB ADDF$ SU,F$ MULF$ DIVF
Reg&ster MO0eB RMO
Reg&ster/t/reg&ster ar&t)met&( perat&%sB ADDR$ SU,R$ MULR$ DIVR
S*per0&sr (a##= SVC?
2A8 >r$t' t,' 3r1r+( )r BETA I ALP9A J INCR -1 +n! DELTAIGAMMA J INCR -1
"&$n1
SIC $n&tr"#t$n&8
LDA ALPDA LOAD ALPDA INTO REGISTER A
ADD INCR ADD TDE VALUE OF INCR
SU, ONE SU,TRACT 1
STA ,ETA STORE IN ,ETA
LDA GAMMA LOAD GAMMA INTO REGISTER A
ADD INCR ADD TDE VALUE OF INCR
SU, ONE SU,TRACT 1
STA DELTA STORE IN DELTA
X''' XX''
ONE 6ORD 1 ONE 6ORD CONSTANT
ALPDA RES6 1 ONE 6ORD VARIA,LES
,ETA RES6 1
GAMMA RES6 1
P a g e | ; LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
DELTA RES6 1
INCR RES6 1
2C8 >r$t' t,' 3r1r+( )r BETA I ALP9A J INCRJ1 +n! DELTAIGAMMA J INCR -1
"&$n1
SIC ;5E $n&tr"#t$n&8
LDS INCR LOAD VALUE OF INCR INTO REGISTER S
LDA ALPDA LOAD ALPDA INTO REGISTER A
ADDR S$ A ADD TDE VALUE OF INCR
SU, V1 SU,TRACT 1
STA ,ETA STORE IN ,ETA
LDA GAMMA LOAD GAMMA INTO REGISTER A
ADDR S$ A ADD TDE VALUE OF INCR
SU, V1 SU,TRACT 1
STA DELTA STORE IN DELTA
X''' XX''
ALPDA RES6 1 ONE 6ORD VARIA,LES
,ETA RES6 1
GAMMA RES6 1
DELTA RES6 1
INCR RES6 1
2D8 >,+t +r' t,' <'/!& +=+$/+./' $n +n +&&'(./% /+n1"+1' $n&tr"#t$n? (NOV 2011)
T)e -*r 5e#+s a0a&#a"#e &% a% assem"#y #a%g*age &%str*(t&% are
La"e#
Op(+e
Opera%+
Cmme%ts
2E8 >,+t +r' t,' !$B'r'nt +&&'(./'r !$r'#t$='&? (NOV 2012)
START / spe(&-y prgram %ame a%+ start&%g a++ress - t)e prgram'
END / &%+&(ate t)e e%+ - t)e s*r(e prgram'
,YTE / ge%erate ()ara(ter r )e2a+e(&ma# (%sta%ts'
6ORD/ Ge%erate %e .r+ &%teger (%sta%t'
RES, / Reser0e t)e &%+&(ate+ %' - "ytes -r a +ata area'
RES6 / Reser0e t)e &%+&(ate+ %' - .r+s -r a +ata area'
@08 >,+t +r' t,' .+&$# +&&'(./'r )"n#t$n&?
18 C%0ert m%em%&( perat&% (+es t t)e&r ma()&%e #a%g*age e9*&0a#e%ts'
28 C%0ert sym"#&( pera%+s t t)e&r e9*&0a#e%t ma()&%e a++resses'
@8 ,*&#+ t)e ma()&%e &%str*(t&%s &% t)e prper -rmat'
P a g e | 1A LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
48 C%0ert t)e +ata (%sta%ts spe(&5e+ &% t)e s*r(e prgram &%t &%ter%a# ma()&%e
represe%tat&%s'
78 6r&te t)e "Ee(t prgram a%+ t)e assem"#y #&st&%g'
@18 >,+t +r' t,' )"n#t$n& ) t* 3+&& +&&'(./'r?
F*%(t&%s - T. Pass Assem"#er
P+&& 1 - !'<n' &%(./& (+&&$1n +!!r'&&'&)
Ass&g% a++resses t a## stateme%ts &% t)e prgram'
Sa0e t)e 0a#*es ass&g%e+ t a## #a"e#s -r *se &% Pass @'
Per-rm sme pr(ess&%g assem"#er +&re(t&0es'
P+&& 2 - +&&'(./' $n&tr"#t$n& +n! 1'n'r+t' .K'#t 3r1r+(
Assem"#e &%str*(t&%s
Ge%erate +ata 0a#*es +e5%e+ "y ,YTE$ 6ORD$ et('
Per-rm sme pr(ess&%g assem"#er +&re(t&0es %t +%e &% Pass 1'
6r&te t)e "Ee(t prgram a%+ t)e assem"#y #&st&%g'
@28 >,+t $& t,' )r(+t ) t,' O.K'#t Pr1r+( 1'n'r+t'! .% t,' A&&'(./'r?
It (%ta&%s C types - re(r+sB
9'+!'r r'#r!-
C#' 1 D
C#' @YF Prgram %ame
C#' <Y1C Start&%g a++ress - "Ee(t prgram =)e2a+e(&ma#?
C#' 1G/1; Le%gt) - "Ee(t prgram &% "ytes =)e2a+e(&ma#?
T'2t r'#r!
C#'1 T
C#' @YF Start&%g a++ress -r "Ee(t (+e &% t)&s re(r+ =)e2?
C#' <Y; Le%gt) - "Ee(t (+e &% t)&s re(r+ &% "ytes =)e2?
C#'1AYH; O"Ee(t (+e =H;/1AP1?NHO1A &%str*(t&%s
En! r'#r!
C#'1 E
C#'@YF A++ress - 5rst e2e(*ta"#e &%str*(t&% &% "Ee(t prgram =)e2?
@@8 >,+t $& t,' "&' ) OPTAB? (MAY 2012)
P a g e | 11 LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
T)e Operat&% (+e ta"#e =OPTA,? (%ta&%s t)e m%em%&( perat&% (+e a%+ &ts
ma()&%e #a%g*age e9*&0a#e%t'
Sme assem"#ers &t may a#s (%ta&% &%-rmat&% a"*t &%str*(t&% -rmat a%+
#e%gt)'
OPTA, &s *s*a##y rga%&3e+ as a )as) ta"#e$ .&t) m%em%&( perat&% (+e as t)e
1ey'
@48 >,+t $& t,' "&' ) SYMTAB? (MAY 2012)
Sym"# ta"#e =SYMTA,? / &s *se+ t stre 0a#*es =a++resses? ass&g%e+ t #a"e#s'
It &%(#*+es t)e %ame a%+ 0a#*e -r ea() sym"# &% t)e s*r(e prgram$ tget)er
.&t) Zags t &%+&(ate errr (%+&t&%s'
Smet&mes &t may (%ta&% +eta&#s a"*t t)e +ata area'
SYMTA, &s *s*a##y rga%&3e+ as a )as) ta"#e -r e[(&e%(y - &%sert&% a%+ retr&e0a#'
@78 >,+t +r' )r*+r! r')'r'n#'&?
It &s a re-ere%(e t a #a"e# t)at &s +e5%e+ #ater &% a prgram'
C%s&+er t)e stateme%t
1A 1000 STL RETADR
' ' ' '
' ' ' '
<A 10@A RETADR RES>
T)e 5rst &%str*(t&% (%ta&%s a -r.ar+ re-ere%(e RETADR' I- .e attempt t tra%s#ate t)e
prgram #&%e "y #&%e$ .e .&## *%a"#e t pr(ess t)e stateme%t &% #&%e1A "e(a*se .e + %t
1%. t)e a++ress t)at .&## "e ass&g%e+ t RETADR 'T)e a++ress &s ass&g%e+ #ater &% t)e
prgram'
@A8 L$&t t,' )'+t"r'& ) (+#,$n' !'3'n!'nt A&&'(./'r8 (NOV 201@)
T)e -eat*res - ma()&%e +epe%+e%t Assem"#er &s
18 I%str*(t&% -rmats
28 A++ress&%g m+es a%+
@8 Prgram Re#(at&%
@C8 D'<n' r'/#+t+./' 3r1r+(8
A% "Ee(t prgram t)at (%ta&%s t)e &%-rmat&% %e(essary t per-rm re9*&re+
m+&5(at&% &% t)e "Ee(t (+e +epe%+s % t)e start&%g #(at&% - t)e prgram +*r&%g
#a+ t&me &s 1%.% as re#(ata"#e prgram'
@D8 D'<n' (!$<#+t$n r'#r! +n! 1$=' $t& )r(+t8
I% M+&5(at&% re(r+ (%ta&%s t)e &%-rmat&% a"*t t)e m+&5(at&% &% t)e "Ee(t
(+e +*r&%g
P a g e | 1@ LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
prgram re#(at&%'
T)e ge%era# -rmat &s
C# 1 M
C# @/F Start&%g #(at&% - t)e a++ress 5e#+ t "e m+&5e+ re#at&0e t t)e "eg&%%&%g
- t)e prgram'
C# </; Le%gt) - t)e a++ress 5e#+ t "e m+&5e+ &% )a#- "ytes'
@E8 D'<n' /$t'r+/&?
L&tera# &s a (%sta%t pera%+ .)&() &s *se+ t .r&te t)e 0a#*e - &t as a part - t)e
&%str*(t&%' T)&s a0&+s )a0&%g t +e5%e t)e (%sta%t e#se.)ere &% t)e prgram a%+ ma1e
*p a #a"e# -r &t'
408 D'<n' L$t'r+/ 3/&8
A## - t)e #&tera# pera%+s *se+ &% a prgram are gat)ere+ tget)er &%t %e r mre
#&tera# p#s' Nrma##y #&tera#s are p#a(e+ &%t p# at t)e e%+ - t)e prgram'
418 >,+t +r' t,' &%(./ !'<n$n1 &t+t'('nt& 1'n'r+//% "&'! $n +&&'(./'r&?
LEMUN / &t a##.s t)e prgrammer t +e5%e sym"#s a%+ spe(&-y t)e&r 0a#*es +&re(t#y'
T)e ge%era# -rmat &s
S%(./ EMU =+/"'
LORGN / &t &s *se+ t &%+&re(t#y ass&g% 0a#*es t sym"#s' 6)e% t)&s stateme%t &s
e%(*%tere+ t)e assem"#er resets &ts #(at&% (*%ter t t)e spe(&5e+ 0a#*e'
T)e ge%era# -rmat &s
ORG =+/"'
428 D$B'r'nt$+t' +.&/"t' '23r'&&$n +n! r'/+t$=' '23r'&&$n8
I- t)e res*#t - t)e e2press&% &s a% a"s#*te 0a#*e =(%sta%t? t)e% &t &s 1%.% as
a"s#*te e2press&%'
E1- BUFEND O BUFFER
I- t)e res*#t - t)e e2press&% &s re#at&0e t t)e "eg&%%&%g - t)e prgram t)e% &t &s
1%.% as re#at&0e e2press&%' La"e# % &%str*(t&%s a%+ +ata areas a%+ re-ere%(es t
t)e #(at&% (*%ter 0a#*es are re#at&0e terms'
E1- BUFEND J BUFFER
4@8 D'<n' Pr1r+( ./#0&8
T)e prgram "#(1s re-er t segme%ts - (+e t)at are rearra%ge+ .&t)&% a s&%g#e
"Ee(t prgram *%&t'
448 >,+t +r' t,' t%3'& ) 3r1r+( ./#0&?
T)e t)ree "#(1s are
P a g e | 1C LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
18 De-a*#t ! &t (%ta&%s t)e e2e(*ta"#e &%str*(t&%s - t)e prgram'
28 CDATA ! &t (%ta&%s a## +ata areas t)at are a -e. .r+s r #ess &% #e%gt)'
@8 C,LKS ! &t (%ta&%s a## +ata areas t)at (%s&st - #arger "#(1 memry'
478 D'<n' #ntr/ &'#t$n8
A (%tr# se(t&% &s a part - t)e prgram t)at ma&%ta&%s &ts &+e%t&ty a-ter assem"#yM
ea() (%tr# se(t&% (a% "e #a+e+ a%+ re#(ate+ &%+epe%+e%t#y - t)e t)ers' D&4ere%t
(%tr# se(t&%s are mst -te% *se+ -r s*"r*t&%es r #g&(a# s*"+&0&s&%s - a prgram' T)e
prgrammer (a% assem"#e$ #a+ a%+ ma%&p*#ate ea() - t)ese (%tr# se(t&%s separate#y'
T)e res*#t&%g Ze2&"&#&ty &s a maEr "e%e5t - t)ese (%tr# se(t&%s'
4A8 >,+t $& 3r1r+( /$n0$n1?
6)e% (%tr# se(t&%s -rm #g&(a##y re#ate+ parts - a prgram$ &t &s %e(essary t
pr0&+e mea%s -r #&%1&%g t)em tget)er'
Fr e2amp#e$ &%str*(t&%s &% %e (%tr# se(t&% m&g)t %ee+ t re-er t &%str*(t&%s r
+ata #(ate+ &% a%t)er se(t&%'
4C8 >,+t $& ('+nt .% '2t'rn+/ r')'r'n#'&?
I% assem"#er .)ere a%y t)er (%tr# se(t&% .&## "e #(ate+ at e2e(*t&% t&me' S*()
re-ere%(es "et.ee% (%tr#s are (a##e+ e2ter%a# re-ere%(es' T)e assem"#er ge%erates
&%-rmat&% -r ea() e2ter%a# re-ere%(e t)at .&## a##. t)e #a+er t per-rm t)e re9*&re+
#&%1&%g'
4D8 >,+t +r' t,' t%3'& ) '2t'rn+/ &%(./&?
T)e t. assem"#er +&re(t&0es t &+e%t&-y s*() re-ere%(es
18 E2ter%a# De5%&t&% =EJTDEF? %ames e2ter%a# sym"#s t)at are +e5%e+ &% a part&(*#ar
(%tr# se(t&% a%+ may "e *se+ &% t)er se(t&%s'
28 E2ter%a# Re-ere%(es =EJTREF? %ames e2ter%a# sym"#s t)at are re-erre+ &% a part&(*#ar
(%tr# se(t&% a%+ +e5%e+ &% a%t)er (%tr# se(t&%'
4E8 >r$t' t,' Fr(+t )r D'<n' +n! R')'r r'#r!?
DERFINE RECORD
C# 1 D
C# @/F Name - e2ter%a# sym"# +e5%e+ &% t)&s (%tr#
se(t&%
C# </1C Re#at&0e a++ress - sym"# .&t)&% t)&s (%tr# se(t&%
C# 1G/FC Repeat &%-rmat&% &% (# @/1C -r t)er e2ter%a# sym"#
REFER RECORD
P a g e | 1G LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
C# 1 R
C# @/F Name - e2ter%a# sym"# +e5%e+ &% t)&s (%tr#
se(t&%
C# </FC Name - t)er e2ter%a# re-ere%(e sym"#
708 >,+t $& t,' "&' ) /+! +n! 1 +&&'(./'r?
O%e pass assem"#er t)at ge%erates t)e&r "Ee(t (+e &% memry -r &mme+&ate
e2e(*t&% &s 1%.% as #a+ a%+ g assem"#er' N "Ee(t prgrammer &s .r&tte% *t
a%+ % #a+er &s %ee+e+'
It &s *se-*# &% a system t)at &s r&e%te+ t.ar+ prgram +e0e#pme%t a%+ test&%g'
718 >,+t $& n' 3+&& +&&'(./'r?
O%e/pass assem"#er t)at ge%erates t)e&r "Ee(t (+e &% memry -r &mme+&ate
e2e(*t&%'
O%e/pass assem"#ers are *se+ .)e% &t &s %e(essary r +es&ra"#e t a0&+ a se(%+
pass 0er t)e s*r(e prgram t)e e2ter%a# strage -r t)e &%terme+&ate 5#e "et.ee%
t. passes &s s#. r &s &%(%0e%&e%t t *se'
M+$n 3r./'(- -r.ar+ re-ere%(es t "t) +ata a%+ &%str*(t&%s' O%e s&mp#e .ay t
e#&m&%ate t)&s pr"#emB re9*&re t)at a## areas "e +e5%e+ "e-re t)ey are re-ere%(e+' It &s
pss&"#e$ a#t)*g) &%(%0e%&e%t$ t + s -r +ata &tems'
Fr.ar+ E*mp t &%str*(t&% &tems (a%%t "e eas&#y e#&m&%ate+'
Samp#e Prgram -r a O%e/Pass Assem"#er'
728 >,+t $& ("/t$-3+&& +&&'(./'r?
Pr,$.$t$n1 )r*+r! r')'r'n#'& $n &%(./ !'<n$t$nB
T)&s restr&(t&% &s %t a ser&*s &%(%0e%&e%(e'
Fr.ar+ re-ere%(es te%+ t (reate +&[(*#ty -r a pers% rea+&%g t)e prgram'
A//*$n1 )r*+r! r')'r'n#'&
T pr0&+e mre Ze2&"&#&ty'
P a g e | 1K LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
11 MAR6S
18 E23/+$n t,' &%&t'( &)t*+r' +n! M+#,$n' &tr"#t"r'&? (11 (+r0&)
S%&t'( &)t*+r' (%s&sts - a 0ar&ety - prgrams t)at s*pprt t)e perat&% - a
(mp*ter' App#&(at&% s-t.are -(*ses % a% app#&(at&% r pr"#em t "e s#0e+' System
s-t.are (%s&sts - a 0ar&ety - prgrams t)at s*pprt t)e perat&% - a (mp*ter'
E2amp#es -r system s-t.are are Operat&%g system$ (mp&#er$ assem"#er$ ma(r
pr(essr$ #a+er r #&%1er$ +e"*gger$ te2t e+&tr$ +ata"ase ma%ageme%t systems a%+
s-t.are e%g&%eer&%g t#s' T)ese s-t.areWs ma1e &t pss&"#e -r t)e *ser t -(*s % a%
app#&(at&% r t)er pr"#em t "e s#0e+$ .&t)*t %ee+&%g t 1%. t)e +eta&#s - ). t)e
ma()&%e .r1s &%ter%a##y'
T%3'& ) &)t*+r'-
18 App#&(at&% s-t.are
28 System s-t.are
O%e ()ara(ter&st&( &% .)&() mst system s-t.are +&4ers -rm app#&(at&% s-t.are &s
ma()&%e +epe%+e%(y'
System s-t.are s*pprts perat&% a%+ *se - (mp*ter'
App#&(at&% s-t.are pr0&+es s#*t&% t a pr"#em'
Assem"#er tra%s#ates m%em%&( &%str*(t&%s &%t ma()&%e (+e' T)e &%str*(t&%
-rmats$ a++ress&%g m+es et('$ are - +&re(t (%(er% &% assem"#er +es&g%' S&m&#ar#y$
Cmp&#ers m*st ge%erate ma()&%e #a%g*age (+e$ ta1&%g &%t a((*%t s*() )ar+.are
P a g e | 1H LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
()ara(ter&st&(s as t)e %*m"er a%+ type - reg&sters a%+ t)e ma()&%e &%str*(t&%s a0a&#a"#e'
Operat&%g systems are +&re(t#y (%(er%e+ .&t) t)e ma%ageme%t - %ear#y a## - t)e
res*r(es - a (mp*t&%g system'
T)ere are aspe(ts - system s-t.are t)at + %t +&re(t#y +epe%+ *p% t)e type -
(mp*t&%g system$ ge%era# +es&g% a%+ #g&( - a% assem"#er$ ge%era# +es&g% a%+ #g&( - a
(mp&#er a%+ (+e pt&m&3at&% te()%&9*es$ .)&() are &%+epe%+e%t - target ma()&%es'
L&1e.&se$ t)e pr(ess - #&%1&%g tget)er &%+epe%+e%t#y assem"#e+ s*"prgrams +es %t
*s*a##y +epe%+ % t)e (mp*ter "e&%g *se+'
C(3n'nt& ) &%&t'( &)t*+r'
T)e #a%g*age tra%s#atr a%+ t)e perat&%g system are t)emse#0es prgrams' T)e&r
-*%(t&% &s t get t)e *serWs prgram$ .)&() &s .r&tte% &% a prgramm&%g #a%g*age$ t r*% %
t)e (mp*ter system' T)e prgrams .)&() )e#p &% t)e e2e(*t&% - a *ser prgram are (a##e+
S%&t'( Pr1r+(& (SP&)8 T)e (##e(t&% - s*() SPs &s t)e 8system s-t.are: - a part&(*#ar
(mp*ter system' A% &+e%t&(a# arg*me%t )#+s &% t)e (ase - a (mp*ter system' ,y .r&t&%g
a prgram &% a )&g)er #e0e# prgramm&%g #a%g*age$ a prgrammer "0&ates t)e %ee+ t
a(9*&re tta##y %e. s1&##s mere#y &% r+er t r*% )&s prgram' T)e (mp&#er per-rms t)e tas1
- ma1&%g )&s prgram *%+ersta%+a"#e t t)e CPU'
T. -*%+ame%ta# aspe(ts - t)e system are
Ma1&%g a0a&#a"#e %e.N"etter -a(&#&t&es
A()&e0&%g e[(&e%t per-rma%(e
T)e "as&( (mp%e%ts - t)e system s-t.are are$
18 I%terpreter
28 Assem"#er
@8 Ma(r pr(ess&%g
48 L&%1&%g #a+er
78 A"s#*te #a+er
A8 Operat&%g system
C8 Cmp&#er
D8 De"*gg&%g a&+s
E8 Te2t e+&trs
108 Ut&#&t&es
Int'r3r't'r
P a g e | 1F LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
T)&s &s a#s a tra%s#atr (%0erts t)e )&g) #e0e# #a%g*age &%t #. #e0e# #a%g*age' It
(%0erts t)e prgram #&%e "y #&%e at a t&me' It a%a#yses t)e s*r(e prgram stateme%t "y
stateme%t a%+ &t (arr&es *t t)e a(t&%s &mp#&e+ "y ea() stateme%t'
A&&'(./'r
It &s a type - tra%s#atr t)at (%0erts assem"#e #e0e# #a%g*age &%t ma()&%e #e0e#
#a%g*age' A% assem"#er &s *se+ t (%0ert t)e g&0e% m%em%&(s &%t %*mer&( a%+ (%0erts
t)em t e2e(*ta"#e r (mma%+ 5#es' O*tp*t &s a% "Ee(t prgram p#*s prgram &%-rmat&%
t)at e%a"#es t)e #a+er t prepare t)e "Ee(t prgram -r e2e(*t&%'
Pr'3r#'&&r
It &s a tra%s#atr t)at (0erts %e )&g) #e0e# #a%g*age &%t a%t)er )&g) #e0e# #a%g*age'
M+#r 3r#'&&r
A ma(r (a## &s a% a""re0&at&% -r sme (+es' A ma(r +e5%&t&% &s a se9*e%(e -
(+e t)at )as a %ame' a ma(r pr(essr &s a prgram t)at s*"st&t*tes a%+ spe(&5es ma(r
+e5%&t&% -r ma(r (a##s'
L+!'r
La+er #a+s t)e "Ee(t prgram a%+ prepare -r &ts e2e(*t&%' La+er s()emes are
a"s#*te$ re#(at&%g a%+ +&re(t #&%1&%g' I% ge%era# #a+er m*st #a+$ re#(ate a%+ #&%1 t)e
"Ee(t prgram'
O3'r+t$n1 &%&t'(
A% perat&%g system =OS? &s a s-t.are prgram t)at ma%ages t)e )ar+.are a%+
s-t.are res*r(es - a (mp*ter' T)e OS per-rms "as&( tas1s$ s*() as (%tr##&%g a%+
a##(at&%g memry$ pr&r&t&3&%g t)e pr(ess&%g - &%str*(t&%s$ (%tr##&%g &%p*t a%+ *tp*t
+e0&(es -a(&#&tat&%g %et.r1&%g$ a%+ ma%ag&%g 5#es'
C(3$/'r
Cmp&#er &s a (mp*ter prgram =r set - prgrams? t)at tra%s#ates te2t .r&tte% &% a
(mp*ter #a%g*age =t)e s*r(e #a%g*age? &%t a%t)er (mp*ter #a%g*age =t)e target
#a%g*age?' T)e r&g&%a# se9*e%(e &s *s*a##y (a##e+ t)e s*r(e (+e a%+ t)e *tp*t (a##e+
"Ee(t (+e' Cmm%#y t)e *tp*t )as a -rm s*&ta"#e -r pr(ess&%g "y t)er prgrams
=e'g'$ a #&%1er?$ "*t &t may "e a )*ma% rea+a"#e te2t 5#e'
S%&t'( S)t*+r' +n! Ar#,$t'#t"r'B
Ma()&%e +epe%+e%(y - system s-t.are
System prgrams are &%te%+e+ t s*pprt t)e perat&% a%+ *se - t)e (mp*ter'
Ma()&%e ar()&te(t*re +&4ers &%B
Ma()&%e (+e
Memry
P a g e | 1< LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
I%str*(t&% -rmats
A++ress&%g m+es
Reg&sters
Ma()&%e &%+epe%+e%(y - system s-t.are
Ge%era# +es&g% a%+ #g&( &s "as&(a##y t)e sameB
C+e pt&m&3at&%
S*"prgram #&%1&%g
28 >r$t' + &,rt nt' n A&&'(./'r? (7 (+r0&)
A% A&&'(./'r tra%s#ates a prgram .r&tte% &% a% assem"#y #a%g*age t &t ma()&%e
#a%g*age e9*&0a#e%t'
A% assem"#er &s a type - (mp*ter prgram t)at &%terprets s-t.are prgrams .r&tte%
&% assem"#y #a%g*age &%t ma()&%e #a%g*age$ (+e a%+ &%str*(t&%s t)at (a% "e
e2e(*te+ "y a (mp*ter'
A% assem"#er e%a"#es s-t.are a%+ app#&(at&% +e0e#pers t a((ess$ perate a%+
ma%age a (mp*terLs )ar+.are ar()&te(t*re a%+ (mp%e%ts'
A% assem"#er &s smet&mes re-erre+ t as t)e (mp&#er - assem"#y #a%g*age' It a#s
pr0&+es t)e ser0&(es - a% &%terpreter'
A% assem"#er &s a prgram t)at a((epts a% assem"#y #a%g*age prgram as &%p*t a%+
pr+*(es &ts ma()&%e #a%g*age e9*&0a#e%t a#%g .&t) &%-rmat&% -r t)e #a+er'
Assem"#y #a%g*age &s (%0erte+ &%t e2e(*ta"#e ma()&%e (+e "y a *t&#&ty prgram
re-erre+ t as a% assem"#erM t)e (%0ers&% pr(ess &s re-erre+ t as assem"#y$ r
assem"#&%g t)e (+e'
Assem"#y #a%g*age *ses a m%em%&( t represe%t ea() #./#e0e# ma()&%e &%str*(t&%
r perat&%' Typ&(a# perat&%s re9*&re %e r mre pera%+s &% r+er t -rm a
(mp#ete &%str*(t&%$ a%+ mst assem"#ers (a% t)ere-re ta1e #a"e#s$ sym"#s a%+
e2press&%s as pera%+s t represe%t a++resses a%+ t)er (%sta%ts$ -ree&%g t)e
prgrammer -rm te+&*s ma%*a# (a#(*#at&%s'
M+#r +&&'(./'r& &%(#*+e a ma(r&%str*(t&% -a(&#&ty s t)at =parameter&3e+?
assem"#y #a%g*age te2t (a% "e represe%te+ "y a %ame$ a%+ t)at %ame (a% "e *se+ t
&%sert t)e e2pa%+e+ te2t &%t t)er (+e' Ma%y assem"#ers 4er a++&t&%a#
me()a%&sms t -a(&#&tate prgram +e0e#pme%t$ t (%tr# t)e assem"#y pr(ess$ a%+
t a&+ +e"*gg&%g'
P a g e | 1; LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
Number of passes
T)ere are t. types - assem"#ers "ase+ % ). ma%y passes t)r*g) t)e s*r(e are
%ee+e+ t pr+*(e t)e e2e(*ta"#e prgram'
O%e/pass assem"#ers g t)r*g) t)e s*r(e (+e %(e' A%y sym"# *se+ "e-re &t &s
+e5%e+ .&## re9*&re \errata\ at t)e e%+ - t)e "Ee(t (+e te##&%g t)e #&%1er r t)e
#a+er t \g "a(1\ a%+ 0er.r&te a p#a(e)#+er .)&() )a+ "ee% #e-t .)ere t)e as yet
*%+e5%e+ sym"# .as *se+'
M*#t&/pass assem"#ers (reate a ta"#e .&t) a## sym"#s a%+ t)e&r 0a#*es &% t)e 5rst
passes$ t)e% *se t)e ta"#e &% #ater passes t ge%erate (+e'
High-level assemblers
Mre sp)&st&(ate+ )&g)/#e0e# assem"#ers pr0&+e #a%g*age a"stra(t&%s s*() asB
A+0a%(e+ (%tr# str*(t*res'
D&g)/#e0e# pr(e+*reN-*%(t&% +e(#arat&%s a%+ &%0(at&%s'
D&g)/#e0e# a"stra(t +ata types$ &%(#*+&%g str*(t*resNre(r+s$ *%&%s$ (#asses$ a%+
sets'
Sp)&st&(ate+ ma(r pr(ess&%g'
O"Ee(t/r&e%te+ prgramm&%g -eat*res s*() as (#asses$ "Ee(ts$ a"stra(t&%$
p#ymrp)&sm$ a%+ &%)er&ta%(e'
B+&$# '/'('nt&
T)ere &s a #arge +egree - +&0ers&ty &% t)e .ay t)e a*t)rs - assem"#ers (ategr&3e
stateme%ts a%+ &% t)e %me%(#at*re t)at t)ey *se' I% part&(*#ar$ sme +es(r&"e a%yt)&%g
t)er t)a% a ma()&%e m%em%&( r e2te%+e+ m%em%&( as a pse*+/perat&%'
A typ&(a# assem"#y #a%g*age (%s&sts - C types - &%str*(t&% stateme%ts t)at are *se+ t
+e5%e prgram perat&%sB
Op(+e m%em%&(s
Data +&re(t&0es
Assem"#y +&re(t&0es
P a g e | @A LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
T%3$#+/ +33/$#+t$n&
Assem"#y #a%g*age &s typ&(a##y *se+ &% a systemLs "t (+e$ =,IOS % I,M/(mpat&"#e
PC systems?'
(mp*ter (artr&+ge games
M&(r(%tr##ers =a*tm"&#es$ &%+*str&a# p#a%ts'''?
te#e(mm*%&(at&% e9*&pme%t
+e0&(e +r&0ers
Very -ast a%+ (mpa(t "*t pr(essr/spe(&5('
@8 >r$t' + &,rt nt' n Int'r3r't'r? (7 (+r0&)
Interpreter &s a#s a tra%s#atr (%0erts t)e )&g) #e0e# #a%g*age &%t #. #e0e#
#a%g*age' It (%0erts t)e prgram #&%e "y #&%e at a t&me'
It a%a#yses t)e s*r(e prgram stateme%t "y stateme%t a%+ &t (arr&es *t t)e a(t&%s
&mp#&e+ "y ea() stateme%t'
It (a% &mme+&ate#y e2e(*te )&g)/#e0e# prgrams' Fr t)&s reas%$ &%terpreters are
smet&mes *se+ +*r&%g t)e +e0e#pme%t - a prgram$ .)e% a prgrammer .a%ts t
a++ sma## se(t&%s at a t&me a%+ test t)em 9*&(1#y'
,ASIC a%+ LISP are espe(&a##y +es&g%e+ t "e e2e(*te+ "y a% &%terpreter' I% a++&t&%$
page +es(r&pt&% #a%g*ages$ s*() as PstS(r&pt$ *se a% &%terpreter'
A% interpreter &s a (mp*ter prgram t)at +&re(t#y e2e(*tes$ &'e' per-rms$ &%str*(t&%s
.r&tte% &% a prgramm&%g r s(r&pt&%g #a%g*age$ .&t)*t pre0&*s#y "at()/(mp&#&%g t)em
&%t ma()&%e #a%g*age' A% &%terpreter ge%era##y *ses %e - t)e -##.&%g strateg&es -r
prgram e2e(*t&%B
18 parse t)e s*r(e (+e a%+ per-rm &ts "e)a0&r +&re(t#y
28 tra%s#ate s*r(e (+e &%t sme e[(&e%t &%terme+&ate represe%tat&% a%+ &mme+&ate#y
e2e(*te
@8 e2p#&(&t#y e2e(*te stre+ pre(mp&#e+ (+e ma+e "y a (mp&#er .)&() &s part - t)e
&%terpreter system'
Ear#y 0ers&%s - t)e L&sp prgramm&%g #a%g*age a%+ Dartm*t) ,ASIC .*#+ "e
e2amp#es - t)e 5rst type' Per#$ Pyt)%$ MATLA,$ a%+ R*"y are e2amp#es - t)e se(%+$ .)&#e
UCSD Pas(a# &s a% e2amp#e - t)e t)&r+ type' S*r(e prgrams are (mp&#e+ a)ea+ - t&me
a%+ stre+ as ma()&%e &%+epe%+e%t (+e$ .)&() &s t)e% #&%1e+ at r*%/t&me a%+ e2e(*te+ "y
a% &%terpreter a%+ (mp&#er' Sme systems$ s*() as Sma##ta#1$ (%temprary 0ers&%s -
,ASIC a%+ 7a0a'
6)&#e &%terpretat&% a%+ (mp&#at&% are t)e t. ma&% mea%s "y .)&() prgramm&%g
#a%g*ages are &mp#eme%te+$ t)ey are %t m*t*a##y e2(#*s&0e$ as mst &%terpret&%g systems
a#s per-rm sme tra%s#at&% .r1$ E*st #&1e (mp&#ers' T)e terms \&%terprete+ #a%g*age\ r
P a g e | @1 LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
\(mp&#e+ #a%g*age\ s&g%&-y t)at t)e (a%%&(a# &mp#eme%tat&% - t)at #a%g*age &s a%
&%terpreter r a (mp&#er$ respe(t&0e#y' A )&g) #e0e# #a%g*age &s &+ea##y a% a"stra(t&%
&%+epe%+e%t - part&(*#ar &mp#eme%tat&%s'
C(3$/'r
Pr&
Less spa(e
Fast e2e(*t&%
Cn&
S#. pr(ess&%g
Part#y S#0e+ =Separate (mp&#at&%?
De"*gg&%g
Impr0e+ t)r* IDEs
Int'r3r't'r
Pr&
Easy +e"*gg&%g
Fast De0e#pme%t
Cn&
Nt -r #arge prEe(ts
E2(ept&%sB Per#$ Pyt)%
Re9*&res mre spa(e
S#.er e2e(*t&%
I%terpreter &% memry a## t)e t&me
48 >r$t' + &,rt nt' n O3'r+t$n1 &%&t'(? (A (+r0&)
A% 3'r+t$n1 &%&t'( (OS) &s a (##e(t&% - s-t.are t)at ma%ages (mp*ter
)ar+.are res*r(es a%+ pr0&+es (mm% ser0&(es -r (mp*ter prgrams' T)e
perat&%g system &s a% esse%t&a# (mp%e%t - t)e system s-t.are &% a (mp*ter
system' App#&(at&% prgrams *s*a##y re9*&re a% perat&%g system t -*%(t&%'
O3'r+t$n1 &%&t'( a(ts as a% &%ter-a(e "et.ee% t)e *ser - a (mp*ter a%+ t)e
(mp*ter )ar+.are'
T)e perat&%g system &s t)e mst &mprta%t prgram t)at r*%s % a (mp*ter' E0ery
ge%era#/p*rpse (mp*ter m*st )a0e a% perat&%g system t r*% t)er prgrams'
E1- >$n!*&: L$n"2: UNI5: D&
T&me/s)ar&%g perat&%g systems s()e+*#e tas1s -r e[(&e%t *se - t)e system a%+ may
a#s &%(#*+e a((*%t&%g s-t.are -r (st a##(at&% - pr(essr t&me$ mass strage$ pr&%t&%g$
a%+ t)er res*r(es'
Fr )ar+.are -*%(t&%s s*() as &%p*t a%+ *tp*t a%+ memry a##(at&%$ t)e perat&%g
system a(ts as a% &%terme+&ary "et.ee% prgrams a%+ t)e (mp*ter )ar+.are$
]1^]@^
a#t)*g)
t)e app#&(at&% (+e &s *s*a##y e2e(*te+ +&re(t#y "y t)e )ar+.are a%+ .&## -re9*e%t#y ma1e a
system (a## t a% OS -*%(t&% r "e &%terr*pte+ "y &t' Operat&%g systems (a% "e -*%+ %
P a g e | @@ LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
a#mst a%y +e0&(e t)at (%ta&%s a (mp*ter -rm (e##*#ar p)%es a%+ 0&+e game (%s#es
t s*per(mp*ters a%+ .e" ser0ers'
E2+(3/'& - pp*#ar m+er% perat&%g systems &%(#*+e A%+r&+$ ,SD$ &OS$ L&%*2$ OS J$
SNJ$ M&(rs-t 6&%+.s$ 6&%+.s P)%e$ a%+ I,M 3NOS'
T%3'& ) 3'r+t$n1 &%&t'(&
R'+/-t$('
A rea#/t&me perat&%g system &s a m*#t&tas1&%g perat&%g system t)at a&ms at
e2e(*t&%g rea#/t&me app#&(at&%s' Rea#/t&me perat&%g systems -te% *se spe(&a#&3e+
s()e+*#&%g a#gr&t)ms s t)at t)ey (a% a()&e0e a +eterm&%&st&( %at*re - "e)a0&r' T)e ma&%
"Ee(t&0e - rea#/t&me perat&%g systems &s t)e&r 9*&(1 a%+ pre+&(ta"#e resp%se t e0e%ts'
T)ey )a0e a% e0e%t/+r&0e% r t&me/s)ar&%g +es&g% a%+ -te% aspe(ts - "t)' A% e0e%t/+r&0e%
system s.&t()es "et.ee% tas1s "ase+ % t)e&r pr&r&t&es r e2ter%a# e0e%ts .)&#e t&me/
s)ar&%g perat&%g systems s.&t() tas1s "ase+ % (#(1 &%terr*pts'
M"/t$-"&'r
A m*#t&/*ser perat&%g system a##.s m*#t&p#e *sers t a((ess a (mp*ter system at
t)e same t&me' T&me/s)ar&%g systems a%+ I%ter%et ser0ers (a% "e (#ass&5e+ as m*#t&/*ser
systems as t)ey e%a"#e m*#t&p#e/*ser a((ess t a (mp*ter t)r*g) t)e s)ar&%g - t&me'
S&%g#e/*ser perat&%g systems )a0e %#y %e *ser "*t may a##. m*#t&p#e prgrams t r*% at
t)e same t&me'
M"/t$-t+&0$n1 =&8 &$n1/'-t+&0$n1
A m*#t&/tas1&%g perat&%g system a##.s mre t)a% %e prgram t "e r*%%&%g at t)e
same t&me$ -rm t)e p&%t - 0&e. - )*ma% t&me s(a#es' A s&%g#e/tas1&%g system )as %#y
%e r*%%&%g prgram' M*#t&/tas1&%g (a% "e - t. typesB pre/empt&0e a%+ (/perat&0e' I%
pre/empt&0e m*#t&tas1&%g$ t)e perat&%g system s#&(es t)e CPU t&me a%+ +e+&(ates %e s#t t
ea() - t)e prgrams' I% 1H/"&t 0ers&%s - M&(rs-t 6&%+.s *se+ (perat&0e m*#t&/
tas1&%g' C@/"&t 0ers&%s - "t) 6&%+.s NT a%+ 6&%;2 *se+ pre/empt&0e m*#t&/tas1&%g' Ma(
OS pr&r t OS J *se+ t s*pprt (perat&0e m*#t&tas1&%g'
D$&tr$."t'! S%&t'(
A +&str&"*te+ perat&%g system ma%ages a gr*p - &%+epe%+e%t (mp*ters a%+
ma1es t)em appear t "e a s&%g#e (mp*ter' T)e +e0e#pme%t - %et.r1e+ (mp*ters t)at
(*#+ "e #&%1e+ a%+ (mm*%&(ate .&t) ea() t)er ga0e r&se t +&str&"*te+ (mp*t&%g'
P a g e | @C LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
D&str&"*te+ (mp*tat&%s are (arr&e+ *t % mre t)a% %e ma()&%e' 6)e% (mp*ters &% a
gr*p .r1 &% (perat&%$ t)ey ma1e a +&str&"*te+ system'
T'(3/+t'!
I% a% OS$ +&str&"*te+ a%+ (#*+ (mp*t&%g (%te2t$ temp#at&%g re-ers t (reat&%g a
s&%g#e 0&rt*a# ma()&%e &mage as a g*est perat&%g system$ t)e% sa0&%g &t as a t# -r
m*#t&p#e r*%%&%g 0&rt*a# ma()&%es' T)e te()%&9*e &s *se+ "t) &% 0&rt*a#&3at&% a%+ (#*+
(mp*t&%g ma%ageme%t$ a%+ &s (mm% &% #arge ser0er .are)*ses'
E(.'!!'!
Em"e++e+ perat&%g systems are +es&g%e+ t "e *se+ &% em"e++e+ (mp*ter
systems' T)ey are +es&g%e+ t perate % sma## ma()&%es #&1e PDAs .&t) #ess a*t%my'
T)ey are a"#e t perate .&t) a #&m&te+ %*m"er - res*r(es' T)ey are 0ery (mpa(t a%+
e2treme#y e[(&e%t "y +es&g%' 6&%+.s CE a%+ M&%&2 C are sme e2amp#es - em"e++e+
perat&%g systems'
C(3n'nt& ) O3'r+t$n1 S%&t'(
T)e (mp%e%ts - a% perat&%g system a## e2&st &% r+er t ma1e t)e +&4ere%t parts -
a (mp*ter .r1 tget)er' A## *ser s-t.are %ee+s t g t)r*g) t)e perat&%g system &%
r+er t *se a%y - t)e )ar+.are$ .)et)er &t &s as s&mp#e as a m*se r 1ey"ar+ r as
(mp#e2 as a% I%ter%et (mp%e%t'
6'rn'/
Program execution
Interrupts
Protected mode a%+ Supervisor mode
Memory management
Virtual memory
Multitasking
isk access and !le systems
evice drivers
N't*r0$n1
S'#"r$t%
U&'r $nt'r)+#'
A33/$#+t$n& ) O3'r+t$n1 S%&t'(
M*t&/tas1&%g
P a g e | @G LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
M*#t&/Prgramm&%g
Para##e# Pr(ess&%g
Sp#&%g
,*4er&%g
pr(ess ma%ageme%t
+ata a%+ memry ma%ageme%t
t pr0&+e se(*r&ty t t)e *ser
78 E23/+$n $n !'t+$/ +."t SIC M+#,$n' Ar#,$t'#t"r'? (11 (+r0&) (NOV 2011)(MAY
201@)(NOV 201@)
S$(3/$<'! In&tr"#t$n+/ C(3"t'r (SIC) &s a )ypt)et&(a# (mp*ter t)at &%(#*+es
t)e )ar+.are -eat*res mst -te% -*%+ % rea# ma()&%es'
T)ere are t. 0ers&%s - SIC are
Sta%+ar+ m+e# =SIC?
JE 0ers&% =SICNJE? =8JE: eJtra E9*&pme%t r eJtra E2pe%s&0e?'
SIC M+#,$n' Ar#,$t'#t"r'-
It (%s&sts -
18 Memry
28 Reg&sters
@8 Data Frmats
48 I%str*(t&% Frmats
78 A++ress&%g M+es
A8 I%str*(t&% Set
C8 I%p*t a%+ O*tp*t
MEMORY
It (%s&sts - </"&t "ytes'
C (%se(*t&0e "ytes -rms .r+ =@G "&ts?'
A## a++resses % SIC are "yte a++resses'
6r+s are a++resse+ "y t)e #(at&% - t)e&r #.est %*m"ere+ "yte
C@$FH< =@
1K
? "ytes &% t)e (mp*ter memry'
P a g e | @K LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
REGISTERS
T)ere are K reg&sters'
Ea() reg&ster &s @G "&ts &% #e%gt)'
Mn'(n$
#
N"(.'r S3'#$+/ "&'
A A A((*m*#atrM *se+ -r ar&t)met&( perat&%s
J 1 I%+e2 reg&sterM *se+ -r a++ress&%g
L @
L&%1age reg&sterM E*mp t s*"r*t&%e =7SU,? &%str*(t&% stres t)e
ret*r% a++ress &% t)&s reg&ster
PC <
Prgram C*%ter =PC?M (%ta&%s t)e a++ress - t)e %e2t &%str*(t&%
t "e -et()e+ -r e2e(*t&%
S6 ;
Stat*s .r+M (%ta&%s a 0ar&ety - &%-rmat&%$ &%(#*+&%g a
C%+&t&% C+e =CC?
DATA FORMATS
I%tegers are stre+ as @G/"&t "&%ary %*m"ers
C)ara(ters B</"&t ASCII (+es
@Ws (mp#eme%t -r %egat&0e 0a#*es
T)ere &s % F#at&%g/p&%t %*m"ers % Sta%+ar+ 0ers&% SIC'
INSTRUCTION FORMATS
A## ma()&%e &%str*(t&%s % t)e sta%+ar+ SIC )a0e @G/"&t -rmat'
P a g e | @H LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
bytes 2 32768
15
=
A .r+ =C "ytes r @G "&ts?
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
T &%+&(ate &%+e2e+/a++ress&%g
m+e
ADDRESSING MODES
T)e t. types - a++ress&%g m+es are
18 D&re(t a++ress&%g m+e
28 I%+e2e+ a++ress&%g m+e
Set J "&t t A r 1
Target a++ress =TA? &s (a#(*#ate+'
M!' In!$#+t$n T+r1't +!!r'&&
#+/#"/+t$n
D&re(t JOA TAOa++ress
I%+e2e+ JO1 TAOa++ressP=J?
INSTRUCTION SET
La+ a%+ stre reg&stersB LDA$ LDJ$ STA$ STJ$ et('
I%teger ar&t)met&( I%str*(t&%sB ADD$ SU,$ MUL$ DIV$ et('
A## ar&t)met&( perat&%s &%0#0e reg&ster A a%+ a .r+ &% memry$ .&t) t)e
res*#t "e&%g #e-t &% t)e reg&ster'
Cmpar&s% I%str*(t&%s B COMP
COMP (mpares t)e 0a#*e &% reg&ster A .&t) a .r+ &% memry$ t)&s &%str*(t&%
sets a (%+&t&% (+e =CC? t &%+&(ate t)e res*#t =Q$ O$R?'
C%+&t&%a# E*mp &%str*(t&%sB 7LT$ 7ES$ 7GT
T)ese &%str*(t&%s test t)e sett&%g - CC a%+ E*mp a((r+&%g#y'
S*"r*t&%e #&%1ageB 7SU,$ RSU,
7SU, E*mps t t)e s*"r*t&%e$ p#a(&%g t)e ret*r% a++ress &% reg&ster L'
RSU, ret*r%s "y E*mp&%g t t)e a++ress (%ta&%e+ &% reg&ster L'
INPUT;OUTPUT
Ea() IO +e0&(e &s ass&g%e+ a *%&9*e </"&t (+e'
O%e "yte at a t&me t r -rm t)e r&g)tmst < "&ts - reg&ster A'
T)ree &%str*(t&%sB
Test +e0&(e =TD?
Test .)et)er t)e +e0&(e &s rea+y t se%+Nre(e&0e
Test res*#t &s set &% CC
P a g e | @F LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
=J?B C%te%ts - a reg&ster r a memry
#(at&%
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
Rea+ +ata =RD?B rea+ %e "yte -rm t)e +e0&(e t reg&ster A'
6r&te +ata =6D?B .r&te %e "yte -rm reg&ster A t t)e +e0&(e'
A8 E23/+$n $n !'t+$/ +."t SIC;5E M+#,$n' Ar#,$t'#t"r'? (11 (+r0&)
M'(r%
Memry &s same as SIC sta%+ar+ 0ers&%'
Ma2&m*m memry a0a&#a"#e % a SICNJE system &s 1 mega"yte
R'1$&t'r&
A++&t&%a# reg&sters are pr0&+e+ "y SICNJE'
Mn'(n$
#
N"(.'r S3'#$+/ "&'
A A A((*m*#atrM *se+ -r ar&t)met&( perat&%s
J 1 I%+e2 reg&sterM *se+ -r a++ress&%g
L @
L&%1age reg&sterM E*mp t s*"r*t&%e =7SU,? &%str*(t&% stres t)e
ret*r% a++ress &% t)&s reg&ster
PC <
Prgram C*%ter =PC?M (%ta&%s t)e a++ress - t)e %e2t &%str*(t&%
t "e -et()e+ -r e2e(*t&%
S6 ;
Stat*s .r+M (%ta&%s a 0ar&ety - &%-rmat&%$ &%(#*+&%g a
C%+&t&% C+e =CC?
D+t+ Fr(+t&
T)ere &s a G</"&t Zat&%g/p&%t +ata type'
S&g% "&t A =P0e? r 1 =/0e?'
e2p%e%t &s a% *%s&g%e+ "&%ary %*m"er "et.ee% A a%+ @AGF'
-ra(t&% &s a 0a#*e "et.ee% A a%+ 1'
1 11 @A
S E23n'nt )r+#t$n
In&tr"#t$n Fr(+t&
Use re#at&0e a++ress&%g'
P a g e | @< LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
A .r+ =C "ytes r @G "&ts?
"ytes
@
@A
1 mega "yte
=
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
E2te%+ t)e a++ress 5e#+ t @A "&ts'
I%str*(t&% t)at re-ere%(e memry *ses'
Frmats 1 a%+ @ + %t re-ere%(e memry at a##'
,&t e +&st&%g*&s)es "et.ee% -rmat C a%+ G'

A!!r'&&$n1 M!'&
,ase re#at&0e a++ress&%g m+e
Prgram C*%ter =PC? re#at&0e a++ress&%g m+e
+&re(t a++ress&%g m+e
I%+e2e+ a++ress&%g m+e
&mme+&ate a++ress&%g m+e
&%+&re(t a++ress&%g m+e
B+&' R'/+t$=' +!!r'&&$n1 (!'
T)e +&sp#a(eme%t 5e#+ &% -rmat C &%str*(t&% &s &%terprete+ as a 1@ "&t *%s&g%e+
&%teger'
E2B 1AKH STJ LENGTD
M!' In!$#+t$n T+r1't +!!r'&& #+/#"/+t$n
,ase re#at&0e "O1$pOA TA I (B)J !$&3 =A T +&sp T GA;K?
Prgram C*%ter =PC?
re#at&0e
"OA$pO1
TA I(PC)J !$&3 =/@AG< T +&sp T
@AGF?
Pr1r+( #"nt'r R'/+t$=' A!!r'&&$n1 (!'
T)e +&sp#a(eme%t 5e#+ &% -rmat C &%str*(t&% &s &%terprete+ as a 1@ "&t s&g%e+
&%teger'
Negat&0e 0a#*es @Ws (mp#eme%t'
E2B AAAA STL RETADDR
D$r'#t +!!r'&&$n1 (!'
P a g e | @; LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
I% +&re(t a++ress&%g -r -rmats C a%+ G &- "OA$ pOA$ 2OA
E2B LDA LENGTD
TA I A!!r'&& <'/! (0 !$&3 40E7)8
In!'2'! +!!r'&&$n1 (!'
Set "&t 2O1$ "O1$ pOA 0a#*e t "e a++e+ t t)e 0a#*e stre+ at t)e reg&ster 2 t
"ta&% rea# a++ress - t)e pera%+'
STCD ,UFFER $ J
TA I (B) J (5) J !$&3
I(('!$+t' +!!r'&&$n1 (!'
Set "&t &O1$ %OAB &mme+&ate a++ress&%g
TA &s *se+ as t)e pera%+ 0a#*e$ % memry re-ere%(e
E2B LDA V;
TA I 3'r+n! =+/"' I !$&3
In!$r'#t A!!r'&&$n1 (!'
Set "&t &OA$ %O1$ 2OA
T)e .r+ at t)e TA &s -et()e+ 0a#*e &% t)&s .r+ &s ta1e% as t)e a++ress - t)e
pera%+ 0a#*e
E2B AA@A 7 _ RETADDR
In&tr"#t$n S't
La+ a%+ stre t)e %e. reg&stersB LD,$ ST,$ et('
F#at&%g/p&%t ar&t)met&( perat&%s/ ADDF$ SU,F$ MULF$ DIVF
Reg&ster m0eB RMO
Reg&ster/t/reg&ster ar&t)met&( perat&%s/ ADDR$ SU,R$ MULR$ DIVR
S*per0&sr (a##B SVC/-r ge%erat&%g a% &%terr*pt'
In3"t +n! "t3"t
T)ere are INO ()a%%e#s t)at (a% "e *se+ t per-rm &%p*t a%+ *tp*t .)&#e t)e CPU
&s e2e(*t&%g t)er &%str*(t&%s'
T)e &%str*(t&%s SIO$ TIO$ a%+ DIO are *se+ t start test a%+ )a#t t)e perat&% -
INO ()a%%e#s'
C8 >r$t' + SIC +n! SIC;5E +&&'(./'r 3r1r+(&? (11 (+r0&) (MAY 201@)
D+t+ M='('nt O3'r+t$n-
P a g e | CA LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
ALP9AI7: C1IP "&$n1 SIC $n&tr"#t$n&
LDA FIVE LOAD CONSTANT K INTO REGISTER A
STA ALPDA STORE IN ALPDA
LDCD CDAR` LOAD CDARACTER U`W INTO
REGISTER A
STCD C1 STORE IN CDARACTER VARIA,LE C1
XX'
ALPDA RES6 1 ONE 6ORD VARIA,LE
FIVE 6ORD K ONE 6ORD CONSTANT
CDAR` ,YTE CW`W ONE ,YTE CONSTANT
C1 RES, 1 ONE ,YTEVARIA,LE
ALP9AI7: C1IP "&$n1 SIC;5E $n&tr"#t$n&
LDA VK LOAD VALUE K INTO REGISTER A
STA ALPDA STORE IN ALPDA
LDA V;A LOAD ASCII CODE FOR U`W INTO
REGISTER A
STCD C1 STORE IN CDARACTER VARIA,LE C1
XX
ALPDA RES6 1 ONE 6ORD VARIA,LE
C1 RES, 1 ONE ,YTEVARIA,LE
Ar$t,('t$# O3'r+t$n-
BETA I ALP9A J INCRJ1 +n! DELTAIGAMMA J INCR -1 "&$n1 SIC $n&tr"#t$n&8
LDA ALPDA LOAD ALPDA INTO REGISTER A
ADD INCR ADD TDE VALUE OF INCR
SU, ONE SU,TRACT 1
STA ,ETA STORE IN ,ETA
LDA GAMMA LOAD GAMMA INTO REGISTER A
ADD INCR ADD TDE VALUE OF INCR
SU, ONE SU,TRACT 1
STA DELTA STORE IN DELTA
X''' XX''
ONE 6ORD 1 ONE 6ORD CONSTANT
ALPDA RES6 1 ONE 6ORD VARIA,LES
,ETA RES6 1
P a g e | C1 LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
GAMMA RES6 1
DELTA RES6 1
INCR RES6 1
BETA I ALP9A J INCRJ1 +n! DELTAIGAMMA J INCR -1 "&$n1 SIC ;5E $n&tr"#t$n&8
LDS INCR LOAD VALUE OF INCR INTO REGISTER S
LDA ALPDA LOAD ALPDA INTO REGISTER A
ADDR S$ A ADD TDE VALUE OF INCR
SU, V1 SU,TRACT 1
STA ,ETA STORE IN ,ETA
LDA GAMMA LOAD GAMMA INTO REGISTER A
ADDR S$ A ADD TDE VALUE OF INCR
SU, V1 SU,TRACT 1
STA DELTA STORE IN DELTA
X''' XX''
ALPDA RES6 1 ONE 6ORD VARIA,LES
,ETA RES6 1
GAMMA RES6 1
DELTA RES6 1
INCR RES6 1
D8 E23/+$n $n !'t+$/ +."t .+&$# +&&'(./'r )"n#t$n&? (11 (+r0&) (NOV 201@)
A% assem"#er &s a type - (mp*ter prgram t)at &%terprets s-t.are prgrams .r&tte%
&% assem"#y #a%g*age &%t ma()&%e #a%g*age$ (+e a%+ &%str*(t&%s t)at (a% "e
e2e(*te+ "y a (mp*ter'
A% assem"#er &s smet&mes re-erre+ t as t)e (mp&#er - assem"#y #a%g*age' It a#s
pr0&+es t)e ser0&(es - a% &%terpreter'
B+&$# A&&'(./'r F"n#t$n&-
T)e "as&( assem"#er -*%(t&%s areB
Tra%s#at&%g m%em%&( perat&% (+es t t)e&r ma()&%e #a%g*age e9*&0a#e%ts'
Ass&g%&%g ma()&%e a++resses t sym"#&( #a"e#s'
A&&'(./'r D$r'#t$='&
T)e 0ar&*s "as&( assem"#er +&re(t&0es are
START / spe(&-y prgram %ame a%+ start&%g a++ress - t)e prgram'
P a g e | C@ LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
END / &%+&(ate t)e e%+ - t)e s*r(e prgram
,YTE / ge%erate ()ara(ter r )e2a+e(&ma# (%sta%ts'
6ORD / Ge%erate %e .r+ &%teger (%sta%t'
RES, / Reser0e t)e &%+&(ate+ %' - "ytes -r a +ata area'
RES6 / Reser0e t)e &%+&(ate+ %' - .r+s -r a +ata area'
A&&'(./'rN& F"n#t$n&
18 C%0ert m%em%&( perat&% (+es t t)e&r ma()&%e #a%g*age e9*&0a#e%ts'
28 C%0ert sym"#&( pera%+s t t)e&r e9*&0a#e%t ma()&%e a++resses'
@8 ,*&#+ t)e ma()&%e &%str*(t&%s &% t)e prper -rmat'
48 C%0ert t)e +ata (%sta%ts spe(&5e+ &% t)e s*r(e prgram &%t &%ter%a# ma()&%e
represe%tat&%s'
78 6r&te t)e "Ee(t prgram a%+ t)e assem"#y #&st&%g
F"n#t$n& ) T* P+&& A&&'(./'r
T)e assem"#e+ prgram .&## "e #a+e+ &%t memry -r e2e(*t&%'
P+&& 1 - !'<n' &%(./& (+&&$1n +!!r'&&'&)
Ass&g% a++resses t a## stateme%ts &% t)e prgram'
Sa0e t)e 0a#*es ass&g%e+ t a## #a"e#s -r *se &% Pass @'
Per-rm sme pr(ess&%g assem"#er +&re(t&0es'
P+&& 2 - +&&'(./' $n&tr"#t$n& +n! 1'n'r+t' .K'#t 3r1r+(
Assem"#e &%str*(t&%s'
Ge%erate +ata 0a#*es +e5%e+ "y ,YTE$ 6ORD$ et('
Per-rm sme pr(ess&%g assem"#er +&re(t&0es %t +%e &% Pass 1'
6r&te t)e "Ee(t prgram a%+ t)e assem"#y #&st&%g'
T)e s&mp#e "Ee(t prgram (%ta&%s t)ree types - re(r+sB
18 Dea+er re(r+
28 Te2t re(r+ a%+
@8 E%+ re(r+'
T)e )ea+er re(r+ (%ta&%s t)e start&%g a++ress a%+ #e%gt)'
Te2t re(r+ (%ta&%s t)e tra%s#ate+ &%str*(t&%s a%+ +ata - t)e prgram$ tget)er .&t)
a% &%+&(at&% - t)e a++resses .)ere t)ese are t "e #a+e+'
T)e e%+ re(r+ mar1s t)e e%+ - t)e "Ee(t prgram a%+ spe(&5es t)e a++ress .)ere
t)e e2e(*t&% &s t "eg&%'
P a g e | CC LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
9'+!'r r'#r!-
C#' 1 D
C#' @YF Prgram %ame
C#' <Y1C Start&%g a++ress - "Ee(t prgram =)e2a+e(&ma#?
C#' 1G/1; Le%gt) - "Ee(t prgram &% "ytes =)e2a+e(&ma#?
T'2t r'#r!
C#'1 T
C#' @YF Start&%g a++ress -r "Ee(t (+e &% t)&s re(r+ =)e2?
C#' <Y; Le%gt) - "Ee(t (+e &% t)&s re(r+ &% "ytes =)e2?
C#'1AYH; O"Ee(t (+e =H;/1AP1?NHO1A &%str*(t&%s
En! r'#r!
C#'1 E
C#'@YF A++ress - 5rst e2e(*ta"#e &%str*(t&% &% "Ee(t prgram =)e2?
E8 D$&#"&& +."t +/1r$t,(& +n! !+t+ &tr"#t"r' *$t, +n '2+(3/'? (11 (+r0&)
A/1r$t,(& +n! D+t+ &tr"#t"r'&-
T)e s&mp#e assem"#er *ses t. maEr &%ter%a# +ata str*(t*resB
18 Operat&% C+e Ta"#e =OPTA,?
28 Sym"# Ta"#e =SYMTA,?
P a g e | CG LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
OPTAB (O3'r+t$n C!' T+./')-
It &s *se+ t #1*p m%em%&( perat&% (+es a%+ tra%s#ates t)em t t)e&r
ma()&%e #a%g*age e9*&0a#e%ts'
I% mre (mp#e2 assem"#ers t)e ta"#e a#s (%ta&%s &%-rmat&% a"*t &%str*(t&%
-rmat a%+ #e%gt)'
OPTA, &s *s*a##y rga%&3e+ as a )as) ta"#e$ .&t) m%em%&( perat&% (+e as t)e
1ey'
T)e )as) ta"#e rga%&3at&% &s part&(*#ar#y apprpr&ate$ s&%(e &t pr0&+es -ast
retr&e0a# .&t) a m&%&m*m - sear()&%g'
I% pass 1 t)e OPTA, &s *se+ t #1 *p a%+ 0a#&+ate t)e perat&% (+e &% t)e
s*r(e prgram'
I% pass @$ &t &s *se+ t tra%s#ate t)e perat&% (+es t ma()&%e #a%g*age' I%
s&mp#e SIC ma()&%e t)&s pr(ess (a% "e per-rme+ &% e&t)er &% pass 1 r &% pass @'
I% pass @ .e ta1e t)e &%-rmat&% -rm OPTA, t te## *s .)&() &%str*(t&% -rmat t
*se &% assem"#&%g t)e &%str*(t&%$ a%+ a%y pe(*#&ar&t&es - t)e "Ee(t (+e
&%str*(t&%'
SYMTAB (S%(./ T+./')-
SYMTA, &s *se+ t stre 0a#*es =a++resses? ass&g%e+ t #a"e#s'
T)&s ta"#e &%(#*+es t)e %ame a%+ 0a#*e -r ea() #a"e# &% t)e s*r(e prgram$
tget)er .&t) Zags t &%+&(ate t)e errr (%+&t&%s
LOCCTR-
P a g e | CK LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
L(at&% C*%ter =LOCCTR? &s &%&t&a#&3e+ t t)e "eg&%%&%g a++ress me%t&%e+ &% t)e
START stateme%t - t)e prgram' A-ter ea() stateme%t &s pr(esse+$ t)e #e%gt) - t)e
assem"#e+ &%str*(t&% &s a++e+ t t)e LOCCTR t ma1e &t p&%t t t)e %e2t &%str*(t&%'
6)e%e0er a #a"e# &s e%(*%tere+ &% a% &%str*(t&% t)e LOCCTR 0a#*e g&0es t)e a++ress
t "e ass(&ate+ .&t) t)at #a"e#'
P+&& 1 A/1r$t,(-
.'1$n
rea+ 5rst &%p*t #&%e
$) OPCODE O USTARTW t,'n
.'1$n
sa0e V]Opera%+^ as start&%g a++ress
&%&t&a#&3e LOCCTR t start&%g a++ress
.r&te #&%e t &%terme+&ate 5#e
rea+ %e2t #&%e
'n!= &- START?
'/&'
&%&t&a#&3e LOCCTR t A
*,$/' OPCODE aO UENDW !
.'1$n
$) t)&s &s %t a (mme%t #&%e t,'n
.'1$n
$) t)ere &s a sym"# &% t)e LA,EL 5e#+ t,'n
.'1$n
sear() SYMTA, -r LA,EL
$) -*%+ t,'n
set errr Zag =+*p#&(ate sym"#?
'/&' b&- sym"#c
sear() OPTA, -r OPCODE
$) -*%+ t,'n
a++ C =&%str #e%gt)? t LOCCTR
'/&' $) OPCODE O U6ORDW t,'n
a++ C t LOCCTR
'/&' $) OPCODE O URES6W t,'n
a++ C d V]OPERAND^ t LOCCTR
'/&' $) OPCODE O URES,W t,'n
P a g e | CH LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
a++ V]OPERAND^ t LOCCTR
'/&' $) OPCODE O U,YTEW t,'n
.'1$n
5%+ #e%gt) - (%sta%t &% "ytes
a++ #e%gt) t LOCCTR
'n! b&- ,YTEc
'/&'
set errr Zag =&%0a#&+ perat&% (+e?
'n! =&- %t a (mme%t?
.r&te #&%e t &%terme+&ate 5#e
rea+ %e2t &%p*t #&%e
'n! b .)&#e %t ENDc
.r&te #ast #&%e t &%terme+&ate 5#e
Sa0e =LOCCTR ! start&%g a++ress? as prgram #e%gt)
'n! bPass1c
T)e a#gr&t)m s(a%s t)e 5rst stateme%t START a%+ sa0es t)e pera%+ 5e#+ =t)e
a++ress? as t)e start&%g a++ress - t)e prgram' I%&t&a#&3es t)e LOCCTR 0a#*e t t)&s
a++ress' T)&s #&%e &s .r&tte% t t)e &%terme+&ate #&%e'
I- % pera%+ &s me%t&%e+ t)e LOCCTR &s &%&t&a#&3e+ t 3er' I- a #a"e# &s e%(*%tere+$
t)e sym"# )as t "e e%tere+ &% t)e sym"# ta"#e a#%g .&t) &ts ass(&ate+ a++ress
0a#*e'
I- t)e sym"# a#rea+y e2&sts t)at &%+&(ates a% e%try - t)e same sym"# a#rea+y e2&sts'
S a% errr Zag &s set &%+&(at&%g a +*p#&(at&% - t)e sym"#'
It %e2t ()e(1s -r t)e m%em%&( (+e$ &t sear()es -r t)&s (+e &% t)e OPTA,' I- -*%+
t)e% t)e #e%gt) - t)e &%str*(t&% &s a++e+ t t)e LOCCTR t ma1e &t p&%t t t)e %e2t
&%str*(t&%'
I- t)e p(+e &s t)e +&re(t&0e 6ORD &t a++s a 0a#*e C t t)e LOCCTR' I- &t &s RES6$ &t
%ee+s t a++ t)e %*m"er - +ata .r+ t t)e LOCCTR' I- &t &s ,YTE &t a++s a 0a#*e %e
t t)e LOCCTR$ &- RES, &t a++s %*m"er - "ytes'
I- &t &s END +&re(t&0e t)e% &t &s t)e e%+ - t)e prgram &t 5%+s t)e #e%gt) - t)e prgram
"y e0a#*at&%g (*rre%t LOCCTR ! t)e start&%g a++ress me%t&%e+ &% t)e pera%+ 5e#+ -
t)e END +&re(t&0e' Ea() pr(esse+ #&%e &s .r&tte% t t)e &%terme+&ate 5#e'
P a g e | CF LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
P+&& 2 A/1r$t,(&-
.'1$n
rea+ 5rst &%p*t #&%e b-rm &%terme+&ate 5#ec
$) OPCODE O USTARTW t,'n
.'1$n
.r&te #&st&%g #&%e
rea+ %e2t &%p*t #&%e
'n! b&- STARTc
.r&te Dea+er re(r+ t "Ee(t prgram
&%&t&a#&3e 5rst Te2t re(r+
*,$/' OPCODE aO UENDW !
.'1$n
$) t)&s &s %t (mme%t #&%e t,'n
.'1$n
sear() OPTA, -r OPCODE
$) -*%+ t,'n
.'1$n
$) t)ere &s a sym"# &% OPERAND 5e#+ t,'n
.'1$n
sear() SYMTA, -r OPERAND
$) -*%+ t,'n
.'1$n
stre sym"# 0a#*e as pera%+ a++ress
set errr Zag =*%+e5%e+ sym"#?
'n!
'n! b&- sym"#c
'/&'
stre A as pera%+ a++ress
assem"#e t)e "Ee(t (+e &%str*(t&%
'n! b&- sym"#c
'/&' $) OPCODE O U,YTEW r U6ORD: t,'n
(%0ert (%sta%t t "Ee(t (+e
$) "Ee(t (+e +es%Wt 5t &%t (*rre%t Te2t re(r+ t,'n
.'1$n
6r&te te2t re(r+ t "Ee(t (+e
&%&t&a#&3e %e. Te2t re(r+
'n!
P a g e | C< LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
a++ "Ee(t (+e t Te2t re(r+
'n! b&- %t (mme%tc
.r&te #&st&%g #&%e
rea+ %e2t &%p*t #&%e
'n! Q*,$/' nt ENDR
.r&te #ast Te2t re(r+ t "Ee(t prgram
.r&te E%+ re(r+ t "Ee(t prgram
.r&te #ast #&st&%g #&%e
'n! bPass @c
T)e 5rst &%p*t #&%e &s rea+ -rm t)e &%terme+&ate 5#e' I- t)e p(+e &s START$ t)e% t)&s
#&%e &s +&re(t#y .r&tte% t t)e #&st 5#e' A )ea+er re(r+ &s .r&tte% &% t)e "Ee(t prgram
.)&() g&0es t)e start&%g a++ress a%+ t)e #e%gt) - t)e prgram =.)&() &s (a#(*#ate+
+*r&%g pass 1?' T)e% t)e 5rst te2t re(r+ &s &%&t&a#&3e+' Cmme%t #&%es are &g%re+' I%
t)e &%str*(t&%$ -r t)e p(+e t)e OPTA, &s sear()e+ t 5%+ t)e "Ee(t (+e'
I- a sym"# &s t)ere &% t)e pera%+ 5e#+$ t)e sym"# ta"#e &s sear()e+ t get t)e
a++ress 0a#*e -r t)&s .)&() gets a++e+ t t)e "Ee(t (+e - t)e p(+e' I- t)e
a++ress %t -*%+ t)e% 3er 0a#*e &s stre+ as pera%+s a++ress' A% errr Zag &s set
&%+&(at&%g &t as *%+e5%e+' I- sym"# &tse#- &s %t -*%+ t)e% stre A as pera%+ a++ress
a%+ t)e "Ee(t (+e &%str*(t&% &s assem"#e+'
I- t)e p(+e &s ,YTE r 6ORD$ t)e% t)e (%sta%t 0a#*e &s (%0erte+ t &ts e9*&0a#e%t
"Ee(t (+e =-r e2amp#e$ -r ()ara(ter EOF$ &ts e9*&0a#e%t )e2a+e(&ma# 0a#*e UGKG-GHW
&s stre+?' I- t)e "Ee(t (+e (a%%t 5t &%t t)e (*rre%t te2t re(r+$ a %e. te2t re(r+ &s
(reate+ a%+ t)e rest - t)e &%str*(t&%s "Ee(t (+e &s #&ste+' T)e te2t re(r+s are
.r&tte% t t)e "Ee(t prgram' O%(e t)e .)#e prgram &s assem"#e a%+ .)e% t)e END
+&re(t&0e &s e%(*%tere+$ t)e E%+ re(r+ &s .r&tte%'
P a g e | C; LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
E5AMPLE- SIC OSt+n!+r! V'r&$n
T)e S*r(e prgram &s P I 5 J Y J 25Y
LOCCTR LABEL OPCO DE OPERAND
OBJECT CODE
@AAA SAMPLE START 2000
@AAA LDA J 00201D
@AAC ADD Y 1D201B
@AAH STA TEMP C0201E
@AA; LDA J 00201D
@AAC MUL Y 20201B
@AAF MUL T6O 202024
@A1@ ADD TEMP 1D201E
@A1K STA P 0C2021
@A1< J RES6 1
@A1, Y RES6 1
@A1E TEMP RES6 1
@A@1 P RES6 1
@A@G T6O 6ORD @
000002
@A@F END
T,' .K'#t 3r1r+( ) t,$& &"r#' 3r1r+(-
9eSAMPLEeAA@AAAeAAAA@F
TeAA@AAAe1BeAA@A1<e1<@A1,eAC@A1EeAA@A1<e@AA@1,e@A@A@Ge1<@A1EeAC@A@1eAA
AAA@
EeAA@AAA
SYMTAB OPTAB
P a g e | GA LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SYMBOL VALUE
X 2018
Y 201B
TEMP 201E
P 2021
TWO 2024
MNEMONICS OPERAND
LDA 00
ADD 18
STA 0C
MUL 20
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
108 E23/+$n $n !'t+$/ +."t (+#,$n' !'3'n!'nt +&&'(./'r )'+t"r'&? (11 (+r0&)
(MAY 2012)
C%s&+er t)e +es&g% a%+ &mp#eme%tat&% - a% assem"#er -r t)e mre (mp#e2 JE 0ers&% -
SIC'
&%str*(t&% -rmats
a++ress&%g m+es
prgram re#(at&%
($)In&tr"#t$n Fr(+t-
I%str*(t&%s (a% "eB
I%str*(t&%s &%0#0&%g reg&ster t reg&ster
I%str*(t&%s .&t) %e pera%+ &% memry$ t)e t)er &% A((*m*#atr
E2te%+e+ &%str*(t&% -rmat
Fr(+t 1-
Le%gt) O 1 "yte
< "&ts
Fr(+t 2-
Le%gt) O @ "ytes
It &s *se+ -r reg&ster !t ! reg&ster &%str*(t&%
<"&ts G G
OPCODE r1 r@
Fr(+t @-
Le%gt) O C "ytes
Reg&ster !memry &%str*(t&%'
H 1 1 1 1 1 1 1@
OPCODE % & 2 " p e D&sp#a(eme%t
D&sp#a(eme%t (a% "e (a#(*#ate+ &% t. .ays
PC re#at&0e
,ase re#at&0e
P a g e | G1 LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
OPCODE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
PC Or'/+t$=' !$&3/+#'('nt C+/#"/+t$n
TAO ]PC^ P +&sp =/@AG< T +&sp#a(eme%t T @AGF?
BASE O r'/+t$=' !$&3/+#'('nt C+/#"/+t$n
TAO =,? P +&sp =A T +&sp T GA;K?
Fr(+t 4 -( E2t'n!'! )r(+t) ($) !$&3S40E7)
E2te%+e+ -rmat - t)e &%str*(t&% m*st "e &%+&(ate+ "y t)e pre52 =P?
H 1 1 1 1 1 1 @A
OPCODE % & 2 " p e A++ress
Tr+n&/+t$n
18 Reg&ster Tra%s#at&%s -r t)e I%str*(t&% &%0#0&%g Reg&ster/Reg&ster a++ress&%g m+e
Reg&ster %ame =A$ J$ L$ ,$ S$ T$ F$ PC$ S6? a%+ t)e&r 0a#*es =A$ 1$ @$ C$ G$ K$ H$ <$ ;?'
D"r$n1 3+&& 1 t)e reg&sters (a% "e e%tere+ as part - t)e sym"# ta"#e &tse#-' T)e
0a#*e -r t)ese reg&sters &s t)e&r e9*&0a#e%t %*mer&( (+es'
D"r$n1 3+&&2: t)ese 0a#*es are assem"#e+ a#%g .&t) t)e m%em%&(s "Ee(t (+e' I-
re9*&re+ a separate ta"#e (a% "e (reate+ .&t) t)e reg&ster %ames a%+ t)e&r e9*&0a#e%t
%*mer&( 0a#*es'
28 Tra%s#at&% &%0#0&%g Reg&ster/Memry &%str*(t&%sB
I% SICNJE ma()&%e t)ere are -*r &%str*(t&% -rmats a%+ 50e a++ress&%g m+es'
Fr -rmats a%+ a++ress&%g m+es
T)e &%str*(t&% -rmats$ -rmat /C a%+ -rmat/G &%str*(t&%s are Reg&ster/Memry type
- &%str*(t&%'
O%e - t)e pera%+ &s a#.ays &% a reg&ster a%+ t)e t)er pera%+ &s &% t)e memry'
T)e a++ress&%g m+e te##s *s t)e .ay &% .)&() t)e pera%+ -rm t)e memry &s t "e
-et()e+'
@8 A++ress Tra%s#at&%
Mst reg&ster/memry &%str*(t&%s *se prgram (*%ter re#at&0e r "ase re#at&0e
a++ress&%g
Frmat CB 1@/"&t +&sp 5e#+
,ase/re#at&0eB AYGA;K
PC/re#at&0eB /@AG<Y@AGF
P a g e | G@ LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
Frmat GB @A/"&t a++ress 5e#+
($$) A!!r'&&$n1 M!'&-
PC/re#at&0e r ,ase/re#at&0e a++ress&%g p m
I%+&re(t a++ress&%g p _ m
Imme+&ate a++ress&%g p V(
E2te%+e+ -rmat P p m
I%+e2 a++ress&%g p m $ 2
Pr1r+(-C"nt'r R'/+t$='-
I% t)&s *s*a##y -rmat/C &%str*(t&% -rmat &s *se+' T)e &%str*(t&% (%ta&%s t)e p(+e
-##.e+ "y a 1@/"&t +&sp#a(eme%t 0a#*e'
T)e ra%ge - +&sp#a(eme%t 0a#*es are -rm A /@AG<' T)&s +&sp#a(eme%t 0a#*e &s a++e+
t t)e (*rre%t (%te%ts - t)e prgram (*%ter t get t)e target a++ress - t)e
pera%+ re9*&re+ "y t)e &%str*(t&%'
TAI FPCG J !$&3 -204D T !$&3 T 204C
B+&'-R'/+t$=' A!!r'&&$n1 M!'B
I% t)&s m+e t)e "ase reg&ster &s *se+ t me%t&% t)e +&sp#a(eme%t 0a#*e'
T)ere-re t)e target a++ress &s
TAI (B) J !$&3 0 T !$&3 T 40E7
I(('!$+t' A!!r'&&$n1 M!'
I% t)&s m+e % memry re-ere%(e &s &%0#0e+' I- &mme+&ate m+e &s *se+ t)e target
a++ress &s t)e pera%+ &tse#-'
In!$r'#t +n! PC-r'/+t$=' (!'-
I% t)&s type - &%str*(t&% t)e sym"# *se+ &% t)e &%str*(t&% &s t)e a++ress - t)e
#(at&% .)&() (%ta&%s t)e a++ress - t)e pera%+' T)e a++ress - t)&s &s -*%+ *s&%g
PC/re#at&0e a++ress&%g m+e'
($$$)Pr1r+( R'/#+t$n-
T)e assem"#er (a% &+e%t&-y -r t)e #a+er t)se part - t)e "Ee(t prgram t)at
%ee+e+ m+&5(at&%'
P a g e | GC LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
A% "Ee(t prgram t)at (%ta&%s t)e &%-rmat&% %e(essary t per-rm t)&s 1&%+ -
m+&5(at&% &s (a##e+ R'/#+t+./' 3r1r+('
T)e &%str*(t&%s .)&() are &% t)e re#at&0e a++ress&%g m+es =PC/re#at&0e r ,ase/
re#at&0e? +es %t re9*&re a%y m+&5(at&%$ .)ere0er t)e prgram &s #a+e+ &% t)e
memry'
Mre t)a% %e prgram at a t&me s)ar&%g t)e memry a%+ res*r(es'
A"s#*te prgram$ start&%g a++ress 1AAA
'818 77 101B LDA T9REE 00102D
Re#(ate t)e prgram t @AAA
'818 77 101B LDA T9REE 00202D
Ea() A"s#*te a++ress s)*#+ "e m+&5e+
M+&5(at&% re(r+ -r ea() a++ress 5e#+ t)at %ee+s t "e ()a%ge+ .)e% t)e
prgram &s re#(ate+'
T)e -rmat - M+&5(at&% Re(r+ &s
MODIFICATION RECORD-
C# 1 M
C# @/F Start&%g #(at&% - t)e a++ress 5e#+ t "e m+&5e+$ re#at&0e t t)e
"eg&%%&%g - t)e prgram =)e2a+e(&ma#?'
C# </; Le%gt) - t)e a++ress 5e#+ t "e m+&5e+ &% )a#- "ytes
=)e2a+e(&ma#?'
O%e m+&5(at&% re(r+ -r ea() a++ress t "e m+&5e+'
T)e #e%gt) &s stre+ &% )a#-/"ytes =@A "&ts O K )a#-/"ytes?'
T)e start&%g #(at&% &s t)e #(at&% - t)e "yte (%ta&%&%g t)e #e-tmst "&ts - t)e a++ress
5e#+ t "e m+&5e+'
I- t)e 5e#+ (%ta&%s a% ++ %*m"er - )a#-/"ytes$ t)e start&%g #(at&% "eg&%s &% t)e
m&++#e - t)e 5rst "yte'
Example of Program Relocation
P a g e | GG LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
Fr e2amp#e$ a prgram &s #a+e+ "eg&%%&%g at a++ress AAAA' T)e 7SU, &%str*(t&% &s #a+e+
at a++ress AAAH' T)e a++ress 5e#+ - t)&s &%str*(t&% (%ta&%s A1ACH$ .)&() &s t)e a++ress -
t)e &%str*(t&% #a"e#e+ RDREC'
R'/#+t+./' O.K'#t C!'
118 E23/+$n .r$'T% +."t (+#,$n' $n!'3'n!'nt )'+t"r'& ) +&&'(./'r? (11 (+r0&)
(NOV 2011: 2012)
T)ese are t)e -eat*res .)&() + %t +epe%+ % t)e ar()&te(t*re - t)e ma()&%e' T)ese
areB
18 L&tera#s
28 Sym"# De5%&%g Stateme%t
@8 E2press&%s
48 Prgram ,#(1s
78 C%tr# Se(t&%s a%+ Prgram L&%1&%g
($)LITERALS-
P a g e | GK LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
L&tera# &s a (%sta%t pera%+ .)&() &s *se+ t .r&te t)e 0a#*e - &t as a part - t)e
&%str*(t&%'
T)&s a0&+s )a0&%g t +e5%e t)e (%sta%t e#se.)ere &% t)e prgram a%+ ma1e *p a
#a"e# -r &t'
A #&tera# &s +e5%e+ .&t) a pre52 O -##.e+ "y a spe(&5(at&% - t)e #&tera# 0a#*e'
E2+(3/'-
AA1A ENDFIL LDA ICNEOFN AC@A1A
LTORG
AA@D d ICNEOFN GKGFGH
1AH@ 6LOOP TD I5N07N EC@A11
D$B'r'n#' .'t*''n L$t'r+/ UI(('!$+t' A!!r'&&$n1
6&t) &mme+&ate a++ress&%g$ t)e pera%+ 0a#*e &s assem"#e+ as part - t)e
&%str*(t&% &tse#-'
E1- LDA H@ 01000@
6&t) #&tera#$ t)e assem"#er ge%erates spe(&5e+ 0a#*e as a (%sta%t at sme t)er
memry #(at&% t)e a++ress - t)&s ge%erate+ (%sta%t &s *se+ as target a++ress
-r t)e ma()&%e &%str*(t&%'
E1- ENDFIL LDA ICNEOFN 0@2010
L$t'r+/ P/-
A## t)e pera%+s *se+ &% t)e prgram are gat)ere+ tget)er &%t %e r mre #&tera#
p#s'
Nrma##y #&tera#s are p#a(e+ &%t a p# at t)e e%+ - t)e prgram'
I% sme (ases &t &s +es&ra"#e t p#a(e #&tera#s &%t a p# at sme t)er #(at&% &% t)e
"Ee(t prgram *s&%g t)e +&re(t&0e LTORG =LITERAL ORIGIN?'
6)e% t)e assem"#er e%(*%ters t)e LTORG stateme%t$ &t (reates a #&tera# p# t)at
(%ta&%s a## - t)e #&tera#s pera%+s *se+ s&%(e t)e pre0&*s LTORG r t)e "eg&%%&%g -
t)e prgram' L&tera#s p#a(e+ "y LTORG .&## %t "e repeate+ at t)e p# at t)e e%+ -
t)e prgram 'T)e +*p#&(ate+ #&tera#s are re(g%&3e+ "y (mpar&%g t)e ge%erate+ 0a#*e
- t)e (%sta%t pera%+s'
E1- *sage - #&tera#s LDA O CWEOFW
LDA O JWGKGFGHW
O.K'#t #!'
De5%&t&% - #&tera#s dO CWEOFW GKGFGH
P a g e | GH LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
dOCWGKGFGHW GKGFGH
L&tera#s (a% "e *se+ t re-er t t)e (*rre%t 0a#*e - t)e #(at&% (*%ter =a++ress -
t)e memry #(at&%?'
E1- "ase d
LD, Od
T)e a"0e &%str*(t&%s are *se+ t spe(&-y t)e pera%+ .&t) 0a#*e as (*rre%t 0a#*e -
#(at&% (*%ter'
($$)SYMBOL DEFINING STATEMENT-
EMU St+t'('nt-
Mst assem"#ers pr0&+e a% assem"#er +&re(t&0e t)at a##.s t)e prgrammer t +e5%e
sym"#s a%+ spe(&-y t)e&r 0a#*es'
T)e +&re(t&0e *se+ -r t)&s EMU =E9*ate?'
T)e ge%era# -rm - t)e stateme%t &s
S%(./ EMU =+/"'
T)&s stateme%t +e5%es t)e g&0e% sym"# =&'e'$ e%ter&%g &% t)e SYMTA,? a%+ ass&g%&%g
t &t t)e 0a#*e spe(&5e+'
T)e 0a#*e (a% "e a (%sta%t r a% e2press&% &%0#0&%g (%sta%ts a%+ a%y t)er
sym"# .)&() &s a#rea+y +e5%e+' O%e (mm% *sage &s t +e5%e sym"#&( %ames t)at
(a% "e *se+ t &mpr0e rea+a"&#&ty &% p#a(e - %*mer&( 0a#*es'
Fr '2+(3/'
JLDT H40EA
T)&s #a+s t)e reg&ster T .&t) &mme+&ate 0a#*e GA;HM t)&s +es %t (#ear#y .)at e2a(t#y t)&s
0a#*e &%+&(ates'
I- a stateme%t &s &%(#*+e+ asB
MA5LEN EMU 40EA a%+ t)e%
JLDT HMA5LEN
T)e% &t (#ear#y &%+&(ates t)at t)e 0a#*e - MAJLEN &s sme ma2&m*m #e%gt) 0a#*e' 6)e% t)e
assem"#er e%(*%ters ESU stateme%t$ &t e%ters t)e sym"# MAJLEN a#%g .&t) &ts 0a#*e &%
t)e sym"# ta"#e'
D*r&%g LDT t)e assem"#er sear()es t)e SYMTA, -r &ts e%try a%+ &ts e9*&0a#e%t 0a#*e as t)e
pera%+ &% t)e &%str*(t&%'
A%t)er (mm% *sage - ESU stateme%t &s -r +e5%&%g 0a#*es -r t)e ge%era#/p*rpse
reg&sters' T)e assem"#er (a% *se t)e m%em%&(s -r reg&ster *sage #&1e a/reg&ster A$ J !
P a g e | GF LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
&%+e2 reg&ster a%+ s %' ,*t t)ere are sme &%str*(t&%s .)&() re9*&re %*m"ers &% p#a(e -
%ames &% t)e &%str*(t&%s' Fr e2amp#e &% t)e &%str*(t&% RMO A$ 1 &%stea+ - RMO A$ J'
T)e prgrammer (a% ass&g% t)e %*mer&(a# 0a#*es t t)ese reg&sters *s&%g ESU +&re(t&0e
A EMU 0
5 EMU 1
T)ese stateme%ts .&## (a*se t)e sym"#s A$ J$ LX t "e e%tere+ &%t t)e sym"# ta"#e .&t)
t)e&r respe(t&0e 0a#*es' A% &%str*(t&% RMO A$ J .*#+ t)e% "e a##.e+' As a%t)er *sage &-
&% a ma()&%e t)at )as ma%y ge%era# p*rpse reg&sters %ame+ as R1$ R@$X$ sme may "e
*se+ as "ase reg&ster$ sme may "e *se+ as a((*m*#atr' T)e&r *sage may ()a%ge -rm %e
prgram t a%t)er'
I% t)&s (ase .e (a% +e5%e t)ese re9*&reme%t *s&%g ESU stateme%ts'
BASE EMU R1
INDE5 EMU R2
COUNT EMU R@
O%e restr&(t&% .&t) t)e *sage - ESU &s .)ate0er sym"# ((*rs &% t)e r&g)t )a%+ s&+e - t)e
ESU s)*#+ "e pre+e5%e+' Fr e2amp#e$ t)e -##.&%g stateme%t &s %t 0a#&+B
BETA EMU ALP9A
ALP9A RES> 1
As t)e sym"# ALPDA &s ass&g%e+ t ,ETA "e-re &t &s +e5%e+' T)e 0a#*e - ALPDA &s %t
1%.%'
ORG St+t'('nt-
T)&s +&re(t&0e (a% "e *se+ t &%+&re(t#y ass&g% 0a#*es t t)e sym"#s' T)e +&re(t&0e &s
*s*a##y (a##e+ ORG =-r r&g&%?'
Its ge%era# -rmat &sB
ORG =+/"'
6)ere 0a#*e &s a (%sta%t r a% e2press&% &%0#0&%g (%sta%ts a%+ pre0&*s#y +e5%e+
sym"#s' 6)e% t)&s stateme%t &s e%(*%tere+ +*r&%g assem"#y - a prgram$ t)e assem"#er
resets &ts #(at&% (*%ter =LOCCTR? t t)e spe(&5e+ 0a#*e' S&%(e t)e 0a#*es - sym"#s *se+
as #a"e#s -rm LOCCTR$ t)e ORG stateme%t .&## a4e(t t)e 0a#*es - a## #a"e#s +e5%e+ *%t&# t)e
%e2t ORG' ORG (a% "e *se-*# &% #a"e# +e5%&t&%'
S*ppse .e %ee+ t +e5%e a sym"# ta"#e .&t) t)e -##.&%g str*(t*reB
SYMBOL A B%t'&
VALUE @ B%t'&
FLAG 2 B%t'&
P a g e | G< LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
Fr e2amp#e$ &- t)e sym"# ta"#e &s +e5%e+ &% t)e -##.&%g str*(t*reB
STAB
(100 'ntr$'&)
I% t)&s ta"#e$ t)e SYM,OL 5e#+
(%ta&%s a H "yte *ser +e5%e+
sym"#' VALUE &s a %e .r+ represe%tat&% - t)e 0a#*e ass&g%e+ t t)e sym"#' FLAGS &s
a @ "yte 5e#+ t)at spe(&5es sym"# type a%+ t)er &%-rmat&%'
($$$) E5PRESSIONS-
Assem"#ers a#s a##. *se - e2press&%s &% p#a(e - pera%+s &% t)e &%str*(t&%' Ea()
s*() e2press&% m*st "e e0a#*ate+ t ge%erate a s&%g#e pera%+ 0a#*e r a++ress'
Assem"#ers ge%era##y ar&t)met&( e2press&%s -rme+ a((r+&%g t t)e %rma# r*#es
*s&%g ar&t)met&( peratrs P$ / d$ N'D&0&s&% &s *s*a##y +e5%e+ t pr+*(e a% &%teger
res*#t'
I%+&0&+*a# terms may "e
(%sta%ts$
*ser/+e5%e+ sym"#s$ r
Spe(&a# terms'
T)e %#y spe(&a# term *se+ &s d =t)e (*rre%t 0a#*e - #(at&% (*%ter? .)&() &%+&(ates
t)e 0a#*e - t)e %e2t *%ass&g%e+ memry #(at&%'
T)*s t)e stateme%t
BUFFEND EMU V
He!e" e#$%ess&'s (%e !)(ss&*&e+ (s e&t,e%
! Abs')-te e#$%ess&' '%
"! .e)(t&/e e#$%ess&'s
A.&/"t' E23r'&&$n-
T)e e2press&% t)at *ses %#y a"s#*te terms &s a"s#*te e2press&%'
A"s#*te e2press&% may (%ta&% re#at&0e term pr0&+e+ t)e re#at&0e terms ((*r &%
pa&rs .&t) pps&te s&g%s -r ea() pa&r'
E2amp#eB
MA5LEN EMU BUFEND-BUFFER
T)e e2press&% (a% )a0e %#y a"s#*te terms'
E2amp#eB
MA5LEN EMU 1000
P a g e | G; LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SYMBOL VALUE FLAGS
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
,*t pr+*(e t)e a"s#*te 0a#*e 1AAA .)&() &s t)e #e%gt) - "*4er
R'/+t$=' E23r'&&$n-
T)e 0a#*e - re#at&0e e2press&% &s +epe%+e%t - start&%g a++ress - t)e prgram'
It may (%ta&% re#at&0e terms r a"s#*te terms "*t &t m*st pr+*(e t)e 0a#*e .)&() &s
re#at&0e t t)e start&%g a++ress - t)e prgram'
E2+(3/'-
SYMBOL EMU STAB
VALUE EMU STABJA 1000JAI100A
FLAGS EMU STABJE 1000JEI100E
T)e 0a#*e - t)e e2press&% &s 1AAH .)&() &s sme memry #(at&% .&t)&% t)e
prgram a%+ a#s re#at&0e t t)e "eg&%%&%g a++ress - t)e prgram'
($=) PROGRAM BLOC6S-
T)e prgram "#(1s re-er t segme%ts - (+e t)at are rearra%ge+ .&t)&% a s&%g#e
"Ee(t prgram *%&t'
T)e (%tr# se(t&%s t re-er t segme%ts t)at are tra%s#ate+ &%+epe%+e%t "Ee(t
prgram *%&ts'
T)&s -eat*re a##.s mre Ze2&"#e )a%+#&%g - s*r(e a%+ "Ee(t prgrams'
Dere t)e ge%erate+ ma()&%e &%str*(t&%s a%+ +ata t appear &% t)e "Ee(t prgram &%
+&4ere%t r+er -rm t)e (rresp%+&%g s*r(e stateme%ts'
T)&s res*#ts t)e (reat&% - se0era# &%+epe%+e%t parts - t)e "Ee(t prgram'
T)ese parts ma&%ta&% t)e&r &+e%t&ty a%+ are )a%+#e+ separate#y "y t)e #a+er'
U&' D$r'#t$='&-
USE D&re(t&0e &%+&(ates .)&() prt&% - t)e s*r(e prgram "e#%gs t t)e 0ar&*s
"#(1s'
I- % USE stateme%ts are &%(#*+e+$ t)e e%t&re prgram "e#%gs t t)e s&%g#e "#(1'
T)&s +&re(t&0e a#s &%+&(ate a (%t&%*at&% - pre0&*s#y "eg&%s "#(1'
Ea() prgram "#(1 (%ta&%s se0era# separate segme%ts - t)e s*r(e prgram'
T)e assem"#er .&t) rearra%ge t)ese segme%ts t gat)er tget)er t)e p&e(es - ea()
"#(1'
T)e assem"#er a((mp#&s)es t)&s #g&(a# rearra%geme%t - (+e "y ma&%ta&%&%g a
separate #(at&% (*%ter -r ea() prgram "#(1 +*r&%g pass1'
I(3/'('nt+t$n ) Pr1r+( B/#0&-
P a g e | KA LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
T)e #(at&% (*%ter -r a "#(1 &s &%&t&a#&3e+ t A .)e% t)e "#(1 &s 5rst "eg*%'
T)e (*rre%t 0a#*e - t)&s #(at&% (*%ter &s sa0e+ .)e% s.&t()&%g t a%t)er "#(1
a%+ sa0e+ 0a#*e &s restre+ .)e% res*m&%g a pre0&*s "#(1'
D"r$n1 P+&& 1
Ea() prgram "#(1 )as a separate #(at&% (*%ter'
Ea() #a"e# &s ass&g%e+ a% a++ress t)at &s re#at&0e t t)e start - t)e "#(1 t)at (%ta&%s
&t'
At t)e e%+ - Pass 1$ t)e #atest 0a#*e - t)e #(at&% (*%ter -r ea() "#(1 &%+&(ates
t)e #e%gt) - t)at "#(1'
T)e assem"#er (a% t)e% ass&g% t ea() "#(1 a start&%g a++ress &% t)e "Ee(t prgram'
D"r$n1 P+&& 2
T)e a++ress - ea() sym"# (a% "e (mp*te+ "y a++&%g t)e ass&g%e+ "#(1 start&%g
a++ress a%+ t)e re#at&0e a++ress - t)e sym"# t t)at "#(1'
Fr e2amp#e$ a prgram (a% "e +&0&+e+ &%t C "#(1s %ame#yB
18 D')+"/t ./#0 T)&s "#(1 (%ta&%s e2e(*ta"#e &%str*(t&% s - s*r(e prgram'
28 CDATA T)&s "#(1 &%(#*+es strage area -r -e. "ytes'
@8 CBLC6S T)&s "#(1 (%ta&%s strage area -r #arger %*m"er - "ytes'
At t)e e%+ - PASS1$ t)e assem"#er (%str*(ts a ta"#e t)at (%ta&%s t)e start&%g
a++ress a%+ #e%gt)s - a## "#(1s'
Fr e2amp#e$ &t m&g)t "eB
B/#0 N+(' B/#0 N St+rt$n1 A!!r'&& L'n1t,
De-a*#t A AAAA AAHH
CDATA 1 AAHH AAA,
C,LCKS @ AAF1 1AAA
6)e% t)e #a"e#s are e%tere+ &% t t)e sym"# ta"#e$ t)e "#(1 %ame r %*m"er &s
stre+ a#%g .&t) &ts re#at&0e a++ress'
E2+(3/' &%(./ t+./'-
B/#0
n8
S%(./ =+/"'
A FIRST AAAA
A CLOOP AAAC
A ENDFIL AA1K
P a g e | K1 LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
1 RETADR AAAA
1 LENGTD AAAC
@ ,UFFER AAAA
@ ,UFEND 1AAA
(=) CONTROL SECTIONS AND PROGRAM LIN6ING-
A #ntr/ &'#t$n &s a part - t)e prgram t)at ma&%ta&%s &ts &+e%t&ty a-ter assem"#yM
ea() s*() (%tr# se(t&% (a% "e #a+e+ a%+ re#(ate+ &%+epe%+e%t#y - t)ers'
D&4ere%t (%tr# se(t&%s are mst -te% *se+ -r s*"r*t&%es r t)er #g&(a#
s*"+&0&s&%s - a prgram'
T)e prgrammer (a% assem"#e$ #a+$ a%+ ma%&p*#ate ea() - t)ese (%tr# se(t&%s
separate#y'
T)e res*#t&%g Ze2&"&#&ty &s a maEr "e%e5t - *s&%g (%tr# se(t&%s'
6)e% (%tr# se(t&%s -rm #g&(a##y re#ate+ parts - a prgram$ &t &s %e(essary t
pr0&+e sme mea%s -r /$n0$n1 t)em tget)er'
Fr e2amp#e$ &%str*(t&%s &% %e (%tr# se(t&% m&g)t %ee+ t re-er t &%str*(t&%s r
+ata #(ate+ &% a%t)er se(t&%' ,e(a*se (%tr# se(t&%s are &%+epe%+e%t#y #a+e+
a%+ re#(ate+M t)e assem"#er &s *%a"#e t pr(ess t)ese re-ere%(es &% *s*a# .ay'
T)e assem"#er )as % &+ea .)ere a%y t)er (%tr# se(t&% .&## "e #(ate+ at
e2e(*t&% t&me' S*() re-ere%(es "et.ee% (%tr# se(t&%s are (a##e+ '2t'rn+/
r')'r'n#'&8
T)e assem"#er ge%erate+ &%-rmat&% -r ea() e2ter%a# re-ere%(e t)at .&## a##. t)e
#a+er t per-rm t)e re9*&re+ #&%1&%g'
Assem"#er *ses t. assem"#er +&re(t&0es %ame#y
18 E5TDEF (E5TERNAL DEFINITION)
T)e EJTDEF stateme%t &% a (%tr# se(t&% %ames sym"#s (a##e+ e2ter%a# sym"#s
t)at are +e5%e+ &% t)&s (%tr# se(t&% a%+ may "e *se+ "y t)er se(t&%s'
28 E5TREF (E5TERNAL REFERENCE)
T)e EJTREF stateme%t %ames sym"#s t)at are *se+ &% t)&s (%tr# se(t&% a%+ are
+e5%e+ e#se.)ere'
T)e assem"#er m*st a#s &%(#*+e t)e &%-rmat&% a"*t t)e e2ter%a# re-ere%(es &%
t)e "Ee(t prgram t)at .&## (a*se t)e #a+er t (a#(*#ate prper a++ress - t)e
pera%+ a%+ &%sert .)e% t)ey are re9*&re+'
T &%(#*+e t)e &%-rmat&% a"*t t)e e2ter%a# re-ere%(es .e %ee+ t. re(r+ types
&% t)e "Ee(t prgram'
T)e t. %e. re(r+ types are
P a g e | K@ LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
18 D'<n' r'#r!
It g&0es &%-rmat&% a"*t e2ter%a# sym"# t)at are +e5%e+ &% t)&s (%tr# se(t&%
t)at &s sym"# %ame+ "y EJTDEF'
28 R')'r r'#r!
It #&sts sym"#s t)at are *se+ as e2ter%a# re-ere%(es "y t)&s (%tr# se(t&% "*t t)e
sym"#s are +e5%e+ &% t)er (%tr# se(t&%$ t)at &s$ sym"# %ame+ "y EJTREF'
FORMAT OF DERFINE RECORD-
C# 1 D
C# @/F %ame - e2ter%a# sym"# +e5%e+ &% t)&s (%tr# se(t&%
C# </1C re#at&0e a++ress - sym"# .&t)&% t)&s (%tr# se(t&%
C# 1G/FC repeat &%-rmat&% &% (# @/1C -r t)er e2ter%a# sym"#
FORMAT OF REFER RECORD-
C# 1 R
C# @/F %ame - e2ter%a# sym"# +e5%e+ &% t)&s (%tr# se(t&%
C# </FC %ame - t)er e2ter%a# re-ere%(e sym"#
T)e %e. -rmat - m+&5(at&% re(r+ &s - t)e -##.&%g
FORMAT OF MODIFICATION RECORD-
C# 1 M
C# @/F start&%g a++ress - t)e 5e#+ t "e m+&5e+$ re#at&0e t t)e
"eg&%%&%g - t)e (%tr# se(t&%
C# </; #e%gt) - t)e 5e#+ t "e m+&5e+ &% )a#- "ytes
C#1A m+&5(at&% Zag =P r /?
C# 11/1H e2ter%a# sym"# .)se 0a#*e &s t "e a++e+ t r s*"tra(te+ -rm
t)e &%+&(ate+
5e#+
E2+(3/' O.K'#t 3r1r+(-
DeCOPYeAAAAAAeAA1ACC
De,UFFEReAAAACCe,UFENDeAA1ACCeLENGTDeAAAA@D
ReRDRECe6RREC
TeAAAAAAH1Ae1F@A@FeG,1AAAAAeAC@A@Ce@;AAAAeC@AAFeG,1AAAeCF@FFCeAC@A
1HeAF@A1H
TeAAAA1AeAAeA1AAACeAF@AAAAeG,1AAAeCF@AAA
TeAAAACAeACeGKGFGH
P a g e | KC LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
MeAAAAAGeAKPRDREC
MeAAAA11eAKP6RREC
MeAAAA@GeAKP6RREC
EeAAAAAA
128 E23/+$n A&&'(./'r !'&$1n 3t$n&? (11 (+r0&) (MAY: NOV 2012)
T)e Assem"#er +es&g% pt&%s are
18 O%e !Pass Assem"#ers
28 M*#t&/Pass Assem"#ers
($) ONE PASS ASSEMBLERS-
T)e ma&% pr"#em &% +es&g%&%g t)e assem"#er *s&%g s&%g#e pass .as t res#0e -r.ar+
re-ere%(es' 6e (a% a0&+ t sme e2te%t t)e -r.ar+ re-ere%(es "yB
E#&m&%at&%g -r.ar+ re-ere%(e t +ata &tems$ "y +e5%&%g a## t)e strage reser0at&%
stateme%ts at t)e "eg&%%&%g - t)e prgram rat)er at t)e e%+'
U%-rt*%ate#y$ -r.ar+ re-ere%(e t #a"e#s % t)e &%str*(t&%s (a%%t "e a0&+e+'
=-r.ar+ E*mp&%g?
T pr0&+e sme pr0&s&% -r )a%+#&%g -r.ar+ re-ere%(es "y pr)&"&t&%g -r.ar+
re-ere%(es t +ata &tems'
T)ere are t. types - %e/pass assem"#ersB
18 O%e t)at pr+*(es "Ee(t (+e +&re(t#y &% memry -r &mme+&ate e2e(*t&% (L+!-
+n!-1 +&&'(./'r&)8
28 T)e t)er type pr+*(es t)e *s*a# 1&%+ - "Ee(t (+e -r #ater e2e(*t&%'
L+!-+n!-G A&&'(./'r
La+/a%+/g assem"#er ge%erates t)e&r "Ee(t (+e &% memry -r &mme+&ate
e2e(*t&%'
N "Ee(t prgram &s .r&tte% *t$ % #a+er &s %ee+e+'
It &s *se-*# &% a system .&t) -re9*e%t prgram +e0e#pme%t a%+ test&%g'
T)e e[(&e%(y - t)e assem"#y pr(ess &s a% &mprta%t (%s&+erat&%'
Prgrams are re/assem"#e+ %ear#y e0ery t&me t)ey are r*%M e[(&e%(y - t)e assem"#y
pr(ess &s a% &mprta%t (%s&+erat&%8
P a g e | KG LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
Fr*+r! R')'r'n#' $n On'-P+&& A&&'(./'r&-
I% #a+/a%+/G assem"#ers .)e% a -r.ar+ re-ere%(e &s e%(*%tere+B
Om&ts t)e pera%+ a++ress &- t)e sym"# )as %t yet "ee% +e5%e+'
E%ters t)&s *%+e5%e+ sym"# &%t SYMTA, a%+ &%+&(ates t)at &t &s *%+e5%e+'
A++s t)e a++ress - t)&s pera%+ a++ress t a #&st - -r.ar+ re-ere%(es ass(&ate+
.&t) t)e SYMTA, e%try'
6)e% t)e +e5%&t&% -r t)e sym"# &s e%(*%tere+$ s(a%s t)e re-ere%(e #&st a%+ &%serts
t)e a++ress'
At t)e e%+ - t)e prgram$ reprts t)e errr &- t)ere are st&## SYMTA, e%tr&es &%+&(ate+
*%+e5%e+ sym"#s'
Fr La+/a%+/G assem"#er
Sear() SYMTA, -r t)e sym"# %ame+ &% t)e END stateme%t a%+ E*mps t t)&s
#(at&% t "eg&% e2e(*t&% &- t)ere &s % errr'
On'-P+&& n''!& t 1'n'r+t' .K'#t #!'-
I- t)e pera%+ (%ta&%s a% *%+e5%e+ sym"#$ *se A as t)e a++ress a%+ .r&te t)e Te2t
re(r+ t t)e "Ee(t prgram'
Fr.ar+ re-ere%(es are e%tere+ &%t #&sts as &% t)e #a+/a%+/g assem"#er'
6)e% t)e +e5%&t&% - a sym"# &s e%(*%tere+$ t)e assem"#er ge%erates a%t)er Te2t
re(r+ .&t) t)e (rre(t pera%+ a++ress - ea() e%try &% t)e re-ere%(e #&st'
6)e% #a+e+$ t)e &%(rre(t a++ress A .&## "e *p+ate+ "y t)e #atter Te2t re(r+
(%ta&%&%g t)e sym"# +e5%&t&%'
P a g e | KK LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
O.K'#t C!' G'n'r+t'! .% On'-P+&& A&&'(./'r-
($$) MULTI-PASS ASSEMBLERS-
ESU assem"#er +&re(t&0e &s re9*&re+ t +e5%e sym"# *se+ % t)e r&g)t )a%+ s&+e "e
+e5%e+ &% t)e s*r(e prgram'
Fr a t. pass assem"#er$ -r.ar+ re-ere%(es &% sym"# +e5%&t&% are %t a##.e+B
ALP9A EMU BETA
BETA EMU DELTA
DELTA RES> 1
P a g e | KH LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
Sym"# +e5%&t&% m*st "e (mp#ete+ &% pass 1'
Pr)&"&t&%g -r.ar+ re-ere%(es &% sym"# +e5%&t&% &s %t a ser&*s &%(%0e%&e%(e'
Fr.ar+ re-ere%(es te%+ t (reate +&[(*#ty -r a pers% rea+&%g t)e prgram'
I(3/'('nt+t$n I&&"'& )r M!$<'! T*-P+&& A&&'(./'r-
Imp#eme%tat&% Iss*es .)e% -r.ar+ re-ere%(&%g &s e%(*%tere+ &% Sym"# De5%&%g
stateme%tsB
Fr a -r.ar+ re-ere%(e &% sym"# +e5%&t&%$ .e stre &% t)e SYMTA,B
T)e sym"# %ame
T)e +e5%&%g e2press&%
T)e %*m"er - *%+e5%e+ sym"#s &% t)e +e5%&%g e2press&%
T)e *%+e5%e+ sym"# =mar1e+ .&t) a Zag d? ass(&ate+ .&t) a #&st - sym"#s
+epe%+ % t)&s *%+e5%e+ sym"#'
6)e% a sym"# &s +e5%e+$ .e (a% re(*rs&0e#y e0a#*ate t)e sym"# e2press&%s
+epe%+&%g % t)e %e.#y +e5%e+ sym"#'
M"/t$-P+&& A&&'(./'r E2+(3/' Pr1r+(-
P a g e | KF LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
P a g e | K< LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
P a g e | K; LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
PONDIC9ERRY UNIVERSITY MUESTIONS
2 MAR6S
18 6)at &s &%terpreterI(NOV 2011) (NOV 2012) (R')8Mn8N810: P18n8A)
28 6)at are t)e 5e#+s a0a&#a"#e &% a% assem"#y #a%g*age &%str*(t&%I (NOV 2011)
(R')8Mn8N82D: P18n810)
@8 De5%e Assem"#erI(MAY 2012) (R')8Mn8N8E: P18n87)
48 De5%e System S-t.are' I(MAY 2012) (NOV 2012) (R')8Mn8N84: P18n84)
78 6)at &s mea% "y OPTA,$ SYMTA,I (MAY 2012) (R')8Mn8N8@@: P18n811)
A8 L&st t)e assem"#er +&re(t&0es' (NOV 2012) (R')8Mn8N82E: P18n810)
C8 De5%e I%str*(t&% set' (MAY 201@) (R')8Mn8N81C: P18n8C)
D8 D. (*#+ #&tera#s "e &mp#eme%te+ &% %e pass assem"#erI (MAY 201@)
(R')8Mn8N812: P18n8A)
E8 State t)e +&4ere%(e "et.ee% assem"#er a%+ I%terpreter' (NOV 201@) (R')8Mn8N811:
P18n8A)
108 L&st t)e -eat*res - ma()&%e +epe%+e%t Assem"#er' (NOV 201@)
(R')8Mn8N8@A: P18n812)
11 MAR6S
NOV 2011(REGULAR)
18 =a? Dra. t)e -rmat - a% &%str*(t&% a%+ e2p#a&% =K? (R')8Mn8N87:A P18n824:2A)
="? Des(r&"e t)e ma()&%e str*(t*re' =H? (R')8Mn8N87: P18n824)
(OR)
28 Des(r&"e t)e -eat*res - ma()&%e/&%+epe%+e%t assem"#er' (R')8Mn8N811: P18n84@)
MAY 2012(ARREAR)
18 L&st *t a%+ +&s(*ss t)e ma()&%e +epe%+e%t assem"#er -eat*res' (R')8Mn8N810:
P18n8@E)
(OR)
28 ,r&eZy e2p#a&% a"*t assem"#er +es&g% pt&%s' (R')8Mn8N812: P18n871)
NOV 2012(REGULAR)
18 L&st *t a%+ +&s(*ss t)e ma()&%e &%+epe%+e%t assem"#er -eat*res' (R')8Mn8N811:
P18n84@)
(OR)
28 ,r&eZy e2p#a&% a"*t %e/pass assem"#er a%+ m*#t&/pass assem"#er' (R')8Mn8N812:
P18n871)
MAY 201@(ARREAR)
18 6)at &s t)e &mprta%t ma()&%e str*(t*res *se+ &% t)e +es&g% - system s-t.areI
D&s(*ss' (R')8Mn8N87: P18n824) (OR)
28 G&0e t. e2amp#e prgrams SIC perat&%s' (R')8Mn8N8C: P18n82E)
NOV 201@ (REGULAR)
18 E2p#a&% t)e s&mp#&5e+ &%str*(t&%a# (mp*ter =SIC? ar()&te(t*re &% +eta&#'
(R')8Mn8N87: P18n824)
(OR)
P a g e | HA LANGUAGE TRANSLATORS DEPARTMENT
OF CSE
SRI MANAKULA VINAYAGAR ENGINEERING COLLEGE
28 E2p#a&% t)e "as&( assem"#er -*%(t&%s a%+ t)e steps &% t)e +es&g% - a% assem"#er'
(R')8Mn8N8D: P18n8@1)
P a g e | H1 LANGUAGE TRANSLATORS DEPARTMENT
OF CSE