4.1
This presentation is the property of its rightful owner.
Sponsored Links
1 / 56

第四章 汇编语言 PowerPoint PPT Presentation


  • 127 Views
  • Uploaded on
  • Presentation posted in: General

4.1 汇编语言语句种类及其格式 1. 基本语句 机器指令语句:对应机器的一种操作,产生对应的目标代码。 伪指令语句:不产生对应的目标代码,伪汇编程序服务。 宏指令语句:用一条语句定义一组语句指令,产生一组机器 指令的目标代码或一组伪指令定的功能。 2. 指令语句 格式: [ 标号: ] 指令助记符 [ 操作数 [ ,操作数 ]] [ ;注释 ] 3. 伪指令语句 格式: [ 符号名 ] 伪指令 [ 参数, …… ,参数 ] [ ;注释 ].

Download Presentation

第四章 汇编语言

An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -

Presentation Transcript


4212639

4.1

1.

2.

[] [[]] []

3.

[] [] []


4212639

  • 4.(Identifier)

  • 31

  • ?@_

  • ?@_

  • (Reserved word)


4212639

4.2

1.

1

B010111001B

D09

H0F

Q0712345Q

2

A , ABC


4212639

(1)816

(2)

(3)


4212639

2.

DB1

DW2

DD4

DQ8

DT110


4212639

DA_BYTE DB 23H23

DA_WORD DW 0ABFH1234H

? ?

DA_B DB ?,?

DA_W DW ?,?


4212639

  • DB255ASCII

  • STRl DB ABCDEF

  • 4.1(a)

  • DWASCII12

  • STR2 DW ABCDE


4212639

  • DUPDUPDUP

  • DB

  • DW

  • [] DD 1 DUP(2)

  • DF

  • DQ

  • DT

  • 12

  • D_DB1 DB 10H DUP(?)

  • D_DB2 DB 10H DUP(AB)

  • D_DWl DW 10H DUP(9)

  • DUP2DUP

  • D_DB3 DB 10H DUP(3,2 DUP(8)6)

  • 10H388640H


4212639

  • (),

  • DA1 DB 0ABH

  • DA2 DW 34A5H

  • MOV AL DA1

  • MOV BX DA2

  • DA3 DB 10H DUP(?)

  • DA4 DW 10H DUP(1)

  • MOV DA3[SI]BL

  • ADD AXDA4[BX][DI]


4212639

  • NUM DB 26H

  • SZ1 DW 10H DUP(0)

  • DZl DW NUM

  • DZ2 DD NUM

  • DZ3 DW SZ1[2]


4212639

DATA SEGMENT

A DW M

BUF DB AB,0AH,0DH

CON EQU 500H

B DW 0FFAAH

D DD BUF

M DB 2 DUP(1),2 DUP(2,B),123,1,2,3

DATA ENDS

(1)(AX)=?

LEA BX,M

MOV AX,[BX+4] ;(AX)= 4202H

(2)A,BUF,B,D,MEA026812


4212639

DW

EA

A+0 0CH

+1 00

BUF+0 A

+1 B

+2 0AH

+3 0DH

B+0 0AAH

+1 0FFH

D+0 2

+1 0

+2

+3

M+0 01

+1 01

+2 2

+3 B

+4 2

+5 B

DD

EA

6 1

7 2

8 3

9 1

0AH 2

0BH 3

DATA


4212639

3.

CALL

16

NEAR

FAR


4212639

NEAR

LOPlMOV AX30H

LOPlNEARFAR


4212639

LABELLABEL

LABEL

LABELDBDWDD()NEARFARBYTEWORDDWORD


4212639

