Assembler







.
,
. , ,
.
 
7 6 5 4 3 2 1 0
Ŀ
̳ Ԡ Π ͳ ߳ . 8.9

 

- 289 -
 
 
 
.
.8.9
. , ,
.
. :
.
16 . ,

. , ,
. 1

. ,
, , .
,
16 16 .
. ,
,
. ,
- . . 8.10
16 , .
 
I R G B
-------------------------------------
0 0 0 0
0 0 0 1
0 0 1 0
0 0 1 1
0 1 0 0
0 1 0 1
0 1 1 0
0 1 1 1 -
1 0 0 0 -
1 0 0 1
1 0 1 0 -
1 0 1 1
1 1 0 0
1 1 0 1
1 1 1 0
1 1 1 1
------------------------------------------- . 8.10
( IBM, 1981 .)
 

. 8.7, , .
, ,
.
,
.
 

- .
, -
. ,
: 0B0000H,
- 0B8000H. ,
. 8.8,
AT 0B800H,
.

.
 

6845 Motorola. -
- 3D4H 3D5H.
6845 18 .
-
. 6845,
3D4H,
3D5H.
 
, , .
. 8.11 18 6845.
R10 R11.
.
, ,
, 0 7.
. R10 6845,
, R11
. ROM BIOS ,
6 7; 6 R10
7 R11.
 
.8.12()
. ,
.
6845 (3D4H) 10,
, 0,
(3D5H). , 11 ,
4.
,
.
()
,
. ,
; ,
6845.
 
. 8.11, , 6845
.
.
-
. , MODE DOS,
,
R2, .
,
, .
Ŀ

#
Ĵ
R0 .
Ĵ
R1
Ĵ
R2 . .
Ĵ
R3 .
Ĵ
R4 .
Ĵ
R5 . .
Ĵ
R6 .
Ĵ
R7 . . .
Ĵ
R8 -
Ĵ
R9 . . .
Ĵ
R10 .
Ĵ
R11 .
Ĵ
R12 (.) -
Ĵ
R13 () -
Ĵ
R14 (.) -
Ĵ
R15 () -
Ĵ
R16 (.) -
Ĵ
R17 () -


. 8.11 6845
( Motorola)
 
DEBUG,
. R14 R15 ,
DEBUG
, .
, DEBUG
6845,
, .
 
6845 -
R12 R13.
16K , 4K
.
,
. 80*25 4K
,
.
, . 8.8.

6845. 0.
80 ( ),
.
.
 
,
.
80*25, 8192- .
 

, 16K .
"".
, - . , ,
,
.
 
[. .: . 252 .
, . 8.12]

Microsoft (R) Macro Assembler Version 5.00 1/1/80 04:05:31
. 8.12 Page 1-1
 
PAGE ,132
TITLE . 8.12
 
0000 STACK SEGMENT STACK
0000 0040[ DW 64 DUP (?)
????
]
0080 STACK ENDS
 
0000 DISPLAY_BUFFER SEGMENT AT 0B800H
0000 DISPLAY_START LABEL WORD
0000 DISPLAY_BUFFER ENDS
 
= 03D4 CRT_INDEX EQU 03D4H
= 03D5 CRT_DATA EQU 03D5H
= 03DA CRT_STATUS EQU 03DAH
= 000A CURSOR_START EQU 10 ;
= 000B CURSOR_END EQU 11 ; 6845
 
0000 CODE SEGMENT
ASSUME CS:CODE
0000 COLOR_GRAPHICS PROC FAR
0000 1E PUSH DS ;
0001 2B C0 SUB AX, AX
0003 50 PUSH AX
 
. 8.12 ()
;----- . 8.12 ()
 
0004 BA 03D4 MOV DX, CRT_INDEX
0007 B0 0A MOV AL, CURSOR_START ;
0009 EE OUT DX, AL ; 6845
000A 42 INC DX
000B B0 00 MOV AL, 0
000D EE OUT DX, AL ;
 
