helloworld.ru -  
helloworld.ru -
           
:  

C#
MS Visual C++
Borland C++
C++ Builder
Visual Basic
Quick Basic
Turbo Pascal
Delphi
JavaScript
Java
PHP
Perl
Assembler
AutoLisp
Fortran
Python
1C

-
HTML
VRML
HTTP
CGI
FTP
Proxy
DNS
TCP/IP
Apache

Web-
HTML

VRML
PhotoShop
Cookie
CGI
SSI
CSS
ASP
PHP
Perl


DirectDraw
DirectSound
Direct3D
OpenGL
3D-
DOS





.



MySQL
SQL






demaker.ru

 .




helloworld.ru

Bo/o

                 1. oc  oceoaeo op.

   p acxpoo c aa ocae  pae a opa
o  oo  .  Bpeee   epa   e   aa   p   o
ecece,  o  peea  e oe a aa oe a.
Ca  a    oe    cooo     oo   po,   o
cooece oec   ee,   oop, o  oeea
(marking),  oa poe co,   ca (spacing),  oa  poe
.
    oepaec    oeeo  coco,  oa  o  e  e
epea  ax.  p  aae epea aa ax ca aae  0,
oea capo  .  ae  ce  oce  o  ax  (oa
ee)    e aopa cox  x poe.  oce  ax
oe  copooac  o  eoc,  coe    oape
oo, a ae  oceoaeoc ac 1  oee co-o,
oop  cooece  co   poe.      co-   aa
oeeoe  cocoe,  oopoe  e coxpac o ex op,  oa e
aec  epeaa  ceeo   aa   ax;   co   coex
co-o ceceo,  oco o caaa aoe pe,
oopoe oo po epe ce capo o.
   Koeo, epeaa    pea  ca o cooa o 
o e pooo  x eoe o  o o pao- a c  oo
  o  e  copoc oea (epeo  ax  ce,  aaex
ae oa).  p oee o eo oa o, oo o-
aooe   oopoae  peocae  paoopa  opa  o
cace a caoo opa,  a  pcoeeoo  e oea. aae
oea  ec peopaoa- e caa,  eeppeoo opo o-
a,   acec ca,  oop oe ae   epea  o
eeoo    aa.    oco   oeo   peoca   ae
ooee oa- oe oooc, ae a aoaec
o  oe, oope e oepac ca opo oa.

               2. popapoae pocxe UART 8250.

   oceoaea c   acoo   coa,  o    papaoa
ceae  pocxe,   oe   pao   o   oppoa   
cxpoa cpo o,  cocax oceoaee ae. Tae
pocxe aa epca  acxpo  peo-epeao
(universal asynchronous receiver transmitter  UART).  IBM PC co-
e UART 8250 p Intel.
   Oepaoa ccea oepae 2 opa oa,  oo-  
ae ec 2  pocxe.  x  aoe  apeca  xpac    ee
0040:0000  COM1  0040:0002  COM2. (ao apec o 2-xao
apec opa,  oop ec a  p apeco opo, ax
oc  UART.) Ha cex aax COM1 ee ao apec 3F8H, a COM2 -
2F8H;
   Mpocxea 8250  ee  10 popapex ooax pecpo,  c
oo oopx paec  opopec op  oa.  o-
co   x aac aae opa,  po- ecco,  oop
oe  oe co.  oc   10 pe- cpa  ocecec
epe  ce apeco opo c oepa 3F8H - 3FEH ( 2F8H - 2FEH).  B
 cax pecp,   oopo oae oc  epe  a  op,
ac  o  oo,  a  caoe    7   pecpe opo ,
oop ec ece pecpo c apeco opa 3FBH.  Bo  
pecp:


                                     - 2 -
3F8H (OUT,  7 = 0  3FBH)   Pecp xpae epeaa
3F8H (IN,  7 = 0  3FBH)    Pecp ax pea
3F8H (OUT,  7 = 1  3FBH)   ee copoc oea (a)
3F9H (IN,  7 = 1  3FBH)    ee copoc oea (cap)
3F9H (OUT,  7 = 0  3FBH)   Pecp papee pepa
3FAH (IN)                      Pecp ea pepa
3FBH (OUT)                     Pecp pae 
3FCH (OUT)                     Pecp pae oeo
3FDH (IN)                      Pecp caca 
3FEH (IN)                      Pecp caca oea

    ec pecpo  oo  ec  eoxo    poco  oce-
