MP Solu
MP Solu
MP Solu
1a)
Machine language is a low-level language made up of binary numbers or bits that a
computer can understand. It is also known as machine code or object code and is
extremely tough to comprehend. The only language that the computer understands is
machine language.
1b)
Multiple interrupt is an interrupt event which can occur while the processor is handling a
previous interrupt. For example − A program receiving data from a communication line
and printing result there is a possibility for communication interrupt to occur while
printer interrupt being processed.
2a)
Direct (register)
MOV AL,BL
Copy one register into another. This is easy to understand. The simulator does not
support this command. If you have to copy from one register to another, use a RAM
location or the stack to achieve the move.
format:
MOV destination,source
MOV copies the data in the source to the destination. The data can be either a byte or a
word. Sometimes this has to be explicitly stated when the assembler cannot determine
from the operands whether a byte or word is being referenced.
Each of the possible values for the destination and source is called an address. From
the above table it becomes apparent that there are a number of different addressing
modes (immediate, register, memory).
___________________________________________________
The Memory Data Register (MDR) or Memory Buffer Register (MBR) is the register of a
computer's control unit that contains the data to be stored in the computer storage (e.g.
RAM), or the data after a fetch from the computer storage.
A memory buffer register (MBR) or memory data register (MDR) is the register in a
computer's processor, or central processing unit, CPU, that stores the data being
transferred to and from the immediate access storage. It contains the copy of
designated memory locations specified by the memory address register.
In a computer, the Memory Address Register (MAR) is the CPU register that either
stores the memory address from which data will be fetched from the CPU, or the
address to which data will be sent and stored. In other words, MAR holds the memory
location of data that needs to be accessed.
A processor register (CPU register) is one of a small set of data holding places that are
part of the computer processor. A register may hold an instruction, a storage address, or
any kind of data (such as a bit sequence or individual characters). Some instructions
specify registers as part of the instruction.
2b)
Display ‘*’ 10 times each in new line (Use NEW_LINE Macro)
newline macro
mov ah, 02
mov dl, 10
int 21h
mov dl, 13
endm
.model small
.stack 100h
.code
main proc
mov cx, 10
pt: mov ah, 02
mov dl, '*'
int 21h
newline
dec cx
jnz pt
mov ah, 4ch
int 21h
main endp
end main
OR
DATA SEGMENT
STR1 DB "ENTER YOUR STRING HERE ->$" Microprocessor and Assembly
Language
STR3 DB "YOUR STRING IS ->$"
STR2 DB 80 DUP("$")
NEWLINE DB 10,13,"$"
N DB 10
DATA ENDS
CODE SEGMENT
ASSUME DS:DATA,CS:CODE START:
MOV AX,DATA
MOV DS,AX
LEA SI,STR2
MOV CL,N
MOV AH,09H
LEA DX,STR1
INT 21H
MOV AH,0AH
MOV DX,SI
INT 21H
L1: MOV AH,09H
LEA DX,NEWLINE
INT 21H
MOV AH,09H
LEA DX,STR3
INT 21H
MOV AH,09H
LEA DX,STR2+2
INT 21H
LOOP L1
MOV AH,4CH
INT 21H
CODE ENDS
END START
2b)
3b)
The JMP instruction can be used for implementing loops. For example, the
following code snippet can be used for executing the loop-body 10 times.
mov( x, eax );
cmp( eax, y );
setl( bl );
// Store X<Y in bl.
mov( z, eax );
cmp( eax, t );
setg( bh );
// Store Z > T in bh.
and( bh, bl );
// Put (X<Y) && (Z>T) into bl.
mov( a, eax );
cmp( eax, b );
setne( bh );
// Store A != B into bh.
or( bh, bl );
// Put (X<Y) && (Z>T) || (A!=B) into bl
je SkipStmt1;
// Branch if result is false (OR sets Z-Flag if false).
3C)
While
ii)The reason is that offset ASC_TBL is calculated during translation - like being be
preprocessed- but, LEA is an actual processor instruction. you can't use the offset
instruction to get the addresses that aren't known before the compilation time.
The lea instruction places the address specified by its first operand into the register
specified by its second operand. Note, the contents of the memory location are not
loaded, only the effective address is computed and placed into the register.
While
iii)The NOT instruction implements the bitwise NOT operation. NOT operation reverses
the bits in an operand. The operand could be either in a register or in the memory.
While
NEG Changes the arithmetic sign of the contents of a general-purpose register and
places the result in another general-purpose register.
4b)
INT 21H will generate the software interrupt 0x21 (33 in decimal), causing the function
pointed to by the 34th vector in the interrupt table to be executed, which is typically an
MS-DOS API call.
4c)
Isolated I/O uses separate memory 01 Memory mapped I/O uses memory
space. from the main memory.
The addresses for Isolated I/O 03 Memory mapped I/O devices are
devices are called ports. treated as memory locations on
the memory map.
IORC & IOWC signals expands the 04 IORC & IOWC signals has no
circuitry. functions in this case which
reduces the circuitry.
5a)
1. Since microprocessor is writing to the OUTPUT device the signal DT/R should be
high. It is because data transmission is taking place. This is indicated by pulling the
signal high after first clock cycle. During first clock cycle address of corresponding
output device will be latched. This is indicated by the ALE signal high during first clock
cycle.
2. Based on the output device M/IO signal also needs to be activated. If writing to IO
device it should be 0 and is indicated by pulling the signal down or if it is to memory
then pull it up
5c)
6a)
Cores 1 1 1
Functional Units 4 6 9
Pipeline stages 3 3 5
Cache on chip 0 0 8 KB
6c)
80286 and up: IOPL (I/O privilege level) : It holds the privilege level at which your code
must be running in order to execute any I/O-related instructions.
NT – Nested task flag (bit D14) – When set, it indicates that one system task has
invoked another through a CALL instruction as opposed to a JMP. For multitasking this
can be manipulated to our advantage
7b)
Architecture of 80386
(i)80386 Microprocessor is a 32-bit processor that holds the ability to carry out 32-bit
operations in one cycle. It has a data and address bus of 32-bit each. Thus has the
ability to address 4 GB (or 232) of physical memory.
(a) Central processing unit, (b) Memory management unit, (c)Bus interface unit
(iii)The Memory management unit consist of a Segmentation unit and a Paging out.
(v)The Paging unit organizes the physical memory in terms of pages of 4kbytes size
each.
(v)The Segmentation unit provides a 4 level protection mechanism for protecting and
isolating the system code and data from those of the application program.
The memory management unit in Pentium is upward compatible with the 80386 and
80486 microprocessors. The linear address space for Pentium microprocessor is 4G
bytes that means from 0 to (232 – 1).
MMU translates the Virtual Address to Physical address in less than a single clock cycle
for a “HIT” and also it minimizes the cache fetch time for a “MISS”. CPU generates
logical address which are given to segmentation unit which produces linear address
which are then given to paging unit and thus paging unit generates physical address in
main memory. Hence, paging and segmentation units are sub forms of MMUs.
Pentium can run in both modes i.e. real or protected. Real mode does not allow
multi-tasking as there is no protection for one process to interfere with another whereas
in protected mode, each process runs in a separate code segment. Segments have
different privilege levels preventing the lower privilege process (such as an application)
to run a higher privilege one (e.g. Operating system). Pentium running in Protected
mode supports both segmentation and segmentation with paging.
Segmentation: Pentium
This process helps in dividing programs into logical blocks and then placing them in
different memory areas. This makes it possible to regulate access to critical sections of
the application and help identify bugs during the development process. It includes
several features like to define the exact location and size of each segment in memory
and set a specific privilege level to a segment which protects its content from
unauthorized access. [6]
Segment registers are now called segment selectors because they do not map directly
to a physical address but point to an entry of the descriptor table.
Pentium CPU has six 16 bit segment registers called SELECTORS. The logical address
consists of 16 bit of segment size and 32 bit offset. The below figure shows a
multi-segment model which uses the full capabilities of the segmentation mechanism to
provide hardware enforced protection of code, data structures, and programs and tasks.
This is supported by IA-32 architecture. Here, each program is given its own table of
segment descriptors and its own segments.
7C)
MyMacro2 MACRO
LOCAL label1,
label2
CMP AX, 2
JE label1
CMP AX, 3
JE label2
label1:
INC AX
label2:
ADD AX, 2
ENDM
ORG 100h
MyMacro2
MyMacro2
RET
CODE SEGMENT ASSUME CS:CODE FACT MACRO MOV BX,AX DEC BX BACK:
MUL BX DEC BX JNZ BACK ENDM START: MOV AX,7 FACT MOV AH,4CH INT
21H CODE ENDS END START
8a)
A thread is a basic unit of CPU utilization, consisting of a program counter, a stack, and
a set of registers, ( and a thread ID. ) Traditional ( heavyweight ) processes have a
single thread of control - There is one program counter, and one sequence of
instructions that can be carried out at any given time.
TurboMode (TM) is a form of dynamic voltage frequency scaling (DVFS). Unlike prior
applications of DVFS which de- crease CPU clock frequency and voltage to save power,
TM oper- ates in the opposite direction. Namely, TM increases CPU clock frequency in
the active cores when a multi-core processor has idle resources.
8b)
The Core i3 range is entirely dual core, while Core i5 and i7 processors have four
cores.It is difficult for an application to take advantage of the multicore system. Each
core is effectively its own processor – your PC would still work (slowly) with just one
core enabled.
19/20
1a)
A single processor system contains only one processor. So only one
process can be executed at a time and then the process is selected from
the ready queue. Most general purpose computers contain the single
processor systems as they are commonly in use.
A multicore processor is an integrated circuit that has two or more
processor cores attached for enhanced performance and reduced power
consumption. These processors also enable more efficient simultaneous
processing of multiple tasks, such as with parallel processing and
multithreading.
1b)
Got it
1c)
The DUP operator is very often used in the declaration of arrays This
operator works with any of the data allocation directives. the count value
sets the number of times to repeat all values within the parentheses.
For example, the statement allocates the integer value 1 five times for a total of 5 bytes.:
The following examples show various ways for allocating data elements with the DUP operator:
2a)
2a
2b)
4a
2c)
3A)
The 8086 has four special segment registers: cs, ds, es, and ss. These stand for Code
Seg- ment, Data Segment, Extra Segment, and Stack Segment, respectively. These
registers are all 16 bits wide. They deal with selecting blocks (segments) of main
memory.
3c)
3c
4a)
Timing diagram\
4b)
4b
4c)
4c
4. It can occur at any time and moment. Here the CPU polls the system at
some particular intervals.
5a)
5b)
6c
6c)
7a)
A segmented memory model divides the system memory into groups of independent
segments referenced by pointers located in the segment registers. Each segment is
used to contain a specific type of data.
In 8086 microprocessor memory are divided into four parts which is known as the
segments. These segments are data segment, code segment, stack segment and extra
segment.
7b)
The program counter (PC) is a register that manages the memory address of the
instruction to be executed next. The address specified by the PC will be + n (+1 for a
1-word instruction and +2 for a 2-word instruction) each time one instruction is
executed.
7c)
Got it
8a)
Real mode, also called real address mode, is an operating mode of all x86-compatible
CPUs. The mode gets its name from the fact that addresses in real mode always
correspond to real locations in memory.
Protected mode is a mode of program operation in a computer with an Intel-based
microprocessor in which the program is restricted to addressing a specific contiguous
area of 640 kilobytes. Intel's original PC microprocessor, the 8088, provided a one
megabyte (1 Mbyte) random access memory (RAM).
In the 80386 microprocessor and later, virtual 8086 mode (also called virtual real mode,
V86-mode, or VM86) allows the execution of real mode applications that are incapable
of running directly in protected mode while the processor is running a protected mode
operating system.
8b)
The 80386DX Intel processor has a 32-bit external bus and a 32-bit address bus.
Memory access is faster with the DX Intel processor. The SX takes two fetches to get a
piece of memory, whereas the DX takes only one fetch. Also, the SX is limited to 16MB
of addressable memory, while the DX may have as much as 4GB.
8c)
2020
2C)
3B)