Title: 4.2.4 ???????PROC?ENDP
14.2.4 ???????PROC?ENDP
- ??????????????????????(?CALL??),????????????????
(RET)? - ???????????
- lt???gt PROC ??
-
-
- RET
- lt???gt ENDP
- ??PROC?ENDP???????
2- ????????
- NEAR(????)??????
- FAR??????
-
- ??????????
- CALL lt???gt
34.2.5 ??????
??????????????,????????????????,??????,?????????
?????????
?????? lt????gt MACRO ??? lt????gt
ENDM
4??????????????? ???? DADD MACRO X,Y,Z
MOV AX,X ADD AX,Y
MOV Z,AX ENDM
X?Y?Z?????????DADD???? DADD
DATA1,DATA2,SUM DATA1,DATA2,SUM?????,?????????X?Y?
Z?
5??????(???)????????,????????????? ?
??????????????????????????,?CALL?RET???CPU??????
? ????????????????? ? ?????????????(??????) ?
?????????????,?????????,?????????????????????????
??
6- ???????????????????
- ??????
- Display MACRO string
- LEA DX,string
- MOV AH,9
- INT 21H
- ENDM
- ??????
-
- DISPLAY
ERROR_MESSAGE - DISPLAY
EXIT_MESSAGE -
- ??????(??????????????)
-
- LEA
DX,ERROR_MESSAGE - MOV AH,9
- INT 21H
- LEA
DX,EXIT_MESSAGE - MOV AH,9
74.2.6 ???????END
??????????,?????????END,??????????? ?? END
??? END????????????????????,?????????(??????????
??)?
8????????? EXAM.ASM
94.3 DOS????????
- ???????OS?????????????????????????,?????????
- ?????????,????DOS????,?????BIOS?????
- ????????????????,???CALL??,?????????INT n????
- ?DOS???,????????????INT 21H?????
10INT 2lH???????????? ?????????????????? ??P411???C
.3
- D0S?????????????
- ? AH????
- ? ???????????????
- ? ??INT 21H??
- ???????
- ????INT 21H??????????
11?????????????????????????,??????????????????????,?
????????
1. DOS??????
(1) ?????????(???1) MOV AH,1 INT 21H
ltAL???????gt
12- ??????????????????
- GET_KEY MOV AH,1 ??????
- INT 21H ???AL?
- CMP AL,Y ?Y?
- JZ YES ?,?YES
- CMP AL,N ?N?
- JZ NO ?,?NO
- JMP GET_KEY ????????
- YES
-
- NO
13- (2) ?????(???0AH)
- ?????????????????????????????
- MOV AH, 0AH
- LEA DX, lt?????????gt
- INT 21H
????????????????
(???N1????????)
0DH
N2
N1
N1 ?????(???????) N2
????????(??????)
14- ?????????(????)???N1,??????????????,??????????
- ???????????????
- STR1 DB 10,?,10 DUP(?)
- ??DOS???0AH????????
- LEA DX,STR1
- MOV AH,0AH
- INT 21H
- ???????????10???(????)?
152. DOS??????
- (1) ???????????(???2)
- MOV AH, 2
- MOV DL, lt??????gt
- INT 21H
- ????????????A
- MOV AH, 2
- MOV DL, A ?MOV DL, 41H
- INT 21H
16(2)?????(???9)
- MOV AH, 9
- LEA DX, lt???gt
- INT 21H
- ???????????????
17- ???????HELLO,WORLD!
- ?????????
- DATA SEGMENT
- STR1 DB HELLO,WORLD!
- DATA ENDS
- ???????????
- MOV AH,9
- LEA DX,STR1
- INT 21H
- ????? HELLO.ASM
18?BIOS????
- BIOS????????,????EPROM???????????????????
- BIOS???????????,?????
- MOV AH,lt???gt
- lt??????,???????????gt
- INT lt????gt
- BIOS????????????
- INT 10H????
- INT 13H????
- INT 14H?????
- INT 16H????
- INT 17H?????
- ????????????,???????????
- BIOS???????p416??D?
194.4 ??????????
- 4.4.1 ??
- 1.????(??)
- 2.???????????
- 1-?????????????,????
- 2-??????(???)
- 3-????????????
- 4-?????????,??.ASM??
- 5-??????,??.OBJ????
- 6-?.OBJ?????.EXE????
- 7-?????
- 3.???????????????????
20????????(???)?
- (1)????????,???????????????
(2) ?????????
?
????????????
N
Y
21(3)? ????????????
?????????(?????)
??????FlowChart.doc
22????????
??
?EDIT,NOTEPAD??????????????.ASM??
??(??)???
?MASM?????????? ?????.OBJ????? ????MASM
lt????.ASMgt
? ?
Y
?? ?
N
?LINK????????? ?????.EXE?????? ????LINK
lt?????.OBJgt
? ?
Y
?? ?
N
? ?
N
?? ?
??
Y
? ?
?TD?DEBUG?????????? ????TD lt??????.EXEgt
23- 4.4.2 ????(p175-176,??)
- 4.4.3 ????
IFTHEN??
???? ??/???? (TEST/CMP)
?????? (Jx ??)
???
?? ????
N
???? ?
Y
??
??
24IFTHENELSE??
???? TEST/CMP?? Jx
??1 ???P1 JMP
??2 ??1 ???P2 ??2????
??1
??2
???? ?
??1
??P1
??P2
??2
25CASE??
????
TEST/CMP??(????1) Jx ??1
??????1 ???P1 JMP
??n1 ??1TEST/CMP??(????2) Jx
??2 ??????2 ???P2
JMP ??n1 ??2TEST/CMP??(????3)
Jx ??3 ??????3
???P3 JMP ??n1 ??3TEST/CMP??(?
???4)
??n1(????)
??1?? ?
Y
P1
??1
N
??2?? ?
Y
P2
??2
N
??n?? ?
Y
Pn
??n
N
Pn1
??n1
?P178,?4-14,?????????????
264.4.4 ????
- 1.DOUNTILlt??gt ??
- ???,?????????????????
???
???
????
?????
Y
N
27- 2. DO WHILElt??gt ??
- ?????,??????????????????
???
????
?????
Y
???
N
28- ????????(????),????????????,?????????
- ?P179?4-15,?????????
- ?????3,7,2,8,6?8,7,6,3,2?
- ??????
- ??????????????,????????,????????????????,?????????
????????????1 - ?????????????????n???,???????n-1?
BSORT.ASM
294.4.5 ???????
- ??????
- ??????CALL??,???????RET???
- ??????????
- ???????????????????(???)?????????(??????),????????
???? - ????????????????????,?????????????????????????????
??(??BP??)?
30?1 ????(0-F)???ASCII(0-F)????? BIN2ASC
PROC ??????AL????
??????AL? CMP AL, 9
JA A2F ADD
AL, 30H JMP DONE A2F
ADD AL, 37H DONE RET BIN2ASC
ENDP ????(?????)
MOV AL, 0CH CALL
BIN2ASC (AL??0CH?ASCII?43H, C)
31- ?2. ?????????
- ????p182?4-17?
- ?????????,?????????????????????CR????????????CR
?????????? - ??????,??????????255????
- ???????????
-
32???
?????/???
??
???1
???
??????
Y
??lt256?
N
N
??CR?? ??????
Y
?? ??
??????
N
???
Y
??????
???
??
??
33- ????
-
- DATA SEGMENT
- STRING DB This is a string,0DH,
- LENGTH1 DW ? ????????
- CR DB 0DH
- MESSAGE DB The string is too
long!,0DH,0AH, - DATA ENDS
- CODE SEGMENT
- ASSUME CSCODE,DSDATA
- MAIN PROC FAR
- BEGIN MOV AX,DATA
- MOV ES,AX
- MOV DS,AX
34- CALL STRLEN ?????????
- MOV DX,LENGTH1 ???DX????
- CMP DX,100H
- JB NEXT1 ?(DX)lt100H,?
- LEA DX,MESSAGE ?(DX)100H,
- MOV AH,9
- INT 21H ????
- JMP NEXT2
- NEXT1 MOV DH,DL ?????DH?
- MOV CL,4
- SHR DL,CL ????4?
- CMP DL,9
35- JBE LP 9,?
- ADD DL,7 gt9,?7
- LP ADD DL,30H ?4????ASCII?
- MOV AH,6
- INT 21H ????ASCII?
- MOV DL,DH ?????
- AND DL,0FH ????4?
- CMP DL,9
- JBE LP1 9,?
- ADD DL,7 gt9,?7
- LP1 ADD DL,30H ?4????ASCII?
- MOV AH,6
- INT 21H ???ASCII?
36- MOV DL,H
- MOV AH,6
- INT 21H ??H
- NEXT2 MOV AH,4CH
- INT 21H ??DOS
- MAIN ENDP
- ------- ????? --------
-
- -----???????? -----
- STRLEN PROC
- LEA DI,STRING
- MOV CX,0FFFFH (CX)-1
- MOV AL,CR (AL)0DH
- MOV AH, (AH)24H
- CLD DF0
37- AGAIN INC CX ???1,???(CX)0
- CMP CX,100H
- JAE DONE ??gt255,???
- CMP DI,AH ?????
- JE DONE ?,???
- SCASB ????CR?
- JNE AGAIN ???,????
- DONE MOV LENGTH1,CX ??,LENGTH1???
- RET ?????
- STRLEN ENDP
- ----- ????? -----
- CODE ENDS
- END BEGIN
38- ???????
- ??????????????
- ???????????????
- ??????????ASCII??????