oaeo  c.  Pecp xpae epeaa coep a ax,
oope    oca,  a  pecp  ax  pea   -   oce
oe  a ax.  Pecp pae  caca  a-
p    pa   e   c,   co   copoc   oea,
coepac   x pecpax ee copoc oea.   ocaxc
epex pecpo pecp pae-   caca  oea  coc
oo  c epe oe , a a pecpa, cax c pepa
coc oo  poepax, paex pepa.
   pepa coc  p  c   ex eoc.  Oa
oaoa poepa epepo poepe pecp ca-  ca  -
,  oa  ooo  coa    aa,  o ce oo- o 
epea ceeo aa ax.  oco poeccop aoo cpee,
e  oe  copoc c oop epeac oc- eoaee ae,
o o eo apaco pacxoe poeccop- oe  pe,  oopoe  oe
cooac    opao ocax  epeaaex ax.  o
o pe pocxea 8250 oe  caoea  pe, a
pepae  p  oe  coa,  ooe  o  ..  o
pepae oeao  oe  poep  Bae  popa,  oopa,
cae,  e  epea-  a  ce  co    oaooo
epa.

               3. aa oceoaeoo opa.

   p aa opa  oa  ("op")  caaac
ce  eo  apaep.    apaep    coa,  co  co-o,
cao eoc  copoc oea.  a  coa  o  co  o,
oopoe opae oco e ax. Ec  paoae c p
op o 8 o, o 7 o ocao  caapx ao ASCII
(  oopx  ce  co e o,  e peae ASCII 128),   o
pe a  epea cex ax ocaoo op o 4 a.

   Cpe poe.

    0 pepa 14H BIOS ape op oa- .  B
DX oe aac oep oaooo aaa (COM1 = 0, COM2 = 1).
B AL oe coepac a aaox ax,  aee  o
oopoo ceee:

    1-0   a coa. 10 = 7 o, 11 = 8 o.
          2   co co-o. 0 = 1, 1 = 2.
        4-3   eoc. 00  10 = e, 01 = ee., 11 = e.
        7-5   copoc oea. 000 = 110 o
                               001 = 150 o
                               010 = 300 o
                               011 = 600 o
                               100 = 1200 o
                               101 = 2400 o

                                     - 3 -
                               110 = 4800 o
                               111 = 9600 o

   B ao  pepe  op apec co coo  8 o,  o
co-o  eo eoc. Copoc oea 1200 o.

;---pcaae ae apaepo epee
   MOV  WORDLENGTH,00000011B   ;a coa 8 o
   MOV  STOPBITS,00000000B     ;1 co-
   MOV  PARITY,00011000B       ;ea eoc
   MOV  BAUDRATE,10000000B     ;copoc 1200 o

;---ape COM1
   MOV  AL,0                   ;c AL
   OR   AL,WORDLENGTH          ;caaae e 
   OR   AL,STOPBITS            ;
   OR   AL,PARITY              ;
   OR   AL,BAUDRATE            ;
   MOV  AH,0                   ; aa opa
   MOV  DX,0                   ;pae COM1
   INT  14H                    ;ape op

   H poe.

   Heaco o oo, aaec   oo  oo, a 
4  pecpa  pocxe  8250 o  apoa  oepa
oea. o pecp ee copoc oea, pe- cp opo 
 pecp papee pepa.
   ee copoc  oea  o  co,  a  oopoe  ao  pae
aco  ccex  aco  (1190000  ep),  o  o   eae
copoc  oea.  Hapep,    copoc  oea  1200  o ee
copoc oea oe  pae 96,  oco 1190000/96 peo
pao 1200.  e oe ee,  e ee copoc oea. Copoc
oea 300  ee pe xaoo ca    ee.  Cap
a  ocaec   3F9H ( 2F9H),  a a  3F8H (2F8H).  B oox
cax  7 pecpa pae   oe    caoe    1
epe  aco  ae;    po-  o cae o   apeca
ae    apecoa    pe  pecp  (c.  [7.1.0]).   Bo
eoope ae, peee  ox copoce oea:

   Copoc oea             3F9H            3F8H

        110                     04H             17H
        300                     01H             80H
        600                     00H             C0H
       1200                     00H             60H
       1800                     00H             40H
       2400                     00H             30H
       3600                     00H             20H
       4800                     00H             18H
       9600                     00H             0CH

   Bcea caaae pecp copoc oea ep,  a a o
