IBM-PC汇编语言程序设计(第二版)课后习题答案(清华大学出版社)(沈美明,温冬蝉著)第三章答案1-22
2006-11-02 22:56

IBM-PC汇编语言程序设计(第二版)课后习题答案(清华大学出版社)(沈美明,温冬蝉著)答案

 

1。

.(1)立即寻址                                                            没有

 (2)直接寻址                                                             7237H

(3)使用BX的寄存器寻址                                           没有

 (4)使用BX的间接寻址                                             637DH

(5)使用BX的寄存器相对寻址                                    0D5F0H

(6)    基址变址寻址                                                       8E18H

(7)相对基址变址                                                      004FH

2。根据下列要求,写出相应的汇编指令。

(1)ADD  DX,BX

 (2)   ADD AL,[BX][SI]

 (3)  ADD [BX][0B2H], CX

 (4)  MOV  AX,2A59H            ADD [0524H] ,AX

(5) ADD AL ,0B5H  

3。

(1)寄存器间接寻址  

   MOV BX,OFFSET [BLOCK][0AH]

  MOV  DX  ,[BX]

(2)寄存器相对寻址

  MOV  SI,OAH

  MOV DX,[BLOCK][SI]

 

(3)基址变址寻址

MOV BX ,BLOCK

 MOV SI,OAH

MOV DX,[BX][SI]

没人来看,还是要写~~

4。现有(DS)=2000H,(BX)=0100H,(SI)=0002H,(20100)=12H,(20101)=34H,(20102)=56H,(20103)=78H,(21200)=2AH,(20201)=4CH,(21202)=B7H,(21203)=65H,试说明下列各条指令执行完后,AX寄存器的内容。

(1)MOV    AX,1200H                                             1200H

 (2)   MOV    AX,BX                                                    0100H

  (3)  MOV    AX,[1200]                                               4C2AH      注意,是字单元!!

(4)MOV   AX,[BX]                                                   3412H           同上

(5)MOV   1100[BX]                                                4C2AH     

 (6)   MOV   AX,[BX][SI]                                               7856H  

 (7)   MOV  AX,1100[BX][SI]                                         65B7H

 

  5。

(1) 7CD9H    (2)  1200H     (3) 6319H

6。     MOV  BX,2000H

           LES   DI ,[BX]

          MOV  AX, ES:DI 

7。转向地址OBJ的值分别为:(1)064DH     (2)0691H   (3)05E0H            注意有符号数的符号位~~

8。(1) MOV  AX,0ABH                              立即数寻址                                    无物理地址

      (2)MOV   AX,BX                                寄存器寻址                                      同上

      (3)MOV  AX,[100]                              直接寻址                                         20100H

      (4)MOV AX,VAL                                 直接寻址                                         20050H

       (5)   MOV AX,[BX]                              寄存器间接寻址                                   20100H

       (6)    MOV  AX,ES:[BX]                       直接寻址                                          21100H

       (7)   MOV AX,[BP]                           寄存器间接寻址                                     20010H

      (8)MOV AX,[SI]                               同上                                                      200A0H

      (9)   MOV AX,[BX+10]                        寄存器相对寻址                                     20110H

    (10)MOV AX,VAL[BX]                      同上                                                      20150H

    (11)   MOV AX,[BX][SI]                        基址变址寻址                                        201A0H

    (12)   MOV AX,VAL[BX][SI]                  相对基相变址寻址                                201F0H

 9。

(1)的指令:  MOV AX, [BX][0CH]                            MOV  ZREO ,AX

 (2)   的指令:  MOV  AX,ARRAY[BX]                         MOV ZREO,AX

10。  MOV AX,TABLE       是把符号地址TABLE里的内容送到AX里,指令执行完后,(AX)=1234H

         LEA AX,TABLE        是把符号地址TABLE 的有效地址(这里是偏移量)送到指定寄存器AX里,指

                                        令执行完后,(AX)=0032H

11。执行完指令后,(AX)=1E00H

12。 LEA AX,CSTRING   

         MOV DL,AX

         MOV DH,[AX+6]

13。这个,,图,很麻烦了,所以就不画了~~大家可以看一下课本上P51--P53,很清楚,看完了这道韪也会了~~~

14。LES BX,[2000]

       MOV AX,ES:[BX]

     注意:一开始我写的是: MOV AX,ES:[8000H],后来看到题目里要求写两条指令,所以一条就不行了,就要画蛇添足~~~

 15。      运算结果                                                      SF,ZF,CF,OF各位的值(从左至右依次往下~)

(1)     74D4H                                                           0    0    0   0

 (2)         A5C1H                                                          1    0    0    1

 (3)         4240 H                                                          0    0    1    0

 (4)          0000 H                                                         0    1    1    0     

16。    接上表~

 (1)      5D14                                                               0    0    0    0