1,,, /,MOD,SHR (,SHL

SHR,SHL

0


4212639

MOV AL,A SHR 3

A=11111111B

A SHR 3 00011111BAL

2

AND,OR,XOR,NOT

:AND DX,789AH AND 0FH

3EQ , NE , LT , GT , LE , GE

(EA)

0FFFFH100

MOV BX,3 LT 5 ;(BX)=0FFFFH


4212639

4

  • TYPE

  • TYPE

  • DB1

  • DW2DD4DQ8DT10

  • NEAR0FFFFH,

  • FAR0FFFEH

  • LENGTH

  • SIZE

  • SEG

  • OFFSET


4212639

MOV BX,SEG OPE ;OPEBX

DAT SEGMENT

A DW 50,100,-70H

B DB ABCDEF,5 DUP(0)

C DW C-B ;CB

DAT ENDS

:

:

MOV AX,SEG B ;DAT AX,BAX

MOV BX,OFFSET B ;6 BX,BBX

MOV CX,TYPE B ;B;1 CX

MOV AX,A+2 ;(A+2)=100 AX,A2

: AX


4212639

5PTR

PTR

BYTE

WORD

DWORD

NEAR

FAR


4212639

:

:

MOV AX,WORD PTR OPE ;0201H AX

MOV AL,BYTE PTR OPER ;34H AL

OPE

OPE

OPER

PTR

MOV [BX],0 ;0[BX]

MOV WORD PTR [BX],0


4212639

DATA SGEMENT

NUM DB 11H,22H,33H

DATA ENDS

:

MOV AX,NUM ;

MOV AX,WORD PTR NUM ;(NUM)=2211H AX

MOV BL,NUM ;(NUM)=11H BL

MOV SI,0FFSET NUM ;NUMEA SI

ADD 2[SI],2 ;

INC [SI] ;

DEC BYTE PTR [SI] ;OPD=[SI]=NUM

MOV BYTE PTR 2[SI],A

:

PTRMOV AL,BYTE PTR SI

MOV AX,SI+5


4212639

(6)

SIZELENGTH

:

PTR OFFSET,SEG,TYPE,THIS

HIGH,LOW

*,/,MOD,SHL,SHR

+,-

EQ,NE,LT,LE,GT,GE

NOT

AND

OR,XOR

SHORT


4212639

:

:


4212639

  • 1.

  • EQU

  • PORT EQU 256

  • BUF EQU PORT+2

  • EMP=6

  • EMP=9


4212639

2.

PROC [NEAR]/FAR

:

RET

ENDP


4212639

3.

$

0

$

DATA SEGMENT

BUF DB 12345

COUN EQU $-BUF ;COUNBUF

COUN5

A DB $

DATA ENDS


4212639

ORG

ORG

065535

DATA SEGMENT

ORG 10

BUF DB ABCD

ORG $+5

NUM DW 50

DATA ENDS

;$1010

;BUF10

;$55

;NUM19


4212639

4.3

1.

SEGMENT [] [] []

ENDS


4212639

PAGE80

0000 0000

PARA40

0000

WORD

0

BYTE

PARA


4212639

NONE

PUBLIC

64K

STACK

COMMON

AT

MEMORY

DAT1 SEGMENT

A DB 55H DUP(0FFH)

DAT1 ENDS

DAT2 SEGMENT

DB 64H DUP(0)

DAT2 ENDS

PARA

PARA


4212639

1000H:0000H 0FFH

1000H:0001H 0FFH

: :

: :

1000H:0054H 0FFH

1000H:0055H :

: :

1000H:005FH :

1006H:0000H 00

: :

1006H:0063H 00

DAT1 DS

DAT1

55H

1000H

1

DAT2 ES

DAT2

64H

1006H

WORDDAT2

1000H:0056H,1

BYTE

DAT2PAGEDAT1DAT2171


4212639

END

PCCPU4

CODE,DATA,

DATA,STACK

A SEGMENT DATA.EXE

B SEGMENT CODE A SEGMENT DATA

C SEGMENT DATA C SEGMENT DATA

B SEGMENT CODE


4212639

1

0000H:0000H 00

: :

0000H:0054H 00

11

0000H:0060H 0FFH

:

0000H:0162H 0FFH

13

0017H:0000H 00

:

0017H:0201H 00

:

:

:

A SEGMENT PARA PUBLIC S

A1 DB 55H DUP(0)

A ENDS

B SEGMENT PARA COMMON S1

B1 DB 202H DUP(0)

B ENDS

64K

A

2

B1

B2

:

A SEGMENT PARA PUBLIC S

A2 DB 103H DUP(0FFH)

A ENDS

B SEGMENT PARA COMMON S1

B2 DB 104H DUP(0)

B ENDS

B


4212639

2.ASSUME

ASSUME

A SEGMENT

:

AA DW 0FFH

A ENDS

B SEGMENT STACK

:

B ENDS

C SEGMENT

C1 DB A

C ENDS

D SEGMENT

:

DD1 DW 11H

:

D ENDS

E SEGMENT

ASSUME CS:E,SS:B,DS:A,ES:D

MOV AX,A

MOV DS,AX

MOV AX,D

MOV ES,AX

E1:MOV AX,AA

E2:MOV DD,AX

ASSUME DS:NOTHING

ASSUME DS:C

MOV AX,C1

:

E ENDS


4212639

(1)CPU4

(2)ASSUMECS,SS

(3)ASSUMEDS,ES

ASSUMEA,DDS,ES

EIEIMOV AX,DS:AA


4212639

  • 3.

  • DSES

  • DSES

  • DATA_DS SEGMENT

  • DAl DB ?

  • DATA_DS ENDS

  • DATA_ES SEGMENT

  • DA2 DB ?

  • DATA_ES ENDS

  • CODE SEGMENT

  • ASSUME CSCODEDSDATA_DS,ES:DATA_ES

  • START MOV AXDATA_DS

  • MOV DSAX

  • MOV AXDATA_ES

  • MOV ESAX

  • CODE ENDS


4212639

  • SS

  • (1)STACK(Assume)SS

  • STACK1 SEGMENT PARA STACK

  • DB 60H DUP(?)

  • STACKl ENDS

  • CODE SEGMENT

  • ASSUME CSCODESSSTACKl

  • SSSTACKSP+1((SP)60H)


4212639

(2)STACKDSESSSSP

STACK1 SEGMENT

DW 50H DUP(?)

TOP LABEL WORD

STACK1 ENDS

CODE SEGMENT

MOV AXSTACK1

MOV SSAX

MOV SPOFFSET TOP

STACK1(50H)TOPSSSP((SP)100H)


4212639

  • CS

  • CSIPCSIPCSIP

  • (1)ENDCSIPEND

  • END

  • (!):

  • CODE SEGMENT

  • ASSUME CS:CODE

  • BEGIN: MOV AX,DATA

  • CODE ENDS

  • END BEGIN


4212639

(2)CPUCSIP

CALLRET

JMP

IRET

(RESET)

CSIP


4212639

1.MODEL

.MODEL

.MODEL

TINYSMALLMEDIUMCOMPACTLARGESMALL

2.DATA

.DATA

.DATA []

_DATA


4212639

3.CODE

.CODE

.CODE []

_CODE

4.STACK

.STACK

.STACK []

1024


4212639

3.4I/O

DOSDOSP405

I/O

AH

INT 21H

I/O

1.1

MOV AH,1

INT 21H

ASCIIAL,CTRL+BREAK


4212639

2.2

MOV DL,a(a)ASCII DL

MOV AH,2

INT 21H

DLDLCTRL+BREAKASCII

MOV DL,0DH

MOV AH,2

INT 21H

MOV DL,0AH

INT 21H

3.5

MOV DL,a ; DL

MOV AH,5

INT 21H

DL


4212639

4.9

LEA DX,

MOV AH,9

INT 21H

DS:DX$

$

2

DATA SEGMENT

BUF DB HOW DO YOU DO?$

DATA ENDS

:

LEA DX,BUF

MOV AH,9

INT 21H

HOW DO YOU DO?


4212639

5.100AH

LEA DX,

MOV AH,10

INT 21H

DS:DX

BUF DB 80

DB ?

DB 80 DUP(0)

;

0

;

;


4212639

(1)WHAT IS YOUR NAME?

(2)

S:MOV AX,DATA

MOV DS,AX

LEA DX,M

MOV AH,9

INT 21H

MOV DX,0FFSET P

MOV AH,10

INT 21H

MOV AH,4CH

INT 21H

CODE ENDS

END S

DATA SEGMENT

P DB 100

DB ?

DB 100 DUP(?)

M DB WHAT IS YOUR NAME?$

DATA ENDS

STACK SEGMENT STACK

DB 100 DUP(?)

STACK ENDS

CODE SEGMENT

ASSUME CS:CODE,DS:DATA,SS:STACK


4212639

(1)

(2)


4212639

.

1.

DOSUC-DOS

WORDSTARSIDEKICKTRURBO,EDIT

MASM.EXE,CREF

LINK.EXE

DEBUG.COM

LIB

2.

TC

.ASM

MASM

.OBJ

LINK

.EXE

DEBUG

.EXE

DOS

.EXE


4212639

.

WORDSTAR,SKTURBO

SKSK

SK

ASCII

WORDSTAR,TURBO

1.SK

(1)DOSA>SK

SKSK

(2)<ALT>+<CTRL>

(3)<ALT>+<N>SK

<F3>

New note file : -


4212639

aA:AB.ASM

b*.*

<F2>

2.

<ESC>

SKSKA

3.

SKwordstarturbo

(1)

<PgUp>:

<PgDn>:


4212639

(2)

<INS>

<DEL>

<Backpace>

<Ctrl>+<Y>

(3)

<F7>/

<F8>/

<ctrl>+<k>+<v>

<ctrl>+<k>+<c>

<ctrl>+<k>+<y>


4212639

.

DOS

MASM

A>MASM

:

Source filename [.ASM]:EXAM

Object filename [EXAM.OBJ]:

Source listing [NUL.LST]EXAM

Cross reference [NUL.CRF]:EXAM

.LST

.CRFCRET

A>MASM EXAM;(.LST ,.CRF


4212639

.

DOSLINK

(1)A>LINK

:

Object Modules[.OBJ]:EXAM

Run File[EXAM.EXE]:

List File[NUL.MAP]:EXAM

Lisbraries [.LIB]:

;

;

;

.MAP,

;


4212639

.

DOS

A>EXAM

HOW ARE YOU

STACK SEGMENT STACK

DB 200 DUP(0)

STACK ENDS

DATA SEGMENT

BUF DB HOW ARE YOU!$

DATA ENDS

CODE SEGMENT

ASSUME CS:CODE,DS:DATA,SS:STACK

START:MOV AX,DATA

MOV DS,AX

LEA DX,BUF

MOV AH,9

INT 21H

MOV AH,4CH

INT 21H

CODE ENDS

END START


  • Login