ecee,  oope  pe,  o  caoe  7  pecpe
opo .  oce oo ao e coepoe pecpa opo
,  cpaca 7- , o ce ocae oc  pecpa 
pa. oco pecp opo  ec pecpo oo
   ac,  o  e  cocoa  ep-      7  opao    1  e
oopeeo cao cex ocax o oo  pecpa.

                                     - 4 -
   aee o  pecpa opo ,  apec opa oopoo pae
3FBH ( 2FBH), ceee:

    1-0   a coa. 00 = 5 o, 01 = 6 o
                             10 = 7 o, 11 = 8 o
          2   co co-o. 0 = 1, 1 = 1.5, ec a
                                , ae 2.
          3   eoc. 1 = eeppec  eoc, 0 = e.
          4   T eoc. 0 = eea, 1 = ea
          5   ca eoc. acae  eoc cea
               0  1. 0 = oeea
                  1 = cea 1, ec  3 = 1 &  4 = 0
               1 = cea 0, ec  3 = 1 &  4 = 1
               1 = e eoc, ec  3 = 0
          6   caoa epepa. Bae o cpo e
               aece caa oaeo ca.
              0 = apeeo, 1 = epep
          7   Mee apeca opo px pecpo

Oo  5-7 cpoe    0.  Ocae  oca  ae,  ope-
eee poooo oea.
   ae ec  B  e  coee  pepa,  ce  pao  B   o
poec   ac      pecp  papee  pepa,  o  
epe, o pepa apee. poco oece  o pecp 0.
Pecp ea pepa oo oppoa.
   aa ocax pecpo  caa  c  oea.  co,  o
oe    oo    c  c ae cpoca,  a e 
pae ea cpoca,  a  a  oceoa-  e
pep.
   B ao pepe  oac ax BIOS epec ao apec  COM1,
oce eo pae pecp apc  copoc oea 1200
o, cex ax, eo eoc  ooo co-a.

;---oae ao apec COM1
   MOV  AX,40H          ;ES aae a oac ax BIOS
   MOV  ES,AX           ;
   MOV  DX,ES:[0]       ;oae ao apec COM1
;---ape pecp ee copoc oea a 1200 o
   ADD  DX,3            ;aae a pecp opo 
   MOV  AL,10000000B    ;caaae  7
   OUT  DX,AL           ;ocae a
   DEC  DX              ;aae a cap a ee
   DEC  DX              ;copoc oea
   MOV  AL,0            ;cap a  1200 o
   OUT  DX,AL           ;ocae cap a  1200 o
   DEC  DX              ;aae a a a ee
   MOV  AL,60H          ;a a ee  1200 o
   OUT  DX,AL           ;ocae a a
;---ape pecp opo 
   MOV  AL,0            ;oe AL
   OR   AL,10B          ;a ax 7 o
   OR   AL,000B         ;1 co-
   OR   AL,1000B        ;eeppec  eoc
   OR   AL,10000B       ;ea eoc
   ADD  DX,3            ;aae a pecp opo 
   OUT  DX,AL           ;ocae aaooe aee

;---ape pecp papee pepa
   DEC  DX              ;aae a pecp papee

                                     - 5 -
   DEC  DX              ;pepa
   MOV  AL,0            ;apeae pepa
   OUT  DX,AL           ;ocae a

            4. caoa eeo oaooo opa.

   ec a cocoa,  oop popaa oe opee,  ao 
oaox opo oe cooac. O  cocoo coco
 aa oepa aaa  oepaope popa. Bopo coco coco 
aca  popa    oea epe op COM1,  o ee o-
aooo aaepa, oc  oopo e epe COM1.
   Oac ax   BIOS   coep   eco      epex  2-xax
epeex,  oope coepa aoe apeca  oaox  aao
(MS DOS oepae oo epe a  x). ao apec opa o
a  p apeco opo, epe oope oo o oc 
ao  oaoo  aa.  ao  apec  COM1 xpac 
ee 0040:0000,  a  COM2 -  ee 0040:0002.    ce  o-
aox  opo  ao  poco oe  a ae.  oopa
cea ae pee  epoa- ao aae opo.

   Cpe poe.

   Ec popaa opaaec  oaoo op epe pepae
14H BIOS, o COM op opeeec coep DX, oopoe pao 0  1
( COM1  COM2). Beco oo, o pcaa DX eocpeceoe
aee,  aoe eo  epe- eo, oopo oe  pcoeo
aee 0  1.  popa, coe oaoe  3 
4 pepa 21H cea apecc  COM1.  B o cae ao oe
aoe apeca:

