«  »

/ , /


: - IBM PC


.., ..

-
I B M P C

(C) p- p

p
1990



p

. . . . . . . . . . . . . . . . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . .
1. - . . . . . . . . . . . . . .

2. . . . . . . . . . .
2.1. . . . . . . . . . . .
2.2. . . . . . . . . . . . . . . . . . . . .
2.3. . . . . . . . . . .
2.4. . . . . . . .
2.4.1. p p XT- .
2.4.2. p p AT- .

3. . . . . . . . . .
3.1. . . . . . . . . . . .
3.2. . . . . . . . . . . . . . . . . . .
3.3. . . . . . . . . . . . . . . . . .

4. . . . . . . . . . . . . . . .
4.1. 8253 . . . . . . . . . . . . .
4.2. IBM PC . . . . . . . . . .
4.3. . . . . . . . . . . . . . . . . . . .

5. . . . . . . . .
5.1. 8255 . . . . . . . . . . . . . . . . . .
5.2. IBM PC . . . . . . . . . . . . .

6. . . . . . . . . . . . . . . . . . . . . . .
6.1. IBM PC/XT . . . . . . . . . . . . . . . .
6.2. IBM PC AT . . . . . . . . . . . . . . . .

7. . . . . . . . . . . . . . . . . . . . . . . . .
7.1. . . . . . . . . . . . . . . . . . . .
7.2. . . . . . . . . . . . . . . . . . . .
7.3. . . . . . . . . . . . . . . . . . .
7.4. MGA . . . . . . . . .
7.5. CGA . . . . . . . . . . .
7.6. EGA . . . . . . . . .
7.7. VGA . . . . . . . . . . . . .

8. . . . . . . . .
8.1. . . . . . . . . . . .
8.2. . . . .
8.3. . . . . . . . . . . .
8.3.1. p pp . . . . . . . . .
8.3.2. pp . . . . . . . . . . . .
8.4. . . . . . . . . . . . . . . . . . . . .
8.5. - . . . . . . .

9. . . . . . . .
9.1. - . . . .
9.1.1. p - . . . . . . . . . . . . . . . .
9.1.2. p p . . . . . . . .
9.1.3. . . . . . . . . . . . . . . . . . .
9.1.4. . . . . . . . . . . . . . . . . . .
9.2. - . . . .
9.2.1. p - . . . . . . . . . . .
9.2.2. . . . . . . . . . . . . . . . . . .

10. . . . . . . . . . . . . . . . .
11. RS-232 . . . . . . . . . .
11.1. . . . . . . . . . . . . . . . . . . .
11.2. . . . . . . . . . . . . . . . . . .
11.3. 8250 . . . . . . . . . . . . .

12. . . . . . . . . . . . . . . . . . . .

13. CMOS . . . . . . . . . . . . . . . . . . . . . . . . .
13.1. CMOS . . . . . . . . . . . . . . . . . . .
13.2. CMOS . . . . . . . . . . . . . . . . . .

14. . . . . . . . . . . . . . . . . . . . . .

1. - . . . . . . . . . . . . . .
2. . . . . . . . . . . . .
p 3. p . . . . . . . . . .
. . . . . . . . . . . . . . . . . . . . . . . .





-, IBM PC,
IBM PC XT, AT PS/2.
- ,
. ,
, ,
INTEL (Intel Handbooks).


,
(, TECH Help!, Norton Guide .).
,
MS-DOS. ,
-,
, , -, -
IBM PC.


; , ,
, ,
. "" ,
,
.


IBM
PC ( ).

,
, :

620075, . ,
. 81,
- .
. 56-92-54, 56-92-41.




PC, XT, AT, PCjr, PC Convertible PS/2 -
IBM PC.
,
:

PC: 8088, 4.77 ,
5 .

PCjr: 8088, .
IBM PC.
.

XT: 8088, , 8 .
PC.

Turbo PC: ( IBM), PC XT,
8086 V30 NEC, 6
8 . 8 .

XT-286: 80286, 8 , 6
( AT 8 ). AT
, PC ,
16- .

AT: 80286, 8 , 6 8
.

PC Convertible: AT. :
(LCD) , 3.5- ,
.

PS/2: IBM. 25 30 -
PC,
. 50 60 - 80286, 32-
MicroChannel, . 80
80386. 3.5
.

AT-386: , AT,
80386.

,
:

PC/XT IBM PC XT,
Portable PC
AT IBM PC AT
PS/2 PS/2

,
IBM.

,
"h" .
, 256 100h 256.


, .

.
, ,
:

: +, -, *, /, % ( )
: & (), | (), ~ ()
: << >>.


1. -


- IBM PC/XT, AT PS/2.
:

- 0 - FFh ;
- 100h - 3FFh ;
- , 400h, .

AT/PS-2 PC/XT .

000-01F 000-00F N 1, 8237-5 2
020-03F 020-021 N 1, 8259A 3
040-05F 040-043 (PC/XT:8253-5, AT:8254-2) 4
060-063 8255 5
060-06F AT 8042 6
070-07F CMOS NMI 13
080 14
080-08F 080-083 74LS612 2
090-097 PS/2
0A0 NMI 14
0A0-0BF N 2, 8259A 3
0C0-0DF N 2, 8237A-5 2
0F0-0FF 80287 14

101-107 PS/2
170-177 N 2 9
1F0-1F7 N 1 9
200-207 200-20F 12
210-217 14
238-23F RS-232 N 4 ( PS/2) 11
278-27F 278-27F N2 (N 3 MGA) 10
2C0-2DF 2C0-2DF (EGA) N 2 7
2F8-2FF 2F8-2FF RS-232 N 2 11
300-31F
320-32F XT 9
338-33F RS-232 N 3 ( RS/2) 11
370-377 N 2 8
378-37F 378-37F N 1 (N2 MGA) 10
380-38F 380-38F : SDLC BSC N 2
3A0-3AF 3A0-3A9 BSC N 1
3B0-3BF 3B0-3BF (MGA) + N 1 7,10
3C0-3CF 3C0-3CF (EGA) N 1 7
3D0-3DF 3D0-3DF (CGA) EGA 7
3F0-3F7 3F0-3F7 N 1 8
3F8-3FF 3F8-3FF RS-232 N 1 11


: ,
- ( ,
..).


2.

(, DMA - Direct
Memory Access)
-
,
.

,
.

,
.

IBM PC-
8237 INTEL (
58057) 8237-4 8237-5,
4 5 (
8237 3 ). 4
,
.


2.1.

2 :
(Idle cycle) (Active cycle).
,
().
(Program Condition)
RESET ,
300 c
( 0) CS (Chip Select). -
,
CS .
:

- ;
- ;
- ,

(
, ,
. .).

16-
8- -.
() () -
( /, First/Last flip-flop),


.

(
0),
" ",
, .
" " 1
.
,
.
:

1. (Signle Transfer Mode).
,
,
,
.

2. (Block Transfer Mode).

" "
(DACK),
.

3. (Demand Transfer Mode).
:
,
,
. ,

.
,
.

4. (Cascade Mode).
,
.

