INCLUDE ?? ??(1) - PowerPoint PPT Presentation

1 / 27
About This Presentation
Title:

INCLUDE ?? ??(1)

Description:

Lecture #7 (4) - 8086 – PowerPoint PPT presentation

Number of Views:71
Avg rating:3.0/5.0
Slides: 28
Provided by: ackr
Category:
Tags: include | masm

less

Transcript and Presenter's Notes

Title: INCLUDE ?? ??(1)


1
Lecture 7
  • ????? (4)- 8086 ??? ?????

2
INCLUDE ?? ??(1)
  • ?? ???? 1
  • AL ????? ?? ASCII ?? 16?? ??? ??? ???? ????
  • PUTHEX CMP DL, 0AH
  • JAE HEX2
  • ADD DL, 0
  • JMP HEX3
  • HEX2 ADD DL, A-0AH
  • HEX3 MOV AH, 2
  • INT 21H
  • RET
  • -------------------------------------------------
    --------
  • LEVEL1 DB ?
  • LEVEL2 DB ?
  • START MOV AX, MAIN
  • MOV DS, AX
  • MOV AL, 3FH
  • CALL PUTAL MOV AH, 4CH
  • INT 21H
  • MAIN ENDS
  • END START
  • MAIN SEGMENT
  • ASSUME CSMAIN, DSMAIN
  • -------------------------------------------------
    --------
  • PUTAL MOV BL, 10H
  • MUL BL
  • MOV LEVEL1, AH
  • MOV AH, 0
  • MOV BL, 10H
  • DIV BL
  • MOV LEVEL2, AL
  • MOV DL, LEVEL1
  • CALL PUTHEX
  • MOV DL, LEVEL2
  • CALL PUTHEX
  • RET
  • -------------------------------------------------
    --------

3
INCLUDE ?? ??(2)
  • ?? ???? 1 ??
  • PUTAL ???? AL ????? ?? 2??? ASCII 16??? ????
    ????
  • PUTHEX ???? DL ????? ?? ???? ?? (09,
    AF)? ??? ???? ????
  • END ???? ???? ?? ??(START)? ??

4
INCLUDE ?? ??(3)
  • ??? ?? ????? (1)
  • PUTAL ????? ??? ??(???? ??)? ????
  • ???? PUTAL.SUB
  • MODULE PUTAL.SUB
  • PUTAL MOV BL, 10H
  • MUL BL
  • MOV LEVEL1, AH
  • MOV AH, 0
  • MOV BL, 10H
  • DIV BL
  • MOV LEVEL2, AL
  • MOV DL, LEVEL1
  • CALL PUTHEX
  • MOV DL, LEVEL2
  • CALL PUTHEX
  • RET
  • -------------------------------------------------
    --------

PUTHEX CMP DL, 0AH JAE HEX2 ADD DL, 0
JMP HEX3 HEX2 ADD DL, A-0AH HEX3 MOV AH,
2 INT 21H RET -------------------------------
-------------------------- LEVEL1
DB ? LEVEL2 DB ?
5
INCLUDE ?? ??(4)
  • ??? ?? ????? (2)
  • ?? PUTAL.SUB? ??? ?? INCLUDE ?? ??? ???? ?? ????
    1? ??? ?? ??? ? ??
  • MAIN SEGMENT
  • ASSUME CSMAIN, DSMAIN
  • INCLUDE PUTAL.SUB
  • START MOV AX, MAIN
  • MOV DS, AX
  • MOV AL, 3FH
  • CALL PUTAL
  • MOV AH, 4CH
  • INT 21H
  • MAIN ENDS
  • END START

6
INCLUDE ?? ??(5)
  • ??? ?? ????? (3)
  • ??
  • ????? ???? ?????? ??? ??
  • ?? ? ?? ??? ???? ???
  • ?? ??? ??? ????? ?? ??? ??
  • ??
  • INCLUDE ?? ??? ?? ?? ?? ??? ??
  • ???? ?? ???? ??

7
???? ??(1)
  • ???? ??
  • ???? ??? ???? ??? ?????? ?? ???? ???? ???? ??
    ???? ??
  • ?????? ???? ?? ??? ??? ?? ???? ????.
  • ???? ??(Register Housekeeping)
  • ?? ???? ????? ???? ????? ?? ??? ??, ???? ?? ??
    ???? ?? ???? ????.
  • ??? ???? ??? ???? ??
  • ??? ??? ???? ??