;---oe aox apeco  COM1  COM2
   MOV  AX,40H        ;ES aae a oac ax BIOS
   MOV  ES,AX         ;
   MOV  DX,ES:[0]     ;oeae 1- ao apec  DX
   MOV  AX,ES:[2]     ;oeae 2- ao apec  AX
   MOV  ES:[0],AX     ;oeae apeca
   MOV  ES:[2],DX     ;

            5. Opeeee caca oaooo opa.

   Pecp caca  pocxe UART 8250 opeee pooo  c-
.  o  pecp  ee  apec  opa a 5 oe,  e ao apec
aoo aaa. Oo o ocoo pocapaec  po- ecce o-
aooo oea. p epeae ax pecp cooae, o pe-
 co e oca,  oo popae aca o co oepx
eo.  p  pee  ax  pecp  oppe popa o oce
ceeo coa,  c e o popaa oa poa  eo  pee
e  o  e  oe  ce-  p.  aee o oo
pecpa ceee:

    0   1 = a ax oe
       1   1 = oee ae  epeaca (pe
               co e  ope ca)
       2   1 = oa eoc (epoo, -a a  )
       3   1 = oa ope (epeaa e cxpooaa)
       4   1 = oape epep (oea a cpoa e,
               pa, o pa ca apaae
               oe epea)
       5   1 = pecp xpae epeaa c ( o pecp

                                     - 6 -
               o oeac epeaaee ae)
       6   1 = pecp ca epeaa c (o pecp o-
               ae ae  pecpa xpae  peopae
               x  oceoae )
       7   1 = aa (cpoco e cao c ao)

   Cpe poe.

    3  pepa 14H BIOS opaae  AH pecp caca 
(AL oae pecp caca  oea  [7.1.5]).  p  xoe  DX  oe
coepa  oep  oaooo  opa,    oopo ocecec
oc,  e COM1 = 0,  a COM2 =  1.  Ka    pe  pep,  o
poepe ae epepa:

   MOV  AH,3          ;oep 
   MOV  DX,1          ;pae COM2
   INT  14H           ;oae a caca
   TEST AH,10000B     ;oape epep?
   JNZ  BREAK_DETECT  ;ec a, o a poep opao

   H poe.

   oac  ax  BIOS  caec ao apec oaooo
aaa,   e oaec 5, a ae  oeoo apeca opa c-
aec a caca.

   MOV  AX,40H          ;ES aae a oac ax BIOS
   MOV  ES,AX           ;
   MOV  DX,ES:[2]       ;oae ao apec COM2
   ADD  DX,5            ;oae 5  pecpa caca
   IN   AL,DX           ;oae a caca
   TEST AL,10000B       ; 5 caoe?
   JNZ  BREAK_DETECT    ;ec a, o a opao epepa

                6. aa  paee oeo.

   eec 6   ,  o  oop  oe  cac  c  oepo
(coepecoae oe o e oaoe  o  epec
RS232). Bo x aa, copae  :

O oepa  oe:

Data Terminal Ready (DTR)        oppe oe, o oep
oooc oepa            e  oo  c.

Request To Send (RTS)            oppe oe, o oep
apoc a oc                oae oc ax.

O oea  oep:

Data Set Ready (DSR)             oppe oep, o oe
oooc oea                e  oo.

Clear To Send (CTS)              oppe oep, o oe
oooc  oce             oo aa epea ax.

Data Carrier Detect (DCD)        oppe oep, o oe
Oape oce ax        ca c p oeo.


                                     - 7 -
Ring Indicator (RI)              oppe oep, o ee-
aop oa                 oa , o oopo pcoe-
                                 e oe ee oo.

   Caaa oep caaae ca  DTR,  a  ae  cpe
oe cac c aeo cae.  oce oo,  a oe cao
c o caaae ca DSR.  o ca oppe  oep,
o  oe  oo    c    o oe oep oe cao
ca RTS. Koa oe oe cao CTS, o epeaa aaec.
   e caape  ,  o  oop  oep  pae  oeo,
oc epe pecp  opo  oea  pocxe  UART  8250.  o
pecp ee apec opa a 4 oe,  e ao apec coeoo
oaooo aaa. Bo aee eo o:

Pecp opo oea:

    7-5     (cea 0)
          4     1 = xo UART a a xo
          3     oao ooae aae a o #2
          2     oao ooae aae a o #1
          1     1 = "apoc a oc" ae
          0     1 = "oooc oepa" aa

   Oo caoe  0  1 pecpa opo oea,  a ocae