. HRQ
(" ") DREG
(" ") , DACK ("
") HDLA ("
") .


() ,
HRQ HDLA.


2.2.

1. - (Memory-to-memory DMA).

.
, - .
( 1)
1.

. e -
(Address hold),

,
, .

2. (, Autoinitialization).


.
,

.
()
.

3. .
0 ,
3 - . ,
,
.

4. .
""
e . ,
,
,
,
. ,
( 0 - ),
1- 2- ,
,
( 2, , , . .
) 2- ,
,
, , 3,
.

5. (Compressed transfer timing).
,
,
2
, .


2.3.

344 ,
.
.

Ŀ

()
Ĵ
16 4
(Base Address Register)

16 4
(Base Word Count Register)

16 4
(Current Address Register)

16 4
(Current Word Count Register)

16 1
(Temporary Address Register)

16 1
(Temporary Word Count Register)

8 1
(Status Register)

8 1
(Command Register)

(Mode Register) 6 4

8 1
(Temporary Register)

(Mask Register) 4 1

4 1
(Request Register)


(Base Address Register).
,
. 16
64.

(Page Registers),
.
.
,
.
, 1000h (0, 1000h, 2000h, ...,
9000h).

(Base Word Count
Register).

.

, . . 100 ,
1 ,
101 .

(Current Address Register).

.

(
). -
,
.

(Current Word Count
Register).
(
).

,
,
,
( 0 0FFFFh).

(Mode Register).

.

7 6 5 4 3 2 1 0
Ŀ
XX :

> 0-1: : 00=,
01= ( ),
10= ( ),
11=
> 2: : 1=,
0=
> 3:
: 0=, 1=
> 4-5: :
00= ,
01= ,
10= ,
11= .

,
. , ,
.

(Command Register).
8- .
,
"Reset" "Master
Clear". .

7 6 5 4 3 2 1 0
Ŀ
:

> 0: 0= -,
1=
> 1: 0=
0, 1=
> 2: 0=, 1=

> 3: 0= ,
1= ;
0 ,
> 4: 0= ,
1=

> 5: 1= ,
0= ; 3
,
> 6: 0=
(DREQ), 1=
> 7:

(DACK), 1=

(Status Register).

. 0 - 3
0 - 3 ( 0 - 0, 1 -
1 ..), .

. 4 - 7
0 - 3
.

(Mask Register).
4- /
, 1 , 0

.

(Request Register).
(DREQ)
, .
4-
4- .

.
.
. ,
,
.

(Temporary Register).
8-
,
-
.


2.4.


-.
-.
2.4.1 2.4.2
XT- - .


2.4.1. XT-

IBM PC XT XT- 4-
8237. :

0 - -;
1 - ( );
2 - ;
3 - .

-,
.

Ŀ

Ĵ
0h -
0

2h 1

4h 2

6h 3

0h -
0

2h 1

4h 2

6h 3

1h
0

3h 1

5h 2

7h 3

Ŀ

Ĵ

1h -
0

3h 1

5h 2

7h 3

8h

8h

9h

0Ah

0Bh


0Ch () - (
/)

0Dh

0Eh 4-

0Fh 4-

0Dh

0Fh
Ĵ
81h 2

82h 3

83h 1

87h 0


0h - 7h
,
4- .
, ,
, 16-, .

-,
0Ch,
16-
.

8h
. .2.3.

8h .
.2.3.

9h
.
:

7 6 5 4 3 2 1 0
Ŀ
X X X X X :

> 0-1: 00 - 0
01 - 1
10 - 2
11 - 3
> 2: 1=
0=

0Ah
. :

7 6 5 4 3 2 1 0
Ŀ
X X X X X :

> 0-1: 00 - 0
01 - 1
10 - 2
11 - 3
> 2: 1=
0=

0Bh
4- . 0 1 (00 -
0, 01 - 1, 10 - 2, 11 - 3). 2 - 7 ,
0 - 6 .
. 2.3.

0Dh
(Master Clear).
, .
, ,
. -
.
.

0Eh -
4-
.

0Fh
. 0 - 3 AL
0 - 3
.


, .
4 20-
, .. 1000h
(0, 1000h, 2000h, ..., 9000h). ,
64,
, ,
, . -

, .


2.4.2. AT-

IBM PC AT AT-
8237, e .

:

0 - ;
1 - SDLC;
2 - ;
3 - ;
4 - ;
5, 6, 7 - .

0 - 3 PC/.
4 - 7 16- .
:

- 0 ,
, 0,
1 - 16 23-
( 0 - 15 20- ,
- ),
4 - 7 17 - 23
, 16 - 23,
0 - 3;

- 16- ,

, , ;

- ,
2000h .

-,
.

Ŀ

Ĵ
0C0h -
4

0C4h 5

0C8h 6

0CCh 7

0C0h -
4

0C4h 5

0C8h 6

0CCh 7

0C2h
4

0C6h 5

0CAh 6

0CEh 7

0C2h -
4

0C6h 5

0Cah 6

0CCh 7

89h 6

8Bh 5

8Ah 7

8Fh 4




. , /

.
, 0,
, 4 ( 4 - 0
, 5 - 1 . .).

Ŀ
.

-2 -1
Ĵ
0D0h 8h

0D0h 8h

0D2h 9h

0D4h 0Ah


0D6h 0Bh


0D8h () - 0Ch
( /)

0DAh 0Dh

0DCh 0Eh

0DEh 4- 0Fh


0DAh 0Dh




3.

(, Programmable
Interrupt Controller, PIC)
. 8259 Intel (
58059), 8259-2 8259-8,
8 .
:

-
;
- ;
- -
, ;
- -
.



.

8259A
.

Ŀ Ŀ
__
CS 1 28 Vcc
__
WR 2 27 A0
__ ____
RD 3 26 INTA

D7 4 25 IR7

D6 5 24 IR6

D5 6 23 IR5

D4 7 22 IR4

D3 8 21 IR3

D2 9 20 IR2

D1 10 19 IR1

D0 11 18 IR0

CAS0 12 17 INT
__ __
CAS1 13 16 SP/EN

GND 14 15 CAS2


Ŀ

Ĵ
Vcc - + 5

GND - ()
__
CS
__
RD
__
WR

D0-D7 -



CAS0-CAS2 /
, .


.
__ __
SP/EN

INT
____
INTA

A0

IR0-IR7
.


:

- /;
- ;
- ;
- ;
- ;
- ;
- .

:
.

(Initialization Command Words, ICW), -
(Operation Control Words, OCW).
:

- ;
- ;
- ;
- ;
- .


3.1.

/ (Read/Write Control
Logic).
.
8-
(Data Bus Buffer),
.
ICW OCW. CS, RD, WR A0. CS
(Chip select) .
CS .
WR (Write)
ICW OCW .
RD (Read)

IRR, ISR IMR, .

ICW OCW
9- . 0 - 7
8- . (,
) 0 0 1
,
- ( )
.
, 0 0,
, , 0
1.

(Interrupt Request Register,
IRR) IR0 - IR7 .
IR0 - IR7 -
(0 - 7).

IRR.

( ,
In-Service Register, ISR) 0 - 7
(0 - 7) .

(Interrupt Mask
Register, IMR) ,
. IMR
,
IRR .

( , Priority
Resolver) ,
.


a, INT ( )
. IF 1
( ),
INTA ( ), 0
IRR 1 ISR,
.
INTA,
8- .

8088/8086.
8080/8085
.
,
, INT
() - 0CDh.


.
INT IR0 -
IR7 . INT
. INTA,
ISR
IRR, CAS0 - CAS2
, ,
. CAS0 - CAS2
, ,
IR .


3.2.

1. (Fixed Priority, Fully
Nested Mode).
. 0
7 (0 - )
.
,

.

2. (Automatic Rotation).

. ,
4
,
5
, ,
.

3. - (Specific
Rotation).
, .
,
.
,
, .
,
3, 2
.

4.
(Automatic End Of Interrupt, AEOI).

ISR ,
. AEOI
ISR ,


(EOI).
,
, . .
.

5. (Special Mask Mode).

.

.

6. (Polling Mode).
.
IRR.

, ,
, .


3.3.


Intel 8086/8088/80286. ,
, , .

2
-. ( 20h)
( 21h).
4 (Initialization Control Word,
ICW1 - ICW4), , 3
( , Operation Control
Words, OCW1 - OCW3). ICW1,
OCW2 OCW3. OCW2 OCW3 , 3 ocw2
0, OCW3 1. 4 OCW2 OCW3 0,
ICW1 1. ,
, , (ICW1,
OCW2 OCW3) .

ICW2, ICW3,
ICW4 OCW1.
, . . ICW2 - ICW4
ICW1,
OCW1
, o o .


ICW1 .

ICW1 - ICW4. ICW3
. ICW4 ICW1.

.

ICW1 :

A0 7 6 5 4 3 2 1 0
Ŀ
0 -- -- -- 1 LTIM ADISNGL IC4


> 1= ICW4
0=
> 1=
0=
>
> 0=

1=


4, 1, , ICW1, OCW2
OCW3.
3 (LTIM), 0, ,
: IRR
ISR.

2 (ADI) -
Intel 8080/8085.

1 (SNGL)
( 1)
( 0). 1, ICW3
ICW2
ICW4.

0 (IC4) , ICW4. ICW4
( 0 = 0),
. ICW4 , . .
8086/8088 1
.

ICW2
0 ( 8 IBM PC,
0 ).
, ICW2
8 ,
1, (0Ah)
2 . .

ICW3
. ICW3
, IR0 - IR7
, 1.
0. ICW3 :

A0 7 6 5 4 3 2 1 0
Ŀ
1 0 0 0 1 0 0 1 0


, 2 ,
IR1 IR4.

ICW3 (, slave)
,
. , 1
ICW3 :

A0 7 6 5 4 3 2 1 0
Ŀ
1 0 0 0 0 0 0 0 1


4, ICW3
:

A0 7 6 5 4 3 2 1 0
Ŀ
1 0 0 0 0 0 1 0 0


(ICW4)
:

A0 7 6 5 4 3 2 1 0
Ŀ
1 0 0 0 SFNM BUF M/SAEOI mPM


> 1=8088/8086
0=8080/8085
> 1=AEOI
0=EOI
> 1=
0=
( BUF=1)
> 1=

> 1=


0 (mPM) ,
(0 - 8080/8085, 1 - 8086/8088).

1 (AEOI), 1,
, .
0, :
ISR.

2 (M/S) , 3 (BUF) = 0.
BUF = 1 1.
1 .

4 (SFNM) ,

(Special Fully Nested Mode).

.
,
.

:

- ;
- ;
- -
;
- / ;
-
ISR IRR;
OCW1 - OCW3.
OCW1:

A0 7 6 5 4 3 2 1 0
Ŀ
1 M7 M6 M5 M4 M3 M2 M1 M0


0 - 7 ,
(IR0 - IR7)
.

(OCW2)

(EOI),
. OCW2 :

A0 7 6 5 4 3 2 1 0
Ŀ
0 R SL EOI 0 0 L2 L1 L0

> 3 -
>
> ,
.


> 1- -
v v
Ŀ
0 0 EOI=1
Ĵ
0 1 EOI ( , -
Ĵ L0 - L2 ISR)
1 0
Ĵ
1 1 , -
L0 - L2

,

ISR (End Of
Interrupt, EOI). EOI:
EOI. EOI ISR, -
. -
EOI (R=0, SL=1, EOI=1, L0 - L2
) ISR ,
, L0 - L2 .
R=1 .

, ,
, , 0
, 1 - , 2 -
..

. ,
5, 6 .

OCW3
,
IRR ISR. OCW3


A0 7 6 5 4 3 2 1 0
Ŀ
0 0 ESMM SMM 0 1 P RR RIS


> 1-
v v v v v
Ŀ Ŀ
1 0 - 0 1 0 IRR
Ĵ Ĵ
1 1 - 0 1 1 ISR


( , Polling Bit)
.
, AL
:

7 6 5 4 3 2 1 0
Ŀ
I 0 0 0 0 L2 L1 L0


I = 1, L0
- L2 - ,
.

P=0, ISR IRR.
ISR IRR (.
) .

ESMM
SMM
.


4.

4.1. 8253


IBM PC/XT
8253 ( 58053),
AT - 8254. .
: ,
- ,
, ,
16- .



. GATE
OUT .

0 ( ).
UT
;
.
( ). ,
, OUT

.
GATE.
.

:
,
.
2.

1 ( ). OUT
t=n*T, n - ,
, T - .
OUT
GATE .


, .
GATE
( ). n=1.

2 ( ).
OUT
.
.
GATE OUT
.
GATE .

3 ( ). 2,

, - . , n
( ) ,
n*T/2;
n - (n+1)*T/2 (n-1)*/2 .
GATE , OUT
. GATE
,
. , n=3 .

4 ( ). ,
, OUT
.
,
. GATE
, - .
1.

5 ( ).
4 ,
GATE .
,
.


:

ڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿ
CLK
__ ÿn=5 Ŀn=4
WR
Ŀ
GATE
Ŀ Ŀ
OUT

n 5 4 3 2 1 0 4 3 2 2 1 0

0


ڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿ
CLK
__ ÿn=4 Ŀn=5
WR
Ŀ Ŀ
GATE
Ŀ Ŀ
OUT

n 4 3 2 1 0 5 4 3 5 4 3 2 1 0

1


ڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿ
CLK
__ ÿn=4 Ŀn=3
WR
Ŀ
GATE
Ŀ Ŀ Ŀ Ŀ
OUT

n 4 3 2 1 0 3 2 1 0 3 2 1 0 3 2 1 0

2


ڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿ
CLK
__ ÿn=4 Ŀn=5
WR
Ŀ
GATE
Ŀ Ŀ Ŀ
OUT

n 4 3 2 1 0 4 3 2 1 0 4 3 2 1 0 5 5 4

3


ڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿ
CLK
__ ÿn=4 Ŀn=5
WR
Ŀ
GATE
Ŀ Ŀ
OUT

n 4 3 2 1 0 5 5 4 3 2 1 0

4


ڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿڿ
CLK
__ ÿn=4
WR
Ŀ Ŀ
GATE
Ŀ Ŀ
OUT

n 4 3 2 1 0 4 3 4 3 2 1 0

5

IBM PC 40h
:



40h 0
0

41h 1
1

42h 2
2

43h



:

7 6 5 4 3 2 1 0
Ŀ


> 0: 0 = , & 1
1 = -
> 1-3: : & 0Eh
000 - 0
001 - 1
X10 - 2
X11 - 3
100 - 4
101 - 5
> 4-5: : & 30h
00 - ""
( 0-3 )
01 -
10 -
00 - ,
> 6-7: : a & C0h
00 - 0
01 - 1
10 - 2
11 -


.

1. .

GATE ( 1),
.

2. " ".
43h
"" (. ).

, .


4.2. IBM PC

IBM PC .



0 (IRQ0) 3, =0 (65536)
1 0
( ) 2, =18
2


1,19318 , . .
0,84 . GATE 0
1 ,
. GATE 2 0 PB
8255 (. . 5), 61h.

BIOS 0
3 0 (. . 65536
).
1,19 /65536 = 18.2
IRQ0, Int 8, 18,2
, . . 55 .

0,

- BIOS ;

- , . .
.

1 2 18,
18 . -
, . .
.

2 .


4.3.

""
: OUT 2- 1
8255.
2 ,
,
(20 - 20 ).
3
. 0 1 ,
( 0 - GATE
2, , 1 -
OUT ).
0 - 1 .
, , ,
. 2-
n=1193181/f=1234DDh/f (1193181 - ,
f - ).

:

;
;
; : X=
;
Sound proc near
push ax ;
push bx
push dx
mov bx,ax ;
mov ax,34DDh
mov dx,12h ;(dx,ax)=1193181
cmp dx,bx ; bx < 18,
jnb Done ;
div bx ;ax=(dx,ax)/bx
mov bx,ax ;
in al,61h ;
or al,3 ; 0-1
out 61h,al
mov al,00001011b ; :
; 2, 3,
mov dx,43h
out dx,al ;
dec dx
mov al,bl
out dx,al ;
mov al,bh
out dx,al ;
Done:
pop dx ;
pop bx
pop ax
ret
Sound endp
;
;
;
No_Sound proc near
push ax
in al,61h ;
and al,not 3 ; 0-1
out 61h,al
pop ax
ret
No_Sound endp

.
octave - (1, 2, ...); note -
(=1, #=2, ..., =12). :

f := 32.625;
for i := 1 to oktave do f := 2*f;
for i := 1 to note do f := 1.059463094*f
Sound (round(f));

,
,
1 .
, :

;
;
; : N=
; FREQ=
;
in al,61h ;
and al,not ; 0
mov dx,N
Repeat:
or al,2
out 61h,al ; 1
mov cx,FREQ
Wait_On:
loop Wait_On
and al,not 2 ; 1
out 61h,al
mov cx,FREQ
Wait_Off:
loop Wait_Off
dec dx
jnz Repeat


. - , f -
, t - ,

N=T*f; FREQ=t/(34*f).

34 ,
Wait_on Wait_off (17*cx)
.

,
-
.

Wait_on Wait_off.


5.

5.1. 8255

IBM PC/XT
() 8255 ( 58055).
8- (, )
.
:
, - .
(0, 1, 2); -
(0 1).
, :

7 6 5 4 3 2 1 0
Ŀ
1 : :

> 0-1: a & 3
( )
> 2: (0 1) a & 4
> 3-4: a & 18h
( )
> 5-6: : a & 60h
00= 0
01= 1
1X= 2

0.
( ).
.
, , -
(, , , -
):

Ŀ

Ĵ
4
3
1
0


1. ,
- .
. 4
(1 = , 0 = ).

:

()

4 (STBA) 0 = ""
5 (IBFA) 1 = ,
6-7 3 0,
;
1, .


:

()

4-5 , 6,7
6 (OBFA) 1 = ,

7 (ASKA) 0 =


3 ,
INTRA.
.
1, , 0,
. INTRA = 1,
, 0, .
4 6
(1 = ).

1
. 2 1 STBB IBFB
( STBA IBFA). 2
1 OBFB ASKB (. ). 0 INTRB,
2.

2. .
,
:

()

4 (STBA) 0 = ""
5 (IBFA) 1 = ,
0 =
6 (ACKA) 1 =
7 (OBFA) 1 = ,
0 =



5.2. IBM PC

IBM PC/XT 60h - 63h. BIOS
( 63h) 99h, . .
0, , -
:



60h

61h


62h

63h /



: 7 0,
-
(. . 6); 7 ,
DIP- SW1 :

7 6 5 4 3 2 1 0
Ŀ
: :

>0: 1= & 1
>1: 1= 8087 & 2
>2-3: : & 0h
00=16K, 04h=32K, 0eh=64K
>4-5: : & 30h
00= EGA/VGA
10h=CGA, 40
20h=CGA, 80
30h=
>6-7: -1 a & C0h
00=1, 40h=2, 80h=3, C0h=4


:

7 6 5 4 3 2 1 0
Ŀ
:

> 0: GATE 2- :
OR 3 = .
AND 0FCh = .
> 1:
> 2:
> 3: 0=

> 4: 0=
> 5: 0=

> 6: 0=
> 7:
( 1=
)

7 .
, 0-3
DIP- SW2, , :

7 6 5 4 3 2 1 0
Ŀ
:

> 0-3: DIP- SW2 (. )
> 4:
> 5: OUT 2-
> 6: 1=
> 7: 1=


SW2 :

7 6 5 4 3 2 1 0
Ŀ
:

> 0-3:
> 4-7:


6.

6.1. IBM PC/XT

60h
61h (. 5.2).
IRQ1, Int 9.
,
:

Int_09h:
push ax
push di
push es
in al,60h ;.
les di,buffer ;
stosb ;
pop es
pop di
in al,61h ;
mov ah,al
or al,80h ; " "
out 61h,al
xchg ah,al ;
out 61h,al
mov al,20h ; EOI
out 20h,al ;
pop ax
iret

- 1.

1 IMR , 6
:

in al,21h ; IMR
or al,2 ; 1
out 21h,al ; IMR

in al,61h ;
or al,40h ; 6
out 61h,al ;


.


6.2. IBM PC AT

PC AT
Intel 8042;
,
PC/XT.


- 64h.
60h.
, 60h.

64h
. -
e :

cli ;
call wait_kbd ;
mov al,cmd_code ;
out 64h,al ;
sti ;

, ,
:

cli
call wait_kbd
mov al,cmd_code ;
out 64h,al
call wait_kbd
mov al,data_value ;
out 64h,al
sti

:

wait_kbd:
mov cx,2500h ; 10
test_kbd:
in al,64h ;
test al,2 ;
loopnz test_kbd
ret


( , , , . .
):



0FFh .
0FEh .
0FDh IRQ1.
0F6h
.
0F5h
.
0F4h .
0F3h .

0,5
10 .
, :

7 6 5 4 3 2 1 0
Ŀ
0 :

> 0-4:
> 5-6: :
00=250, 01=500, 10=750, 11=1000

:

Ŀ
...
Ĵ
00h 30.0 0Bh 10.9 16h 4.3
01h 26.7 0Ch 10.0 17h 4.0
02h 24.0 0Dh 9.2 18h 3.7
03h 21.8 0Eh 8.6 19h 3.3
04h 20.0 0Fh 8.0 1Ah 3.0
05h 18.5 10h 7.5 1Bh 2.7
06h 17.1 11h 6.7 1Ch 2.5
07h 16.0 12h 6.0 1Dh 2.3
08h 15.0 13h 5.5 1Eh 2.1
09h 13.3 14h 5.0 1Fh 2.0
0Ah 12.0 15h 4.6


0EEh ( ). 0h.
0EDh .

:

7 6 5 4 3 2 1 0
Ŀ
X X X X X :

> 0: 1 = ScrollLock
> 1: 1 = NumLock
> 2: 1 = CapsLock

0DFh 20- .
0DDh 20- .
0D1h 8042.
0D0h 8042.
0C0h 8042.
0AEh .
0ADh .
0ACh .
0ABh .
0AAh .



7.

7.1.

IBM PC
,
.
IBM PC, :

- MGA;
- CGA;
- EGA;
- VGA.


- (). IBM PC
Motorola,

.
.
:

- (
);
- (
);
- ;
- , , . .



, .

, ()
.
(
)
;
e
( ) -
.

,
,
. (overscan),

.


(character clock).
- , 8
8 9 - .


;
MGA/CGA EGA/VGA.


7.2.

MGA CGA Motorola 6845,
:



R0
(horizontal total) .
R1 .
(horizontal displayed)
R2
(horizontal
sync position) .
R3
(sync width) ( - ,
- ).
R4
(vertical total) .
R5 50
(vertical adjust) 60 .
R6
(vertical displayed) .
R7
(vertical
sync position) .
R8 4-5:
(interlace mode);
6-7: (skew)
R9 .
.
R10 .
R11 .
R12\
R13/
R14\
R15/
R16\
R17/


A EGA VGA
, :



R0
(horizontal total) .
R1 (horizontal
display enable end) (. R7).
R2 ,
(start horizontal
blank) .
R3 ,
(end horizontal
blank) ( 0-4);
( 5-6).
R4
(start .
horizontal retrace)
R5
(end .
horizontal retrace)

7 6 5 4 3 2 1 0
Ŀ
:

> 0-4:

> 5-6:

> 7: 1=
, 0=

R6
(vertical total) (. R7).
R7
(overflow) :

7 6 5 4 3 2 1 0
Ŀ
:

> 0: 8- (R6)
> 1: 8-
(R18)
> 2: 8-
(R16)
> 3: 8-
(R21)
> 4: 8- (R24)
> 5: EGA: 8- R10, VGA: 9- R6
> 6: 9- R18 ( VGA)
> 7: 9- R16 ( VGA)

R8 (preset
row scan) .
R9 .
( 0-4);
VGA: 5=9- R21.
R10 .
R11 (
0-4); ( 5-6).
R12\
R13/
R14\
R15/
:
R16\
R17/
:
R16
(start .
vertical retrace)
R17
(end .
vertical retrace)

7 6 5 4 3 2 1 0
Ŀ
0 :

> 0-3:

> 4: 0=

> 5: 0= -
(IRQ2)
> 7: VGA: R0 - R7

R18 - ,
(vertical -
displayed end)
R19
(vertical displayed .
adjustment)
R20 ( 0-5).
R21 ,
(start vertical
blank) .
R22 ,
(end vertical
blank) .

R23 :

7 6 5 4 3 2 1 0
Ŀ
:

> 0: 0= CGA

> 1:

> 2: :
1=, 0=
> 3:
: 1=,
0=
> 4: 1=
, 0=

> 5:
CGA: 0= 64
, 1= 64
> 6: : 1=,
0=
> 7: 0= , 1=


R24 ,
(line compare) .


,

, ,
.

BIOS,
.


7.3.

(
, ); ASCII,
, -
.
.

CGA :

7 6 5 4 3 2 1 0
Ŀ
Blr g b I R G B :

> 0-2:
> 3: 1=
> 4-6:
> 7: 1=

, 0 7,
- 0 0Fh.
:

16 * + ( 128
)

:

Ŀ

Ĵ
0 8
1 9 -
2 0Ah -
3 0Bh
4 0Ch
5 0Dh
6 0Eh
7 - 0Fh


EGA VGA
, ,
, .
64 (EGA) 256 (VGA)
.

-
, :

01h
07h ( )
09h
0Fh -
70h ( )
81h
87h
89h
8Fh -

,
,
(. 7.4 - 7.6).


7.4. MGA

(MGA Hercules) -
,
.
- 3B0h - 3BFh, .



3B4h .
. Rn
:
out 3B4h,n out 3B5h,.

3B5h / .
R12 - R17.

3B8h :

7 6 5 4 3 2 1 0
Ŀ
X X X X :

> 1: 0= , 1=
> 3: 0= , 1=

> 5: 1= 7 -
0= 7 -
> 7:

3B9h /
.

3BAh :

7 6 5 4 3 2 1 0
Ŀ
XXX XX :

> 0: 0= , 1=

> 3: 0= , 1= (

)
> 7: 0= ,
1=

3BBh /
.

3BCh-3BEh . (. 10).

3BFh .
:
0 (DIAG) - ;
1 (HALF) -
0;
3 (FULL) - .


MGA B0000h - BFFFFh.
(25 80 )
4 B0000h B0FFFh.
B000h : 160*L+2*C, .
L - (0 - 24), C - (0 - 79).

720
348 ,
32 . MGA :
0 B0000h - B7FFFh, 1 -
B8000h - BFFFFh. ,
(X,Y),

2000h * (Y % 4) + 90 * int(Y/4) + int(X/8),

7 - (X % 8).
X - (0 - 719), Y - -
(0 - 347).

MGA
.

;
Graph_Tbl db 35h,2Dh,2Eh,07h,5Bh,02h,57h,57h,02h,03h,00h,00h
Text_Tbl db 61h,50h,52h,0Fh,19h,06h,19h,19h,02h,0Dh,0Bh,0Ch

; :
Gr_Mode:
mov al,2
lea si,Graph_Tbl
mov bx,0
mov cx,4000h
call Set_Mode
. . .

; :
Txt_Mode:
mov al,20h
lea si,Text_Tbl
mov bx,0720h
mov cx,2000h
call Set_Mode
. . .

; MGA.
; : AL -
; SI -
; CX -
; BX -
Set_mode proc near
push ax ;
push bx
push cx
mov dx,3B8h ;
out dx,al ; ,
mov ax,cs
mov ds,ax ; DS:SI =
mov dx,3B4h ;
mov cx,12 ; 12
xor ah,ah
cld
Set_CRT:
mov al,ah
out dx,al ;
inc dx
lodsb
out dx,al ;
dec dx
loop Set_CRT
pop cx
mov ax,0B000h
mov es,ax
pop ax
xor di,di ; ES:DI =>
rep stosw ;
mov dx,3B8h ;
pop ax
add al,8
out dx,al ;
ret
Set_Mode endp


7.5. CGA

(CGA - Color Graphics Adapter)
- .
- 3D0h - 3DFh,
.



3D4h .
. Rn
:
out 3D4h,n out 3D5h,.

3D5h / .
R12 - R17.

3D8h :

7 6 5 4 3 2 1 0
Ŀ
XX :

>0: - :
0=40 , 1=80
>1: 0= , 1=
>2: 1=
>3: 0= , 1=

>4: :
0=320 , 1=640
>5: 1= 7 -
0= 7 -

3D9h :

7 6 5 4 3 2 1 0
Ŀ
XX I R G B :

>0-3: (. 7.3): -
, -
>4: : - ,
-
>5: (0 1)

:
. 0 - //,
1 - //- (. .
).

3DAh :

7 6 5 4 3 2 1 0
Ŀ
XXXX :

>0: 0= , 1=

>1: 1=
>2: 1=
>3: 0= , 1= (

- ,
"")

3DBh /
.

3DCh /
.


CGA B8000h - BFFFFh.
CGA : 25 40
80 . 25 40
800h , 8
; 25 80 1000h
4 .

B800h :
n*P+m*L+2*C, . L -
(0 - 24), C - (0 - 79 0 - 39), m = 2 *
, n = 800h m=80 1000h m=160.

CGA : ,
320 200
, - 640 200
. 320 200 ,
; 640 200
(/).
16 ,
, B8000h - BFFFFh.
: B8000h
, ;
BA000h . ,
(X,Y),

B800h : 2000h * (Y % 2) + 80 * int(Y/2) + int(X/4),

7 - 2 * (X %
4) 6 - 2 * (X % 4). X - (0
- 319), Y - (0 - 199).

, (X,Y),
-
B800h : 2000h * (Y % 2) + 80 * int(Y/2) + int(X/8),

7 - (X % 8).
X - (0 - 639), Y -
(0 - 199).


7.6. EGA

(EGA - Enhanced Graphics
Adapter) - ,
CGA MGA,
. IBM PC EGA
-:

EGA #1 - 3C0h - 3DFh;
EGA #2 - 2C0h - 2DFh.

EGA IRQ2 (Int 0Ah)
. , BIOS
; , . . Int 0Ah
PC AT
(. . 3).

EGA :

3C0h (ATC)
3C2h
3C4h-3C5h (sequencer)
3CAh-3CFh (GDC)
3D4h-3DCh
3B4h-3BCh ( )

(ATC) 20 ,
:



R0-R15
( ) :

7 6 5 4 3 2 1 0
Ŀ
XXr g b R G B :

> 0: 2/3
> 1: 2/3
> 2: 2/3
> 3: 1/3
( MGA)
> 4: 1/3
( MGA)
> 5: 1/3

R16 :

7 6 5 4 3 2 1 0
Ŀ
XXXX :

> 0: : 0=, 1=
> 1: 1= MGA, 0= CGA
> 2: 9- :
1=9- 8-
0= 9-
> 3: 7 :
1= , 0=

R17 ,
.
R18 :


7 6 5 4 3 2 1 0
Ŀ
XX :

>0-3: 1=
Ci, i = 0 - 3
>4-5: :
00=R&B, 01=b&G, 10=r&g,
11=

R19
(0 - 15).


.
1.
. , 02h
ATC , 10h - -,
12h - -.

2. , CGA,
:

Ŀ

Ĵ
00h 00h 08h 38h
01h 01h 09h 39h
02h 02h 0Ah 3Ah
03h 03h 0Bh 3Bh
04h 04h 0Ch 3Ch
05h 05h 0Dh 3Dh
06h 14h 0Eh 3Eh
07h 07h 0Fh 3Fh



.
.



R0 0 -

, 1
- .

.
R1 :

7 6 5 4 3 2 1 0
Ŀ
XXXX :

> 0: : 1=8 , 0=9
> 1: : 1=, 0=
> 2: 0= , 1=
> 3: :
1=, 0=

R2 0 - 3

.
R3 0-1 B,
2-3 - A; A -
, 3
, B -
, 3 .
,
EGA 64.
R4 :

7 6 5 4 3 2 1 0
Ŀ
XXXXX :

> 0: 1= , 0=
> 1: EGA: 0=64K, 1= 64
> 2: :
1=, 0= CGA
( )


(GDC)
:



R0 / 0 - 3
-
00.
R1 R0.

R2 0 - 3
1.
R3 :

7 6 5 4 3 2 1 0
Ŀ
XXX :

> 0-2:
00
> 3-4: 00
02: 00= , 01=, 10=,
11=

R4 0-2
1.
R5 :

7 6 5 4 3 2 1 0
Ŀ
XX :

> 0-1: 0 - 2 (. )
> 2: 1= ( -
), 0=
> 3: 0 - 1 (. )
> 4: 1=
(. 4 )
> 5: 1= 2 ,
CGA ( -
); 0=


R6 :

7 6 5 4 3 2 1 0
Ŀ
XXXX :

> 0: 1=, 0=
> 1:
> 2-3: :
00=A0000h (128K), 01=A0000h (64K)
10=B0000h (32K), 11=B8000h (32K)

R7 0-3 -

1.
R8 0-7 , -
.


. .
:

0 - ;
1 - R2 -
1 .

:

00 - , ,
;
01 - , -
;
10 - 8 -
0-3 ( )
11 - .

- EGA .



3C0h .
ATC :
in al,3C2h ;
out 3C0h,n ; ATC ( )
out 3C0h,val ;
0-4 n - , 5 :
1= , 0=
ATC.

3C2h :

7 6 5 4 3 2 1 0
Ŀ
:

> 0: :
1=3BXh (MGA), 0=3DXh (CGA)
> 1: 0=
1=
> 2-3: :
00=14 , 01=16 ,
10= , 11=
> 4: 1= ,
0=
> 5:
: 0=
, 1=
> 6:
: 1=
> 7:
: 1=

0:

7 6 5 4 3 2 1 0
Ŀ
X X X :

> 3-4:
(. )
> 5-6:
> 7: 0=


3C4h .

3C5h . -
Rn
:
out 3C4h,n out 3C5h,

3CAh 2 ( EGA 1).

3CCh 1 ( EGA 0).

3CEh .

3CFh .
Rn
:
out 3CEh,n out 3CFh,

3D4h .
. Rn
3B4h :
out 3X4h,n out 3X5h,.

3D5h/ / .
3B5h .

3DAh/ 0 - 1 FC0
3BAh FC1 ( 19 17 ).

1:

7 6 5 4 3 2 1 0
Ŀ
XXXX :

>0: 0= , 1=

>1: 1=
>2: 1=
>3: 0= , 1= (EGA

- ""
)
3DBh/ /
3BBh .

3DCh/ /
3BCh .


EGA CGA MGA,
:

320 200, 16
640 200, 16
640 350, -
640 350, 16

4
,
: , , .
EGA , -
,
( 4 16 ).

EGA o A0000h - B0000h.
EGA 64 256
. , EGA 256,
16 .
,
; ,
,
.

640 200 64
4 16 .
A0000h, A4000h, A8000h AC000h.
,
(X,Y), 80*Y + int(X/8),
7 - (X % 8). X -
(0 - 639), Y - (0 - 199).

320 200 8
8. ,
(X,Y), 40*Y + int(X/8),
7 - (X % 8).
X - (0 - 639), Y -
(0 - 199).

640 350
A0000h A8000h .
.


EGA 640 200.
,
PageSize .

PageSize equ 4000h ; 640 200


; .
; : CX = (0-3)


EGA_Cls proc near
push ax
push bx
push cx
push dx
push es
push di
xor ax,ax ;
mov bx,PageSize
jcxz Page_0
High_Page:
add ax,bx
loop High_Page
Page_0:
mov di,ax ; DI =
mov ax,0A000h
mov es,ax ; ES:DI =
mov ax,0FF08h
mov dx,3CEh ;
out dx,ax ;
mov ax,0FF02h
mov dx,3C4h ;
out dx,ax ;
mov ax,3
mov dx,3CEh ;
out dx,ax ;
mov cx,PageSize
xor al,al
rep stosb ;
pop di
pop es
pop dx
pop cx
pop bx
pop ax
ret
EGA_Cls endp


; .
; : AX =
; BX =
; CX = (X)
; DX = (Y)


Put_Pixel proc near
push ax
push bx
push cx
push dx
push es

push ax
push cx
push dx
mov ax,dx
mov cx,80
mul cx ; AX = 80 * Y
pop dx
pop cx
push cx
shr cx,1
shr cx,1
shr cx,1 ; CX = X / 8
add ax,cx ; AX = 80 * Y + X / 8
mov cx,bx ;
mov bx,PageSize
jcxz Page_Done
Next_Page:
add ax,bx ;
loop Next_Page
Page_Done:
pop cx
mov bx,ax ; BX = ,
mov ax,0A000h
mov es,ax ; ES:BX =
and cl,7 ; CL = X % 7
mov ah,80h
shr ah,cl ; AH =
mov dx,3CEh
mov al,8
out dx,ax ;
pop ax
mov ch,al ;
mov dx,3C4h
mov ax,0FF02h
out dx,ax ;
mov al,es:[bx] ;
xor al,al
mov es:[bx],al ;
mov al,2
mov ah,ch ;
and ah,0Fh ; 0-15
out dx,ax ; .
mov al,es:[bx] ;
mov al,0FFh
mov es:[bx],al ;
mov ax,0FF02h
out dx,ax ;
mov ax,3
mov dx,3CEh ;
out dx,ax ;
mov ax,0FF08h
out dx,ax ;
pop es
pop dx
pop cx
pop bx
pop ax
ret
Put_Pixel endp


; .
; : CX = (X)
; DX = (Y)
; :AX =


Get_Pixel proc near
push ax
push bx
push cx
push dx
push es

push dx
mov ax,205h
mov dx,3CEh
out dx,ax ; : =01, =0
pop dx
push cx
push dx
mov ax,dx
mov cx,80
mul cx ; AX = 80 * Y
pop dx
pop cx
push cx
shr cx,1
shr cx,1
shr cx,1 ; CX = X / 8
add ax,cx ; AX = 80 * Y + X / 8
mov cx,bx ;
mov bx,PageSize
jcxz My_Page
Higher_Page:
add ax,bx ;
loop Higher_Page
My_Page:
mov di,ax ; DI = ,
mov ax,0A000h
mov es,ax ; ES:DI =
pop cx
and cl,7 ; CL = X % 7
mov ch,80h
shr ch,cl ; CH =
mov bl,7
sub bl,cl
mov cl,bl ; CL =
xor bl,bl ;
mov ah,3 ;
mov al,4 ; R4 =
mov dx,3CEh ;
Read_Plane:
out dx,ax ; AH
mov bh,es:[di] ;
and bh,ch ;
shr bh,cl ; 0
shl bl,1 ;
or bl,bh ;
dec ah ;
jge Read_Plane ;
mov al,bl
xor ah,ah ; AX =
pop es
pop dx
pop cx
pop bx
pop ax
ret
Get_Pixel endp


7.7. VGA

VGA (Video Graphics Array) -
EGA.
EGA, .

1. EGA- , VGA -
.

(, ),

.

2. VGA , EGA,
:

640 x 480, 2
640 x 480, 16
320 x 200, 256

640 480
153600 . 320 200 256
,
; 4
16.
.

3. VGA 25
28 ( 14 16 EGA).

4. VGA 3CCh,
(.
3C2h . 7.6). 3CAh 3CCh,
EGA, VGA .


8.

8.1.

PC-
8272 Intel,
(Floppy Disk Controller, FDC).
,
.
40 80,
8 26. ,
/ (
).
8, 5.25 3.5 ,
, (128,
256, 512 1024 ),
, .

.
, .
2 :

. FDC
6 (IRQ6), 0Eh.
3
-.


8.2.


8272,
.
82072 , . .
,

.

-
.

Ŀ

Ĵ

3F2h


3F4h

3F5h

3F5h


3F5h


3F5h



3F2h.

7 6 5 4 3 2 1 0
Ŀ
:

> 0-1: :
00-
01-
10-
11-
> 2: 0= ,
1=
> 3: 1=

> 4-7: :
0001 -
0010 -
0100 -
1000 -

- 4, 2
, ,
, . 2, 0,
.
, .
, .
, .

1.

3F4h.


FDC.

7 6 5 4 3 2 1 0
Ŀ
:

> 0-3:
:
0001-, 0010-
0100-, 1000-
> 4: 0= ,
1= -


> 5: :
0= ,
1=
> 6: :
0= -->
1= -->
> 7: :
0= , 1=

7, 1, ,
,
/
,
.


8.3.

3 :

- ;
- ;
- .


.
(
).


( ).
/
" ".
/.
/
. ,
( 3F4h)
.

,
.
.
,
, .
, 2 .


8.3.1. pp

FDC.
"* * *".
.
.
,
.

Ŀ

Ĵ
1. MT MF SK 0 0 1 1 0
X X X X X HD US1 US0 -
C
H
R
N
EOT
GPL
DTL
* * *
ST0
ST1
ST2
C
H
R
N
Ĵ
2. MT MF SK 0 1 1 0 0
X X X X X HD US1 US0 -
C , -
H
R
N
EOT
GPL
DTL
* * *
ST0
ST1
ST2
C
H
R
N
Ĵ
3. MT MF 0 0 0 1 0 1
X X X X X HD US1 US0 -
C
H
R
N
EOT
GPL
DTL
* * *
ST0
ST1
ST2
C
H
R
N
Ĵ
4. MT MF 0 0 1 0 0 1 -
X X X X X HD US1 US0 -
C -
H
R
N --
EOT
GPL
DTL
* * *
ST0
ST1
ST2
C
H
R
N
Ĵ
5. 0 MF SK 0 0 0 1 0
X X X X X HD US1 US0 -
C
H
R
N
EOT
GPL
DTL
* * *
ST0
ST1
ST2
C
H
R
N

"
" " ",

, .
( )
, ,
.

Ŀ
6. 0 MF 0 0 1 0 1 0 -
- X X X X X HD US1 US0 -
* * *
ST0 -
ST1
ST2
C
H
R
N
Ĵ
7. - 0 MF 0 0 1 1 0 1
X X X X X HD US1 US0 -
N
SC
GPL
D
* * *
ST0
ST1
ST2
C
H
R
N


.
(, ,
)
.
"N" - ,
.
.
" ",
-.

Ŀ
8.- MT MF SK 1 0 0 0 1 -
X X X X X HD US1 US0
"" C -
H
R -
N
EOT -
GPL -
STP
* * *
ST0
ST1
ST2
C
H
R
N
Ĵ
9.- MT MF SK 1 1 0 0 1
X X X X X HD US1 US0
" C
" H
R
N
EOT
GPL
STP
* * *
ST0
ST1
ST2
C
H
R
Ĵ
10.- MT MF SK 1 1 1 0 1
X X X X X HD US1 US0
" C
" H
R
N
EOT
STP
* * *
ST0
ST1
ST2
H
R
N
* * *

Ĵ
12. - 0 0 0 0 0 0 1 1
<--- SRT ---> <--- HUT --->
<--------- HLT ---------> ND

Ĵ
13. 0 0 0 0 1 1 1 1 -
HD US1 US0 -
NCN -
* * *
Ĵ
14. 0 0 0 0 1 0 0 0
* * *
ST0 ST0
PCN ,






Ĵ
15. 0 0 0 0 0 1 0 0
HD US1 US0
* * * ST3
ST3

Ĵ
16. - < FDC> -
* * *
ST0
ST0=80h



:

=1 - ( );
MF=1 - - ( ) -

, ;

SK=1 - ;

HD - (0 1);

US1, US0 - (0 - 3);

- ;

- ;

R - ;

N - (0 - 128, 1 - 256, 2 - 512, 3 - 1024
);

EOT - ;

GPL - ( 2Ah
50h );

DTL - / (
N = 0);

ST0 - ST3 - ST0-ST3;

STP - ;

SRT - ( 0Dh);

HUT - 16
( = 0Fh);

HLT - 2
( = 1);

ND=0 - , =1 -
;

NCN - ;

PCN - ;

SC - ;

D - - ( 0F6h).


8.3.2.

ST0:

7 6 5 4 3 2 1 0
Ŀ
:

> 0-1: (0 - 3)
> 2:
> 3:
> 4: ""
0 77

> 5:
> 6: :
00-
01-
10-
11- -


2 ( )
0, ,
.

3 1,
1 (
0).


ST1:

7 6 5 4 3 2 1 0
Ŀ
0 0 :

> 0: 1= -

> 1: 1=

> 2: 1=
> 4: 1=

> 5: 1= CRC -

> 7: 1= (


)

ST2:

7 6 5 4 3 2 1 0
Ŀ
0 :

> 0: 1=

> 1: 1=
> 2: 1=

> 3: 1= -
""
> 4: 1=

> 5: 1= CRC
> 6: 1=



ST3:

7 6 5 4 3 2 1 0
Ŀ
:

> 0-1:
> 2:
> 3: 1= ""

> 4: 1= " 0"

> 5: 1= ""

> 6:1= " "

> 7: 1= ""


8.4.

.
.
.
,
,

,
4 - 5
.
.
:

Ŀ



Ĵ

80 4Eh

Ĵ
12 00h, 3 0C2h,
1 0FCh, 50 4Eh

Ĵ

1- 574

Ĵ

80 4Eh

Ĵ
. .
. 8 9 .
. .
Ĵ

574

Ĵ

80 4Eh

Ĵ

4Eh

Ĵ





:
Ŀ

22

Ĵ

22 4Eh

Ĵ

530



:
Ŀ
12 00, 3 0A1h
1 0FEh

Ĵ
6 : , ,
,
2


:
Ŀ
12 00, 3 0A1h,
1 0FXh (=8 -
, 0Bh -
Ĵ )

512

Ĵ

2




8.5. -

- ,

.

(
3F2h - 3F7h 372h - 377h).
-
82072 Intel (
).
3F7h,
(Data Rate Select Register, DSR).

3F7h.

7 6 5 4 3 2 1 0
Ŀ
:

> 0-1:
> 2-4:

> 5: 1=

> 6: 1=

> 7: 1=


0
- 1 DSR .

Ŀ

Ĵ
1 0
Ĵ
1 1 1 /
0 0 500 /250 /
0 1 300 /150 /
1 0 250 /125 /


2, 3 4 DSR
:

Ŀ

4 3 2
Ĵ
1 1 1

0 0 1 41.67

0 1 0 83.34

0 1 1 125.00

1 0 0 166.00

1 0 1 208.33

1 1 0 250.00

0 0 0




.

Ŀ


Ĵ
1 / 41.67
500 / 125.00
300 / 125.00
250 / 125.00


8272,
82072 4 :

- ;
- / ;
- ;
- .

.

Ŀ

Ĵ
1. 0 0 0 1 0 0 1 1 -
HDSA <- MOFF-> <--- MON --->
0 EIS EF POLL <- FIFOTHR ->
<--------- PRETRK ---------->
* * *
Ĵ
2./ ON/OFF US1 US0 0 1 0 1 1 /
-
-

Ĵ
3. - 1 DIR 0 0 1 1 1 1 -
0 0 0 0 0 HD US1 US0 -
<----------- RCN ----------->
* * *


Ĵ
4. 0 0 0 0 1 1 1 0
* * *
<---- PCN-- 0 -------->
<---- PCN-- 1 -------->
<---- PCN-- 2 -------->
<---- PCN-- 3 -------->
<--- SRT ---> <--- HUT --->
<--------- HLT ---------> ND
<--------- SC/EOT ---------->
HDSA <- MOFF -> <--- MON --->
<--------- PRETRK ---------->
0 EIS EF POLL <- FIFOTHR ->



:

US1, US0 - ;

DIR - (0-, 1-);

HD - /;

RCN - ;

PCN - ;

SRT - ;

HUT - ;

HLT - ;

ND - ;
SC/EOT - /
;

ON/OFF - / (0/1);

MON - ;

MOFF - ;

EIS = 1 -
/ , = 0;

EF = 1 - 8272;

POLL = 1 - ;

HDSA = 1 -
;

PRETRK - ( = 0).


9.


"".


Seagate, ,
, ,
. ,
-
,
.

,
, .
(*)
.


9.1. -

-
.
.
5- (IRQ5),
0Dh.
, ,
- .
0C800h,
(0CA00h, 0D000h 0D800h ST-251
ST-225 Seagate). 16
-,
(320h-32Fh), 4
, 320h-323h, 324h-327h, 328h-32Bh 32Ch-32Fh.
(1-, 2-, 3- 4- )
, 320h-323h.


9.1.1. -


.

Ŀ

Ĵ
320h

320h ,



321h

321h

322h ()

322h

323h



320h.


. ,
,
.
( 1
321h) 320h " ",
4 ,
.

321h.


.
:

7 6 5 4 3 2 1 0
Ŀ
X X X :

> 0,2,3: 11=


01=

> 111=

> 1: 1=
> 5: (0-1)

2, 1, 0, 1,
, .
2 = 0, 0 = 1,
,
.

3, 1, 0 1, 1,

" ". 1
0, 2 3 - ,
.

322h.


. (, )
(enable controller)
320h .

322h 0FFh,
, (
).

7 6 5 4 3 2 1 0
Ŀ
:


> 0,1,4,5: 1111=
, -

> 2,3,6,7:

( 5, 4, 1 0) 1111,
,
( 32 ),
(,
(Split switch)). XT
Seagate 15-
( 0 - 14), . 15
( ) ,
.

Ŀ
C H R B V
Ĵ
0 Seagate ST-225 615 4 17 0 21.4
Ĵ
1 Seagate ST-4038 733 5 17 2 31.9
Ĵ
2 Miniscribe-3425 615 4 17 0 21.4
Ĵ
3 Seagate ST-212 306 4 17 0 10.6
Ĵ
4 Priam V-150 987 5 17 0 42.9
Ĵ
5 Priam V-170 987 7 17 0 60.1
Ĵ
6 Miniscribe-8425,Kyocera 20A/20B 615 4 17 0 21.4
Ĵ
7 Seagate ST-138 615 6 17 0 32.1
Ĵ
8 Seagate ST-4051 977 5 17 2 42.5
Ĵ
9 Seagate ST-251/ST-251-1 820 6 17 0 42.8
Ĵ
10 HH-725 612 4 17 0 21.3
Ĵ
11 Seagate ST-4053, 1024 5 17 0 44.5
Miniscribe-3053/6053
Ĵ
12 Maxtor-1085, Newbury Data-1085 1024 8 17 0 71.3
Miniscribe-6085
Ĵ
13 Seagate ST-4096 1024 9 17 0 80.2
Ĵ
14 Maxtor-1140,Newbury Data-1140 396 15 17 0 51.7



C- ();
H- ();
R- ();
B- ();
V- ().

323h.

7 6 5 4 3 2 1 0
Ŀ
:

> 0: 1=
0=
> 1: 1=

(IRQ5)

-
.


9.1.2.

1 - 6 .
.

Ŀ
\
\ 7 6 5 4 3 2 1 0
\
Ĵ
0
Ĵ
1 0 0
Ĵ

2 (
)
Ĵ
3 ( )
Ĵ
4
( )
Ĵ
5


:

-
;

- - (0/1);

- - ;

- (Interleave Factor) -
(.
);

- :
7 6 5 4 3 2 1 0
Ŀ
X X X :

> 0-2:
""
> 6: 1= -
.

> 7: 1=
.

7, 1,
( 4 ),
1,
0.

6, 1,

, 6 0 -
, -
, 0.

0 - 2
"":

100 --> 200 ;
101 --> 70 ;
110 111 --> 3 ;


3 .


:

0 1 - ;
- ;
- (0/1);
-
( 7 );
- ( 6
);
-
"";
- 2 ;
- 8 ;
- (5 );
- (6 );
- (5 );
- (8 ).


9.1.3.

--> ( 0, 0).


.

Ŀ
0 0 0 0 0 0 0 0 0
Ĵ
1 0 0


--> ( 0, 1).

/
.

Ŀ
0 0 0 0 0 0 0 0 1
Ĵ
1 0 0
Ĵ
2
Ĵ
3
Ĵ
4
Ĵ
5 0 0 0 0


--> ( 0, 3).


( 1 321h). 2
,
.

:

Ŀ
0 0 0 0 0 0 0 1 1
Ĵ
1 0 0


:

Ŀ
0
Ĵ
1 0 0 <------ ------>
Ĵ
2 <-------- -------->
Ĵ
3 <------------ ------------>


:

7 6 5 4 3 2 1 0
Ŀ
0 :


> 0-3:

> 4-5:

> 7: 1=



7 1,
, 1 - 3
,
.

.

Ŀ


Ĵ
00 0000 ( )
00 0001 ""
00 0010 " "
00 0011 " "
00 0100

00 0101
00 0110 " 0"
00 0111
00 1000 "
"

Ĵ
01 0000
01 0001
01 0010
01 0011
01 0100
01 0101
01 0110
01 0111
01 1000
01 1001 " "
Ĵ
10 0000
10 0001
Ĵ
11 0000 "
"
11 0001

11 0010
(ECC)


--> ( 0, 4).

,

.
, -.

Ŀ
0 0 0 0 0 0 1 0 0
Ĵ
1 0 0 <------- ------>
Ĵ
2 0 0 0 0 0 0
Ĵ
3 <----------- ------------->
Ĵ
4 0 0 0 <------ ------->
Ĵ
5 0 0 0 0


--> ( 0, 5).


.

Ŀ
0 0 0 0 0 0 1 0 1
Ĵ
1 0 0 <------- ------>
Ĵ
2 <--------- -------->
Ĵ
3 <----------- ------------->
Ĵ
4 <------------ ------------->
Ĵ
5 0 0 0


--> ( 0, 6).

.
" ".

Ŀ
0 0 0 0 0 0 1 1 0
Ĵ
1 0 0 <------- ------>
Ĵ
2 0 0 0 0 0 0
Ĵ
3 <----------- ------------->
Ĵ
4 0 0 0 <------ ------->
Ĵ
5 0 0 0 0


--> ( 0, 7).

,
" " .
.

Ŀ
0 0 0 0 0 0 1 1 1
Ĵ
1 0 0 <------- ------>
Ĵ
2 0 0 0 0 0 0
Ĵ
3 <----------- ------------->
Ĵ
4 0 0 0 <------ ------->
Ĵ
5 0 0 0 0


--> ( 0, 8).


. .

Ŀ
0 0 0 0 0 1 0 0 0
Ĵ
1 0 0 <------- ------>
Ĵ
2 <--------- -------->
Ĵ
3 <----------- ------------->
Ĵ
4 <------------ ------------->
Ĵ
5 0 0 0


--> ( 0, 0Ah).(*)


, .
.

Ŀ
0 0 0 0 0 1 0 1 0
Ĵ
1 0 0 <------- ------>
Ĵ
2 <--------- -------->
Ĵ
3 <----------- ------------->
Ĵ
4 <------------ ------------->
Ĵ
5 0 0 0

--> ( 0, 0Ch).(*)


.

Ŀ
0 0 0 0 0 1 1 0 0
Ĵ
1 0 0 <------- ------>
Ĵ
2
Ĵ
3 <----------- ------------->
Ĵ
4
Ĵ
5 0 0 0 0


--> ( 0, 0Eh).(*)


(512 ).
/ , /
/ .

Ŀ
0 0 0 0 0 1 1 1 0
Ĵ
1 0 0
Ĵ
2
Ĵ
3
Ĵ
4
Ĵ
5


--> ( 0, 0Fh).(*)

.

Ŀ
0 0 0 0 0 1 1 1 1
Ĵ
1 0 0
Ĵ
2
Ĵ
3
Ĵ
4
Ĵ
5


--> ( 7, 0).(*)


. 3
0.

Ŀ
0 1 1 1 0 0 0 0 0
Ĵ
1 0 0
Ĵ
2
Ĵ
3
Ĵ
4
Ĵ
5


--> ( 7, 3).

.

Ŀ
0 1 1 1 0 0 0 1 1
Ĵ
1 0 0
Ĵ
2
Ĵ
3
Ĵ
4
Ĵ
5


--> ( 0, 4).


: , , .

Ŀ
0 1 1 1 0 0 1 0 0


--> ( 7, 5).


. " "
.
.

Ŀ
0 1 1 1 0 0 1 0 1
Ĵ
1 0 0 <------- ------>
Ĵ
2 <--------- -------->
Ĵ
3 <----------- ------------->
Ĵ
4 <------------ ------------->
Ĵ
5 0 0 0 0


--> ( 7, 6).


,
. " " .

Ŀ
0 1 1 1 0 0 1 1 0
Ĵ
1 0 0 <------- ------>
Ĵ
2 <--------- -------->
Ĵ
3 <----------- ------------->
Ĵ
4 <------------ ------------->
Ĵ
5 0 0 0 0



9.1.4.

.
.
( ).
() ,
,
.
8 26
.
"",
.
.
, 1,
. .
3, 17-
:

Ŀ
1 7132 8 143 9 154 1016 51117 612
Ĵ

-
<--<------> -->

.

Ŀ

()
Ĵ
4
1 9-12
Ĵ
:
1 1
2 2
1
1
1
1
1
1
1
1 4
Ĵ
3 16
Ĵ
:
2 1
4 2
512
2 4
Ĵ
5 43



, . ,
1 - 5, ,
2 4 2 ,
1, 3 5 ,
, .
()
, ,
,
,

.
,
,

.

.
,
, .


(Error Correction Code, ECC)
32- .


9.2. -

IBM PC AT IBM PC
:

- BIOS
, ;

-
;

- -, -
,
- .

.
(1F0h-1F7h
170h-177h ).
. .


9.2.1. -

1F0h


,
.

1F1h.


:

7 6 5 4 3 2 1 0
Ŀ
0 0 :

>0: 1=

>1: 1=
>2: 1= -
,

>4: 1=

>6: 1= -
,

>7: 1=

1F2h.

/ .

1F3h.

/ " "
.

1F4h.

/
( 0 - 1 - 8 - 9 10-
).

1F5h.

/
.

1F6h.

/
.

1F7h ().

.

1F7h ().


:

7 6 5 4 3 2 1 0
Ŀ
:

>0: 1= -

>1: 1= ""
>2: 1= -
-

ECC
>3: 1=
>4: 1=
>5: 1=
>6: 1= -
,
>7: 1= -
(

)


9.2.2.

1F7h ,
1F2h - 1F6h.
1F7h
. . 4
, .

.

Ŀ


Ĵ
1 (
0) ""
Ĵ
2 , -
Ĵ
3
Ĵ
4
Ĵ
5 = 0
Ĵ
7
""
Ĵ
9 = 0
Ĵ
= 1
(-

)



10.

IBM PC-
.
Centronix, 36
( -).
:

-
,
3BCh - 3BEh;

-
, 378h - 37Ah (
) 278h - 27Ah ( ).


- ( );
BIOS, 0:408h
(LPT1) LPT4.
, 378h.



378h - , -

-
,

379h :

7 6 5 4 3 2 1 0
Ŀ
XXX :

> 3: 0=
> 4: 0=
> 5: 1= " "
> 6: 0=

> 7: 0= ,



37Ah / :


7 6 5 4 3 2 1 0
Ŀ
XXX :

> 0: (. )
> 1: 1=
( MS-DOS
)
> 2: 1=
> 3: 1= (
)
> 4: 1=


.
1.
0 , .

2.
:
(IRQ7, 0Fh), -
(IRQ5, 0Dh). ,
IRQ5 XT-
.
(),
.


:

- ;

- a 7
( );

- 3-5 ;

-
,
:

mov dx,37Ah ;
mov al,00001101b ; 0,2 3
out dx,al ;
xor al,1 ; 0
out dx,al ;

-
.

,
, ,
.
.

.

. ,
Centronix,
. (,
, , ),

.

ESC (
1Bh) (
,
,
).
, ,
, .
.
,

, -
, , -,
, , -,
.

2
( IBM EPSON),
-,
.
,
ASCII ( 129-255) .
:

- ;

- (draft) (pica),
(condensed) (elita).

- (NLQ, Proportional, Orator, Script
. .);

- (
, ,
);

-
( ,
);

- ;

- ( ,
, , )
(, / ,
. .).


,
DIP-. ,
(,
).


11. RS-232

11.1.

IBM PC
, RS-232 (
- 2) 1 - 4.
-:

1: 3F8h-3FFh COM3: 338h-33Fh
COM2: 278h-2FFh COM4: 238h-23Fh

( 3 4 PS/2).


:

1 IRQ4 (Int 0Ch)
COM2 IRQ3 (Int 0Bh)
3 4 .

RS-232
8250, 25- 9-
.
, .
RS-232

Ŀ
-
Ĵ
EIACCITT9-. 25-.
Ĵ
DCD CF 109 1 8

RX BB 104 2 3
TX BA 103 3 2
DTR CD 108/2 4 20

SG AB 102 5 7
DSR CC 107 6 6

RTS CA 105 7 4
CTS CB 106 8 5

RI CE 125 9 22
FG AA 101 1


RS-232
; :
-,
(/).


11.2.

- 1,
3F8h. , 3F8h 3F9h
7 3F8h (. .
DLAB - Divisor Latch Access Bit).



3F8h -

-

DLAB=1,
(. 3F9h)

3F9h DLAB=1,
.
, 115200/V, V -
. , 9600
115200/9600=12=0Ch,
0Ch 3F8h 0 3F9h.
(1 =
):

7 6 5 4 3 2 1 0
Ŀ
0 0 0 0 :

> 0:
> 1:

> 2:

> 3:
( CTS, DSR, RI
DCD)

3FAh .
, ,
:

7 6 5 4 3 2 1 0
Ŀ
0 0 0 0 0 :


> 0: 0=
> 1-2: :
11= ;

( 3FDh)
10= ;
( 3F8h)
01= ;

( 3F8h)
00=
( CTS, DSR, RI DCD);

( 3FEh)

3FBh / :


7 6 5 4 3 2 1 0
Ŀ
:


> 0-1: :
00=5, 01=6, 10=6, 11=8
> 2: -:
0=1, 1=1.5 5
2
> 3-4: :
X0=,
01=,
11=
> 5:
0=
1= ,
3-4:
3-4=01 -
1
3-4=11 -
0
3-4=X0 -
> 6: 1=
( )
> 7: DLAB:
1= 3F8h 3F9h
;
0= 3F8h 3F9h


3FCh

7 6 5 4 3 2 1 0
Ŀ
0 0 0 :

> 0: 1= DTR
> 1: 1= RTS
> 2: 1= OUT1 ( )
> 3: 1= OUT2 ( -
RS-232)
> 4: 1= (
).

3FDh . 1-4
, :

7 6 5 4 3 2 1 0
Ŀ
0 :

> 0:1= .

> 1:1=
> 2:1=
> 3:1= -
> 4:1=
> 5:1= .
.
> 6:1= .
.

3FEh . 0-3
e ,
:

7 6 5 4 3 2 1 0
Ŀ
:


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

: " ..." ,
RS-232
.


11.3. 8250

8250
.

1. DLAB 3FBh ,
, 3F8h 3F9h.

2. ( 3FBh);
DLAB.

3. ( 3FCh).

4. (
3F9h) , ,
RS-232.

, -
COM1 1200
.

title RS232
_DATA segment para public
Buf_Size equ 1024 ;

Source db Buf_Size+2 dup (0) ;
Src_ptr dw Source ;
Count dw 0 ;
Ser_ip dw 0 ; Int 0Ch
Ser_cs dw 0
Save_ds dw 0 ;
Int_sts db 0
Overrun db 0
_DATA ends

_TEXT segment para public
assume cs:_TEXT, ds:_DATA
public Ser_Ini:near, Ser_Rst:near
public Get_Chr:near, Out_Chr:near

; COM1.

Ser_Ini proc near
push ax ;
push dx
push bx
push es
in al,21h ; IMR 1-
or al,10h ; IRQ4 COM1
out 21h,al
mov al,0Ch
mov ah,35h
int 21h ; Int 0Ch es:bx
mov Ser_ip,bx ;
mov Ser_cs,es
mov al,0Ch
mov dx,offset Ser_int
push ds
mov bx,cs
mov ds,bx
mov ah,25h
int 21h ; Int 0Ch = ds:dx
pop ds
pop es
pop bx
cli ;
in al,21h ; IMR 1-
and al,not 10h
out 21h,al ; COM1
mov dx,3FBh ;
in al,dx
or al,80h ; DLAB
out dx,al
mov dx,3F8h
mov al,60h
out dx,al ; 1200
inc dx
mov al,0
out dx,al ;
mov dx,3FBh ;
mov al,00000011b ; 8 , 2 -,
out dx,al
mov dx,3F9h ;
mov al,1 ;
out dx,al
nop ; -
nop
mov dx,3FCh ;
mov al,00001011b ; DTR, RTS OUT2
out dx,al
sti ;
mov dx,3F8h ;
in al,dx ;
pop dx
pop ax
ret
Ser_Ini endp

; COM1.

Ser_Rst proc near
push ax ;
push dx
Wait_Free:
mov dx,3FDh ;
in al,dx
jmp short $+2 ;
test al,60h ; ?
jz Wait_Free ; ,
mov dx,3F9h ;
mov al,0 ;
out dx,al
jmp short $+2 ; ...
jmp short $+2
mov dx,3FCh ;
mov al,00000011b ; DTR RTS
out dx,al
jmp short $+2
jmp short $+2
push bx
mov al,0Ch
mov dx,Ser_ip
push ds
mov bx,Ser_cs
mov ds,bx
mov ah,25h
int 21h ; Int 0Ch
pop ds
pop bx
cli ;
in al,21h ;
jmp short $+2
or al,10h ; IRQ4
out 21h,al
sti ;
pop dx
pop ax
ret
Ser_Rst endp

; COM1.

Ser_Int proc far
push ax
push dx
push ds
mov ax,seg _DATA
mov ds,ax
mov dx,3FAh ;
in al,dx
mov Int_Sts,al;
test al,1 ; ?
jz Is_Int ;
pop Save_ds ; ,
pop dx ; Int 0Ch
pop ax
push Ser_cs
push Ser_ip
push Save_ds
pop ds
ret ;
Is_Int:
mov al,64h ; EOI IRQ4
out 20h,al ; 1-
test Int_Sts,4 ; ?
jnz Read_Char ;
No_Char:
sti ; ,
jmp Int_Ret ; Int 0Ch
Read_Char:
mov dx,3FDh ;
in al,dx
and al,2
mov Overrun,al; ovvrrun<>0,
mov dx,3F8h ;
in al,dx ;
or al,al ; ,
jz No_Char ;
push bx
mov ah,Overrun
or ah,ah ; ?
jz Save_Char ;
mov ah,al ; ,
mov al,7 ; (07h)
Save_Char:
mov bx,Src_ptr;
mov [bx],al
inc Src_ptr ;
inc bx
cmp bx,offset Src_ptr-2 ;
jb Ser_Int_1
mov Src_ptr,offset Source ; ""
Ser_Int_1:
cmp Count,Buf_Size ; ?
jae Ser_Int_2 ;
inc Count ; ,
Ser_Int_2:
or ah,ah ;
jz Ser_Int_3
mov al,ah ;
xor ah,ah
jmp short Save_Char
Ser_Int_3:
pop bx
sti ;
Int_Ret:
pop ds
pop dx
pop ax
iret
Ser_Int endp

; AL .
; CF=1, CF=0.

Out_Chr proc near
push ax
push cx
push dx
mov ah,al
sub cx,cx
Wait_Line:
mov dx,3FDh ;
in al,dx
test al,20h ; ?
jnz Output ;
jmp short $+2
jmp short $+2
loop Wait_Line ; ,
pop dx
pop cx
pop ax
stc ;
ret
Output:
mov al,ah
mov dx,3F8h ;
jmp short $+2
out dx,al ;
pop dx
pop cx
pop ax
clc ;
ret
Out_Chr endp

; AL.
; , CF=1, CF=0.

Get_Chr proc near
cmp Count,0 ; ?
jne loc_1729 ;
stc ; ,
ret
loc_1729:
push si
cli ;
mov si,Src_ptr
sub si,Count
cmp si,offset Source
jae loc_1730
add si,Buf_Size
loc_1730:
mov al,[si] ;
dec Count ;
sti ;
pop si
clc ;
ret
Get_Chr endp
_TEXT ends
end


12.

- - ,

(, ).
"/"
(, )
(,
). IBM PC
201h. , , :

7 6 5 4 3 2 1 0
Ŀ
B2 B1 A2 A1By Bx Ay Ax :

> 0-3: ( )
> 4-7: ( )

:

mov dx,201h
out dx,al ; , AL -
in al,dx ; , 4-7 - 0=
; 1=

,
e ,
OUT 201h,XXX. X :

mov dx,201h
out dx,al ; , AL-
mov cx,-1 ;
Again:
in al,dx
inc cx ;
test al,1 ; AX ?
jne Again ;,

X .
,
, .


13. CMOS

13.1. CMOS

IBM PC AT (RTC) 64
(CMOS),
.
CMOS BIOS,
.

CMOS 70h 71h.
CMOS :

mov al,XXh
out 70h,al ; CMOS XX
jmp $+2 ;
in al,71h ; CMOS

CMOS :

mov al,XXh
out 70h,al
jmp $+2
in al,71h

CMOS 10h 20h ,
2Eh.

.

70h CMOS,
NMI ( ).
7 0, NMI , 1 - ,
:

mov al,2Dh ;2Dh - CMOS
out 70h,al ; NMI
mov al,0ADh
out 70h,al ; NMI


13.2. CMOS

CMOS :



00h-0Dh (RTC)
0Eh
0Fh
10h
11h
12h
13h
14h
15h-16h
17h-18h
19h-1Ah
1Bh-2Dh
2Eh-2Fh CMOS
30h-31h
32h
33h
34h-3Fh


CMOS.



0 RTC, RTC
1 , -
2 ,
3 , (BCD)
4 ,
5 ,
6
7
8
9

0Ah A RTC:

7 6 5 4 3 2 1 0
Ŀ
:

> 0-3: ( 0110)
> 4-6: ( 010)
> 7: (0= )

0Bh B RTC:

7 6 5 4 3 2 1 0
Ŀ
:

> 0: ( 0)
> 1: 12- 24-
( 1=24 )
> 2: : 0=BCD,
1= ( 0)
> 3: 1=
( 0)
> 4: 1=
( 0)
> 5: 1=
( 0)
> 6: 1=
( 0)
> 7: (0= )

0Ch RTC: ,
.
0Dh D RTC. 7=1, CMOS
; 0= .

0Eh :

7 6 5 4 3 2 1 0
Ŀ
0 0 :

> 2: 1=

> 3: 1=

> 4: 1=
> 5: 1=
CMOS
> 6: 1= CMOS
> 7: 1=
CMOS

0Fh .
,
80286 . :

0 = ( Ctrl-Alt-Del)

1 =
2 =
3 =
4 =
5 =
JMP FAR PTR [0:467h]
6, 7, 8 =
9 = JMP FAR PTR [0:467h]

10h :

7 6 5 4 3 2 1 0
Ŀ
:

> 0-3:
> 4-7: :
0 =

1 = 360 , 5 1/4
2 = 1.2 M, 5 1/4
3 = 720 , 3 1/2

12h C D:

7 6 5 4 3 2 1 0
Ŀ
:

> 0-3: C
> 4-7: D:
0000 =
1111 = . 19h 1Ah
=
(. 2)

14h :

7 6 5 4 3 2 1 0
Ŀ
X X :

> 0: 1=
> 1: 1= 80287
> 4-5: :
00 - EGA VGA
01 - CGA, 40
10 - CGA, 80
11 -
> 6-7: - 1

15h-16h (0100h=256 K, 0200h=512 K,
0280h=640 K)
17h-18h , ( 0 3C00h)

19h , 12h 0Fh
1Ah D, 12h 0Fh

2Eh-2Fh CMOS 10h 20h (
16- ; 2Eh
)

30h-31h , (0-3C00h), -


32h -

33h . 7: 1= 128
6 SETUP



14.

,
.



80h AT

.

90h PS/2

91h PS/2

92h A PS/2

94h PS/2

96h, 97h PS/2

0A0h NMI PC/XT:
out 0A0h,80h - NMI;
out 0A0h,0 - NMI.

0F0h
80287,
.

0F1h
80287 .

0F8h-0FCh 80286
.

210h XT.
213h XT.
215h XT.
215h XT
( ).
216h XT
( ).



1. -

,
,
"-" , . .
. - ,
, -,
: 0 - , 1 - .

Ŀ
- -
Ĵ
01h 1 Esc 2Bh 43 \ |
02h 2 1 ! 2Ch 44 Z
03h 3 2 @ 2Dh 45 X
04h 4 3 # 2Eh 46 C
05h 5 4 $ 2Fh 47 V
06h 6 5 % 30h 48 B
07h 7 6 ^ 31h 49 N
08h 8 7 & 32h 50 M
09h 9 8 * 33h 51 , <
0Ah 10 9 ( 34h 52 . >
0Bh 11 0 ) 35h 53 / ?
0Ch 12 - _ 36h 54 Shift
0Dh 13 = + 37h 55 PrtSc *
0Eh 14 BackSpace 38h 56 Alt
0Fh 15 Tab 39h 57
10h 16 Q 3Ah 58 CapsLock
11h 17 W 3Bh 59 F1
12h 18 E 3Ch 60 F2
13h 19 R 3Dh 61 F3
14h 20 T 3Eh 62 F4
15h 21 Y 3Fh 63 F5
16h 22 U 40h 64 F6
17h 23 I 41h 65 F7
18h 24 O 42h 66 F8
19h 25 P 43h 67 F9
1Ah 26 [ { 44h 68 F10
1Bh 27 ] } 45h 69 NumLock
1Ch 28 Enter 46h 70 ScrollLock
1Dh 29 Ctrl 47h 71 Home [7]
1Eh 30 A 48h 72. [8]
1Fh 31 S 49h 73 PgUp [9]
20h 32 D 4Ah 74 -
21h 33 F 4Bh 75 <- [4]
22h 34 G 4Ch 76 [5]
23h 35 H 4Dh 77 -> [6]
24h 36 J 4Eh 78 +
25h 37 K 4Fh 79 End [1]
26h 38 L 50h 80. [2]
27h 39 ; : 51h 81 PgDn [3]
28h 40 ' " 52h 82 Ins [0]
29h 41 ` ~ 53h 83 Del [.]
2Ah 42 Shift 54h 84 SysReq



2.

,
BIOS IBM PC AT , -
CMOS.
, , ,
, .


- - . -
,

1 306 4 128 305 17 10,1
2 615 4 300 615 17 20,4
3 615 6 300 615 17 30,6
4 940 8 512 940 17 62,4
5 940 6 512 940 17 46,8
6 615 4 615 17 20,4
7 462 8 256 511 17 30,6
8 733 5 733 17 30,4
9 900 15 901 17 112,0
10 820 3 820 17 20,4
11 855 5 855 17 35,4
12 855 7 855 17 49,6
13 306 8 128 319 17 20,3
14 733 7 733 17 42,5
15 ppp - . 13.2
16 612 4 663 17 20,3
17 977 5 300 977 17 40,5
18 977 7 977 17 56,7
19 1024 7 512 1023 17 59,5
20 733 5 300 732 17 30,4
21 733 7 300 732 17 42,5
22 733 5 300 733 17 30,4
23 306 4 336 17 10,1
24 615 4 300 615 26 31,2
25 615 4 615 17 20,4
26 1024 4 1023 17 34,0
27 1024 5 1023 17 42,5
28 1024 8 1023 17 68,0
29 512 8 256 512 17 34,0
30 1024 5 512 1024 26 65,0
31 989 5 989 17 41,0
32 1020 15 1024 17 127,0
33 ? ? ? ? ? ?
34 ? ? ? ? ? ?
35 1024 9 1024 1024 17 76,5
36 1024 5 512 1024 17 42,5
37 830 10 830 17 68,8
38 823 10 256 824 17 68,3
39 615 4 128 664 17 20,4
40 615 8 128 664 17 40,8
41 917 15 918 17 114,1
42 1023 15 1024 17 127,3
43 823 10 512 823 17 68,3
44 820 6 820 17 40,8
45 1024 8 1024 17 68,0
46 925 9 925 17 69,1
47 699 7 256 700 17 40,6


.
1. 1 - PC XT, 2 -
PC AT.

2. 33 - 47 -
IBM.


3.

DIP-
EGA-.
,
(,
)
.

IBM;
. ,
Compaq Portable
. Deskpro .

IBM PC


IBM PC, 64
( PC-1),
, SW1 SW2.

SW1
ON 12345678

Ľ
˼ ˼ 7-8:
5-6:
3-4: pp
2: pp 8087
1:

SW2 (PC-1)

ON 12345678
ܳܳܳܺ
Ľ
ͼ 5-8: OFF
1-4: pp

p IBM PC ( PC-2)
ppp p . p, SW1
, SW2 :

SW 2 (PC-2)
ON 12345678
ܳܳܺ
Ľ
ͼ 6-8: OFF
1-5: pp

p p.

():


SW1
ON 12345678 ON 12345678
ܳ ߳ߺ 1 ܳ ߳ܺ 3
Ľ Ľ
ON 12345678 ON 12345678
ܳ ܳߺ 2 ܳ ܳܺ 4
Ľ Ľ

. 1 ON .

:


SW1
ON 12345678
߳߳ EGA
Ľ
ON 12345678
ܳ߳ 40x25 CGA
Ľ
ON 12345678
߳ܳ 80x25 CGA
Ľ
ON 12345678
ܳܳ (MDA) MDA, CGA
Ľ

8087:


SW1
ON 12345678 ON 12345678
ܳ 8087 ߳ 8087
Ľ Ľ

:


SW1
ON 12345678
ܳܳ 64K
Ľ


(SW2 PC-1):


PC-1 5 - 8 OFF.
- 544.

SW2 (PC-1)
ON 12345678 ON 12345678
߳߳߳߳ 64K ߳ܳ߳ܳ 384K
Ľ Ľ
ON 12345678 ON 12345678
߳ܳ߳߳ 128K ߳߳ܳܳ 448K
Ľ Ľ
ON 12345678 ON 12345678
߳߳ܳ߳ 192K ߳ܳܳܳ 512K
Ľ Ľ
ON 12345678 ON 12345678
߳ܳܳ߳ 256K ܳܳܳܳ 544K
Ľ Ľ
ON 12345678
߳߳߳ܳ 320K
Ľ

(SW2 PC-2):


PC-2 6 - 8 OFF.
- 640.
, PC-2.

SW2 (PC-2)
ON 12345678 ON 12345678
߳߳߳߳߳ 64K ߳ܳ߳ܳ߳ 384K
Ľ Ľ
ON 12345678 ON 12345678
߳ܳ߳߳߳ 128K ߳߳ܳܳ߳ 448K
Ľ Ľ
ON 12345678 ON 12345678
߳߳ܳ߳߳ 192K ߳ܳܳܳ߳ 512K
Ľ Ľ
ON 12345678 ON 12345678
߳ܳܳ߳߳ 256K ߳߳߳߳ܳ 576K
Ľ Ľ
ON 12345678 ON 12345678
߳߳߳ܳ߳ 320K ߳ܳ߳߳ܳ 640K
Ľ Ľ

:

1.
IBM PC.
, .
,
CHKDSK, , ,
. ,
.

2. 640, BIOS
, , . .
COMMAND.COM .

IBM PC XT


IBM PC XT (SW1):

SW1 (XT)
ON 12345678
ܳ
Ľ
˼ ˼ 7-8:
5-6:
3-4:
2: 8087
1: OFF

2, 5-6 7-8 , IBM PC.
3-4 :

SW1 (XT)
ON 12345678
ܳ߳ 128K
Ľ
ON 12345678
߳ܳ 192K
Ľ
ON 12345678
ܳܳ 256K
Ľ

. BIOS IBM PC XT
.
.

IBM PC AT


IBM PC AT DIP-.
CMOS
SETUP. CMOS . . 13.

J18,
:

J18
1 o 256K
2 oٺ (512 )
3 o
ͼ
J18
1 o 256K
2 o (256 )
3 oٺ
ͼ

, SW1,
:

SW1
ݺ ON ON () - CGA
OFF
ͼ
SW1
ON
ݺ OFF OFF () -
ͼ

. EGA ,
!

EGA


DIP- EGA ,
, .
"" ,
; ""
,
.

: EGA
(MDA),
. !

ON 4321 EGA 40x25
߳ܳܳߺ MDA
Ľ
ON 4321 EGA 80x25
߳ܳܳܺ MDA
Ľ
ON 4321 EGA
ܳ߳߳ߺ ( CGA)
Ľ MDA
ON 4321 EGA
ܳ߳߳ܺ ( EGA)
Ľ MDA
ON 4321 EGA
ܳ߳ܳߺ CGA 4025
Ľ
ON 4321 EGA
ܳ߳ܳܺ CGA 8025
Ľ
ON 4321 MDA
߳߳߳ߺ EGA 4025
Ľ
ON 4321 MDA
߳߳߳ܺ EGA 8025
Ľ
ON 4321 MDA
߳߳ܳߺ EGA
Ľ ( CGA)

ON 4321 MDA
߳߳ܳܺ EGA
Ľ ( EGA)
ON 4321 CGA 4025
߳ܳ߳ߺ EGA
Ľ
ON 4321 CGA 8025
߳ܳ߳ܺ EGA
Ľ

EGA (P1 - P3):

P1ͻ
1 o
2 oٺ (640x350 64 )
3 o
ͼ
P1ͻ
1 o
2 o
3 oٺ (640x200 16 )
ͼ

P2 ( ) - .

P3ͻ
1 o / EGA 3xxH
2 oٺ ( )
3 o
ͼ
P3ͻ
1 o
2 o / EGA 2xxH
3 oٺ ( BIOS EGA)
ͼ




p (adapter).
. pp.

p (assembly language).
ppp p p
pp.

(byte).
p pp 8 .

(bit).
pp, p 0 1.

(block).
, p
p -.

(display).
p p p p.

p (interface).
p p p,
p .

p p (parallel interface).
p p, p p
p p p .
p.

p (serial interface);
p p, p p
p p .
, pp .

(channel).
p p,
p pp.

pp (controller).
ppp p,
pp p.

(disk drive).
p ,
p pp. ()
(p).

p, (random access memory, RAM).
, p p
p . p p p.

, (read-only memory, ROM).
, p p-
.

p - (i/o port).
p pp -,
p pp p.

p (expansion slots).
p , p
pp p -.

pp (interrupt).
, pp p p
p pp p pp.

p , (direct memory access, DMA).
, p p pp
pp p , "p" p-
pp.

p (registers).
p , p p
p.

(word).
p ,
.

p pp, (central processing unit, CPU).
p , p,
p , p
pp p p .

DIP-p (DIP-switchs).
p ,
p p.



?
?
?