000E 4A DEC DX
000F B0 0B MOV AL, CURSOR_END
0011 EE OUT DX, AL ;
0012 42 INC DX
0013 B0 04 MOV AL, 4
0015 EE OUT DX, AL ;
 
;----- . 8.12 () 6845
 
0016 B8 0002 MOV AX, 2
0019 CD 10 INT 10H ; 80*25
001B B8 ---- R MOV AX, DISPLAY_BUFFER
001E 8E C0 MOV ES, AX ;
0020 B8 0720 MOV AX, 0720H ;
0023 NEXT_CHAR:
0023 BF 0000 MOV DI, 0
0026 B9 0050 MOV CX, 80
0029 F3/ AB REP STOSW ; 80
002B FE C0 INC AL ;
002D 75 F4 JNZ NEXT_CHAR
 
002F BB 0720 MOV BX, 0720H
0032 NEXT_CHAR_1:
0032 B9 0050 MOV CX, 80
0035 BF 0000 MOV DI, 0
0038 BA 03DA MOV DX, CRT_STATUS ;
;
003B WAIT_NO_RETRACE:
003B EC IN AL, DX ;
003C A8 01 TEST AL, 1
003E 75 FB JNZ WAIT_NO_RETRACE ;
0040 FA CLI
0041 WAIT_RETRACE:
0041 EC IN AL, DX
0042 A8 01 TEST AL, 1
0044 74 FB JZ WAIT_RETRACE ;
0046 8B C3 MOV AX, BX ;
0048 AB STOSW ;
0049 FB STI ;
004A E2 EF LOOP WAIT_NO_RETRACE
004C FE C3 INC BL
004E 75 E2 JNZ NEXT_CHAR_1
 
;----- . 8.12 ()
 
. 8.12 ()
0050 B8 0004 MOV AX, 4
0053 CD 10 INT 10H ;
; 320*200
0055 06 PUSH ES
0056 1F POP DS
0057 B3 32 MOV BL, 50 ;
0059 B1 02 MOV CL, 2 ;
005B BF 0000 MOV DI, 0
005E DOT_LOOP:
005E B0 C0 MOV AL, 0C0H ; AL
0060 88 05 MOV [DI], AL
0062 81 C7 2000 ADD DI, 2000H ;
0066 D2 E8 SHR AL, CL ;
0068 88 05 MOV [DI], AL
006A 81 EF 1FB0 SUB DI, 2000H-80 ;
006E D2 E8 SHR AL, CL
0070 88 05 MOV [DI], AL
0072 81 C7 2000 ADD DI, 2000H ;
0076 D2 E8 SHR AL, CL
0078 88 05 MOV [DI], AL
007A 81 EF 1FAF SUB DI, 2000H-81 ; ,
007E FE CB DEC BL ;
0080 75 DC JNZ DOT_LOOP
 
;----- 80*25
 
0082 B8 0002 MOV AX, 2
0085 CD 10 INT 10H
0087 CB RET
0088 COLOR_GRAPHICS ENDP
0088 CODE ENDS
END
 
. 8.12 ()
 
-
. - 03D8H.

. , 5
"0" 16 ,
5 "1" 7- .
, ,
.
 
- 03D8H.
.
,
- . ,
,
. 4
16 ,
. 8.10.
 
, - 3DAH

. ,
,
. ,
,
.
 
, ,
""
, .

80*25. , . 8.12,
.
,
. ,
.
 
,
. 0 1.
, 0 1,
. . 8.12 ,
.
, .
224 80
, .
,
, .
 
. 8.12 ,
. ,
.
, 0. ,
1, .
, , ,
,
1,
0. , ,
,
,
, 1.
 
,
, ,
.
, .
- ,
, . 8.8,
. -
. 3 (3D8H)
. 0,
.
,
. ,
. ,
.
. IBM
.