pa 0.   2 pae 0,  a cee cae,  oa  pooe
oea  peaa  eo    ceaoo  coo-  a.    3
caoe oo  cae,  oa coc pe-  pa  [7.1.8].
Haoe,   4 peocae oooc ecpoa oaox
popa e caoe peao c.  Bxoo  ca  pocxe
UART  oaec  a  xo,  a  o  UART  pae oceoaee
ae. o coco oo c- ooa  ecpoa paoc
pao cao   pocxe.  Oo  eoco  p  cooa  o-
aox poep pepa 14H BIOS.
   epe ,  o  oop  oe  oca  opa  oep,
pac pecpo caca oea. o pecp pacooe o apec
opa  a  6 oe,  e ao apec coeoo oaooo
aaepa. Bo aee eo o:

Pecp caca oea:

    7      1 = DCD
       6      1 = RI
       5      1 = DSR
       4      1 = CTS
       3      1 = eee  DCD
       2      1 = eee  RI
       1      1 = eee  DSR
       0      1 = eee  CTS

   popaa epepo  poepe        xoe oaox
oepa.  Oe,  o 4 ax  a  apae  cap  epe
a.      caaac   1 oo oa,  oa pocxo
eee  cace cooeceo capeo a  c  ex  op,  oa
pecp  ac  oce  pa.  Bce  4  ax  a  aoaec
cpacac p e pecpa.  popa oo po o  po
a o pecp. po oooc ec cooae 
3 pepa 14H BIOS,  oopa opaae pecp caca oea   AL
(p o  AH e coep- ac pecp caca ). p xoe DX
oe coepa oep oaooo aaa (0  1).

                                     - 8 -
   oco oeo ee aoo oe oooce,  o cpae
c e,  o opae  x cax  c  oeo  pecpax.  ec
oooc  aoaeco  c    aoaecoo oea,  oope
opopc pae cpoo.  a cpoa ocaec  oe, a
o epeac oe ae. Moe ee  cpo  ax o
ceao  co,  coe-  o  oo    aa  aaa
pae  cpo.  o  co  oe   peopeee (aco
coec o Esc - ASCII 27)   pae  ooaee.  Moe
cocoe  opee  ac-  oo  o  oa  aa cpoa,
oo o ooa  cpo  o  o  paccapae  xo  oo
opa a ae. Ka oe ee co aop oa.

   H poe.

   Bo a e caa cxea a e acceepa:

;---caaae ca DTR
   MOV  DX,BASE_ADDRESS    ;aae c aooo apeca
   ADD  DX,4               ;aae a pecp opo oea
   MOV  AL,1               ;caaae  1
   OUT  DX,AL              ;ocae  op
;---ocae pa cpo oe  oa
    .
   (o o pa  pax oeo)
    .
;---oae oa e caoe ca DSR
   INC  DX                 ;aae a pecp caca oea
   INC  DX                 ;
TRY_AGAIN:  IN   AL,DX     ;oae coepoe
   TEST AL,10B             ;poepe opo 
   JZ   TRY_AGAIN          ;e oa o e e pae 1

;---caaae  RTS
   DEC  DX                 ;opaaec  pecp pae
   DEC  DX                 ;
   MOV  AL,3               ;caaae ca RTS
   OUT  DX,AL              ;ocae  op
;---oae caa CTS
   INC  DX                 ;opaaec  pecp caca
   INC  DX                 ;
ONCE_MORE:  IN   AL,DX     ;oae a caca
   TEST AL,1               ;poepe  CTS
   JZ   ONCE_MORE          ;e pooae oa o e caoe
;---eep oo oca ae

                          6. epeaa ax.

   epeaa ax poe e pe,  oco popaa  ee  o
opo  a  cocao  ax    copoc,  c  oopo  o  o
ocac.  Te e eee  poep  epea  o    ocaoo
co,   ec   o  opaaa  ae  o  epe  oo,  a  o
ocac.  Mo      ae   poe   c   cxpoae   p
cooa  poooa XON/XOFF.  o pooo coe o ASCII
17(XON)  19(XOFF),  oo o capoa pae ca,
o  epea  xoe  poo epea peeo pepaoo ooa
ax.  o p  ca,  popaa oa epepo aa-
poa paee co p epeae ( ooeco pee,  
oopo oo paoa oe, ca oopeeo   oe copo
o  eeoo aa).  Kpoe oo,  o oap,  o aea

                                     - 9 -
