Mit Ii
Mit Ii
Interrupt Structure
Interrupt Vector Table (IVT)
ISR
Hardware and software Interrupts
Internals of DOS
DOS loading
DOS memory map
Internal and external commands of DOS
BIOS & DOS Interrupts
Concepts of PSP, .EXE & .COM files
Concepts of TSR
8259 (Programmable Interrupt Controller): Features,
Block Diagram, Control & status registers, Interfacing &
Programming
Computer Memory & Memory Mapping in 64 Bit
Interrupts
An interrupt refers to the change in
state of the CPU as a result of a
condition which is external to the
system or within the system.
The terms exception, trap, supervisor
call, system call are the synonyms of
the term interrupt.
Interrupts
Device tells the CPU that is ready with/for
data or needs service by interrupting the CPU
Intelligence is moved to the device
Device informs the CPU when it needs
service
Which is better/faster?
Classification I
Interrupts can be broadly categorized
into 3 groups:
1.External Hardware Interrupts
2.Internal Hardware Interrupts
3.Software Interrupts (INT
instruction)
Classification II
(Based On The Source Of
Interrupt)
1.Hardware Interrupts
2.Exception Interrupts
3.Software Interrupts
The interrupts can be again categorized as
maskable interrupts and non-maskable
interrupts.
Maskable interrupts can be enabled or disabled
using program instructions such as STI or CTI.
The signal on INTR line of 8086 is an example
of maskable interrupt.
The non-maskable interrupts can never be
disabled. Ex: NMI
Hardware Interrupts
Generated from an external signal applied to
NMI line or INTR input line of 8086.
The interrupt on INTR line can be disabled by
clearing the interrupt flag (IF) in the flag
register , i.e., if the IF is cleared CPU does not
respond to the signal on the INTR line.
CPU have an instruction to disable the
interrupts when a section of the code has to
run without being disturbed by external events.
Hence , most CPUs also have a special
interrupt called a Non- maskable interrupt
(NMI),which is serviced even when all the other
interrupts are disabled.
The NMI is used to signal emergencies such as
memory failure or power failure.
Exception Interrupt
A signal from some condition generated
in the 8086 by the execution of an
instruction.
Ex: Divide by zero interrupt
An attempt to perform division by zero
will automatically interrupt the
execution of the program.
Other examples: Divide overflow , An
illegal memory reference
Software Interrupts
Treated like hardware interrupts,
except that they are never disabled.
Use to implement the system call or
service instead of calling the
processor directly.
Example : Execution of Interrupt
instruction INT.
Interrupt Actions
The microprocessor checks to see if
any interrupt has been requested at
the end of each instruction cycle .
If the interrupt signal is sensed and
interrupt flag is set or the interrupt is
NMI , then 8086 performs ..
Interrupt Actions
Following are the actions initiated on the occurrence
of an interrupt:
1. Decrements the stack pointer by 2 and saves the flag register
onto the stack.[SP
SP 2; [SP]
flags ]
2. Clears the interrupt flag in the flag register to disable the INTR
interrupt. [IF
0]
3. Clears the trap flag in the flag register to stop generation of
the single step interrupt. [TF
0]
4. Decrement the stack pointer by 2 and saves the code segment
register onto the stack. [SP
SP 2; [SP]
CS]
5. Loads the code segment register with the segment address of
the interrupt service routine(ISR).[CS
segment of ISR ]
6. Decrement the stack pointer by 2 again and saves the
instruction pointer onto the stack. [SP
SP 2; [SP]
IP]
7. Loads instruction pointer with the offset address of the
interrupt service routine in the code segment of the ISR.[IP
offset of ISR]
NMI /
INTR
/ INT
N
Push Flags
Clear IF,TF
Push CS
Push IP
Fetch ISR
Address;
CS = 0000:
[N*4]
IP = 0000:
[N*4+2]
Interrupt Service
Procedure
Push Registers
ISR Body
POP IP
POP CS
POP Flags
Pop Registers
IRET
Fig: An Overview of
servicing of interrupt by
microprocessor
Current
program
execution
Interruptio
n
Push
flags,
return
address
Decode
the
interrupt
Duration
of ISR
execution
Execution
resumes
here
Points
to IVT
Interrupt
processing
Control
returns
Pop
return
addres
s and
flags
Execut
e ISR
Get
addres
s of ISR
Interrupt Priorities
Interrupt
Priority
Highest
NMI
INTR
Single Step
Lowest
SKIP
The most common method of servicing such devices
is the Polled approach.
This is where the processor must test each device in
sequence and in effect ``ask'' each one if it needs
servicing.
It is easy to see that a large portion of the main
program is looping through this continuous polling
cycle and that such a method would have a serious
detrimental effect on system throughput, thus
limiting the tasks that could
be assumed by the microcomputer and reducing
the cost effectiveness of using such devices.
SKIP
A more desirable method would be one that would
allow the microprocessor to be executing its main
program and only stop to service peripheral
devices when it is told to do so by the device itself.
In effect, the method would provide an external
asynchronous input that would inform the
processor that it should complete whatever
instruction that is currently being executed and
fetch a new routine that will service the requesting
device.
Once this servicing is complete, however, the
processor would resume exactly where it left off.
SKIP
This method is called Interrupt .
It is easy to see that system
throughput would drastically
increase, and thus more tasks could
be assumed by the microcomputer to
further enhance its cost
effectiveness.
SKIP
The Programmable Interrupt Controller
(PIC) functions as an overall manager in an
Interrupt-Driven system environment.
It accepts requests from the peripheral
equipment, determines which of the
incoming requests is of the highest
importance (priority), determines whether
the incoming request has a higher priority
value than the level currently being
serviced, and issues an interrupt to the
CPU based on this determination.
SKIP
Each peripheral device or structure usually has a
special program or ``routine'' that is associated
with its specific functional or operational
requirements; this is referred to as a ``service
routine''.
The PIC, after issuing an Interrupt to the CPU,
must somehow input information into the CPU
that can ``point'' the Program Counter to the
service routine associated with the requesting
device. This ``pointer'' is an address in a
vectoring table and will often be referred
to, in this document, as vectoring data
SKIP
Programmable Interrupt
Controller 8259A
Interrupts can be used for a variety of
applications.
Each of these interrupt applications requires a
separate interrupt input.
If we are working with 8086, we get only 2
inputs INTR and NMI.
For applications where we have multiple
interrupt sources, we use external device
called a priority interrupt controller [PIC] to
funnel the interrupt signals into a single
interrupt input on the processor.
Features Of 8259A
8 levels of interrupts.
Can be cascaded in master-slave configuration to handle
64 levels of interrupts.
Internal priority resolver.
Fixed priority mode and rotating priority mode.
Individually maskable interrupts.
Modes and masks can be changed dynamically.
Accepts IRQ, determines priority, checks whether incoming
priority > current level being serviced, issues interrupt
signal.
In 8085 mode, provides 3 byte CALL instruction. In 8086
mode, provides 8 bit vector number.
Polled and vectored mode.
Starting address of ISR or vector number is programmable.
No clock required.
Architecture Of 8259A
3.Priority Resolver
This unit determines the priorities of the
interrupt requests appearing simultaneously.
The highest priority is selected and stored
into the corresponding bit of ISR during INTA#
pulse.
The IR0 has the highest priority while the IR 7
has the lowest one, in fixed priority mode.
The priorities may be altered by
programming the 8259A in rotating priority
mode.
8.Cascade Buffer /
Comparator
This block stores
and compares the IDs of
all the 8259As used in the system.
3 I /O pins CAS 0-2 are outputs when the
8259A is used as a master.
The same pins act as inputs when the
8259A is in slave mode.
The 8259A in master mode sends the ID of
the interrupting slave device on these
pins.
The slave thus selected, will send its
preprogrammed vector address on the
data bus during the next INTA# pulse.
Functional Description Of
8259 Signals
6.SP# / EN#
Slave Program / Enable Buffer
Dual purpose pin
When the chip is used in buffered
mode, it can be used as an output to
control buffer transreceivers (EN).
If not in buffered mode it is used as
input to designate whether the chip is
used as:
a master (SP= 1) or a slave (EN = 0).
7.INT
This pin goes high whenever a valid
interrupt request is asserted.
This is used to interrupt the CPU and
is connected to the interrupt input of
CPU.
8.IR0 IR7
Interrupt Requests
These pins act as inputs to accept
interrupt requests to the CPU.
In edge triggered mode, an interrupt
service is requested by raising an IR
pin from a low to a high state and
holding it high until it is acknowledged,
just by latching it to high level, if used
in level triggered mode.
9.INTA#
Interrupt Acknowledge
This pin is an input used to strobe
in 8259A interrupt vector data on to
the data bus.
In conjunction with CS# , WR# , and
RD# pins , this selects the different
operations like, writing command
words, reading status words.
Interfacing Technique
Either Polling Or Interrupt Driven
8259A
AD0
D0
IR0
D7
INTA#
IR7
INT
AD0
AD7
INTR
INTA#
Interrupt
Input
D7
A7
D6
D5
D4
D3
D2
A6
A5
LTI
M
ADI
D1
D0
SN
GL
IC4
A7 A5 of interrupt
vector address
MCs 80/85 modes
only
1 = ICW4 needed
0 = No ICW4 needed
1 Single
0 Cascaded
1 Level Triggered
0 Edge Triggered
Dont Care
Initialization Sequence
ICW2
In 8086 based system A15 - A11 of the
interrupt vector address are inserted
in place of T7 - T3 respectively.
The remaining 3 bits (A8,A9, A10) are
selected depending upon the
interrupt level, i.e. from 000 to 111
for IR0 to IR7.
D7
D6
D5
D4
D3
D2
D1
D0
T7
T6 T5 T4 T3 A1 A9 A8
0
Note
Compulsory command words in
ICW3
ICW3 is read only when there are more
than one 8259As is in the system , i .e .
cascading is used (SNGL = 0).
The SNGL bit in ICW1 indicates whether
the 8259A is in cascade mode or not.
The ICW3 loads an 8-bit slave register.
D7
D6
D5
D4
D3
D2
D1
D0
1 S7 S6 S5 S4 S3 S2 S1 S0
Sn = 1 -- IRn Input has a slave
= 0 IRn Input does not have a
slave
D7
D6
D5
D4
D3
D2
D1
D0
ID ID ID
2 1 0
or slave 1 to slave 8
ICW4
The use of this command word
depends on the IC4 bit of ICW1.
If IC4=1, ICW4 is used, otherwise it is
neglected.
ICW4
A0
1
D7
0
D6
0
D5
0
D4
SFN
M
1
=
0
Normal EOI
=D2ModeD1
D3
D0
BUF M/S AEO P
I
M
1
=
1
=
8086 / 8088
Mode
0
=
0
=
MCS 80 / 85
Mode
ICW4
The bit functions of ICW4 :
1.SFNM:
Special fully nested mode is selected.
If BUF = 1, the buffered mode is selected.
In the buffered mode, SP/EN acts as enable
output and the master/slave is determined
using the M/S bit of ICW4.
2. M/S:
ICW4
3. AEOI:
If AEOI = 1, the automatic end of
interrupt mode is selected.
4.PM :
If the PM bit is 0, the MCS-85 system
operation is selected.
If PM=1, 8086/88 operation is
selected.
Operation Command
Words
Once 8259A is initialized using the command
words for initialization , it is ready for its normal
function
The chip 8259A is ready to accept interrupt
requests at its input lines.
8259A has its own way of handling the received
interrupts called as modes of operation.
These modes of operations can be selected by
programming.
Writing 3 internal registers called as
operation command word registers.
OCWs
The data written into the operation
command word registers (bit pattern) is
called as operational command words.
OCW1
A0
1
D7
M7
D6
M6
D5
M5
D4
M4
D3
M3
D2
M2
D1
M1
D0
M0
1 Mask Set
0 Mask Reset
OCW2
In OCW
OCW2
A0 D7 D6 D5
D4
D3
1 R
S E
L OI
D2
L2
D1
L1
D0
L0
IR NO.
NO OPERATION
0 12 3 4 5 6 7
0 1 0 1 0 1 0 1
0 0 1 1 0 0 1 1
0 0 0 0 1 1 1 1
OCW3
In operation command word 3 (OCW 3), if
the ESMM bit, i.e. enable special mask
mode bit is set to 1, the SMM bit is enabled
to select or mask the special mask mode.
When ESMM bit is 0 the SMM bit is
neglected.
If the SMM bit, i.e. special mask mode bit
is 1, the 8259A will enter special mask
mode provided ESMM=1.
OCW3
ESMM : Enable Special Mask Mode.
When ESMM =1 it enables the SMM
bit to set or reset the Special Mask
Mode.
When ESMM = 0 the SMM bit becomes
a don't care .
OCW3
SMM: Special Mask Mode
If ESMM = 1 and SMM = 1 the 8259A
will enter Special Mask Mode.
If ESMM = 1 and SMM = 0 the 8259A
will revert to normal mask mode.
When ESMM = 0, SMM has no effect.
OCW3
A0
D7
D6
D5
ESM SMM
M
0
Reset Special
Mask
Set Special
Mask
No Action
D4
1 Poll
Command
0 No Poll
Command
D3
D2
D1
D0
RR
RIS
No
Action
Read IRR on
next RD# pulse
Read ISR on
next RD# pulse
OCW3
If ESMM=1 and SMM=0, the 8259A
will return to the normal mask mode.
3.Automatic Rotation
This is used in the applications where all
the interrupting devices are of equal
priority.
In this mode, an interrupt request IR level
receives lowest priority after it is served
while the next device to be served gets
the highest priority in sequence.
Once all the device are served like this,
the first device again receives highest
priority.
5.Specific Rotation
In this mode a bottom priority level
can be selected, using L2, L1 and L0
in OCW2 and R=1, SL=1, EOI=0.
The selected bottom priority fixes
other priorities.
5.Specific Rotation
If IR5 is selected as a bottom priority,
then IR5 will have least priority and
IR4 will have a next higher priority.
Thus IR6 will have the highest priority.
These priorities can be changed
during an EOI command by
programming the rotate on specific
EOI command in OCW2.
9.Poll Command
In polled mode of operation, the INT output of
8259A is neglected, though it functions
normally, by not connecting INT output or by
masking INT input of the microprocessor.
The poll mode is entered by setting P=1 in
OCW3.
The 8259A is polled by using software
execution by microprocessor instead of the
requests on INT input.
The 8259A treats the next RD# pulse to the
D7
D6
D5
D4
D3
D2
D1
D0
8259A
as
interrupt
I
X an X
X
Xacknowledge.
W2
W1
W0
If = 1, there is an
interrupt
Binary code
of highest
priority level
9.Poll Command
An appropriate ISR bit is set, if there is a
request.
The priority level is read and a data word is
placed on to data bus, after RD# is
activated.
A poll command may give more than 64
priority levels.
[This has nothing to do with the 8086
interrupt structure and the interrupt
priorities.]
11.Buffered Mode
When the 83259A is used in the
systems where bus driving buffers
are used on data buses.
The problem of enabling the buffers
exists. The 8259A sends buffer
enable signal on SP/ EN pin,
whenever data is placed on the bus.
12.Cascade Mode
The 8259A can be connected in a system
containing one master and eight slaves
(maximum) to handle up to 64 priority levels.
The master controls the slaves using CAS0CAS2 which act as chip select inputs
(encoded) for slaves.
In this mode, the slave INT outputs are
connected with master IR inputs.
When a slave request line is activated and
acknowledged, the master will enable the
slave to release the vector address during
second pulse of INTA sequence.
12.Cascade Mode
The cascade lines are normally low and contain
slave address codes from the trailing edge of
the first INTA pulse to the trailing edge of the
second INTA pulse.
Each 8259A in the system must be separately
initialized and programmed to work in different
modes.
The EOI command must be issued twice, one for
master and the other for the slave.
A separate address decoder is used to activate
the chip select line of each 8259A.
INTERRUPT SEQUENCE
OUTPUTS
MCS-80, MCS-85
This sequence is timed by three INTA
pulses.
During the first INTA# pulse the CALL
opcode is enabled onto the data bus.
8086, 8088
8086 mode is similar to MCS-80 mode
except that only two Interrupt Acknowledge
cycles are issued by the processor and no
CALL opcode is sent to the processor.
The first interrupt acknowledge cycle is
similar to that of MCS-80, 85 systems in
that the 8259A uses it to internally freeze
the state of the interrupts for priority
resolution and as a master it issues the
interrupt code on the cascade lines at the
end of the INTA pulse.
D7
D6
D5
D4
D3
D2
D1
D0
Always
set to 0
always
set to 1
ICW1 = 1F
ICW4 needed
Single 8259A
Call address
interval of 4
Level
triggered
mode
ICW2
T7
T6
T5
T4
T3
A10
A9
A8
= 83 H
IR3 Selected
A0
D7
D6
D5
D4
D3
D2
D1
D0
ICW3= 0 0H
Actually ICW3 is not at all needed, because in ICW1 the 8259A is set for single
mode.
The ICW4 should be set as shown below:
A0
D7
D6
D5
D4
D3
D2
D1
D0
ICW4= 0 1H
For 8086 system
Normal EOI
D7
D6
D5
D4
D3
D2
D1
D0
OCW1 = 40H
IR6 masked
The OCW2 sets the modes and rotating priority as shown below:
A0 D7 D6 D5 D4 D3 D2 D1 D0 OCW2 = E4H
0
0
Bottom Priority
Level set at IR4
The OCW3 sets the special mask mode and reads ISR and IRR using the following
control words.
For reading IRR:
A0
D7
D6
D5
D4
D3
D2
D1
D0
Special
mask mode
Read IRR
No Poll
OCW3 = 6AH
A0
D7
D6
D5
D4
D3
D2
D1
D0
OCW3 = 6BH
Read
ISR
DOS
BIOS Module
MS-DOS kernel communicates with these
device drivers through I/O request packets
Then translate the drivers these requests into
proper commands for the various hardware
controllers.
Most primitive parts of hardware drivers are
located in ROM so that they can be used by
stand-alone applications ,diagnostics , and the
system startup programs.
Resident drivers : drivers built into BIOS
Installable drivers: installed during system
initialization by DEVICE command in
Organization Of DOS
4 major components
1. IO.SYS:
a.
b.
c.
2. MSDOS.SYS:
a.
b.
3. COMMAND.COM:
a.
b.
c.
4. Boot Sector
Map Of Conventional
Memory
640K
0K
Segments
Stack: Need to define an .EXE program with a
stack segment, whereas a .COM program
automatically generates a stack.
Data : An .EXE program usually defines a data
segment and initializes the DS register with the
address of that segment. Since the data for a
.COM program is defined within the code
segment, no need to define the data segment
either.
Code :An either .COM program combines the
PSP, stack , data segment, and code segment
into one code segment , in a maximum of 64K
bytes.
Initialization
When DOS loads a .COM program for execution ,
it automatically initializes all segment registers
with the address of PSP. Since the CS and DS
registers will contain the correct initial segment
address, the user program does not have to load
them.
Because addressing begins at an offset of 100H
bytes from the beginning of the PSP, code an
ORG directive as ORG 100H immediately
following the code SEGMENT or .CODE statement.
The ORG directive tells the assembler to begin
generating the object code at an offset of 100H
bytes past the start of the PSP, where the
actual .COM program begins.
00 01 H
02 03H
04 09H
Reserved by DOS
0A 0DH
0E 11H
12 15H
16 17H
Reserved by DOS
18 2BH
2C 2DH
2E 31H
Reserved by DOS
32 33H
34 37H
38 4FH
Reserved by DOS
50 51H
52 5BH
Reserved by DOS
5C 6BH
6C 7FH
80 FFH
SS:SP
CS: 0000H
DS:0000H
ES:0000H
SS:0000H
SS:SP
SS:0000H
CS:0100H
DS:0000H
ES:0000H
Data segment
Program code
Program segment prefix
File Handles
A file handle is simply a number that refers to
a specific device.
DOS delivers a file handle when you open a
file for input or create a file for output.
The operation involves the use of an ASCIIZ
string and DOS function 3CH or 3DH.
The file handle is a unique one-word number
returned in the AX that we save in a word data
item and use for all subsequent requests to
access file.
HANDLE DEVICE
01
Console
Keyboard (Standard
input)
01
Console
Keyboard (standard
output)
01
Console
00
COM1(Serial
port)
Auxiliary
ASCIIZ Strings
Tell DOS the address of an ASCIIZ string containing the
location of the file: disk drive, directory path, and
filename
All are optional and within apostrophes
Followed by a byte of hex zeros
So the name given
The max length of the string is 128bytes
The following code defines a drive and filename:
PATHNAM1 DB D:\Test.asm,00H
Interrupts
1. To Get the address of PSP:
mov ah,51h
int 21h
;Call DOS
mov ES,BX ; Save PSP address in ES
By determining the address of PSP, the data can
be accessed in order to process specified files or
to take special action.
DOS function 51H delivers to the BX register the
segment address of current PSP.
The above code gets address of PSP and stores
it in ES register.
INT 21H
; ASCIIZ string
; (0000-> NORMAL, 0001->READ
ONLY, 0002-> HIDDEN )
; Call DOS
DOS commands
Internal / External Commands
Internal Command
Internal Commands
External Commands
FORMAT
NEW DISKS MAY BE FORMATTED
ALREADY OR NOT
USING THE FORMAT COMMAND
INITIALIZES; BY WRITING CODE ON IT
TO ASSIGN TRACKS AND SECTORS
WHERE YOUR DATA WILL BE STORED.
FORMAT ERASES AND CHECKS OLD
DISKS FOR ERRORS
DIRECTORY
THE DIR COMMAND IS AN INTERNAL
DOS COMMAND USED TO LIST
CONTENT
DIR
DIR/W
DIR/P
COPY COMMAND
THE COPY COMMAND MAKES A
SECOND COPY OF A FILE ONTO
ANOTHER DESTINATION
IF YOU WANT TO COPY SOMETHING
FROM ONE DIRECTORY TO A DISK
YOU MUST BE IN THAT DIRECTORY
COPY DOES NOT ERASE THE
ORIGINAL
DEL OR ERASE
REMOVES DATA
WINDOWS 95 IS HELPFUL FOR THIS
ONCE ERASED , A FILE CANNOT BE
RECOVERD UNLESS USE A SPECIAL
UTILITY LIKE NORTON UTILITIES
TYPE
LIST OR TYPES THE CONTENTS OF A
FILE ON THE SCREEN
USEFUL FOR ; BAT, TXT,
MKDIR(MD), CHDIR(CD) ,
RMDIR(RD)
MD MAKES A DIRECTORY
CD CHANGES DIRECTORY
RD REMOVES A DIRECTORY
EXAMPLES
Batch Files
Text files that contain lists of other
intrinsic , extrinsic , or batch
commands.
These files are processed by a special
interpreter that is built into the
transient portion of COMMAND.COM.
The interpreter reads the batch file
one line at a time and carries out each
of the specified operations in order.
TSR Programs
It is a DOS program that on execution is
loaded in the memory and is resident in the
memory till it is removed or system is reboot.
Present in the memory even if not active
Other programs (transient) run and free the
memory block in use after completion or
system aborting them.
TSR performs the task in background
Many TSRs in memory at a time
Typically include clocks, calculators, screen
savers
TSR
While running another program in DOS , press the
present keyboard key or the combination of keys
and TSR program will pop up in view.
Can be loaded any time
Mostly no option for unloading so stay in memory
Active TSR: responds to a h/w interrupt e.g. pop up
programs
Passive TSR: activated in response to an explicit
call from an executing application program. They
contain a callable library of routines. They can also
extend some BIOS or DOS call. E.g. mouse driver.
b.All of above
d.iii & iv
d.4
c.Page table
d.
a.IF
b.Trap Flag
c.Direction Flag
d.All of above
a.Timer
b.Microcontroller
c.Microprocessor
d. Programmable Interrupt Controller
3.OCW3
4.
Answer Key
Q1
Q2
Q3
Q4
Q5
Q6
Q7
Q8
Q9
Q10
b
a
c
b
B
c
b
d
a
a
i7
Q1. Which of the following statement(s) is /
are true about the 64-bit RFLAGS register in
i7 ?
i.Lower 32-bits same as EFLAGS register
ii.Upper 32 bits are reserved
iii.Lower 32 bits are reserved
a.All of above
b.None of above
c.i only
d.i & ii
i7
Q2. Which of the following statement(s) is/
are true related to features of i7?
i.Nehalem microarchitecture support with QPI
ii.64 bit RIP
iii.On chip FPU
iv.8MB L3 cache shared by all 4 cores
a. None of above
b. i & ii
c. i ,ii, iv
d. all of
above
Instruction Set
Q3 the versions of REP instructions:
i.REPE , REPZ
ii.REPNE, REPNZ
a. i only
None
b. ii only
c. i & ii
d.
Instruction Set
Q4 Macro and Procedure
i.Like macro procedure expands at the
place of call in the program
ii.Like procedure macro need stack
operation to store return address
a.Both are true
c. Only i is true