8
???? ??(2)
  • ?? ???? 2
  • ?? NUM? ???? ?? ??? 16??? ???? ????
  • MAIN SEGMENT
  • ASSUME CSMAIN, DSMAIN
  • INCLUDE PUTAL.SUB
  • START MOV AX, MAIN
  • MOV DS, AX
  • MOV BX, OFFSET NUM
  • MOV SI, 0
  • NEXT MOV AL, BXSI
  • CMP AL, 0
  • JE EXIT
  • MOV BXSAVE, BX
  • CALL PUTAL
  • MOV BX, BXSAVE
  • INC SI
  • JMP NEXT
  • EXIT MOV AH, 4CH
  • INT 21H
  • BXSAVE DW ?
  • NUM DB 01H, 23H, 45H, 67H, 89H
  • DB 0ABH, 0CDH, 0EFH, 00H
  • MAIN ENDS
  • END START

9
???? ??(3)
  • ?? ???? 2 ???
  • ???? ??? ?? ??? ??? ??? ??
  • ???? ?? ???? ???? ???? ?? ???? ?? ?? ???? ???
    ????? ????? ????.

10
PUSH POP ??(1)
  • ??(Stack)
  • LIFO(Last-In First-Out) ??? ???? ??? ??
  • 8086 CPU? ?? ????? ????
  • ???? SS(Stack Segment), SP(Stack Pointer)? ?? ??
  • PUSH / POP ??? ?? ?? ???? ??? ??

11
PUSH POP ??(2)
  • PUSH POP ??
  • PUSH ??? operand? 16 ?? ???? ??(SSSP)? ????
  • POP ??? ??(SSSP)?? 16 ?? ???? ??? operand? ????
  • SP ???? ?? PUSH/POP ??? ?? ????? 2? ????

12
PUSH POP ??(3)
  • PUSH POP ??

13
PUSH POP ??(4)
  • ??? ??? ???? ?? (1)
  • ?????? 2? ??? ???? ??
  • MAIN SEGMENT
  • ASSUME CSMAIN, DSMAIN, SSMAIN
  • INCLUDE PUTAL.SUB
  • START MOV AX, MAIN
  • MOV DS, AX
  • MOV SS, AX
  • MOV BX, OFFSET NUM
  • MOV SI, 0
  • NEXT MOV AL, BXSI
  • CMP AL, 0
  • JE EXIT
  • PUSH BX
  • CALL PUTAL
  • POP BX
  • INC SI
  • JMP NEXT
  • EXIT MOV AH, 4CH
  • INT 21H
  • NUM DB 01H, 23H, 45H, 67H, 89H
  • DB 0ABH, 0CDH, 0EFH, 00H
  • MAIN ENDS
  • END START

14
PUSH POP ??(5)
  • ??? ??? ???? ?? (2)
  • PUTAL ??????? ???? ??
  • MODULE PUTAL.SUB
  • PUTAL PUSH AX
  • PUSH BX
  • PUSH DX
  • MOV BL, 10H
  • MUL BL
  • MOV DL, AH
  • CALL PUTHEX
  • MOV AH, 0
  • MOV BL, 10H
  • DIV BL
  • MOV DL, AL
  • CALL PUTHEX
  • POP DX
  • POP BX
  • POP AX
  • RET
  • -------------------------------------------------
    --------

PUTHEX PUSH AX PUSH DX CMP DL, 0AH JAE
HEX2 ADD DL, 0 JMP HEX3 HEX2 ADD DL,
A-0AH HEX3 MOV AH, 2 INT 21H POP
DX POP AX RET -------------------------------
--------------------------
15
PUSH POP ??(6)
  • ??? ??? ???? ?? (3)
  • MAIN SEGMENT
  • ASSUME CSMAIN, DSMAIN, SSMAIN
  • INCLUDE PUTAL.SUB
  • START MOV AX, MAIN
  • MOV DS, AX
  • MOV SS, AX
  • MOV BX, OFFSET NUM
  • MOV SI, 0
  • NEXT MOV AL, BXSI
  • CMP AL, 0
  • JE EXIT
  • PUSH BX
  • CALL PUTAL
  • POP BX
  • INC SI
  • JMP NEXT
  • EXIT MOV AH, 4CH
  • INT 21H
  • NUM DB 01H, 23H, 45H, 67H, 89H
  • DB 0ABH, 0CDH, 0EFH, 00H
  • MAIN ENDS
  • END START

16
PUSH POP ??(7)
  • ??? ??? ???? ?? (4)
  • ????? ??? ?? ???? ??? ???? ????? ??? ????? ??
  • ???? ?? ???? ????? ??? PUSH
  • ?????? ???? ?? ???? ?? ???? POP
  • ?? ???? ???? ??? ?? ?? ?? ????? ??? ? ??? ??

17
?? ?? ??(1)
  • ?? ?? ??
  • ?? ?? ??? ???? ??
  • ?? ?? ?? / ??? ?? ??
  • ?? ?? ??
  • ?? ??? ?? ??(and, or, not ?)? ???? ??
  • AND / OR / NOT / XOR / TEST / NEG