ca ocae cpo e,    aece  caa  epepa,  oe
epe-  po  aapoac  cac a epepa (oep 4) pecpa
caca .
   Cpe poe.

    1  pepa 14H BIOS ocae co,  coepac  AL 
oao aa.  p xoe DX coep oep opa (0    1).
p  opae  AH  coep  a  caca,   oopo  7 = 1,  ec
oepa ecea. B o cae e aee cee :

 4   oape epep (ca "co" o pae ca)
    5   pecp ca epeaa c
    6   pecp xpae epeaa c

   MS DOS  ee      epea  o  oaoo  aa
coa,  oeaeoo  DL.  o  oep 4 pepa 21H, o oa
e ee ax peec epe e  BIOS;  oa  e  opaae
caco opa  e ooe aaa ao  oaox
opo ao cooa (cea coec COM1).
   o ec  cpo a coe  40H pepa 21H.
o  oa    oa    cex   ao      cpoc   p
cooa  eoa  oca  ecpopa  ao.  COM1  ee  pe-
opeee oep #3.  oece oep aa    BX,  a  co  epe-
aaex ao  CX. c DS:DX aa a ep ox ax 
ae .

   MOV  AH,40H         ;oep 
   MOV  BX,3           ;peopeee oep aa  COM1
   MOV  CX,50          ;o 50 ao
   LEA  DX,DATA_BUFFER ;DS:DX aa a ep ax
   INT  21H            ;ocae ae
   JC   COM_ERROR      ;xo a opao o

   H poe.

   Koa a  ax oeaec  pecp xpae epeaa,  o o
aoaec oc  oceoae aa epe  pecp  ca
epeaa,  oop cepae ae.  He eoxooc  ce
a cpoa,  a o eaec  cae a- paeoo aaepa.  5
pecpa   caca     oaae  cooe    pecp  xpae
epeaa  pea ax.  Pe- cp ocoo poepec o  ex
op,  oa    5  e cae pa 1.  oce oo  pecp xpae
epeaa  ocaec  oepeo  a    oo  eca,  oa  o
epc.  B  poecce  epea    5 pae 0  oo oa o o
cae pa 1,  o  pecp xpae epeaa oe    oca
ce co. o poecc oopec o ex op, oa o o.
   B cee  pepe  a  ocoe  o  o  o   poepe.
Koeo,  oa  oe    ceaa  eoao  coo  ( acoc,
popapoae c pee ocoo  aex  poep  oape
oo    occaoe  p  cox).  B pepe peoaaec,  o
oao op  oe  e  apoa.

;---e oa ce e ooo  oc coa
KEEP_TRYING:  MOV  DX,BASE_ADDRESS   ;ao apec
   ADD  DX,5              ;aae a pecp caca 
   IN   AL,DX             ;oae a caca
   TEST AL,00011110B      ;poepe a o
   JNZ  ERROR_ROUTINE     ;ec ec, o a poep opao
   TEST AL,00000001B      ;poepe oe  ae

                                     - 10 -
   JNZ  RECEIVE           ;ec a, o a poep pea
   TEST AL,00100000B      ;poepe oooc  epeae
   JZ   KEEP_TRYING       ;ec e, o opaaec aa
;---epeae co pae c aap
   MOV  AH,1              ; poep aa a
   INT  16H               ;pepae aap BIOS
   JZ   KEEP_TRYING       ;opa, ec e o aa
   MOV  AH,0              ; oe oa c aap
   INT  16H               ;eep  co  AL
   SUB  DX,5              ;apec pecpa xpae epeaa
   OUT  DX,AL             ;ocae co
   JMP  SHORT KEEP_TRYING ;opaaec  aa a

                         7. oee ax.

   Koaoa popaa ooa pa ae a  oo  -
apoa  oao  op    caoea  c c aeo
cae. pe ax oa ooc e oee o epea ax,
oco  popae  oe  opeo- ac oca ca XOFF (ASCII
19), o ocao oo ax, ec o oca co cpo 
oa e ceae x opaaa.  Ko XON (ASCII 17) cooae aeo
ca, o oo poo epea.
   B acoc   o   cooc   coeoo   poooa   oea,
paee ae o peoa poco  coo opao. Te 
x,  oope  c  opae  ax ae oapac p
cxpoo oee.  p oe oaex coo a pa  ae
e coo epeoa cpo (ASCII 10),  oco eoope 
(a ec) aoaec ca epeo cpo oce  opaa
ape;    o  cae  cae  epeo  cpo   paex
ax, o ea cx cpo p oe.

   Cpe poe.

    2 pepa 14H BIOS oae  co    oceoaeoo
