3CFH. 8 3CEH, . 1 , . , , "" . , - , . . 3C5H. - . 2 . 0-3 0-3; 4 . 0-3 0, - . - , . , , 3CFH, 5 . 0 1, 0 2. 2 0, 4-7. 3 . 0 1. BIOS EGA 00. 0: 0 . , - 11111111B (.. - ). - 1, 1111B. , 8 15, - , , . , 00001000B. 3 1111, - 0000, (). 3 (), 7 . 7 - , 0000. , 1111B. , , . , 0100, 0100 . 0, 1 3 . - 11111111B, 2 0100. 00001000B, 3 0100, - 0000. , , . , . , 0 , 1 3 . , 11111111B - , 2 11111111B, 0 , 0101B. , . - , (.. ) , 1111B 0000B. 0 . - . . ? , , , . - , . 0, , . 0 1 - ; 2, , , 0FFH 4H, , 2 . 2 - , 0 . , - , 8 . ( [4.4.4]) . . , , . 0. . . - - : 2-0 4-3 00 01 10 11 7-5 , 0 7, , . . , 4-3, 00, , . - . 3 3CEH; 3CFH. , 0 - /. / ( 3CFH, 0 3CEH). - /, , 1. 4 / , 8 - , - . /, . , / - , /. BIOS - / 0, . 3CFH, 1 3CEH. 1: 1 . - . , . . . - . 2: 2 . , - 4 , ( ). , . , , - . , 0. - , 4 . . EGA - . - EGA . , , A000:0000. . : 10 S$ = CHR$(&H2A)+CHR$(&HE4)+CHR$(&HB0)+CHR$(&H0D) +CHR$(&HCD)+CHR$(&H10)+CHR$(&HCB) 20 DEF SEG ' 30 Y = VARPTR(S$) ' 40 Z = PEEK(Y+1)+PEEK(Y+2)*256 ' 50 CALL Z ' S$ , D. . . , , . . . 2: 50 OUT &H3CE,5 ' 60 OUT &H3CF,2 ' 2 . , , : 0: 100 ' 110 DEF SEG = &HA000 ' 120 OUT &H3CE,8 ' 130 OUT &H3CF,128 ' , 140 X = PEEK(0) ' 150 POKE 0,0 ' 160 OUT &H3C4,2 ' 170 OUT &H3C5,4 ' 180 POKE 0,&HFF ' 1: 100 ' 110 DEF SEG = &HA000 ' 120 FOR N = 0 TO 79 ' 80 130 X = PEEK(N) ' 140 POKE N+80,Y ' 150 NEXT ' 2: 100 ' 110 DEF SEG = &HA000 ' 120 OUT &H3CE,8 ' 130 OUT &H3CF,128 ' , 140 X = PEEK(0) ' 150 POKE 0,4 ' . EGA BIOS. CH 10H, PCjr. DX , CX - , 0. AL. AX . ;--- 50,100 MOV AH,0CH ; MOV AL,12 ; 12 MOV CX,100 ; MOV DX,50 ; INT 10H ; . . - , A000:0000. - BIOS, , D: MOV AH,0 ; MOV AL,0DH ; D INT 10H ; . , . - 2: MOV DX,3CEH ; MOV AL,5 ; 5 OUT DX,AL ; INC DX ; MOV AL,2 ; 2 OUT DX,AL ; , , : 0: ;--- MOV AX,0A000H ; MOV ES,AX ; MOV BX,0 ; ;--- , MOV DX,3CEH ; MOV AL,8 ; OUT DX,AL ; INC DX ; MOV AL,10000000B ; OUT DX,AL ; ;--- MOV AL,ES:[BX] ; MOV AL,0 ; MOV ES:[BX],AL ; ;--- MOV DX,3C4H ; MOV AL,2 ; OUT DX,AL ; INC DX ; MOV AL,4 ; OUT DX,AL ; ;--- MOV AL,0FFH ; 7 MOV ES:[BX],AL ; 1: ;--- MOV CX,80 ; MOV BX,0 ; 1- MOV AX,0A000H ; MOV ES,AX ; NEXT_BYTE: MOV AL,ES:[BX] ; MOV ES:[BX]+80,AL ; INC BX ; LOOP NEXT_BYTE ; 2: ;--- MOV AX,0A000H ; MOV ES,AX ; MOV BX,0 ; ;--- MOV DX,3CEH ; MOV AL,8 ; OUT DX,AL ; INC DX ; MOV AL,10000000B ; , 7- OUT DX,AL ; ;--- MOV AL,ES:[BX] ; MOV AL,4 ; MOV ES:[BX],AL ; 4.4.4 . PCjr : . EGA , DH - 10H - . EGA , . , PCjr EGA, , , - , . EGA. 0 , , . 1 , 1, . 3 (0 = 0). 3CFH - 5 3CEH, . - , - , 0, 0 1, . BIOS 0 ( 0), 0, 0 8, 1. 0 , . - - , . 0 3. 3CFH 4 3CEH, . 1 . , . 4 ; 4 - . 3CFH - 2 3CEH. - , 1 , . - (color don't care register) . 4 1; , - . , 3 ( 3) 0110 0010, - , 3 0, - 1. - 1011, , - 3 1. 3CFH - 7 3CEH. 4 - . , IBM ( 2 1984 .) , .., 1 - . . . 0 4 , - , - . 1, , - 16 , - , . EGA , . . POINT, . , 200 100 Q = POINT(200,100). , Q - . , , POINT -1. WINDOW [4.4.2], POINT . POINT . , 0,0 , Q = POINT(1) - Q x- , Q = POINT(2) - y-. WINDOW, Q = POINT(3) Q = POINT(4) - x- y- . - WINDOW, , . EGA (D-10H). . 1 0001 1001: 100 OUT &H3CE,5 ' 110 OUT &H3CF,8 ' 0 120 OUT &H3CE,2 ' 130 OUT &H3CF,1 ' 0001 140 OUT &H3CE,7 ' 150 OUT &H3CF,7 '7 = 0111B, . . 0001 1001 160 DEF SEG = &HA000 ' EGA 170 X = PEEK(0) ' 180 IF X <> 0 THEN... '.. 0001 1001 . D 10H . BIOS EGA , - . (- 0) DX, ( 0) - CX. AL. ;--- 100,200 MOV AH,0DH ; MOV DX,100 ; MOV CX,200 ; INT 10H ; AL . PCjr , - , [4.4.2]. , : ;--- ( ) MOV AH,ES:[BX] ; ROR AH,CL ; 2 AND AH,00000011B ; RET ; AH - EGA DH 10H , . 0 2 A000:0012. ;--- MOV DX,3CEH ; MOV AL,5 ; OUT DX,AL ; INC DX ; MOV AL,0 ; 0 OUT DX,AL ; ;--- , DEC DX ; MOV AL,4 ; OUT DX,AL ; INC DX ; MOV AL,2 ; 2 OUT DX,AL ; ;--- MOV AX,0A000H ; MOV ES,AX ; MOV BX,12 ; MOV AL,ES:[BX] ; 2 , , 0010 1010 - 1: ;--- MOV DX,3CEH ; MOV AL,5 ; OUT DX,AL ; INC DX ; MOV AL,8 ; 3 1 OUT DX,AL ; ;--- DEC DX ; MOV AL,2 ; OUT DX,AL ; INC DX ; MOV AL,0010B ; OUT DX,AL ; ;--- DEC DX ; MOV AL,7 ; OUT DX,AL ; INC DX ; MOV AL,0111B ; 1010 0010 OUT DX,AL ; ;--- MOV AX,0A000H ; MOV ES,AX ; MOV BX,12 ; MOV AL,ES:[BX] ; CMP AL,0 ; ? JNZ FOUND_IT ; , 4.4.5 . , - . , . , , . , . . LINE. LINE (20,10)-(40,30) 20 10 40 30. . , , . , LINE -STEP(xoff- set,yoffset). LINE . ; LINE (50,50)-(60,60),2 2. , 3. - . - , . , 1010101010101010, &HAAAA, , . - . , LINE (30,30)-(40,40),3,,&HAAAA 3. - . LINE. . B (box - .. - ) . LINE (50,50)-(100,100),1,B,&HAAAA 50 1 , . - , BF ( ). CIRCLE. CIRCLE (x,y),r,,-,-,. - x,y , r - ; . - , 3. , - - ( , - ). - , . ( 360 6.292 , = 0.0174532 ). - . , 5/6 - 5/12 . , , - . PI=3.14159: CIRCLE(200,50),30,2,PI/2,PI,6 , 50,200, 30 - 2, - . DRAW, . DRAW (- ), , . , DRAW "E12F12G12H12" . PSET ( [4.4.2]); , . , . : Ux ( x ) Dx Rx Lx Ex Fx Gx Hx 100 100 ( y x 5/6). , . - - , - , . , 45 , M. . - x y. DRAW "M50,60" , 50 60. + - . x 100, +50 150, -50 - 50. 100,100 120,70 DRAW "M+20,-30". . B, , . , DRAW "L10BU5R10" - . N. - . , , ( ). C, . DRAW "C2D5" , 2. - , . S, . , 4. 4, 1:1. 8 , . DRAW "S8U12D12" .. - . A 90- . A0 . A1 - - 90 , A2 - 180 A3 - 270 . , TA 0 360 ( ) 0 -360 ( ). DRAW "A1L10" DRAW "TA90L10" , , 90 . DRAW , . - . DRAW X . : 100 S$ = "U12R15U45L32" 110 DRAW "XS$;" DRAW , - . , , DRAW . - DRAW , , , . - , . , , , DRAW "C=PCOLOR;". , - VARPTR$. - DRAW "X" + VARPTR$(S$) DRAW "C=" + VARPTR$(PCOLOR). . - . [4.4.6]. . , . BIOS , - . . : , . 1 , ; - . , - , . , , . BX - , , . : ;--- START_X DW 0 END_X DW 319 START_Y DW 0 END_Y DW 199 COLOR DB 2 DIAGONAL_Y_INCREMENT DW ? DIAGONAL_X_INCREMENT DW ? SHORT_DISTANCE DW ? STRAIGHT_X_INCREMENT DW ? STRAIGHT_Y_INCREMENT DW ? STRAIGHT_COUNT DW ? DIAGONAL_COUNT DW ? ;--- MOV AH,0 ; MOV AL,4 ; 320*200 INT 10H ; ;--- MOV CX,1 ; x MOV DX,1 ; y ;--- MOV DI,END_Y ; SUB DI,START_Y ; JGE KEEP_Y ; < 0 NEG DX ; -1 NEG DI ; > 0 KEEP_Y: MOV DIAGONAL_Y_INCREMENT,DX ;--- MOV SI,END_X ; SUB SI,START_X ; JGE KEEP_X ; < 0 NEG CX ; -1 NEG SI ; > 0 KEEP_X: MOV DIAGONAL_Y_INCREMENT,CX ;--- CMP SI,DI ; ? JGE HORZ_SEG ; , MOV CX,0 ; x XCHG SI,DI ; CX JMP SAVE_VALUES; HORZ_SEG: MOV DX,0 ; y SAVE_VALUES: MOV SHORT_DISTANCE,DI ; MOV STRAIGHT_X_INCREMENT,CX ; 0, MOV STRAIGHT_Y_INCREMENT,DX ; - 1. ;--- MOV AX,SHORT_DISTANCE ; AX SHL AX,1 ; MOV STRAIGHT_COUNT,AX ; SUB AX,SI ;2* - MOV BX,AX ; SUB AX,SI ;2* - 2* MOV DIAGONAL_COUNT,AX ; ;--- MOV CX,START_X ; x MOV CX,START_Y ; y INC SI ; 1 MOV AL,COLOR ; ;--- MAINLOOP: DEC SI ; JZ LINE_FINISHED ; MOV AH,12 ; INT 10H ; CMP BX,0 ; BX < 0, JGE DIAGONAL_LINE ; ;--- ADD CX,STRAIGHT_X_INCREMENT ; - ADD DX,STRAIGHT_Y_INCREMENT ; ADD BX,STRAIGHT_COUNT ; JMP SHORT MAINLOOP ; ;--- DIAGONAL_LINE: ADD CX,DIAGONAL_X_INCREMENT ; - ADD DX,DIAGONAL_Y_INCREMENT ; ADD BX,DIAGONAL_COUNT ; JMP SHORT MAINLOOP ; LINE_FINISHED: 4.4.6 . , . , , . - , - , . , , . [4.3.4] - 8*8 , . , . 8*8 - , , . - . . . PAINT . , . , , , PAINT (100,110),2 2 . , , . , , - , . , , . , PAINT (100,180),2,3 2 3. , , - , " ", .. - , , , - . - , . , . 100 LINE (50,70)-(270,130),1,B ' 110 LINE (100,30)-(220,170),2,B ' 120 PAINT (101,31),3,2 ' , LINE , 'BF', 'B'. [4.4.5]. PAINT "" , . , 4 8 (8*8 ) - . , - .