(2)       A870                                                               1    0    0    1

(3)       D870                                                               1    0    0    0

(4)       34E4                                                               0    0    1    0

17。

(1).MOV AX,Z      ;把Z送到AX

    SUB AX,X         ;Z-X

    ADD AX,W       ;W+(Z-X)

     MOV Z,AX      ;结果保存在Z中

(2).  MOV AX,R    ;R送到AX中

      ADD AX,9      ;R+9

     MOV  BX,X     ;X送到BX中

     ADD  BX,6     ;X+6

    ADD  AX,BX    ;(R+9)+(X+6),结果保存在AX中

   MOV  BX,W     ; W送到BX中

   SUB    BX,AX   ; W-(R+9)-(X+6),连续减去两个数,相当于减去这两个数的和~~

  MOV   Z,BX      ;最终结果送到Z中

(3)

MOV AX,W                      ;把W送到AX

IMUL X                               ;W*X         注意:低十六位保存在AX里,高十六位保存在DX里

MOV BX,Y                       ;把Y送到BX 里

ADD BX,6                        ;Y+6

IDIV BX                              ;(W*X)/(Y+6)    注意:商保存在AX里,余数保存在DX里

MOV Z,AX                        ;把商送到Z中,

MOV R,DX                       ;把余数 送到R中

(4)

MOV AX,W                    ;把W送到AX中

SUB AX,X                       ;W-X

CWD                             ;把AX中的十六位带符号数扩展成为32位,低十六位保存在AX中,高十六位保

                                      ;在DX中   

MOV BX,5                      ;把5送到BX中

IDIV BX                           ;(W-X)/5        被除数为32位,除数为16位  商为16位 

IMUL Y                            ;上一步结果再乖以Y,积为32位

MOV BX,2                        ;把2送到BX中 

IMUL BX                             ;上一步乘法所得的积再乘以2,各为64位

MOV Z,EAX                      ;把结果中低32位放入Z双字单元中

MOV [Z+4],EDX                 ;把结果中高32位放入Z+4双字单元中

18。

指令                                     本条指令执行完后AX的内容                                 执行完后CF,SF,ZF的值

MOV AX,1234H                       1234H                                                                   0     0      0

MOV CL,4                               1234H                                                                   0      0      0  

ROL AX,CL                             2341H                                                                    1      0      0

DEC AX                                   2340H                                                                   1      0       0  

MOV CX,4                                2340H                                                                   1      0       0 

MUL CX                                     8918H                                                                   0       0       0

INT 20H

 程序结束后,(AX)=8918H     (DX)=0000H

19。

指令                                           执行完后AX的内容                             执行完后CF ,SF,ZF和OF的值

MOV AX,0                                            0                                                     0010

DEC AX                                           FFFFH                                                0100

ADD AX,7FFFH                               7FFEH                                                 0000

ADD AX,2                                         8000H                                                 0101

NOT AX                                            7FFFH                                                 0101  

SUB  AX,0FFFFH                             8000H                                                  1101

ADD AX,8000H                                 0000H                                                  1011

SUB  AX,1                                        FFFFH                                                 1101                                                                  

AND AX,58D1H                                58D1H                                                 0000

SAL AX,1                                         B1A2H                                                  0101

SAR AX,1                                         D8D1H                                                 0100

NEG AX                                            272FH                                                  1000 

ROR AX,1                                        9397H                                                   1001  

20。

(1)MOV AX,DATAX

          ADD DATAY,AX

(2)MOV AX,DATAX

         ADD DATAY,AX

        MOV  AX,[DATAX+2]

         ADD [DATAY+2] ,AX

(3)本組指令的作用是:BX <------[DATAX]+[DATAY]+[1](CF的值)      帶進位加法~

 (4)MOV  AX,DATAX

          MUL  DATAY              ;結果的高十六位保存在DX裏,低十六位保存在AX裏

  (5)MOV AX,DATAX

          MOV DX,[DATAX+2]

          MUL  DWORD DATAY     ;結果的高三十二位保存在EDX裏,低三十二位保存在EAX裏

                                                   ;這裏所用的DWORD為一屬性操作符,在第四章會學到~~

 (6)MOV AX,DATAX

          DIV   17H                             ;結果商保存在AL中,余數在AH中

 (7)MOV AX,DATAX

          CDW                                  

          DIV  DATAY

 21。NEG DX

         NEG AX

         SBB DX,0

22。

MOV AX,A                             ;把雙字長數的低字放到AX中

MOV DX,[A+2]                       ;把雙字長數的高字放到DX中

TEST DX,8000H                     ;測試雙字長數的符號

JZ   RIGHT                               ;如果是非負數,則直接保存

NEG DX                                   ;如果是負數,則求補 

NEG AX

SBB DX,0                              

RIGHT: MOV B ,AX

                MOV [B+2],DX