18
?? ?? ??(2)
  • AND ??
  • ?? ?? ???(mask) ??? ??
  • ?) AL ????? ?? 4?? ?? ???
  • ? AND AL, 0FH
  • OR ??
  • ?? ??? ??? 1? ???? ??? ??
  • ?) AL ???? ??? ??? 1? ????
  • ? OR AL, 80H

19
?? ?? ??(3)
  • XOR ??
  • ?? ??? ??? ????? ??? ??
  • ?) AL ????? ?? 4??? ????
  • ? XOR AL, 0F0H
  • TEST ??
  • AND ??? ???? operand ?? ???? ?? ?? ??? ?? ???
    ????? ?? ??? ????
  • ?? ??? ??? 1??? ???? ??? ??
  • ?) AL ???? ??? ??? 1??? ????
  • ? TEST AL, 80H

20
?? ?? ??(4)
  • NEG ??
  • ???? ???? ?? ?? ??(?? ?? ??)
  • 2? ?? ??
  • NOT ??? ??? ?? 1? ??? ??? ??
  • ?) AL ????? 2? ?? ???
  • ? NEG AL

21
?? ?? ??(5)
  • ??????
  • AL ????? ?? ?? ?? ?? ??? ??? ?? 2?? ??? ???? ????

BINOUT PROC PUSH AX PUSH DX JZ PUT0 MOV
DL, 1 JMP PUT1 PUT0 MOV DL, 0 MOV AH,
2 INT 21H POP DX POP AX RET BINOUT
EMDP CRLF PROC PUSH AX PUSH DX MOV DL,
0DH MOV AH, 2 INT 21H
  • MAIN SEGMENT
  • ASSUME CSMAIN, DSMAIN
  • PUTBIN PROC NEAR
  • TEST AL, 10000000B
  • CALL BINOUT
  • TEST AL, 01000000B
  • CALL BINOUT
  • TEST AL, 00100000B
  • CALL BINOUT
  • TEST AL, 00010000B
  • CALL BINOUT
  • TEST AL, 00001000B
  • CALL BINOUT
  • TEST AL, 00000100B
  • CALL BINOUT
  • TEST AL, 00000010B
  • CALL BINOUT
  • TEST AL, 00000001B

22
?? ?? ??(6)
  • ?????? (??)

XOR AL, 11110000B CALL PUTBIN CALL
CRLF NOT AL CALL PUTBIN CALL CRLF NOT
AL CALL PUTBIN CALL CRLF MOV AH,
4CH INT 21H MAIN ENDS END START
MOV DL, 0AH MOV AH, 2 INT 21H POP
DX POP AX RET CRLF ENDP START MOV AX,
MAIN MOV DS, AX XOR AX, AX CALL
PUTBIN CALL CRLF MOV AL, 10101111B CALL
PUTBIN CALL CRLF AND AL, 11110000B CALL
PUTBIN CALL CRLF OR AL, 00000011B CALL
PUTBIN CALL CRLF
23
??? ???? ??(1)
  • ??? ???? ??
  • ?? ??? ?? ?? ??
  • ??? ???? ??? ?? ??? ??? CF(Carry Flag)? ????

24
??? ???? ??(2)
  • ??? ??
  • SHL(SHift logical Left) / SHR(SHift logical
    Right)
  • SAL(Shift Arithmetic Left) / SAR(Shift
    Arithmetic Right)

25
??? ???? ??(3)
  • ???? ??
  • ROL(ROtate Left) / ROR(ROtate Right)
  • RCL(Rotate through Carry Left) / RCR(Rotate
    through Carry Right)

26
??? ???? ??(4)
  • ??? ???? ?? ??
  • ?? ? ????? ??
  • 2? ??? ?? ? Shift Left
  • 2? ??? ??? ? Shift Right
  • ?) AL ????? 16 ??? ?
  • MOV CL, 4
  • SAL AL, CL
  • AL ????? 8? ??? ?
  • MOV CL, 3
  • SAR AL, CL
  • ?? MUL/DIV ???? ?? ??? ??? ??

27
??? ???? ??(5)
  • ??????
  • PUTAL ????? ??? ??? ???? ??
  • MODULE PUTAL.SUB
  • PUTAL PUSH AX
  • PUSH BX
  • PUSH CX
  • PUSH DX
  • PUSH AX
  • AND AL, 0F0H
  • MOV CL, 4
  • SHR AL, CL
  • CALL PUTHEX
  • POP AX
  • AND AL, 0FH
  • CALL PUTHEX
  • POP DX
  • POP CX
  • POP BX
  • POP AX
  • RET

PUTHEX PUSH AX PUSH DX CMP DL, 0AH JAE
HEX2 ADD DL, 0 JMP HEX3 HEX2 ADD DL,
A-0AH HEX3 MOV AH, 2 INT 21H POP
DX POP AX RET -------------------------------
--------------------------
Write a Comment
User Comments (0)
About PowerShow.com