Assembly Language Programming: An Example of Arithmetic Operations - Prof. M. Ali, Study notes of Operating Systems

An example of assembly language programming for performing arithmetic operations, specifically adding and subtracting variables a, b, c, and d. The code is presented in both assembly language and machine language, allowing for a better understanding of the underlying instructions.

Typology: Study notes

Pre 2010

Uploaded on 02/13/2009

koofers-user-kjb
koofers-user-kjb ๐Ÿ‡บ๐Ÿ‡ธ

10 documents

1 / 31

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
๎˜๎˜‚๎˜ƒ๎˜„๎˜…๎˜†๎˜‡๎˜ˆ๎˜‰
๎˜๎˜Š๎˜‹๎˜„๎˜Œ๎˜…๎˜†๎˜‡๎˜ˆ๎˜๎˜‡๎˜Ž๎˜ƒ๎˜๎˜๎˜‘๎˜ƒ๎˜…๎˜๎˜Š๎˜
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c
pf1d
pf1e
pf1f

Partial preview of the text

Download Assembly Language Programming: An Example of Arithmetic Operations - Prof. M. Ali and more Study notes Operating Systems in PDF only on Docsity!

^

^  

 ^



^

int a,

b, c,

d;

Source.. .a = b + c;d = a - 100;

; Code

for a = b + cload^

R3,b load^

R4,c add^

R3,R

store

R3,a

Assembly Language^ ;^ Code

for d = a - 100load^

R4,=

subtract

R3,R

store

R3,d

^  

 

  ^

 



^ 

^  

^

^

^ &

"^ 

^

^ .

^ &

^ /)

Data^ might be fetched as a result of execution

^  

 ^

0

  ^





 

^ 

1   ^1    !

^23

^ 

^ &#

^  

 ^

9

^1

:

^ 

 



^ ""

^2 " 

^2 " 

^8 "!

^  

^  

 ^

<

 

^





=#

"

int a,

b, c,

d;

Source.. .a = b + c;d = a - 100;

; Code

for a = b + cload^

R3,b load^

R4,c add^

R3,R

store

R3,a

Assembly Language^ ;^ Code

for d = a - 100load^

R4,=

subtract

R3,R

store

R3,d

^  

 ^

B

.

C /

)

%!

^  

 ^

BB

$

 D

^ * ,

^ "

%"^

$^  E

^4

^  ^ !

^  

 ^

B

^

%



^

^  

 ^

B

^

%



^ 

^ ^

^ ^8

=^

^ &^8

=^

^ &

=^

^ 

2^8

^  

 ^

B^5

&# 

&#

 

 !! ^    

2 ^   !! &#

^  

 ^

B^9

&#  

 !! 

,

!

"



&#

2 ^2

^  

 ^

B?

&#  

 !! 

^ &#

 ^

write

Prints info

^  

 ^



&# &

#





^ ^

^

^ 

^ 

 ^

 ^

OS could provide higher leveloperations to application than theone Driver presents to it