0% found this document useful (0 votes)
53 views

Org 100h Mov Al, 5 Bin 00000101b Mov BL, 10 Bin 00001010b 5 + 10 15 (Decimal) or Hex 0Fh or Bin 00001111b Add Al, BL Ret

The document contains 5 programs written in assembly language to perform arithmetic operations like addition, subtraction using registers like AX and BX. The programs are run in a simulator to observe the values in registers before and after operations. Addition and subtraction results are stored in the AX register. Hexadecimal notation is used while addressing memory for ease of reading compared to binary.

Uploaded by

Manaal Azfar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

Org 100h Mov Al, 5 Bin 00000101b Mov BL, 10 Bin 00001010b 5 + 10 15 (Decimal) or Hex 0Fh or Bin 00001111b Add Al, BL Ret

The document contains 5 programs written in assembly language to perform arithmetic operations like addition, subtraction using registers like AX and BX. The programs are run in a simulator to observe the values in registers before and after operations. Addition and subtraction results are stored in the AX register. Hexadecimal notation is used while addressing memory for ease of reading compared to binary.

Uploaded by

Manaal Azfar
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 5

CEL-221 Lab Manual Computer Architecture and Organization

LAB 02
Write the following code in the text editor

Program 01:

org 100h

mov al, 5 ; bin=00000101b


mov bl, 10 ;bin=00001010b ;
5 + 10 = 15 (decimal) or
hex=0Fh or bin=00001111b add
al, bl

ret

Press the emulate button and single step the code.

Observe the values in the registers.

Register Value
AX 000F
BX 000A
CS 0700
IP 0106
Note the final values of registers in the following table
CEL-221 Lab Manual Computer Architecture and Organization

Program 02:

org 100h
mov al, 5 ; al = 5
add al, -3 ; al = 2
ret
Observe the values in the registers.

Note the final values of registers in the following table

Register Value
AX 0002
BX 0000
CS 0700
IP 0104

Program 03:

Org 100h
mov bl, 5 ; bl = 5
add bl, -3 ; bl = 2
ret
Observe the values in the registers.

Note the final values of registers in the following table


Register Value
AX 0000
BX 0002
CS 0700
IP 0105
CEL-221 Lab Manual Computer Architecture and Organization

Program 04:

Org 100h
mov al, 5
sub al, 1 ; al = 4
ret
Observe the values in the registers.

Note the final values of registers in the following table

Register Value
AX 0004
BX 0002
CS 0700
IP 0105

Program 05:

Org 100h
mov al, 7
mov bl, 4
sub al,bl
ret
Observe the values in the registers.

Note the final values of registers in the following table

Register Value
AX 0003
BX 0004
CS 0700
IP 0106
CEL-221 Lab Manual Computer Architecture and Organization

Where (in which register) is the result of addition stored?

Result of addition is stored in Ax register.

Why is the answer stored in the register you mentioned above?

Because it perform arithmetic operations (addition and subtraction).

Exercise:
1. Write a program to subtract two integer constants using SUB command.

Org 100h
mov bl, 10
sub bl, 6
ret

2. Differentiate between high-level and low-level language.

High Level Language:


High-Level Languages are easy to learn and understand. They are
executed slower than lower level languages because they require a translator program.
They allow much more abstraction. They do not provide many facilities at the
hardware level. For writing programs, hardware knowledge is not required. The
programs are easy to modify. A single statement may execute several instructions.

Low Level Language:


Low-Level Languages are challenging to learn and understand. They
execute with high speed. They allow little or no abstraction. They are very close to the
hardware and help to write a program at the hardware level. For writing programs,
hardware knowledge is necessary. Modifying programs is difficult. The statements
can be directly mapped to processor instructions.

3. What is meant by a one-to-many relationship when comparing a high-level


language to machine language?
In a one-to-many relationship, a single statement expands into multiple assembly
language or machine instructions.
CEL-221 Lab Manual Computer Architecture and Organization

4. What is the advantage of using Hexadecimal notation while addressing memory?

Computers convert binary data into the hexadecimal (hex) number system because it
is much less complex than converting data into decimal numbers, and it is much easier
for human beings to read hex numbers than to read binary numbers. This way, even
though the actual processing and inner workings of computers use the binary system,
they often display information using the hex system.

5. Explain the concept of portability as it applies to programming languages.

A language whose source programs can be compiled and run on a wide variety of
computer systems is said to be portable. Portability, in relation to software, is a
measure of how easily an application can be transferred from one computer
environment to another, it also refers to the ability of an application to move across
environments, not just across platforms (operating system and computer hardware
only). Some programming languages are fairly portable, for example the C language.

6. Is the assembly language for x86 processors the same as those for computer
systems such as the Vax or Motorola 68x00?

No. Each assembly language is based on either a processor family or a specific


computer.

You might also like