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

Coae a

 Ec B  xoe o ae-o coe ,  o B o po
popapoa pocxe aepa 8253.  Kaa 2 o pocxe po
ca  c  ao  oepa.  Koa  o  aa popapec 
pee 3,  o o ocae pooe  o  ao  aco.  -a
poco  aa  o  ca- ae pa pooo o,  oa
oee p  cxa ccoa o.  K coae, pocxea
8253  e  oe  e-   a o,  oo  e oe e
pooc a, aaeoo ao.
   a ee e o,  a a xoa  eepa a. acoa -
co ao  pocxe  oe    eea,  oo  op
oec x x coo  oe oa ceae oe
e.

                          1. eepa oa.

   oo ocaoo apopapo-  a  pocxe  aepa  8253,
oopa  paoae eaco o poeccopa.  B peeo ec eoe
poeccop  eocpeceo  pae  ao,   oo   popae
pxoc  o  pao-  ,  oop  oe  o pocxea
aepa.  Xo o coco oee pe,  o o  ocae  ceceo
o  opo  a  ao    coae  oca ceax
ox eo ocoaec a e.

                 C(o)              523.3
                 D(pe)              587.3
                 E()              659.3
                 F(a)              698.5
                 G(co)            784.0
                 A()              880.0
                 B(c)              987.7

aco a oa e oo o,  aa  ae,  a  e
oa e - ee pa aa aco.   aoopo,  aco a oa
e pa peo ooe x ae (xopo- o  acpoeoe
ao oo e cee apeec epa- a).

   H poe.

   eepa a  c  oo  aaepa  epeca  c epepe 8255
coco o e  e c eaeo  acoo  a  opa  B,
oop ca c ao ( 1).  op B ee apec 61H (xo AT e
ee pocxe epeca c epepe 8255 a aoo,  o  co-
e    o  e o e apec opa  o e ).  Ec popaa
epeae aee a c acao ooo acoo,  o acoa
co coa, o  oeo. oo e  epee-
 ao ca co .  oe,  o  0 opa  B  pae
opoa  aaa 2 pocxe aepa,  oop  co oepe ca c
ao. oo o  oe  cpoe, ocoec o aaa
aepa.
   B cee  pepe  ee  e  epeee.  Oa,  ooaea
"FREQUENCY",  coec    aece  cea   co e e
ec e  e.  e ee ee aee, e cpee
pocxo  eee  a    e  oe  acoa.  epe-  ea e
"NUMBER_CYCLES"  caaae  pooeoc  oa.  Oa   oop
coo  pa  oe  oope poecc e  e.  e
oe o co, e oe  a .

                                     - 2 -
   Oe, o    o  poep aapae pepa o 
apee.  pa oo  o,  o pepae aepa  pocxo  c
ao  acoo    pepoc (18.2 paa  ce),  o oo e
ceceo   a  aco.  ee  ,  o  oa  pepa
apee,  ce  pee  co BIOS e e paoa.  Ec ae
poa eo aee,  o oo e oac a eoop  e
o  peaoo,  o  ex  op,  oa  e  e  ceao cooecee
eee.

NUMBER_CYCLES  EQU   1000
FREQUENCY      EQU   300
PORT_B         EQU   61H
               CLI                 ;ape pepa
               MOV   DX,NUMBER_CYCLES  ;eoc oa  DX
               IN    AL,PORT_B     ;oae aee  opa B
               AND   AL,11111110B  ;oae a o aepa
NEXT_CYCLE:    OR    AL,00000010B  ;ae a
               OUT   PORT_B,AL     ;ocae oa  op B
               MOV   CX,FREQUENCY  ;aepa a o-a  CX
FIRST_HALF:    LOOP  FIRST_HALF    ;eae aep
               AND   AL,11111101B  ;ae a
               OUT   PORT_B,AL     ;ocae oa  op B
               MOV   CX,FREQUENCY  ;aepa a o-a  CX
