»ã±àÓïÑÔ³ÌÐòÉè¼Æ(ºÏ¹¤´ó°æ)Ï°Ìâ²Î¿¼´ð°¸ ÏÂÔر¾ÎÄ

3.26 ´Ó¼üÅÌÊäÈëÒ»¸öÓ¢ÎÄ×Öĸ£¬ÏÔʾÊä³öÆä´óд¡£»­³öÁ÷³Ìͼ£¬²¢±àд³ÌÐò¶Î¡£

3.27 ´Ó¼üÅÌÊäÈëһλÊý×ÖN£¬ÏÔʾÊä³öN¸öN¡£»­³öÁ÷³Ìͼ£¬²¢±àд³ÌÐò¶Î¡£

CODE SEGMENT ASSUME CS:CODE START: MOV AH,1 INT 21H MOV DL,AL AND AL, 0FH MOV CL,AL MOV CH,0

NEXT: MOV AH,2 INT 21H LOOP NEXT MOV 4CH INT 21H CODE ENDS END START

3.28 ¼Ä´æÆ÷ÖÐΪѹËõµÄBCDÂë±íʾµÄÊ®½øÖÆÊý£¬Ð´³öÖ¸ÁîÍê³ÉÊ®½øÖƼӼõ¼ÆË㣬¼´¼ÆËãAL+BL£»AL-BL¡£²¢ÔÚDEBUGÏÂÉÏ»úÑéÖ¤¡£

(1) AL=65H,BL=37H (2) AL=98H,BL=69H

3.29 ¼Ä´æÆ÷ÖÐΪ·ÇѹËõµÄBCDÂë±íʾµÄÊ®½øÖÆÊý£¬Ð´³öÖ¸ÁîÍê³ÉÊ®½øÖƼӼõ¼ÆË㣬¼´¼ÆËãAL+BL£»AL-BL¡£²¢ÔÚDEBUGÏÂÉÏ»úÑéÖ¤¡£

(1) AX=235H,BL=37H (2) AL=238H,BL=39H

3.30 ÓÃÏà¶Ô»ùÖ·±ÈÀý±äÖ·Ñ°Ö··½·¨ÇóARRAYÐÐÁÐʽµÄÖµ¡£ ARRAY DW 2£¬3£¬5 DW 1£¬4£¬6 DW 2£¬7£¬9

Ï°Ìâ4

4.1 ¼ÙÉèVAR1Ϊ×Ö½Ú±äÁ¿£¬VAR2Ϊ×Ö±äÁ¿£¬LABΪ±êºÅ£¬VALΪ³£Á¿£¬Ö¸³öÏÂÁÐÓдíÎóµÄÖ¸Áî,˵³öÔ­Òò£¬²¢Óè¾ÀÕý¡£

(1) ADD AX£¬VAR1 / ADD AL£¬VAR1 (2) MOV VAR2£¬VAR1 / MOV VAR2£¬AX (3) MOV VAR1£¬BYTE PTR VAR2 / MOV VAR1£¬AL

(4) MOV VAR1£¬OFFSET VAR2 / MOV VAR2£¬OFFSET VAR1 (5) MOV VAR2£¬OFFSET VAR1

(6) MOV VAR1£¬VAR2+VAR1 / MOV VAR2£¬VAR2-VAR1 (7) MOV VAR1£¬VAR2-VAR1 / MOV VAR2£¬VAR2-VAR1 (8) MOV VAR2£¬VAR2-VAR1

(9) MOV BX£¬VAR2+VAL-4*5

(10) MOV BX£¬TYPE VAL (11) MOV BX£¬LAB

(12) JMP VAR1 /JMP WORD PTR VAR1 (13) JMP VAR2

(14) JMP [VAL] /½öÔÚDEBUGÏ¿ÉÒÔ

(15) MOV BL, VAR1 AND VAL / VAR1 AND VALÐëÓÃÖ¸ÁîʵÏÖ (16) MOV BX, VAL AND 0FH (17) MOV BX, VAL LT 0FH

(18) MOV BL£¬LAB+VAR1 / MOV BL£¬VAR1

4.2 »­Í¼ËµÃ÷ÏÂÁÐÊý¾Ý¶¨ÒåÓï¾äËùʾÄÚ´æ¿Õ¼äµÄÊý¾Ý£¬²¢»Ø´ð¼Ä´æÆ÷µÄÖµ¡£

ORG 0

ARRAY LABEL BYTE

DA1 DW 2£¬9£¬14£¬3£¬315H£¬-6 DA2 DB 7£¬¡®ABCDEDFG¡¯

LEN = $£­DA2 ORG 100H DA3 DW DA4

DA4 DB 4 DUP(2 DUP(1,2,3),4)

MOV AL£¬ARRAY+2 £¨AL£©=£¨ £©H ADD AL£¬DA2+1 £¨AL£©=£¨ £©H MOV AX£¬DA2-DA1 £¨AX£©=£¨ £©H MOV BL£¬LEN £¨BL£©=£¨ £©H MOV AX, DA3 £¨AX£©=£¨ £©H MOV BX, TYPE DA4 £¨BX£©=£¨ £©H MOV BX, OFFSET DA4 £¨BX£©=£¨ £©H MOV CX, SIZE DA4 £¨CX£©=£¨ £©H MOV DX, LENGTH DA4 £¨DX£©=£¨ £©H MOV BX, WORD PTR DA4 £¨BX£©=£¨ £©H MOV BL, LEN AND 0FH £¨BL£©=£¨ £©H MOV BL, LEN GT 5 £¨BL£©=£¨ £©H MOV AX, LEN MOD 5 £¨AX£©=£¨ £©H

