8-, 16- . : SP BP SP BP . . 1. SP. , . SS . 2. BP. : . : SI DI . 1. SI. . SI DS. 2. DI. . DI ES. : IP IP , . , DOS DEBUG . IBM PC 11 16 . . : O () . D () ( ). I () . T ( ) . , DOS DEBUG , . S () (0 - , 1 - ). Z () (0 - , 1 - ). A ( ) 3- 8- , . P ( ) 8- (1 - 0 - ). C () , , . O, S, Z, C , D . p. PC ------------------------------------------------------------ : c , , , , () IBM PC 12 . , . : - (Intel); - (ROM 40); - (RAM 512 ); - -. , (), , . , o , , "" 20 . "" , . 8088 16- , o. 8088 8086, : 8088 8- ( 16- ) , , . . 80286 80386 8086. . 1.3 : o () (). , . c - (), y () . , o ( , ). : , : -, , /. -, 1 . . , . 4 , , " " , . , . c /. IBM PC 13 . , . , c . . () ROM (read-only memory). ROM , p ( ) . ROM " " . ROM : ROM p (RAM) (, DOS). ROM BIOS (Basic Input/Output System) /, . (Basic - , ). ROM . , , RAM (Random Access Memory) , .. , , . RAM . RAM , . e , ROM DOS RAM. ( DOS, DOS). o DOS DOS . RAM. DOS , () . RAM , . RAM. () RAM. . 64 , RAM : 4 64 = 256. . , c, . IBM PC 14 RAM , ROM - . , . 1.4, 256 RAM . RAM , 640 , DOS. ROM 768 o / c . ROM, c 960 , , . RAM - . . 00 - . . 1025. . - 0401 . c - 04 - 01. : , - . , . 0401 5612 5613, : |01|04| | | 5612, 5613 , . , a, . ------------------------------------------------------------ - , . . - , . - ASCII . - , : 0 1, . - . , 1111 2**3 + 2**2 + 2**1 + 2**0, 15. IBM PC 15 - : +1. - . . 0-9 A-F 0000 1111. - : , . . - , , . - ROM () RAM () . - () . ------------------------------------------------------------ 1.1. ASCII . ( 1 ): ) P, ) p, ) #, ) 5. 1.2. : ) 5, ) 13, ) 21, ) 27. 1.3. C : ) 00010101 ) 00111110 ) 00011111 00001101 00101001 00000001 1.4. : ) 00010011, ) 00111100, ) 00111001. 1.5. : ) 11001000, ) 10111101, ) 10000000. 1.6. . ) ASCII Q, ) ASCII 7, ) 01011101, ) 01110111. 1.7. . : ) 23A6 ) 51FD ) 7779 ) EABE 0022 3 887 26C4 1.8. . . 2. , . . ) 19, ) 33, ) 89, ) 255, ) 4095, ) 63398. 1.9. , , . IBM PC 16 1.10. : ) , ) , ) , ) , ) , ) ? 1.11. ? IBM PC. 2 30  2.  ------------------------------------------------------------ : , . ------------------------------------------------------------ DOS - DEBUG, , . . . . , . . c . - IBM PC c DOS. ------------------------------------------------------------ DOS A. , ; e , Ctrl Alt Del. DOS , , , A C ( ). , , Return. , . ------------------------------------------------------------ DOS DEBUG . DEBUG Return, DEBUG . IBM PC. 2 31 , DEBUG . , o , D - . 1. . . , . .413 414 DEBUG , : 400 - , 40 ( ) 13 - . , : D 40:13 ( Return) , , , . . , . . .. . . . () 8000 0080 128 0001 0100 256 8001 0180 384 0002 0200 512 8002 0280 640 2. . "" ROM . FE000. , : D FE00:0 ( Return) . 3. ROM BIOS. ROM BIOS mm/dd/yy . FFFF5. D FFFF:05 ( Return) () . IBM PC. 2 32 , , D (Display), . , D, - DEBUG , . DOS Q (Quit). DEBUG . : ------------------------------------------------------------ - , . : B82301 . 0123 AX. 052500 . 0025 AX. 8BD8 AX BX. 03D8 AX BX. 8BCB BX CX. 2BC8 AX AX ( AX). 90 . CB DOS. , : , . . . , , . , MOV - . B8, - . 8B. . c . - o DEBUG Return. DEBUG . Ctrl PrtSc . , : E CS:100 B8 23 01 05 25 00 ( Return) E Enter (). CS:100 , , - . 100 (256) . ( IBM PC. 2 33 DEBUG). E p , CS:100 CS:105. Enter: E CS:106 8B D8 03 D8 8B CB (Return) , CS:106 107, 108, 109, 10A 10B. Enter: E CS:10C 2B C8 2B C0 90 CB (Return) , CS:10C 10D, 10E, 10F, 110 111. . , , . - . p. 2-1 , E. o. R . . , , AX=0000, BX=0000, ... DOS . 2.1. IP ( ) IP=0100, 100 . ( E CS:100 .) . 2.1 : NV UP DI PL NZ NA PO NC ------------------------------------------------------------ ------------------------------------------------------------ . 2.1. . : , , , , , , . . R 0100 . CS . 2.1 CS=13C6 ( ), : 13C6:0100 B82301 MOV AX,0123 IBM PC. 2 34 CS=13C6 , 13C6 13C60. 13C6:0100 100 (.) 13C6 CS. B82301 - , CS:100. MOV AX,0123 - , . , . . AX. MOV . T ( ) Return. MOV , , . , AX 0123. AX B8 2301. B8 23 AX, . AL, 01 - AX, . AH: AX: |01|23| IP:0103 : 13C6:0103 052500 ADD AX,0025 T. 25 (AL) AX 00 (AH) AX, . 0025 AX. AX 0148, IP 0106 - c . T. AX BX BX 0148. AX e 0148, MOV p . T . c AX BX, 0290. p BX CX, AX CX, AX . , c NZ () ZR (), ( AX 0). IBM PC. 2 35 T NOP RET, . D : D CS:100 16 . (32 . ) ASCII ( . ). ASCII . . 00 CS:100 CS:10F. c CS:110 CS:11F. , CS:111, Dump a CS:100 CS:170. IP . R IP, 100, T. Return. .2.2 D CS:100. CS:100 111 ; . ------------------------------------------------------------ ------------------------------------------------------------ . 2.2. . DEBUG Q (Quit - ). DOS A> C>. , c Ctrl/PrtSc. : ------------------------------------------------------------ , (MOV ADD). , 0123 0025 . DS . , c : DS .. 0000 2301 0 1 IBM PC. 2 36 0002 2500 2 3 0004 0000 4 5 0006 2A2A2A 6, 7 8 , . , o, , 23 0 ( ) , 01 - 1 (.. ). , : A10000 ( ), DS 0000, AX. 03060200 ( ), DS 0002, AX. A30400 AX , DS 0004. CB DOS. , MOV p : A1 A3. , , ( ), ( ) . DEBUG . , . E (Enter) : E DS:00 23 01 25 00 00 00 ( Return) E DS:06 2A 2A 2A ( Return) ( ) , DS:00. , , 0123 2301, a 0025 2500. MOV c, 2301 0123, 2500 - 0025. (***) , D (Dump) - . , CS:100: E CS:100 A1 00 00 03 06 02 00 E CS:107 A3 04 00 CB IBM PC. 2 37 CS:100 CS:10A. . . 2.3 , E. , CS DS . D (Dump) : : D DS:000 (Return) : D CS:100 (Return) , . 2.3. DS:00 DS:08 CS:100 CS:10A . 2.3. R . , . - : 13C6:0100 A10000 MOV AX,[0000] , CS 13C6, CS:100 A10000. MOV [0000] . , . ------------------------------------------------------------ ------------------------------------------------------------ . 2.3. , MOV AX,0000 o AX 0000. T. MOV AX,[0000] c , , AX. 2301 0123 AX. ADD , T. DS 0002 AX. AX 0123 0025, . 0148. MOV [0004],AX T. AX 0004. D DS:00. : : 23 01 25 00 48 01 2A 2A 2A : 00 01 02 03 04 05 06 07 08 IBM PC. 2 38 0148, AX 04 05, 4801. . ASCII. , .23 e #, .25 - %. . 2A (***). , . ( ) . D DS:100 , . 2.3. Q . ------------------------------------------------------------ CS IP. , , CS . 04AF ( 04AF0), IP . 0023: CS: 04AF0 IP: 0023 : 04B13 , , 04B13 : A11200 MOV AX,[0012] | 04B13 04B13 . (A1) o - 3 . [0012] a, DS ( ) c . DS .04B1 ( 04B10), c : DS: 04B10 : 0012 : 04B22 , 04B22 04B23 : : 24 01 | | : 04B22 04B23 IBM PC. 2 39 24 04B22 AL, 01 04B23 - AH. AX 0124. IP , IP 0026. p , CS (04AF0) IP (0026), . 04B16. 8086, 80286 80386 , e , . o 4B22 . , . , , , c 04B23 AX: : ||24|01|| | : 04B23 4B22 4B23 4B23 AL. 4B24 4B25 4B23 AH. AX 0124. - , . , , -, , , -, , , . , , , , . , , - . EVEN, . : ------------------------------------------------------------ IBM PC. 2 40 (RAM), . BIOS ( /) ROM , p . BIOS INT, c 12H. BIOS AX . DEBUG INT 12H RET : E CS:100 CD 12 CB R ( Return) . IP 0100, INT 12H. T ( Return) BIOS ( , ): STI PUSH DS MOV AX,0040 MOV DS,AX MOV AX,[0013] POP DS IRET AX p . T BIOS . RET CB, . ------------------------------------------------------------ DOS 2.0 DEBUG , . . A A (Assemble) DEBUG .