). , - .00000, - . 00020. ------------------------------------------------------------ ------------------------------------------------------------ . 21.3. EXTRN PUBLIC. , CALL SUBMUL 9A 0000 D413 CALL - .9A. IP 0000, .13D2 CS .D413. CS:IP .. 13D40 0000. , CS, .13D2, .. 13D20. , .0020. , : CS 13D20 IP 0020 13D40 , CALL. : PUBLIC ------------------------------------------------------------ .21.4 .21.3. - . SEGMENT PUBLIC: CODESG SEGMENT PARA PUBLIC 'CODE' ------------------------------------------------------------ ------------------------------------------------------------ .21.4. , PUBLIC. IBM PC. 21 6 CALL. ( ) : CODESG - PUBLIC ( .21.3 NONE). , ! , (CODESG), ('CODE') PUBLIC, . , , : 9A 2000 D213 .2000 IP . D213 CS. , CS - .D213. .0020: CS: 13D20 IP: 0020 : 13D40 , , , .13D40. ? , , .0016. SEGMENT, , .. .10 0. - .00020. 13D20 0020 13D40. +----------------------------------------+--------------+ | ... ( | | | ) | | +----------------------------------------+--------------+ | | | 13D20 13D30 13D40 , , . : IBM PC. 21 7 ------------------------------------------------------------ , . , QTY PRICE - , BX AX . .21.5. : QTY PRICE PUBLIC. PUBLIC. Global ( ) QTY PRICE . QTY PRICE EXTRN WORD. 2 . MOV, . , QTY PRICE External (). ------------------------------------------------------------ ------------------------------------------------------------ .21.5. . MOV : A1 0000 E MOV AX,PRICE 8B 1E 0000 E MOV BX,QTY .A1 AX, .8B - BX ( AX , ). , : A1 0200 8B 1E 0000 , MOV . , DS . , PUBLIC EXTRN. , , , IBM PC. 21 8 . - , 64 . 23 , GROUP . ------------------------------------------------------------ . . PUSH . , .21.6, SUBMUL PRICE QTY. CALL : ... | 1600 | D213 | 4001 | 0025 | 0000 | C213 | 6 5 4 3 2 1 1. PUSH DS . DOS. 2. PUSH AX . 3. PUSH PRICE (2500). 4. PUSH QTY (0140). 5. CALL CS (D213) 6. CALL , IP (1600). BP , BP, . , , BP , (). BP SP, BP, SP. BP 0072. SP , .. .80. SP 2: | 0000 | 1600 | D213 | 4001 | 0025 | 0000 |C213 | | | | | | | | SP: 72 74 76 78 7A 7C 7E IBM PC. 21 9 BP 0072, (PRICE) BP+8, (QTY) - BP+6. AX BX . ------------------------------------------------------------ ------------------------------------------------------------ .21.6. . BP , SP 2, 72 74. RET "" . : IP (1600). SP 2, 74 76. CS (D213). SP 2 76 78. . . RET RET 4 4 ( ). RET SP, 7C. , . SP - . BASIC- ------------------------------------------------------------ BASIC IBM PC BASIC- . : BIOS- . - ; BASIC . BASIC , . , 64 , BASIC. . IBM PC. 21 10 : BASIC - POKE BASIC-. BASIC- POKE. , . , LST- DEBUG. BASIC- DATA. BASIC- READ POKE . . , (EXE) . BASIC- . BASIC- BSAVE (BASIC save) BLOAD - . BASIC- , , . BASIC : USR CALL. DS, ES SS BASIC. CS , DEF SEG ( ). SP , , . , . SP BASIC RET. , . HIGH , , B:/HIGH. DEBUG EXE- R CS IP: . ( N) BASIC L. BASIC- EXE- - USR CALL. , EXE- , , USRn CALL. BASIC IBM PC USRn CALL . IBM PC. 21 11 : BASIC . BASIC- . BASIC- - . FOR-NEXT . BASIC- , . . 21.7 BASIC- . BASIC-: 10 32 ; 20, 30, 40 50 . BASIC- . BASIC- . BASIC , . F2. SAVE "B:BASTEST.BAS" : - , BASIC; ; - BP SP BP; - , , . ------------------------------------------------------------ ------------------------------------------------------------ .21.7. BASIC . - . , (DOS) A, - B: 1. , B:LINKBAS.ASM . 2. LINK, , : LINK B:LINKBAS,B:LINKBAS/HIGH,CON; 3. DEBUG BASIC - : DEBUG BASIC.COM. IBM PC. 21 12 4. R . SS, CS IP. 5. : N B:LINKBAS.EXE L 6. R CX, CS IP. 7. SS, CS IP 4. ( R SS, R CS R IP). 8. G (go) BASIC. BASIC-. 9. , , ( ): DEF SEG = &Hxxxx ( CS 6) BSAVE "B:CLRSCRN.MOD",0,&Hxx ( CX 6) . , . B. 10. BASIC- . , , SYSTEM BASIC , , Q DEBUG. DOS. 11. BASIC, BASIC- : BASIC LOAD "B:BASTEST.BAS" LIST 12. 20, 30, 40 50 : 20 BLOAD "B:CLRSCRN.MOD" 30 DEF SEG = &Hxxxx ( CS 6) 40 CLRSCRN = 0 ( ) 50 CALL CLRSCRN ( ) 13. , BASIC- . BASIC- , , . IBM PC. 21 13 .21.8 - . . , BASIC- CALL (-1,-2,...) ------------------------------------------------------------ ------------------------------------------------------------ .21.8. BASIC . , BP [BP], .21.3. RET, . , CALL RET 6. PASCAL ------------------------------------------------------------ , PASCAL IBM MicroSoft . .21.9 PASCAL- . PASCAL- OBJ-, OBJ-. LINK OBJ- EXE-. PASCAL- : temp_row temp_col, . temp_row temp_col . PASCAL- procedure move_cursor , extern (). PASCAL-, , : move_cursor (temp_row, temp_col); : , , . : 00 02 IBM PC. 21 14 04 06 08 BP, PASCAL-. , .21.6. ------------------------------------------------------------ ------------------------------------------------------------ .21.9. PASCAL-. SP . , BP SP BP. BP . - . ( ) 08, BP+08. ( ) 06 BP+06. BX, DI SI. [BP+08] SI, [SI] ( ) DH. DL. DX BIOS . BP. RET , , 22, 4. . PUSH POP . . - , PASCAL , AX DX:AX. , PASCALL PASCALL-, CODESEG ( ) . PASCALL-. IBM PC. 21 15 .5720 - 20. . C ------------------------------------------------------------ C , C C. , : C ( ) . , , , , : MOV ES,BP MOV BP,SP MOV DH,[BP+4] MOV DL,[BP+6] ... POP BP RET C , , C-. C , , DI SI, . , , AX ( ) DX:AX ( ). C, DF, CLD . ------------------------------------------------------------ , , EXTRN, - PUBLIC. IBM PC. 21 16 , 1 2, 1. , , PUBLIC. . ( ). PUBLIC, ( ) - EXTRN. ------------------------------------------------------------ 21.1. , MAINPRO SUBPRO. ) MAINPRO , SUBPRO ? ) SUBPRO , MAINPRO? 21.2. , MAINPRO QTY DB, VALUE DW PRICE DW. SUBPRO VALUE QTY PRICE. ) MAINPRO , ? ) SUBPRO , ? 21.3. 21.2 21.3 . 21.4. , MAINPRO , . SUBPRO . 21.5. , . 21.4 , MAINPRO (QTY) (VALVE) , SUBCONV ASCII- ; IBM PC. 21 17 SUBCALC (PRICE); SUBDISP ASCII- . IBM PC. 22 33  22.  ------------------------------------------------------------ : . ------------------------------------------------------------ DOS , DOS . DOS , : 1. DOS, , FORMAT /S. (, DOS A C) . , , . 2. IBMBIO.COM BIOS ROM; , .00600. IBMBIO.COM , COMMAND.COM. IBMBIO.COM - , . 3. IBMDOS.COM , .00B00. , , INT 21H, . 4. COMMAND.COM DOS, DIR CHKDSK, COM, EXE BAT-. : , . COMMAND.COM, , . .22.1 . . IBM PC. 22 34 ------------------------------------------------------------ 00000 (..23) 00400 ROM () 00500 DOS 00600 IBMBIO.COM XXXX0 IBMDOS.COM (FAT, ) XXXX0 COMMAND.COM XXXX0 (COM EXE-) XXXX0 COM- (256 ) XXXX0 COMMAND.COM, . ------------------------------------------------------------ .22.1. DOS . COMMAND.COM ------------------------------------------------------------ COMMAND.COM . COMMAND.COM: 1. IBMDOS.COM ( ), . - : INT 22H . INT 23H Ctrl/Break. INT 24H / (FAT). INT 27H , . 2. AUTOEXEC- . . , . . . IBM PC. 22 35 3. . "" , DOS , . COMMAND.COM DOS A> C>, . COM- EXE- . - , (PSP) COMMAND.COM. .100 , . : IBMBIO.COM IBMDOS.COM COMMAND.COM () ... COMMAND.COM ( , ). RET INT 20H COMMAND.COM. , . ------------------------------------------------------------ (PSP) 256 (. 100) COM- EXE-, . PSP : 00 INT 20H (.CD20). 02 0. , 512K .8000 .80000. 04 . 05 DOS. OA . OE Ctrl/Break. 12 . 16 . 2C ASCIIZ . 50 DOS (INT 21H RETF). 5C 1, (FCB1). IBM PC. 22 36 6C 2, (FCB2); , FCB1 . 80-FF (DTA). DTA PSP .80 - . , . , ( ). "", . DTA: 1. . , CALCIT.EXE CALCIT [return]. , DOS PSP , .80 .000D. , CALCIT, " ". Return , . , .0D. , .80 81 000D. 2. . , ( ), , COLOR BY, COLOR "BY" . , .80, DOS : 80: 03 20 42 59 0D 3, , "BY" . 3. . DEL ( ) . , , DEL B:CALCIT.OBJ [return], PSP, .5C .80, : 5C: 02 43 41 4C 43 49 54 20 20 4F 42 4A C A L C I T O B J 80: 0D 20 42 3A 43 41 4C 43 49 54 2E 4F 42 4A 0D B : C A L C I T . 0 B J IBM PC. 22 37 .5C, FCB, , , CALCIT.OBJ, . (02=B ). CALCIT , , , OBJ. , : progname A:FILEA,B:FILEB DOS FCB FILEA .5C FCB FILEB .6C. .80 ( ) - 16, (.20) A:FILEA,B:FILEB (OD). PSP , PSP . DTA COM- .80 SI : MOV SI,80H ; DTA CMP BYTE PTR [SI],0 ; ? JE EXIT EXE- , PSP. , DS ES PSP, ES DS: MOV AX,DSEG MOV DS,AX MOV SAVEPSP,ES PSP: MOV SI,SAVEPSP CMP BYTE PTR [SI+ 80H],0 ; ? JE EX