SECOND_HALF:   LOOP  SECOND_HALF   ;eae aep
               DEC   DX            ;ae e  cea
               JNZ   NEXT_CYCLE    ;ec 0, o ao oa
               STI                 ;papeae pepa

         2. eepa a oopeeo c p ec.

    oco pocxea    aepa   8253   paoae   eaco   o
poeccopa,  o  oe  poco  eeppoa  ,  oop   aec
oopeeo   c   oee   px   oepa.  B  o  poco
apopapoa aa 2 o pocxe    eepa  opeeeo
aco, a ae epepopapoa pocxe  e a.

   H poe.

Mpocxea oa  peapeo papeea epe op B pocxe
epeca c epepe 8255 (apec 61H).  Bce peeoe aee
cea   a,  pae 1.19 oo a pee aco 
epax.   e pooac o ex  op,  oa  e    ap
opoa  aaa 2.  oo B o cpoc  1 opa B  0,  ae
 e pooac eco- eo    oe    pepae  oo
epeapo oepa.   ooo pepoa eoc a
oo cooa ce pee co BIOS, a aao  [2.1.6]. B
ao  pepe eeppec acoa 440 ep.   pepaaec oce
aa o a a aape.

;---papeee aaa 2 caoo opa B pocxe 8255
PORT_B     EQU  61H           ;caoa apeca opa B
           IN   AL,PORT_B     ;ee eo ae
           OR   AL,3          ;caoa x ax o
           OUT  PORT_B,AL     ;ocae a  op B
;---caoa pecpo oa/oa
COMMAND_REG  EQU  43H         ;apec oaoo pecpa
CHANNEL_2    EQU  42H         ;apec aaa 2
             MOV  AL,10110110B    ;eoa o  aaa 2
             OUT  COMMAND_REG,AL  ;aca  oa pecp

                                     - 3 -
;---aca cea  a
           MOV  AX,2705       ;ce = 1190000/440
           OUT  CHANNEL_2,AL  ;ocae a a
           MOV  AL,AH         ;cae a a  AL
           OUT  CHANNEL_2,AL  ;ocae cap a
;---e aa a
           MOV  AH,1          ;oep  pepa 21H
           INT  21H           ;ae pepae
;---ee a
           IN   AL,PORT_B     ;oae a  opa B
           AND  AL,11111100B  ;cpacae a ax a
           OUT  PORT_B,AL     ;ocae a opao

                      3. eepa aopa oo.

   B o  opaee  oaao a eeppoa eo o,  oa
oep e  p  e  a;    cee  e  oaao  a
o    e aa,  oa oep a po paoo.  Koa
oep  e  p  e  a,  o  oo  o  eo  
poo  ceae  oe  e;  oa  e oep a
po paoo, o e poo oe e.
   Coae ox  cpo ec oo  oex oooc- e,
peocaex eco.  ocpoee e cpo o    ac-  ceepe
pee  oo  pao.  Moe  cooa o  x eoo
eepa a.   oox eoo ao poco eeppoa o o 
ee  aaoo  pee,  ae  ce   ..  Kaa oa
cpoa oppec  x  cpo  ax,  oa    oopx  coep
aco-  oceoaex oo,  a pa xpa x eoc (p
co, o pec pae eoc). pooeoc a
opeeec c cooae cea pee co BIOS [2.1.6].

   H poe.

   B pepe   eepa a coec pocxea aepa 8253.
ec poco coc 8 o,  o eoa oa oe  co
pacp oooc o poep. eec p cpo ax. epa
caaae  eoc  ao  o,  a  paoe  poooo
epoa aep (e o epo a- ep, oo e e).
Bopa cpoa coep aco ao  8  o;    ae  o
   oee     cac  pao  oae  ooo 