opa,  oeae  eo    AL  p  oe    ae  opaaec  
popa.  p xoe ao  oec  oep  opa  (0-1)    DX.  p
opae  AX pae ,  ec e o o.  Ec AH e pae 0,  o
oe  opae a caca,   oopo e aee  oo  5
o. o cee :

  1   oa epeoe (o co oc  pae,  e
          ae cap)
     2   oa eoc (epoo, -a poe  )
     3   oa oope (capo  co- eep)
     4   oape epep (oea a cpoa o 0)
     5   oa aaa (e oe ca DSR)

   MS DOS  ae  peocae  oao      pea
ooo coa, o  3 pepa 21H.  oae co 
COM1  oeae eo  AL.  Oe,  o  p  o  e    -
aa   opa,  oop  ao  ea  epe  poep  BIOS  
eocpeceo,  a oaao  [7.1.2].  o oa op  a-
pec co ae 2400 o, e opo eoc, o co- 
8 o a co. a  e ee ax ococ o cpae
c e BIOS  e opaae opa o cace.

   H poe.

   p oe   ax   e  cooa  oaooo  pe-

                                     - 11 -
pa popaa oa ocoo  poep  pecp  caca  ,
apec  opa  oopoo a 5 oe aooo apeca coeoo o-
aooo aaepa.   0 oo pecpa e pae ,  o  ex
op  oa  e e oe co  pe- cp ax pea.  Koa
 0 caoc pa 1,  o ao eeeo ca eo  pecpa,
c e o a eo e ao- c ce pae co.  oce
oo a co ca,   0 o caoc  pa  0    ocaec
ao, oa e pe o co.
   Xo ec o o  e  oopoc,  o  oaoe  poep
oo  coa ec ep  copa ocax co- o.  B
o ae a,  o ec ocae ae oaa a  pa  co
copoc 1200 o, o poepa ca paa BIOS e e ce- a
 pooe epeoee.  pocoe  peee  x  poe  coco  
cooa oaooo pepa.
   Ce pep aco pe coepoe peeo  paea,
ooceoc   epeae coo.  Ka   o cae o aaec c
ecoeoo a.

KEEP_TRYING:   MOV  DX,BASE_ADDRESS   ;ao apec
   ADD  DX,5           ;aae a pecp caca 
   IN   AL,DX          ;oae a caca
   TEST AL,00011110B   ;poepe a o
   JNZ  ERROR_ROUTINE  ;ec a, o a opao o

   TEST AL,00000001B   ;poepe oe  ae
   JNZ  RECEIVE        ;a poep pea ax
   TEST AL,00100000B   ;poepe oooc  epeae
   JZ   KEEP_TRYING    ;ec e, o  aa a
    .
   (ec pacooea poepa epea - c. [7.1.6])
    .
;---oae ae  o x a pa
RECEIVE:   MOV  DX,BASE_ADDRESS        ;ao apec
   IN   AL,DX          ;ae oe co
   CMP  AL,19          ;poepa a XOFF
   JE   XOFF_ROUTINE   ;
    .
   ( ..)
    .
   MOV  DL,AL          ;oo co  oa a pa
   MOV  AH,2           ; oa coa
   INT  21H            ;o eo
   JMP  SHORT KEEP_TRYING   ;opaaec a aao a

  8. oca/oee ax c oo oaooo pepa.

   Xopoa oaoa popaa ee co oo pao, o
oc  ce eo o/o.  ocae ae o aa-
poac,  epeaaee ae o  copac,  a  oe  o
ax  o  acac  a  c    cac c eo.  Ko-
aooe pepae ooe popae  e  pa  a  o/o
oe   pee,  e  o  oo  pee.  Hapep,  oce  cao
pepa,  paee epeaec poepe epe- a a oo 
o  cae,  oa  pecp  xpae  epeaa c  opaaec
popae,  a oo oca a ax,  oo e pooa co
pao  o  ex  op,  oa pecp xpae epeaa e e coa
oo.
   IBM PC   oo  a  aapax  pepa    oaox
aao,  oep 3 (COM1)  4 (COM2).  Mpocxea UART 8250 ocae  4

                                     - 12 -
