??6.5?????Z=((X Y)*8-X)/2 - PowerPoint PPT Presentation

1 / 40
About This Presentation
Title:

??6.5?????Z=((X Y)*8-X)/2

Description:

Title: Author: WANG Last modified by: Billgates Created Date: 4/30/2003 2:16:35 PM Document presentation format: – PowerPoint PPT presentation

Number of Views:16
Avg rating:3.0/5.0
Slides: 41
Provided by: wang97
Category:
Tags:

less

Transcript and Presenter's Notes

Title: ??6.5?????Z=((X Y)*8-X)/2


1
?6?
2
?6?6.2 ??????
  • 6.2.1 ??????
  • ???????????????,???????????????,???????
  • ?????????????
  • ?????????????????

??6.5?????Z((XY)8-X)/2 ??6.6
?????????????,????16 ??????ASCII???
3
?6??6.6(2) ???
  • ???
  • ASCII db 30h,31h,32h,33h,34h,35h,36h,37h,38h,39h
  • ??0 9?ASCII?
  • db 41h,42h,43h,44h,45h,46h
  • ??A F?ASCII?
  • hex db 04h,0bh
  • ??????

4
?6??6.6(2) ???
  • ???
  • mov bx,offset ASCII
  • BX??ASCII??
  • mov al,hex
  • AL????16???
  • ????ASCII??????
  • and al,0fh
  • ???4?????,?4??0
  • xlat
  • ??AL?DSBXAL

XLAT
5
?6??6.6(2) ???(?)
  • mov dl,al ????DL?AL
  • mov ah,2 02?DOS????
  • int 21h ????ASCII???
  • mov al,hex1 ??????????
  • and al,0fh
  • xlat
  • mov dl,al
  • mov ah,2
  • int 21h

XLAT
6
?6?6.2.2 ??????
  • ??????????????????
  • ??????????,?CMP?TEST???????????
  • ????Jcc?JMP????????
  • ?????
  • ?????
  • ?????
  • ?????

7
?6??????
  • ??????,???????????
  • ????????????????????

??????
8
?6???AX?????????
  • cmp ax,0
  • jge nonneg ????(AX0),??
  • neg ax ?????,??
  • nonneg mov result,ax ????

?????? cmp ax,0 jl yesneg ????(AXlt0),?? jmp
nonneg yesneg neg ax ?????,?? nonneg mov
result,ax ????
9
?6??????
  • ?????????2??????,???????1??????
  • ???1???????????JMP?????2?????

????BX????
10
?6???BX????
  • shl bx,1 BX?????CF??
  • jc one CF1,?????1,??
  • mov dl,30h
  • CF0,?????0DL?30H0
  • jmp two ???????????
  • one mov dl,31h DL? 31H1
  • two mov ah,2
  • int 21h ??

???JNC??JC
11
?6???BX????(?)
  • shl bx,1 BX?????CF??
  • jnc one CF0,?????0,??
  • mov dl,31h
  • CF1,?????1DL?31H1
  • jmp two ???????????
  • one mov dl,30h DL? 30H0
  • two mov ah,2
  • int 21h ??

????????
12
?6???BX????(??)
  • mov dl,0 DL?30H0
  • shl bx,1 BX?????CF??
  • jnc two CF0,?????0,??
  • mov dl,1
  • CF1,?????1DL?31H1
  • two mov ah,2
  • int 21h ??
  • ??????,???????????

13
?6???BX????(???)
  • mov dl,0
  • shl bx,1 BX?????CF??
  • adc dl,30h
  • CF0,DL?030h030H0
  • CF1,DL?030h131H1
  • two mov ah,2
  • int 21h ??

14
?6??????
????????????????????,????????????????
or ah,ah cmp ah,0 jz function0 dec ah cmp
ah,1 jz function1 dec ah cmp ah,2 jz function2
15
?6?6.2.3 ??????
  • ?????????????????,????????
  • ??????????3???
  • ??????????????????,???????????????
  • ???????????????,????????????????
  • ????????????????,????????

??????
16
?6?????
  • ??????????????????
  • ???????????????,??????????,????????
  • ?????????,WHILE_DO
  • ?????????,DO_UNTIL
  • ??????????????,?????????,????
  • ??????
  • ??????

??
17
?6????????????
18
?6? ??????
  • ??????????????????
  • ????????LOOP?JCXZ??
  • ?????????????????CX
  • ???
  • ?????LOOP???CX?1???????0

19
?6???????BL??
???
  • mov cx,8 CX?8(????)
  • again shl bl,1 ???CF,???????
  • mov dl,0 MOV?????CF
  • adc dl,30h DL?030HCF
  • CF??0,?DL?' 0 '
  • CF??1,?DL?' 1 '
  • mov ah,2
  • int 21h ??
  • loop again
  • CX?1,??CX???0,???

???
?????? ??????
20
?6???????
  • ??????????????????????
  • ???????????????????
  • ??????????????????????,????????????????????????,??
    ????????

21
?6????0??????
  • ???
  • string db 'Let us have a try !',0
  • ???
  • mov bx,offset string
  • again mov dl,bx
  • cmp dl,0
  • jz done ?0??
  • mov ah,2 ??0,??
  • int 21h
  • inc bx ???????
  • jmp again
  • done

?????? ??????
22
?6?6.2.4 ?????
  • ??????????????????,????????????????,??????
  • ??????????????,????????,????????
  • ???(????)????CALL???????(?????)
  • ???????RET???????

23
?6?1 ???????
  • ?????,????????????PROC?ENDP??,????
  • ??? PROC NEARFAR
  • ???
  • ??? ENDP
  • ???????????????????????,???????
  • NEAR??(?????)??????????????????
  • FAR??(?????)???????????????????