ecox coo poea  a  eo  oae  ooo  
ecox  coo  "opa  a  a"   coa opaa ape.
e  ocecc  epepo  -   e   ocpae   x   a
cooece  oceoaeoc a oo e ae.  o ex
op, oa Baa popaa ae a- aoe ooee eaae oo
oa  oe  oae  epe-  oo  cpo,  poeo,  a  
opao a a opapo- a Ba  o    cooec  c  Ba
oea.  pep, oope e o opa eepo cpo
o coo- ac  a paoocpoe.
   B paecx  peax  ooo  epeeee  oo a ae o
a.  p ea eca B oee o  paec pe- ,  o
oc pax poeo e coa.
   eec cea   o,   oop   acae   oo   cea

                                     - 5 -
opaac    pa  e o epe ea oepeo cpo,
oe apae ea.  Xo o aeo aee ea,
oao p o ocaec oee ooe oopoae oo.  o
ocoeo oeo p paoe   paec-  o  pee.  o  
ooapae  ea ao oca o 27,85,1,  a o epc 
apaeo ea - o 27,85,0.

                      7. eee pa ea.

   pa cpa 8 1/2 a ooe aeaa  cpoe  o  80-
ox    coo,    ec   ce   o   e   oao   p.
poopoaa ea ooe  oec    cpoe  ee  ecoo
coo.  C po copo,  oa ea ooe ec  cpoe
132 coa, ea c oo po - 40 coo, a oa ea c
oo po - 64 coa.  ee , o cooae ea c
pao po  oo cpoe pee  poc c opapoae.
   oco apx  pepo  peoca aop peo ea
cea  pa.  Bo  epee   caapx   oooc-   e
peocaex paec pepo IBM:

oa ea:
    e  pea  oo  ea  ao   oca   ooa
pa o 15.   e oo pea - o 18.  Caapa
cpaa po 8 1/2 a ooe aeaa 132 coa   cpoe
 o pee.

ea c oo po:
    oo,  o pep  aa  eaa  c  oo  po  ao
oca  a  eo  pa  o 14.  Pe ea c oo po
eoe e,  o pep aoaec ae  o  pe,  oa
cpeae co opaa ape  epeoa cpo.  oco ao
 ea oo coec    oocpox  aooo,  o  o
coco  oo.  o  o pe  cepee cpo oe
o 20.

Beea ea:
   p eeo  ea  a  co eaaec a paa  oo 
o e o.  o eae o eee, o coae e ee.
Copoc ea p o eaec oe.   e oo pea
oe o 27,69.  e - 27,70.

ea a a poxoa:
   B pee  ea  a  a  poxoa  aa caec a 1/216 a
epe op poxoo eaae oo.  p  o  oac  oee
aoee  ,  oope   o e  pe.  Copoc ea
eaec oe.  o pe aec pa  oo  27,71,  a
aec oo 27,72.

ea c oepae:
   ea c   oepae   oe   oc      cocoa.
paec  pep  ee  pe  oepa,    oopo  oep
eaaec o  a  coo,  a  poe.    paecoo
pepa  IBM o pe aec oo 27,45,1,  a aec oo
27,45,0.  pep,  e  ee  pea  oepa  o  cea
oep   p  opo  poxoe  o  o  e  cpoe,  eaa  co
oepa (ASCII 95)  ex ecax,  e oo o  poe  (ASCII
32)  o  cex ocax ox.  Bopo poxo ocaec e,  o
oce epoo poxoa oaec o opaa ape e  oa  epeoa
cpo.  Bopo  poxo  e  eae  pe-  p pao oca

                                     - 6 -
cpo p ce paepa cpa.

ea c epx   eca:
   Ha paecx  pepax  ec  c  epx      eca
caec epao.   ea epxeo eca oe pa
o 27,83,0,  a  ea eo - 27,83,1. Moo po epexo o
ox eco  p.   e ea eco,  c e, o
pep oaac a ee cpoe oe pa o 27,84.

   Heoope pe  e  o  cooac   oa c p.
