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

Practical Final

1. The document explains assembly language programming concepts like assembling code from symbolic to object code, unassembling from object to symbolic code, displaying memory contents, entering data into memory, and executing programs. It provides examples of assembly language instructions and how they manipulate data in registers and memory. 2. The document contains sample assembly language programs that demonstrate performing arithmetic operations like addition and subtraction on data in registers, as well as using address registers and segment:offset addressing to access memory locations. 3. Key concepts discussed include the object code format, general purpose and address registers, segment:offset addressing, and how data is stored and accessed in memory in reverse byte order compared to registers.

Uploaded by

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

Practical Final

1. The document explains assembly language programming concepts like assembling code from symbolic to object code, unassembling from object to symbolic code, displaying memory contents, entering data into memory, and executing programs. It provides examples of assembly language instructions and how they manipulate data in registers and memory. 2. The document contains sample assembly language programs that demonstrate performing arithmetic operations like addition and subtraction on data in registers, as well as using address registers and segment:offset addressing to access memory locations. 3. Key concepts discussed include the object code format, general purpose and address registers, segment:offset addressing, and how data is stored and accessed in memory in reverse byte order compared to registers.

Uploaded by

June
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

Q1

A 100 Assemble(Convert symbolic code[code with


opcode,eg…MOV , ADD , SUB , etc] to object
code (Hex) from code segment (CS),starts
from offset address(IP) 0100h

073F:0100 Segment:Offset address


=address registers
=CS:IP
(2 bytes for each)

MOV CL,42 Symbolic code


CL=42h(0100 0010b) = 1byte

MOV DL,2A DL=2Ah

ADD CL,DL CL = CL+DL → CL=42h+2A→CL=6Ch

JMP 100 IP = 0100h

Q1(a)
U 100,107 Unassemble(Convert object code to symbolic
code) from code segment(CS) starts from
offset address(IP) 0100h until 0107h(for a
total 0f 8 bytes)

B142 Object code (hex)


B142 =B142h
= B1h 42h
Address= 0100h 0101h
Therefore,next address(IP) is 01012h
In another words,
Next IP=Current IP + length of instruction
= 0100h + 2 bytes
=0102h
Q1(b)

D CS:100 Display the content of memory,from code


segment (CS) , start from offset address
(IP),0100h.
It displays a total of 128 bytes(8 rows * 16
bytes)

B1..00 Object code(hex)


B1h = 1011 0001b = 1 byte (memory stores
data byte-by-bytes basis)
Object code B1h is stored in offset
address(IP) 0100h

.B.* …….. ASCII code (standard alpha numeric code)


that available for I/O operation.
Eg: When user press “B” (ASCII code) from
keyboard , computer receive 42h (object
code) which is equivalent to 0100 0010b
(machine code)

Q1(c)

E CS:100 A1 00 02 03 06 02 02 Same as E CS:100 A1,00,02,03,06,02,02


Means:enter the content ( object code) to
memory in code segment (CS) starts from
outset address (IP) 0100h
Object codes entered are:
A1h,00h,02h,03h,06h,02h,02h for a total of 7
bytes
A1h stores in IP = 0100h
06h stores in IP = 0104h

Q1(d)

MOV AX,[0200] [ ] = content of


0200 in [ ] = address
[0200] content of address 0200h

AX = content of memory address 0200h

Because memory stores data in reversed


byte sequence , therefore the object code of
this instruction show A10002h.(0200h has
been stored as 0002h.)

ADD AX,[0202] AX=AX+[0202h]


=content of memory address 0200h + content
of memory address 0202h

Q2

A 100 AX = 0123h
MOV AX,0123 AX = AX+0025h → AX=0123h+0025h → AX
ADD AX,0025 = 0148h
MOV BX,AX BX = BX+AX → BX = 0148h+0148h → BX =
ADD BX,AX 0290h
MOV CX,BX CX = BX = 0290h
SUB CX,AX CX = CX - AX → CX = 0290h-0148h → CX =
SUB AX,AX 0148h
JMP 100 AX = AX - AX → 0148h-0148h → AX = 000h
IP 0100h

(b)
( c ) P = 100,8
Do program execution,from code segment (CS) starts from offset address(IP) 0100h,for a total
of 8 instructions.
The “P” command is used when the user only wanted to view the final result (because the
details working might too long to display on 1 windows and no scrolling is allowed)
NOTE : JMP 100 is the last instruction

General purpose registers AX,BX,CX,DX (2bytes)


Eg: AX = AH & AL
H = higher byte
L = lower byte

Address registers SP,BP<SL,DI,DS,ES,SS,CS,IP(2bytes)

Segment:offset address NV UP EI PL NZ NA PO NC

Object code(hex) B82301 → 3bytes


Stores in memory IP=IP+length of instruction
=0100h + 3bytes
=0103h

Symbolic code MOV AX,0123

For data :0123h


In memory, it is stored as 2301h(reserved
byte sequence)
In register , it is stored as 0123h(normal byte
sequence)
3. (a)

(b)

(c)

4.
(a)
MOV AL,05 AL = 05h
MOV BL,10 BL = 10h
MUL BL AX=AL*BL→AX=05h*10h→AX=0050h
JMP 100 IP=0100h
4b

4c
5(Bitwise Logical operation = logicgate

C
D

You might also like