24
?6?1 ???????
???? XSEG SEGMENT SUBT1
PROC FAR
RET SUBT1 ENDP
CALL SUBT1 XSEG ENDS YSEG SEGMENT
CALL SUBT1
YSEG ENDS
?????????? CSEG SEGMENT MAIN PROC FAR
CALL SUBT
RET MAIN
ENDP SUBT PROC NEAR
RET SUBT ENDP CSEG ENDS
25
?6??????????
  • ????????????????
  • ????????RET???????,?????CALL???????
  • ?????????????????????,???????
  • ???????????????????,????????????
  • ?????????????????,???????????????(??DOS??????END??
    ??),?????????????????

26
?6??????????(?)
  • ???????????
  • ?????????????????,???????????(????DS),????????????
    ??(??CS??)
  • ????????????,????????(??RET??)???,??????????????
  • ???????????????????
  • ?????????????

27
?6?????????
  • ???HTOASC????????ASCII?
  • HTOASC proc
  • push bx
  • mov bx,offset ASCII
  • and al,0fh
  • xlat CSASCII ??AL?CSBXAL
  • pop bx
  • ret
  • ???
  • ASCII db 30h,31h,32h,33h,34h,35h,36h,37h,38h,39h
  • db 41h,42h,43h,44h,45h,46h
  • HTOASC endp

28
?6???????
  • ???HTOASC????????ASCII?
  • HTOASC proc
  • and al,0fh
  • cmp al,9
  • jbe htoasc1
  • add al,37h ?A F,?37H
  • ret ?????
  • htoasc1 add,30h ?0 9,?30H
  • ret ?????
  • HTOASC endp

29
?6?2.????
  • ???????????????????
  • ????(????) ?????????,?????????
  • ????(????) ????????????????
  • ???????
  • ?????????
  • ????????????
  • ?????????
  • ???
  • ????
  • ??

30
?6? ????????
  • ???????????????????,??????????????????
  • ???????????,?????????????????,????????????
  • ?????????,???????????????????,????????????????????
    ?,?????????

dpchar
dpstri
HTOASC
31
?6? ?????????
  • ???????????????????????????(????)??????
  • ??????????????????,????PUBLIC?EXTREN??
  • ???????????????,????????
  • ??????????,?????????,????????????????????????????

32
?6? ???????????
  • ??????????????????,???????,?????????,???????????
  • ????????????????,??????,???????????????????
  • ????

33
?6????????
  • ???????????????????????????????,?????????????????
    ??????,???????????
  • ?????????????,??????????????????????????????????

34
6.4 DOS?BIOS??????
  • ????????
  • DOS??
  • ?????20H3FH???????20H27H?2FH,?????
  • ROM BIOS??
  • ??????10H1FH?
  • ????
  • ?????40HFFH,??????????????????????

35
6.4.1 DOS???????
  • DOS????
  • ?INT 22 H?INT 23H?INT 24H???????DOS?????,??????
    ??
  • DOS?????
  • ?INT 20H?INT 21H?INT 25H?INT 26H?INT 27H?INT
    2FH 6???????????,?????????????

36
  • ??????25?26H
  • ?????????????
  • ????
  • AL??????
  • CX???????
  • DX??????????
  • DSBX????????

MOV AL,0 MOV CX,7 MOV DX,5 MOV BX,1000H INT
25H JMP 0
37
  • ??????20?27H
  • 20H?????
  • 27H???????,??????DOS????????,?????????????????,???
    ????????????
  • ?????????
  • INT 2FH?????????????PRINT
  • ??????
  • 21H??????????????????????????,????????????????????
    ?????

38
6.4.2 BIOS????
  • ?????????BIOS
  • ???DOS???I/O????,????????????
  • ???I/O?????????,?????????DOS??I/O??????
  • ??
  • ???????INT 16H
  • ????INT 10H
  • ???????INT 17H

39
?6?????
  • ????????????
  • ???????????????????????????
  • ??????????????????????????
  • ???????????
  • EQU/-/DB/DW/DD??/DUPORG/?OFFSET/SEG/PTR.MO
    DEL/.STACK/.DATA/.CODE/ENDPROC/ENDP

40
?6?????(?)
  • ?????????????????????
  • ??????????
  • ?????,??(????????)?ASCII?BCD??????????(09?AZ?a
    z)??????????????????????????????????????

41
dpchar????????
  • ???
  • mov al,? ?????????
  • call dpchar
  • ?????AL????
  • dpchar proc
  • push ax
  • push bx
  • mov bx,0
  • mov ah,0eh
  • int 10h
  • pop bx
  • pop ax
  • ret
  • dpchar endp

???????AL,??? ?????
42
dpstri????????
  • ???dpstri??DSSI??????
  • dpstri proc
  • push ax
  • dps1 mov al,si
  • inc si
  • cmp al,0
  • jz dps2
  • call dpchar
  • jmp dps1
  • dps2 pop ax
  • ret
  • dpstri endp

???????DSSI,??? ?????
43
HTOASC????????
  • ???HTOASC????????ASCII?
  • HTOASC proc
  • push bx
  • mov bx,offset ASCII
  • and al,0fh
  • xlat CSASCII
  • pop bx
  • ret
  • ASCII db 30h,31h,32h,33h,34h,35h,36h,37h,38h,39h
  • db 41h,42h,43h,44h,45h,46h
  • HTOASC endp

???????AL,??? ???????AL,???
Write a Comment
User Comments (0)
About PowerShow.com