Ec B xoe  cooa  4  pea  oopeeo,  o  pooc-
pec  co cee ae.  B ao  ec coo peea
oca oa.

   Koa           1  2  3  4  5  6

   opa           X  X
   ca                     X  X
   ee                       X  X
   a a poxoa       X     X     X
   c eca             X     X     X
   oo p       X  X  X  X  X  X
   c oepae     X  X  X  X  X  X


                     8. oca ax a pep.

   oca ax a pep paa  ax cooo po, a 
popaca a e acceepa eec  p    oepa-  oo
cce,    oope    ea    aa   ae   ocaoo   poco.
popapoae a  o  poe  pee  oe  pao,  o  ao
peocae   oe  oooce.  Ka  pao,  poep  ea
oo po oca co a pep,  a ae ocoo poepe
pecp caca oa opa,   oopo pcoee pep. Ce
co ocaec oo oa,  oa pep  cape,  o  o
oo  (pep oe e eaa co cpa,  a aaca eo  coe
epe,  o ex op oa e e oea ea  cpoa  coo  
ea).
   Kpoe oo,  poep oo po o cooa  pepae
pepa    o  poa ece oo pepa.  C oo
ceaoo popapoa oo  cea  a,  o  pep  e
ea  pepae  poeccopa,  oa  o  oo   pe ceeo
coa.  poepa opao  pepa  ocae  ce  co,
oce  eo  poeccop oe pooa aac co ea.  o
eo coec  ooo  ea  (oop  aa  ae  c-
o).  oco  ece   a   cpa
acaec    ope  0,n,  e  n oe  o 1 o 22 o.  
caapo cpa ao oca oa 27,67,0,11.

             6. paee ooee eaae oo.

   eaae ec  pacpeeec  o  cpae  aco   a   ce
e  a,  a  aco  a  ce  e  eaae oo.
ooa oe  oopoaa  oe eco,  o e e  aa
ee oopa.  Beco oo aaec ee ceee, ooceo cao
eo o,  oop oa oe oca.   pepa e  ao,
cooax eee ooee oo. Baa popaa oa ocea
ooee oo,  ec oo oo  ec.  p  o  xopoe
pao  ec  aa ea c oa paeo oa 27,60,
oop cae oo   ca  e  o,  e  ea  epeoa
cpo (o e caoe eae  o opaa ape).
   p ea eca eec ecoo cocoo epe o- o 
oe  ooee.  Oa  oe B     ;epe cac opa B
              OR   AL,00000011B  ;papeae a  aep
              OUT  PORT_B,AL     ;ocae a opao
              MOV  SI,0          ;aae a cpo
              MOV  AL,0B6H       ;aa aaa 2 aepa
              OUT  COMMAND_REG,AL   ;ocae  oa pecp
              MOV  FIRST_NOTE?,0    ;cpacae a epo o
;---e o, oae ee aco, ocae  aa 2
NEXT_NOTE:    LEA  BX,MELODY     ;epe ceee cpo eo
              MOV  SI,WHICH_NOTE ;aae a e o
              MOV  AL,[BX][SI]   ;o ee o cpo
              CMP  AL,0FFH       ;poepe pa oa
              JE   NO_MORE       ;ec a, o a oe
              CBW                ;ae  co opa
   ;oae aco
              MOV  BX,OFFSET FREQUENCY  ;ceee a aco
              DEC  AX            ;aae oce c 
              SHL  AX,1          ;oae a 2, .. coa
              MOV  DI,AX         ;apecec epe DI
              MOV  DX,[BX][DI]   ;oae aco  a
   ;aae coee o
              MOV  AL,DL         ;oo a a aco
              OUT  LATCH2,AL     ;ocae  pecp a
              MOV  AL,DH         ;oo cap a
              OUT  LATCH2,AL     ;ocae eo
