4615-4719_chapter 8.ppt

Upload: a-samuel-clement

Post on 02-Jun-2018

240 views

Category:

Documents


0 download

TRANSCRIPT

  • 8/10/2019 4615-4719_Chapter 8.ppt

    1/83

  • 8/10/2019 4615-4719_Chapter 8.ppt

    2/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das $

    The co%cep& o' i%&err(p&s) *he% &he processor is i%&err(p&e+, i& s(spe%+s

    i&s

    c(rre%& ac&i i&y a%+ exec(&es &he I%&err(p&ser ice ro(&i%e correspo%+i%. &o &hei%&err(p& re/(es&

    ) #'&er &ha& ,i& res(0es &he pre io(s ac&i i&y

    ) I%&err(p&s ca% occ(r a& a%y &i0e

  • 8/10/2019 4615-4719_Chapter 8.ppt

    3/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das

    Interrupts of 80868"86 has har+2are i%&err(p&s, so'&2are i%&err(p&sa%+ error .e%era&e+ i%&err(p&s!or &he &hree cases 0e%&io%e+ here, &hei%&err(p&i%.

    0echa%is0 is +i3ere%&, 4(& &he 2ay &he processorrespo%+s is si0ilar#% i%&err(p& is %o& ery +i3ere%& 'ro0 a C#LL

    i%s&r(c&io% i% i&s philosophy, 4(& &here are+i3ere%ces i% &he 2ay i& is ha%+le+ a%+ processe+

  • 8/10/2019 4615-4719_Chapter 8.ppt

    4/83

  • 8/10/2019 4615-4719_Chapter 8.ppt

    5/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das :

    I%&err(p& Respo%se - S&epsi7 The ;a. re.is&er is p(she+ o% &o &he s&ac 7ii7 The i%&err(p& ;a. is +isa4le+ 7i 7 The CS re.is&er is p(she+ o% &o &he s&ac 7

    7 The IP re.is&er is p(she+ o% &o &he s&ac 7i7 Co%&rol is &ra%s'erre+ &o &he loca&io% i% 2hich

    &he correspo%+i%. ?I%&err(p& Ser ice Ro(&i%e@ is s&ore+7 This, i% e3ec&, 2o(l+ 4e a 'ar

    A(0p7

  • 8/10/2019 4615-4719_Chapter 8.ppt

    6/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 6

    I%&err(p& Respo%se-S&eps Co%&+7

    ii7 The pro.ra0 correspo%+i%. &o &he ISR isexec(&e+7 The las& i%s&r(c&io% i% &he ISR 2ill 4eIRET7

    iii7 The%, IP is poppe+ o3 &he s&ac 7ix7 CS is poppe+ o3 &he s&ac 7x7 The !la. re.is&er is poppe+ o3 &he s&ac 7xi7 Co%&rol re&(r%s &o &he poi%& a& 2hich i& ha+ le'& o37xii7 S&eps i &o i co%s&i&(&e &he ac&io%s 4e'ore .e&&i%.

    &o &heinterrupt service routine , a%+ s&eps iii&o xi occ(r o% re&(r%i%. 'ro0 &he i%&err(p&7

  • 8/10/2019 4615-4719_Chapter 8.ppt

    7/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das

    !i.(re 871 S&eps i% processi%. a%i%&err(p& re/(es&

  • 8/10/2019 4615-4719_Chapter 8.ppt

    8/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 8

    Interrupt Service Routine and

    Interrupt Vector*he% a% i%&err(p& occ(rs, &he processor s(spe%+s&he

    exec(&io% o' i&s c(rre%& &as a%+ &a es o% a%o&her&as as re/(ire+ 4y &he i%&err(p&i%. so(rce7

    This pro.ra0, or ro(&i%e as i& 0ay 4e calle+, is+esi.%a&e+ as a% ?i%&err(p& ser ice ro(&i%e@ ori%&err(p& ha%+ler7

    The a++ress o' a% ISR is calle+ i&s ? interruptvector @7

  • 8/10/2019 4615-4719_Chapter 8.ppt

    9/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das

    I%&err(p& Fec&or Ta4le The 8"86 has $:6 i%&err(p& ec&ors a%+ si%ceeach ec&or is speci e+ 4y 5 4y&es, i& i0plies&ha& $:6 G 5 = 1"$5 4y&es o' 0e0oryare alloca&e+ &o s&ore &he i%&err(p& ec&ors7 These $:6 ec&ors are s&ore+ i% a &a4le calle+&he ?I%&err(p& Fec&or Ta4le@ i% sys&e0

    R#M 'ro0 loca&io%s """"" &o "" !!H i7e7, (p&o """"9 " !!7

  • 8/10/2019 4615-4719_Chapter 8.ppt

    10/83

  • 8/10/2019 4615-4719_Chapter 8.ppt

    11/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 11

    !i.(re 87$4 # &ypical i%&err(p&

    ec&or

  • 8/10/2019 4615-4719_Chapter 8.ppt

    12/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 1$

    Example 8.1!i%+ &he a++ress o' &he i%&err(p&ec&or o' INT 61H7 !i%+ &he physical a++ress o'

    &he ISR correspo%+i%. &o &his i%&err(p& i' &heec&or is "!""9 8 $7

  • 8/10/2019 4615-4719_Chapter 8.ppt

    13/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 1

    Exa0ple 871 Sol(&io%

  • 8/10/2019 4615-4719_Chapter 8.ppt

    14/83

  • 8/10/2019 4615-4719_Chapter 8.ppt

    15/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 1:

    INT 0 ( ivide !" #ero Error$

    The i%&err(p& 2i&h &ype %(04er " is +e+ica&e+&o &he ?+i i+e 4y Jero@ error7 This i%&err(p& is a%?error .e%era&e+@ i%&err(p& 7

    % +i isio%, i' &he /(o&ie%& re.is&er is %o& lar.ee%o(.h &o co%&ai% &he /(o&ie%&, &his i%&err(p& is.e%era&e+ a(&o0a&ically7De+ica&i%. Type " 'or &his case 0ea%s &ha& &hecorrespo%+i%. i%&err(p& ec&or i% &he i%&err(p&

    ec&or &a4le is a aila4le a& """"9""""

  • 8/10/2019 4615-4719_Chapter 8.ppt

    16/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d

    e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 16

    INT 1 (Sin%le Steppin%$

    This &ype %(04er is +e+ica&e+ 'or ?si%.le s&eppi%.@or ?&race@7

    Si%.le s&eppi%. is a% i0por&a%& i+ea i% +e4(..i%.7

    D(ri%. lo.ical +e4(..i%. o' o(r pro.ra0s, 2e2o(l+ li e &o s&op a'&er &he exec(&io% o' eachi%s&r(c&io% a%+ chec &he co%&e%&s o' re.is&ers,0e0ory a%+ so o%7!or &his, &he TR#P ;a. %ee+s &o 4e se&7

  • 8/10/2019 4615-4719_Chapter 8.ppt

    17/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d

    e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 1

    Ho2 &o se& &he &rap ;a.

  • 8/10/2019 4615-4719_Chapter 8.ppt

    18/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d

    e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 18

    INT & (Non' as)a!le Interrupt$ This i%&err(p& correspo%+s &o &he ec&or o' &he har+2are i%&err(p& NMI7

    *he% a% i%&err(p& is recei e+ o% &he pi% NMI o' &he processor, a&ype $ i%&err(p& occ(rs &his 0ea%s &ha& &heISR 'or NMI 0(s& 4e 2ri&&e% i% &he a++ress

    poi%&e+ 4y &he correspo%+i%. IFT co%&e%&7

  • 8/10/2019 4615-4719_Chapter 8.ppt

    19/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d

    e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 1

    INT * (+rea)point Interrupt$ This is &he 4rea poi%& i%&err(p&, 2hich is(se'(l 'or +e-4(..i%.7

    *e 2ill %ee+ &o se& 4rea poi%&s a%+ chec&he co%&e%& o' re.is&ers a%+ 0e0ory a'&erexec(&i%. i%s&r(c&io%s (p &o &he 4rea poi%&7

    The 4rea poi%& i%&err(p& is special i% &ha& i& isa si%.le 4y&e i%s&r(c&io% 2i&h &he co+e CCH7

  • 8/10/2019 4615-4719_Chapter 8.ppt

    20/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d

    e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das $"

    INT , (-ver o/ Interrupt$ This i%&err(p& correspo%+s &o &he o er;o2;a.7 I' &he o er;o2 ;a. is se&, &his i%&err(p&occ(rs, 4(& %o& a(&o0a&ically7#% i%s&r(c&io% INT 0(s& 4e 2ri&&e% a'&er &he pro.ra0 se.0e%&2hich is li ely &o ca(se &he o er;o2 ;a. < !>

    &o 4e se&7

  • 8/10/2019 4615-4719_Chapter 8.ppt

    21/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das $1

    Ta4le 871 I%&err(p& Fec&or Ta4le

    #lloca&io%

  • 8/10/2019 4615-4719_Chapter 8.ppt

    22/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das $$

    ard/are InterruptsINTRNMI

  • 8/10/2019 4615-4719_Chapter 8.ppt

    23/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das $

    NMI This is a posi&i e e+.e &ri..ere+ i%&err(p&, 4(&i& is also re/(ire+ &o ha e a +(ra&io% i% &hehi.h s&a&e o' 0ore &ha% &2o cloc cycles7

    ) This is a %o%-0as a4le i%&err(p&, i% &ha& & +oes%o& +epe%+ o% &he se&&i%. o' &he i%&err(p& ;a.7 I& ca%%o& 4e 0as e+ or pre e%&e+ 'ro0

    4ei%. ac&i a&e+7I& is a Type $ i%&err(p&7

  • 8/10/2019 4615-4719_Chapter 8.ppt

    24/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das $5

    INTR This is &he %o%- ec&ore+ i%&err(p& pi% o' &he8"86, 2hich 0ea%s &ha& 2he% a% i%&err(p&re/(es& is recei e+ o% &his pi%, i& +oes %o& .e&a(&o0a&ically +irec&e+ &o2ar+s a%y par&ic(lare%&ry i% &he IFT7 The i%&err(p& ;a. is re/(ire+ &o 4e se& 'or

    a% i%&err(p& re/(es& o% &he INTR li%e &o 4eho%ore+7INTR is a hi.h le el &ri..ere+ i%&err(p&7

  • 8/10/2019 4615-4719_Chapter 8.ppt

    25/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das $:

    Respo%se &o a% INTR re/(es& The INT# li%e is lo2ere+ a%+ a% ?I%&err(p&ac %o2le+.e 0achi%e cycle is s&ar&e+ 7

    I% &he rs& 0achi%e cycle, &he +a&a 4(s is;oa&e+7D(ri%. &he rs& 0achi%e cycle, &hei%&err(p&i%. +e ice places &he ?&ype %(04er@

    o' &he i%&err(p& o% &he lo2er +a&a li%es

  • 8/10/2019 4615-4719_Chapter 8.ppt

    26/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das $6

    !i.(re 87 I%&err(p& ac %o2le+.e

    0achi%e cycle o' &he 8"86

  • 8/10/2019 4615-4719_Chapter 8.ppt

    27/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das $

    !i.(re 875 Ke%era&io% o' a &ype

    %(04er +(ri%. &he INT# cycle

  • 8/10/2019 4615-4719_Chapter 8.ppt

    28/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das $8

    7

    Ca% *e Co%si+er &he Rese& Pi%as a% I%&err(p& Pi%

  • 8/10/2019 4615-4719_Chapter 8.ppt

    29/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das $

    #4o(& &he rese& ec&or i% a PCC9 +e4(.-+33 9""""!!!!9"""" E 2+ E0 00 30 " 6 $!- $ " $! " : ""

    !C ""7 777"6O$"O":777 The rs& : 4y&es, co%s&i&(&e &he asse04ly co+e 'or &he A(0p i%s&r(c&io% i7e7, MP !"""9E":B7 The %ex& ei.h& 4y&es 2ere ori.i%ally calle+ &he QRELE#SEM#R ER 4y IBM, as &hey al2ays co%&ai% &he release +a&eo' &he co+e i7e7, BI"S

  • 8/10/2019 4615-4719_Chapter 8.ppt

    30/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das "

    4riorit" of Interrupts

    *he% 0a%y i%&err(p&s occ(r a& &he sa0e&i0e, 2hich so(rce .e&s i&s re/(es& ho%ore+

    rs& The processor +eci+es &he priori&y7 Theor+er o' priori&y is se& i% &he 'ollo2i%. 0a%%er9

    i> I%&er%al i%&err(p&s a%+ So'&2are i%&err(p&s .e& &he hi.hes& priori&y

    ii> NMIiii> INTR .e&s &he lo2es& priori&y

  • 8/10/2019 4615-4719_Chapter 8.ppt

    31/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 1

    Ta4le 87$ I%&err(p& #lloca&io% 'or TypeN(04ers " &o $1 i% &he IBM PC

  • 8/10/2019 4615-4719_Chapter 8.ppt

    32/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das $

    Ta4le 87$ I%&err(p& #lloca&io% 'or TypeN(04ers " &o $1 i% &he IBM PC Co%&+7

  • 8/10/2019 4615-4719_Chapter 8.ppt

    33/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das

    Soft/are Interrupts

    ) *he% a% i%&err(p& is i%i&ia&e+ 4y a%i%s&r(c&io%, i& is calle+ a so'&2are i%&err(p&7 The 'or0a& o'&his i%s&r(c&io% is9INT type number

    ) The &ype %(04ers ca% ary 'ro0 " &o $::7 Th(s, &he (ser ca% 2ri&e a%y proce+(re as

    a% ISR, s&ore i& i% so0e a++ress i% 0e0orya%+ call i& 4y (si%. &he i%s&r(c&io% INT %7

  • 8/10/2019 4615-4719_Chapter 8.ppt

    34/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 5

    7

    *ha& Is &he SiJe o' a% I%&err(p&I%s&r(c&io%

  • 8/10/2019 4615-4719_Chapter 8.ppt

    35/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das :

    -S and +I-S Interrupt RoutinesD S i%&err(p& '(%c&io%s are par& o' &he MS-D S opera&i%. sys&e0 a%+ ha%+le access &oIO 7BI S i%&err(p& '(%c&io%s also +o &he sa0e&hi%., 4(& &he +e.ree o' co%&rol o' IO is 0orehere7

    BI S i%&err(p&s are ?lo2 le el@ co0pare+ &oD S i%&err(p&s, 0ea%i%. &ha& &hey are closer&o &he har+2are7

  • 8/10/2019 4615-4719_Chapter 8.ppt

    36/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 6

    +I-S 10 3unctions These '(%c&io%s ca&er &o &he i+eo +isplay7 To 4e a4le &o (se &hese '(%c&io%s e3ec&i ely,2e rs& ha e &o 0a e a s&(+y o' &he i+eo+isplay7*e %ee+ &o ha e a% o erall i+ea o' i&s his&ory s(ch as i&s

    co0po%e%&s a%+ s&a%+ar+s7

  • 8/10/2019 4615-4719_Chapter 8.ppt

    37/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das

    Fi+eo #+ap&erI% a%y PC, &here is &he +isplay (%i& a%+ a ? i+eoa+ap&er@7

    This a+ap&er is &he har+2are &ha& pro i+es &hesys&e0 i&s +isplay capa4ili&ies7

    I& is also +esi.%a&e+ 4y %a0es s(ch as i+eo car+a%+ .raphics car+7 The i+eo +isplay (s(ally has a ?co%&roller@ 2hich&a es care o' &he co0plexi&ies o' &he +isplay0echa%is07

    The IBM PC 0e0ory 0ap sho2s R#M'ro0 #""""H &o B!!!!H +e+ica&e+ &o i+eo7

    This area o' 0e0ory is calle+ i+eo +isplay R#M or i+eo 0e0ory or FR#M7

  • 8/10/2019 4615-4719_Chapter 8.ppt

    38/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 8

    Display a+ap&er &ypesCK#9 Color .raphics a+ap&erEK#9 Ex&e%+e+ .raphics a+ap&er

    FK#9 Fi+eo .raphics a+ap&erSFK#9 S(per FK#

    d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    39/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das

    Text and 5rap ics

    The 0os& 4asic classi ca&io% o' &he +isplay0o+e is ?&ex& or .raphics@7I% &ex& 0o+e, a 0o%i&or ca% +isplay o%ly #SCIIcharac&ers7 I% .raphics 0o+e, a 0o%i&or ca%+isplay a%y 4i&-0appe+ i0a.e7

    d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    40/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 5"

    Ta4le 87 Tex& Mo+e De&ails o'

    CK#

  • 8/10/2019 4615-4719_Chapter 8.ppt

    41/83

    d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    42/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 5$

    7olor 7on %uration The a&&ri4(&e 4y&e o' a charac&er +eci+es i&scolor7 This 4y&e +e %es &he 4ac .ro(%+ a%+'ore.ro(%+ colors7!ore.ro(%+ re'ers &o &he color o' &he charac&er

    +isplaye+7Bac .ro(%+ is &he color &ha& s(rro(%+s acharac&er7

    d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    43/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 5

    Ta4le 875 !or0a& o' &he #&&ri4(&e

    By&e

    d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    44/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 55

    d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    45/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 5:

    td

  • 8/10/2019 4615-4719_Chapter 8.ppt

    46/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 56

    Exa0ple 87$!i%+ &he a&&ri4(&e 4y&e 'or &he 'ollo2i%. caseso' &ex& 0o+e +isplay7

    i> Blac 4ac .ro(%+ 2i&h 4ri.h& 2hi&e &ex&iii> Bli% i%. 2i&h cya% 4ac .ro(%+ 2i&h 4ro2%

    &ex&

  • 8/10/2019 4615-4719_Chapter 8.ppt

    47/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t d

    The x86 Microprocessor - Lyla B Das 5

    t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    48/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t

    The x86 Microprocessor - Lyla B Das 58

    +I-S 10 3unctionsi$ +I-S 10 3unction 0 Se& i+eo 0o+e7

    This '(%c&io% is 'or se&&i%. &he ? i+eo 0o+e@ &he '(%c&io% %(04er is place+ i% #H, a%+ &he

    i+eo 0o+e i% #L7 This '(%c&io% is 'or se&&i%. &he i+eo 0o+e7 I&also clears &he scree%7

    t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    49/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t

    The x86 Microprocessor - Lyla B Das 5

    .

    ii$ +I-S 10 3unction 0& Se& c(rsorposi&io%7 This is 'or posi&io%i%. &he c(rsor 4y speci'yi%.&he ro2 a%+ col(0% co-or+i%a&es7 , DH = ro2, DL = col(0%7

    t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    50/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t

    The x86 Microprocessor - Lyla B Das :"

    .

    iii$ +I-S 3unction 06 Scroll (p scree%7 This '(%c&io% scrolls (p &he scree% 4y &hespeci e+ %(04er o' li%es a%+ 4la% li%es appeara& &he 4o&&o07

    The re.is&ers i% ol e+ a%+ &he al(es &o 4es&ore+ i% &he0 are9

    #L = %(04er o' li%es &o 4e scrolle+ (p

  • 8/10/2019 4615-4719_Chapter 8.ppt

    51/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t

    The x86 Microprocessor - Lyla B Das :1

    .

    iv$ INT 10 3unction 09 Display charac&er2i&h a&&ri4(&e a& c(rsor posi&io%7 This '(%c&io% +isplays a charac&er a& &hec(rsor posi&io%7#L = #SCII charac&er, BH = pa.e %(04er, BL= a&&ri4(&e 4y&e, C = co(%&

    t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    52/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t

    The x86 Microprocessor - Lyla B Das :$

    Exa0ple 87:*ri&e a pro.ra0 &ha& +oes &he 'ollo2i%.9

    i> Se&s &he i+eo 0o+e a%+ clears &he scree%7

    ii> Ma es a 2i%+o2 o' a speci e+ siJe a%+ color7iii> Se&s &he c(rsor a& a speci e+ posi&io% 2i&hi%&he 2i%+o27

    i > Displays 1" &i0es &he charac&er ? @ a& &he

    c(rsor posi&io%7

    Lt d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    53/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L t

    The x86 Microprocessor - Lyla B Das :

    Exa0ple 876*ri&e a pro.ra0 &o +isplay ?HELL @ er&ically+o2%2ar+s a& &he ce%&re o' &he scree%7

    L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    54/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v t

    L

    The x86 Microprocessor - Lyla B Das :5

    Exa0ple 87

    *ri&e a si0ple pro.ra0 &o 0a e &he scree%.ree% i% color o% pressi%. &he ?K@ ey7

    L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    55/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v t

    L

    The x86 Microprocessor - Lyla B Das ::

    ddressin% Video emor"

    irectl"Fi+eo 0e0ory ca% 4e +irec&ly 2ri&&e% i%&o, 4y%o2i%. &he a++ress o' FR#M, a%+ 2i&ho(&

    (si%. BI S i%&err(p&s7

    L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    56/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v t

    L

    The x86 Microprocessor - Lyla B Das :6

    Exa0ple 878

    Ma e &he 2hole o' pa.e " +isplay appear.ree%7 !or &his a 16-4i& %(04er 2i&h &he a&&ri4(&e4y&e a%+ #SCII charac&er is loa+e+ i% # 7 This 2or+ is 2ri&&e% i%&o &he $""" loca&io%s

  • 8/10/2019 4615-4719_Chapter 8.ppt

    57/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v t

    L

    The x86 Microprocessor - Lyla B Das :

    Exa0ple 87Display HELL * RLD i% &he ce%&re o' &hescree%7

    L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    58/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v t

    L

    The x86 Microprocessor - Lyla B Das :8

    :e"!oard Interfacin% BI S i%&err(p&s are a aila4le 'or &heco0p(&er ey4oar+7!or &ha&, 2e ha e &o (%+ers&a%+ &he co0p(&erey4oar+, as 2ell as &he har+2are associa&e+

    2i&h &he ey4oar+7

    L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    59/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v t

    L

    The x86 Microprocessor - Lyla B Das :

    7omputer :e"!oard The ey4oar+ o' &he PC +i+ %o& al2ays loo li e&his7 I% &he rs& IBM PC a%+ PC- T, &here 2ere 8

    eys7 La&er &he PC-#T ey4oar+ ha+ &he sa0e%(04er o' eys, 4(& &he arra%.e0e%& o' &he eys2as +i3ere%&7

    #'&er &a i%. i%&o co%si+era&io%, ario(s +esi.%i+eas, &he c(rre%& PC ey4oar+ has 4ee%+esi.%e+ &o ha e 1"1 eys, i%cl(+i%. &he'(%c&io% eys !1 &o !1$7 This is calle+ &he?e%ha%ce+ ey4oar+@7

  • 8/10/2019 4615-4719_Chapter 8.ppt

    60/83

    L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    61/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v t

    L

    The x86 Microprocessor - Lyla B Das 61

    Scan 7ode*he% a ey is presse+, &he 0icroco%&roller &herei%se%+s &o &he 0o&her4oar+ a (%i/(e ?sca% co+e@ 'oreach ey7# ey press is .e%erally 'ollo2e+ 4y a ey release a%+&his ?release@ ca(ses a%o&her sca% co+e &o 4e se%&,2hich is di;erent 'ro0 &ha& o' &he ey press o' &hesa0e ey7

    ey press a%+ release are also calle+ ?0a e@ a%+?4rea @7

    The 0a e a%+ 4rea sca% co+es are +i3ere%& 'or a ey7 They +i3er 4y 8"H7 !or exa0ple, i' &he 0a e sca% co+e'or a charac&er is , i&s 4rea sca% co+e 2ill 4e 8 H7

    L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    62/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v t

    The x86 Microprocessor - Lyla B Das 6$

    :e"!oard Status +"tes There are &2o ey4oar+ s&a&(s 4y&es &ha& arehel+ i% &he BI S +a&a areas9 5"91 a%+ 5"9187 They sho2 &he s&a&(s o' &he 0o+i er a%+&o..le eys7

    L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    63/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v t

    The x86 Microprocessor - Lyla B Das 6

    !i.(re 876a !irs& ey4oar+ s&a&(s

    4y&e

    L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    64/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v t

    The x86 Microprocessor - Lyla B Das 65

    !i.(re 8764 Seco%+ ey4oar+ s&a&(s

    4y&e

    t L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    65/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v t

    The x86 Microprocessor - Lyla B Das 6:

    :e"!oard Interrupt T"pe 09

    The i%&err(p& 2i&h &ype %(04er " has 4ee%alloca&e+ &o &he ey4oar+ o% IR 1 li%e7 He%ce,&his is a har+2are i%&err(p&7 Th(s, 2he% a ey is presse+, i&s sca% co+e isse%& &o &he 0o&her4oar+ i% serial 'or0, a%+&herei% co% er&e+ &o parallel 'or07 This 8-4i&sca% co+e is prese%&e+ &o por& # o' &he 8$::2i&h IO a++ress 6"H, a%+ alo%. 2i&h &his, &heIR 1 li%e &ha& has 4ee% ec&ore+ &o INT isac&i a&e+7

    t L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    66/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v t

    The x86 Microprocessor - Lyla B Das 66

    +I-S INT 09 Routine I& rea+s &he sca% co+e 'ro0 Por& 6"H a%+i+e%&i es &he ey presse+7*he% &he ey is release+, i& se%+s a +i3ere%&sca% co+e, a%+ &his is eri e+ 4y &he ISR a%+co% r0e+ &o 4e a ey release7 There is a possi4ili&y &ha& &he ey co%&i%(es &o4e ep& presse+7 I' i& is 'o(%+ so 'or 0ore &ha%

    hal' a seco%+, &he ISR i+e%&i es i& as a %e2ey press a%+ se%+s i&s sca% co+e accor+i%.ly7Repea&i%. &he sa0e ey is re'erre+ &o as?&ype0a&ic@ i% IBM li&era&(re7

    t L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    67/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v t

    The x86 Microprocessor - Lyla B Das 6

    BI S I%&err(p& 16H #H = " or #H = 1"H7 The rs& '(%c&io% %(04er is 'or &he ol+er ey4oar+7 The seco%+ o%e is &he e/(i ale%& o%e 'or &he

    e%ha%ce+ ey4oar+7 This '(%c&io% chec s 'or acharac&er i% &he ey4oar+ 4(3er7 I' a aila4le, &hesca% co+e is re&(r%e+ i% #H, a%+ #SCII al(e i% #L7!or '(%c&io% eys

  • 8/10/2019 4615-4719_Chapter 8.ppt

    68/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v t

    The x86 Microprocessor - Lyla B Das 68

    BI S I%&err(p& 16H#H = "1 or #H = 11H7 The rs& '(%c&io%%(04er is 'or &he ol+er ey4oar+7 The seco%+o%e is &he e/(i ale%& o%e 'or &he e%ha%ce+

    ey4oar+7 This '(%c&io% is si0ilar &o &hepre io(s o%e, excep& &ha& i' %o charac&er isa aila4le i% &he ey4oar+ 4(3er, i& +oes %o&2ai& 'or a ey press7 I& si0ply se&s V! a%+ re&(r%s7

    t L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    69/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v t

    The x86 Microprocessor - Lyla B Das 6

    BI S I%&err(p& 16H#H = "$ or #H = 1$H7 The rs& '(%c&io%%(04er is 'or &he ol+er ey4oar+7 The seco%+o%e is &he e/(i ale%& o%e 'or &he e%ha%ce+

    ey4oar+7 This '(%c&io% re&(r%s &he rs&ey4oar+ s&a&(s 4y&e i% &he #L re.is&er7 The

    s&a&(s 4y&e is also a aila4le i% &he BI S +a&aarea ""5"9""1 7

    t L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    70/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v t

    The x86 Microprocessor - Lyla B Das "

    Exa0ple9 871"Explai% 2ha& &he 'ollo2i%. pro.ra0 +oes7. - E< TIN= .7- E.ST RT>4-V ? 10

    INT 16

    -V ? 1&INT 16.E@ITEN

    t L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    71/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v t

    The x86 Microprocessor - Lyla B Das 1

    Exa0ple 8711

    *ri&e a pro.ra0 &ha& lls (p &he scree% 2i&h&he ey presse+7 I' %o ey is presse+, i& eeps2ai&i%. 'or a ey press7

    t L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    72/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v t

    The x86 Microprocessor - Lyla B Das $

    oo)in% an Interrupt This A(s& 0ea%s &he 0echa%is0 o' i%s&alli%. a%i%&err(p& ec&or i% &he IFT7 The &ric y par& o' &hisis &ha& &he &ype %(04er 2e pla% &o (se 0ay

    alrea+y 4e i% (se 'or a%o&her i%&err(p& ro(&i%e7 This ISR is &e0porarily ep& asi+e 2he% 2e i%s&alla %e2 ec&or correspo%+i%. &o &he sa0e &ype%(04er7

    To i%s&all a% i%&err(p& ec&or, &he asse04ler%ee+s &o a++ress a4sol(&e 0e0ory a%+ &heeasies& 2ay &o

    +o i& is (si%. cer&ai% D S i%&err(p& '(%c&io%s7

    t L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    73/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v

    The x86 Microprocessor - Lyla B Das

    Terminate and Sta" ResidentD S (ses a par& o' &he 65" o' R#M i% &he lo2er area o'0e0ory, a%+ &he exac& a0o(%& o' &his aries 'ro0

    ersio% &o ersio%7 *he%e er a% applica&io% pro.ra0r(%s, a por&io% o' R#M is alloca&e+ &o &he applica&io%7#'&er &his, &he pro.ra0 is a4a%+o%e+7 The alloca&e+

    0e0ory is 'ree+ a%+ is 0ar e+ as a aila4le 'or o&herpro.ra0s7

    There are pro.ra0s 2hich are ep& ?resi+e%&@ i%0e0ory, e e% a'&er i& is r(% a%+ a4a%+o%e+7S(ch pro.ra0s are &i&le+ ?Ter0i%a&e a%+ s&ay resi+e%& pro.ra0s@7

    t L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    74/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v

    The x86 Microprocessor - Lyla B Das 5

    -S 3unctions for Interrupt oo)si$ INT &1 ? 3unction *2 Ke& I%&err(p& Fec&or7

    Ke& &he se.0e%&-o3 se& al(e o' a% i%&err(p&ec&or7

    I%p(&9 #L = i%&err(p& %(04er7 (&p(&9 ES9B =a++ress o' &he i%&err(p& ha%+ler7

    Use+ &o sa e &he al(e o' CS9IP o' &ha& i%&err(p&ha%+ler7

    This 2ill 4e %ecessary 'or res&ori%. &he pre io(ss&a&e o' &he i%&err(p& ec&or &a4le7 This is +o%e4y !(%c&io% :H7

  • 8/10/2019 4615-4719_Chapter 8.ppt

    75/83

    v t

    L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    76/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v

    The x86 Microprocessor - Lyla B Das 6

    -S 3unctions for Interrupt

    oo)sINT &1 ? 3unction *1 Ter0i%a&e a%+s&ay resi+e%&7 Ter0i%a&e &he c(rre%& pro.ra0 or process, 4(&0a e i& resi+e%& i% 0e0ory a%+ a&&e0p& &ose& &he c(rre%& 0e0ory alloca&io% &o &he%(04er o' para.raphs speci e+ i% D 7I%p(&9 #L = re&(r% co+e, a%+ D = re/(es&e+%(04er o' para.raphs7 The '(%c&io% 1H 0a es o(r ISR resi+e%& i%0e0ory7

    v t

    L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    77/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n

    d e r s

    l e y

    I n d i a P v

    The x86 Microprocessor - Lyla B Das

    Exa0ple 871$# %e2 ISR %a0e+ ?NE*6"@ is &o 4e i%s&alle+as a &ype 6"H i%&err(p&7 The ISR is a pro.ra0&o 0a e &he '(ll scree% cya% i% color 2i&h4lac 'ore.ro(%+7 *ri&e a pro.ra0 'or &his7

    v t

    L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    78/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v

    The x86 Microprocessor - Lyla B Das 8

    Exa0ple 871*ri&e a pro.ra0 &o r(% &he ISR i%s&alle+ 4y Ex 871$

    v t

    L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    79/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v

    The x86 Microprocessor - Lyla B Das

    .

    *ha& is a Ree%&ra%& Pro.ra0

    v t

    L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    80/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P v

    The x86 Microprocessor - Lyla B Das 8"

    oo)in% Into ard/are

    InterruptsChoose &he har+2are i%&err(p& 2i&h &ype %(04er" &ha& has 4ee% alloca&e+ &o &he ey4oar+ o%IR 1 li%e7

    Replace &he %or0al ey4oar+ se/(e%ce associa&e+2i&h &his har+2are i%&err(p&, 2i&h a%o&her pro.ra0a%+

    &ha& pro.ra0 2ill 4e ac&i a&e+ 2i&h a ho& ey7

    *ha& is a ho& ey I& is +e %e+ as a (ser-+e %e+ ey se/(e%ce &ha&exec(&es a co00a%+ or ca(ses &he opera&i%.sys&e0 &o s2i&ch &o a%o&her pro.ra07

    v t

    L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    81/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P

    The x86 Microprocessor - Lyla B Das 81

    Exa0ple 8715*ri&e a TSR pro.ra0 &ha& replaces &he %or0al ro(&i%eassocia&e+ 2i&h INT 7

    The ho& ey &o 4e (se+ is #l& X !1"7 To eri'y &hisco04i%a&io%, rs& &he INT 16H ro(&i%e 2i&h #H = 1$H is(se+ &o chec 'or &he #LT ey7 This &es&s 'or &he D 4i& o' &he+a&a i% #L < rs& ey4oar+ s&a&(s 4y&e>, 2hich is &o 4e ?1@ i'&he #l& ey has 4ee% presse+7 The% por& # o' &he 8$::

  • 8/10/2019 4615-4719_Chapter 8.ppt

    82/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P

    The x86 Microprocessor - Lyla B Das 8$

    Exa0ple 871:*ri&e a si0ilar pro.ra0, excep& &ha& &he ho&eys &o 4e i% o e+ are C&rl X ! 7 The ISR

    accesses &he i+eo 0e0ory +irec&ly a%+ca(ses &he '(ll scree% &o 4e .ree% i% color7

    P v t

    L t d

  • 8/10/2019 4615-4719_Chapter 8.ppt

    83/83

    C o p y r i g

    h t

    D o r l

    i n g

    K i n d e r s

    l e y

    I n d i a P

    Exa0ple 8716*ri&e a TSR pro.ra0 ac&i a&e+ 4y &he ho& eyco04i%a&io% C&rl X #l& X i7 I& is &o pri%& &he2or+ ?#NUR#K@ i% .ree% color i% a re+ 2i%+o22i&h siJe as speci e+ i% &he pro.ra07Si%ce D S i%&err(p&s ca%%o& 4e (se+, &hes&ri%. is %o& &o 4e +isplaye+ (si%. &he D Si%&err(p& 2i&h '(%c&io% %(04er " 7I%s&ea+, a 0acro ca% 4e (se+ 2i&h BI S'(%c&io%s &o pri%& si%.le charac&ers7