acca  pepa   aoo aaa,  co ce- e oe
ooe ca:

   00     eee  pecpe caca oea
   01     pecp xpae epeaa c
   10     oe ae
   11     oa pea,  oeo coe epepa

   o  coepac  ax 2-1 pecpa ea pepa- ,
apec opa oopoo a  2  oe,  e  ao  apec  coeoo
oaooo  aaepa.    0 oo pecpa caaaec p
ooe pepa,  a ocae  e c- oc   cea
pa 0.
   o pa oo  oee pepa,  ao  apopapo-  a
pecp  papee  pepa,  apec  oopoo  a 1 oe aooo
apeca. aee eo o aoe:

 0     1 = pepae p oe ax
    1     1 = pepae oa pecp xpae epeaa c
    2     1 = pepae p oe pea ax
    3     1 = pepae p ee pecpa caca oea
  7-4     e coc, cea 0

  Koa oo  x co  pocxo,  o  pec  aapaoe
pepae,  oaee    pocxee  opao  pepa  8259 o
aa 3    COM1    o  aa  4    COM2.  poepa  opao
pepa   epeae   paee  o  o,  a  oop  aae
cooec  eop  pepa.  oco  o  aapaoe   pe-
pae,   o  oo  oe    acpoao.  oe,  o  poepa
opao pepa oa aepac  caap  oo  xoa  
aapaoo  pepa  MOV  AL,20H/OUT 20H,AL.  Ha pc.  7-3 oaao
oaooe pepae.
   oe co  o pepa oe  papeeo oopeeo.  Ho
ec papee oee e o ,  o  poepa  opao  pepa
oa  caa  opee ao  o pepa pooe,  poep
pecp ea pepa.  Oopeeo o pocxo oee
e oo pepae,  oo  0 pe- cpa ea cooae o
o,  o  oco  ee  oo  pe-  pae.  Koa  a    oee
pepa   oco     o    o  e  oe  pee,  o  o
opaaac    ope,  aao      epeeo   ae.
oaoe  pepa o  opa- oa o aepe poep
opao pepa.  co peecx pepa "oec" c
oo ec, peex  pao coe cee a:

Ko             T               ec  "cpoca"

 11       oa  epep     ee pecpa caca 
 10       oe ae        ee pecpa pea ax
 01       epea oo       o coa  pecp xpae
                                 epeaa
 00    eee caca oea  ee pecpa caca oea

   H poe.

   Bo  oa  opa popa,  opaaae  oaoe
pepa:

;---caoa eopa oaooo pepa
   PUSH DS                  ;coxpae DS

                                     - 13 -
   MOV  DX,OFFSET IO_INT    ;DS:DX aa a poep
   MOV  AX,SEG IO_INT       ;
   MOV  DS,AX               ;
   MOV  AL,0BH              ;oep eopa  COM1
   MOV  AH,25H              ; ee eopa
   INT  21H                 ;ee eop pepa
;---aa pecpa papee pepa (COM1)
   MOV  AX,40H              ;DS aae a ae BIOS
   MOV  DS,AX               ;
   MOV  DX,DS:[0]           ;oae ao apec COM1
   INC  DX                  ;aae a pecp papee
   MOV  AL,3                ;pepa  papeae pepa
   OUT  DX,AL               ;pea  epea
   POP  DS                  ;occaaae pecp

;---poepa opao pepa - caaa opeee eo 
IO_INT      PROC FAR
NEXT_INT:   MOV  DX,BASEADDRESS     ;ao apec
   INC  DX                  ;aae a pecp ea
   INC  DX                  ;pepa
   IN   AL,DX               ;ae eo aee
   TEST AL,10B              ;o pepae epeaa?
   JNZ  TRANSMIT            ;ec a, o a epea

RECEIVE:                    ;ae a pe
   .
   .
   JMP SHORT ANOTHER        ;poepe e  poo pepa

TRANSMIT:                   ;ec o  epea
   .
   .

;---epe xoo, poepe e  poo pepa
ANOTHER:   MOV  DX,BASEADDRESS       ;ao apec
   INC  DX                  ;aae a pecp ea
   INC  DX                  ;pepa
   IN   AL,DX               ;ae eo aee
   TEST AL,1                ;poepe  1
   JNZ  NEXT_INT            ;ec o caoe, o a aao
   MOV  AL,20H              ;ae o aepe aapaoo
   OUT  20H,AL              ;pepa
   IRET
IO_INT      ENDP
[ | | ]










helloworld.ru © 2001-2018
Rambler's Top100 TopList