;---co , opee eoc o
TIME_IT:      MOV  AH,0          ; e cea
              INT  1AH           ;oae aee cea
              MOV  BX,OFFSET BEAT  ;ceee cpo  o
              MOV  CL,[BX][SI]   ;eoc ee o
              MOV  CH,0          ;
              MOV  BX,DX         ;aee coo ae cea
              ADD  BX,CX         ;oae   cax
              MOV  END_NOTE,BX   ;aoae pe ooa
TIME_CHECK:   MOV  AH,0          ; e cea
              INT  1AH           ;ae ce
              CMP  DX,END_NOTE   ;cpaae c 
              JNE  NOT_NOW       ;ec epao, o xo
              MOV  SI,WHICH_NOTE ;ae, epe ce o
              INC  SI            ;eae oep o
              MOV  WHICH_NOTE,SI ;aoae eo
              JMP  NEXT_NOTE     ;aae ce o
;---aepee poep
NO_MORE:      IN   AL,PORT_B     ;epe cac opa B
              AND  AL,0FCH       ;ae a
              OUT  61H,AL        ;opaae a
              MOV  SOUND_NOW?,0  ;occaaae epeee
              MOV  FIRST_NOTE?,1 ;
NOT_NOW:      POP  DS            ;occaaae pecp
              POP  SI            ;

                                     - 7 -
              POP  DI            ;
              POP  DX            ;
              POP  CX            ;
              POP  BX            ;
              POP  AX            ;
              IRET               ;opa  pepa
MELODY2       ENDP

                 5. Coae aoo epexoa oo.

   ae epexo oo pooc a ce epepoo e- e
aco.  o oo e oo cea oee pae,  ec
eoo ea eoc  aoo  ceea  oa  p  oe
a  cea ea eoc p oe.

   H poe.

   poe ceo   cooa   eo   eepa   a,  pae
pocxeo epeca c epepe 8255.  poco ee aee a
1 opa B e 0  1,  co  ocea pee co .  p
aae aoo ooo coo a,  ace  ac  ae    CX,
cea ee o ae- e. ec o oaec:

;---ape pocxe aepa
PB       EQU  61H        ;apec opa B pocxe 8255
         IN   AL,PB      ;oae  eo a
         OR   AL,1       ;cpacae  0
         OUT  PB,AL      ;opaae a  op
;---caoa aco  eoc a
         MOV  BX,9000    ;aaoe aee cea
         MOV  DX,3000    ;eoc a 3000 o
REPEAT:                  ;ca opaaec oce a
;---caoa a aa
         OR   AL,00000010B   ;caaae  1
         OUT  PB,AL          ;ocae a  op B
         MOV  CX,BX          ;caoa cea  1/2 a
CYCLE1:  LOOP CYCLE1         ;co  a 1000 oopo
;---cpoc a aa
         AND  AL,11111101B   ;cpacae  1
         OUT  PB,AL          ;ocae a  op
         MOV  CX,BX          ;caoa cea
CYCLE2:  LOOP CYCLE2         ;co 
;---epexo  cee 
         DEC  BX             ;eae aco, ea
         DEC  BX             ;ce
         DEC  DX             ;eae ocac eoc
         JNZ  REPEAT         ;ec DX e 0, o o 
o poco   eo   po    o,  o  coe  oa  poxo
aeo cpee,  e e.   opox epao ao e
oe  eae, a oa o e e, ao oa o, oop
p oe oa epecae  DX oe ae a cee e.

                    6. Coae ox eo.

   oe e oo ocac epep  eee  aco
oa.

   H poe.


                                     - 8 -
   cceep ooe  eeppoa ece oa,  oa epa,  
eee  oopoo  a  e,  e  pae  epa,    eee
oopoo  o  e.  Taoe  apee  cep  oe po 
a    pa  a.   Koa   ooee   x   epao
cocae,  cae  50    1,  o  oae  ae.  Ec e
ooee ee   10  -  20  pa,  o  ae  epexo    oee
pae   .   B   o  cae    eeppec  pocxeo
epeca c epe- pe 8255.
Bo pep a:

NUMBER_CYCLES  EQU  300     ;co epee aa
FREQUENCY1     EQU  50      ;pe, oa a e
FREQUENCY2     EQU  3200    ;pe, oa a e
PORT_B         EQU  61H     ;apec opa B pocxe 8255
            CLI                  ;ape pepa
            MOV  DX,NUMBER_CYCLES;DX cae  oa
            IN   AL,PORT_B       ;oae cac opa
            AND  AL,11111110B    ;oae a o aepa
NEXT_CYCLE: OR   AL,00000010B    ;ae a
            OUT  PORT_B,AL       ;ocae oa
            MOV  CX,FREQUENCY1   ;aepa  epo ac
FIRST_HALF: LOOP FIRST_HALF      ;
            AND  AL,11111101B    ;ae a
            OUT  PORT_B,AL       ;ocae oa
            MOV  CX,FREQUENCY2   ;aepa  opo ac
SECND_HALF: LOOP SECND_HALF      ;
            DEC  DX              ;eae co o
            JNZ  NEXT_CYCLE      ;ec 0, o opa oa
            STI                  ;papeae pepa

  coa pax o oo cooa o e o, o
ao ae aee FREQUENCY2 a e ooo 40000.

               7. Oopeea eepa pax o.

   Too pocxea eepaopa a,  eac  PCjr,  oo-  e
oopeeo  eeppoa  pae  .  Oao  acceep ooe
oe  a  cocoa  ee-  pa  a,  o  coae   a
oopeeo  eepa  x  pax o.  epepe x x
cao po  coo ope oo o. Ka  x o
ee   e  pooc,  oo    peae  oaec  copee
ae,  e a pax ooca. o pe peao oee oo 
coa ox eo.

   H poe.

   Hao poco  oe  a  eoa  eepa a.  Hae 
epe aa 2 pocxe ae- pa.  ae ope xo  aa,
a  ce  a  1  opa  B pocxe epeca c epepe.  Bopoe
ece opeee  pooeoc  a.  He  ae  
pocxe aepa p aepe.

;---aae eepa a epe aa 2 aepa
      IN   AL,61H          ;oae a  opa B
      OR   AL,3            ;caaae ae a aa
      OUT  61H,AL          ;ocae a opao
      MOV  AL,10110110B    ;eoa  oaoo pecpa 8253
      OUT  43H,AL          ;ocae  pecp
      MOV  AX,600H         ;ce  aaa 2

                                     - 9 -
      OUT  42H,AL          ;ocae a a
      MOV  AL,AH           ;oo cap a
      OUT  42H,AL          ;ocae cap a
;---eeppe op aco pocxeo 8255
NUMBER_CYCLES  EQU  9000           ;co epee
FREQUENCY      EQU  150            ;aepa  oo a
               CLI                 ;ape pepa
               MOV  DX,NUMBER_CYCLES  ;DX cae  oa
               IN   AL,61H         ;oae cac opa
               AND  AL,11111111B   ;oae a o aepa
NEXT_CYCLE:    OR   AL,00000010B   ;ae a
               OUT  61H,AL         ;ocae aa  op
               MOV  CX,FREQUENCY   ;aepa a 1/2 a
FIRST_HALF:    LOOP FIRST_HALF     ;
               AND  AL,11111101B   ;ae a
               OUT  61H,AL         ;ocae oa  op
               MOV  CX,FREQUENCY   ;aepa a 1/2 a
SECOND_HALF:   LOOP SECOND_HALF    ;
               DEC  DX             ;ee ce o
               JNZ  NEXT_CYCLE     ;ec 0, o opa oa
               STI                 ;papeae pepa
;---ee aaa 2 pocxe aepa
               IN   AL,61H         ;oae cac opa
               AND  AL,11111100B   ;cpacae 2 ax a
               OUT  61H,AL         ;ocae a opao
[ | | ]










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