4.3 ±äÁ¿ºÍ±êºÅÓÐÄÄЩÇø±ð£¿±äÁ¿ºÍ±êºÅÓÐÄÄЩÊôÐÔ£¿ÈçºÎ»ñÈ¡ÊôÐÔÖµ£¿Ð´

³öÖ¸Áî¡£

±äÁ¿ÊÇΪָÁîÌṩµÄ²Ù×÷Êý£¬±êºÅÊÇΪָÁîÌṩ±êʶ£¬¶¼ÊÇΪÁËÔÚÖ¸ÁîÖÐÒýÓá£ËüÃÇ×îÖ÷ÒªµÄÊôÐÔÓУºÆ«ÒÆÊôÐÔ£¬¶ÎÊôÐÔ£¬ÀàÐÍÊôÐÔ¡£ÀýÈ磺 MOV BX£¬ OFFSET VAL £»È¡Æ«ÒÆÊôÐÔ MOV BX£¬ SEG VAL £»È¡¶ÎÊôÐÔ MOV BX£¬ TYPE VAL £»È¡ÀàÐÍÊôÐÔ

4.4 Ö¸ÁîºÍαָÁîµÄÇø±ðÔÚÄÄÀαָÁî¿ÉÒÔ³öÏÖÔÚ´úÂë¶ÎÂð£¿Ö¸Áî¿ÉÒÔÔÚÊý¾Ý¶ÎÂð£¿

Ö¸ÁîÖ»ÄܳöÏÖÔÚ´úÂë¶Î£¬¶¨ÒåÊý¾ÝµÄαָÁîͨ³£ÔÚÊý¾Ý¶Î¡£Î±Ö¸Áî²»»áÉú³ÉÖ¸Áî¡£

4.5 ÏÂÃæµÄ³ÌÐòÊÇ·ñÓÐ´í£¿ÄÜ·ñͨ¹ý»ã±à£¿³ÌÐòÔËÐеĽá¹ûÈçºÎ£¿³ÌÐòµÄÕæÕýÒâͼÊÇʲô£¿Ó¦ÈçºÎÐ޸ijÌÐò²ÅÄÜʵÏÖÕæÕýÒâͼ£¿ ´ð£ºÍ¨¹ý»ã±àºÍÁ¬½Ó¿ÉÒÔÔËÐУ¬µ«³ÌÐòÕæÕýÒâͼÊÇÊä³öASCIIÂëΪ30H~39HµÄ×Ö·û0~9£¬Ó¦×÷Ð޸ġ£

CODE SEGMENT

ASSUME CS:CODE

K=30H £»¸ÄΪ K DB 30H J DW 0 START: MOV DL, K MOV AH, 2 INT 21H

K=K+1 £»K=K+1ÊÇαָÁûÉú³É´úÂ룬¸ÄΪ INC K INC J CMP J, 10 JNZ START MOV AH, 4CH INT 21H CODE ENDS

END START

4.6 ÓÃ32λָÁî±àдÍêÕû³ÌÐò£¬²¢ÉÏ»úµ÷ÊÔ£¬¼ÆËãV=(X+Y)*R£¬ÆäÖÐËùÓбä

Á¿¾ùΪ64λ±äÁ¿£¬X¡¢Y¡¢RµÄ¾ßÌåÊýÖµÓÉÄã×Ô¼ºÈ·¶¨£¬±äÁ¿¶¨Òå¸ñʽÈçÏ£º

X DD ?,? Y DD ?,? R DD ?,? V DD ?,? data segment x dd 1 y dd 2 r dd 3 v dd ?,? data ends

code segment

assume cs:code,ds:data .386p start:

mov ax,data mov ds,ax mov eax,x add eax,y mov ebx,r

imul ebx mov v,eax mov v+4,edx mov dl,al add dl,30h mov ah,2 int 21h mov ah,4ch int 21h code ends end start

Ï°Ìâ5

5.1 ÏÂÁгÌÐòÊÇÔÚ3¸öÊýÖÐÕÒ³ö×îСµÄÊý²¢·ÅÈëAL£¬ÔÚÀ¨ºÅÖÐÌîÈëÖ¸ÁîʹÆäÍêÕû¡£

mov al£¬x mov bl£¬y

mov cl£¬z

cmp al£¬bl

( jl l1 )

xchg al£¬bl l1: cmp al, cl

jle l2

( xchg al,cl ) l2: ret

5.2 Êý¾Ý¶ÎÈçÏ£º

data segment

da1 db 1£¬2£¬¡®abcd¡¯ count = $-da1

da2 db 9 dup(?)

data ends

²¹³äÀ¨ºÅ´¦µÄÖ¸ÁʹµÃ³ÌÐò°ÑDA1Êý¾ÝÇøÊý¾ÝÒƵ½DA2Êý¾ÝÇø¡£

mov ax£¬data

mov ds, ax

mov es£¬( AX ) mov cx£¬( COUNT )

mov si, ( OFFSET DA1 ) ( MOV DI, OFFSET DA2 ) ( REP MOVSB )

5.3 ÒÔϳÌÐò¶ÔÎÞ·ûºÅÊý×éARRAYµÄ6¸öÔªËØ´ÓСµ½´óÅÅÐò£¬²¹³äÀ¨ºÅ´¦µÄÖ¸Áî¡£

data segment

array dw 4£¬3£¬12£¬56£¬5£¬8