微机原理及接口技术课后习题及参考答案

内容发布更新时间 : 2024/12/22 22:35:48星期一 下面是文章的全部内容请认真阅读。

(2)my2_b db 64H

(3)my3_w dw 100 dup(?) (4)my4_c equ 100

(5)my5_c equ

4.9答:(1) mov byte ptr [bx],256;改正――mov word ptr [bx],256

(2) mov bx,offset opw[si];改正――mov bx,offset opw (3) add opbl,opb2;改正――add al,opb2 (4) mov opbl,al+l;改正――mov opbl,al (5) sub al,opw;改正――sub al,opb1

(6) mov [di],1234h;改正――mov word ptr [di],1234h 4.10答: .MODEL SMALL .DATA X DW 1234H Y DW 4321H MAX DW ? .CODE

START: MOV AX,@DATA MOV DS,AX MOV AX,X CMP AX,Y JNZ NEQU

MOV MAX,0FFFFH JMP STOP NEQU: JC NEXT MOV MAX,X JMP STOP

NEXT: MOV MAX,Y STOP: MOV AX,4C00H INT 21H END START

4.11答:.MODEL SMALL .DATA

DAT DW 9234H SIGN DW ? .CODE

START: MOV AX,@DATA MOV DS,AX

MOV AX,DAT

CMP AX,0 JZ STOP

TEST AX,8000H JNZ FU MOV SIGN,0 JMP STOP

FU: MOV SIGN,0FFH STOP: MOV AX,4COOH INT 21H END START 4.12答: DISPLAY MACRO

MOV AH,2 INT 21H ENDM

.MODEL SMALL .DATA X DW 1230H Y DW 1234H Z DW 1234H

.CODE

START: MOV AX,@DATA

MOV DS,AX MOV AX,X MOV BX,Y CMP AX,Z JNZ N1 CMP AX,BX JNZ N2 MOV DL,'Y' DISPLAY

STOP: MOV AX,4C00H

INT 21H

N1: CMP AX,BX

JNZ N3 N2: MOV DL,'X'

DISPLAY JMP STOP N3: CMP BX,Z

JNZ N4 JMP N2 N4: MOV DL,'N'

DISPLAY JMP STOP END START 4.13答: .MODEL SMALL .DATA

DAT DB 12H,23H,0F3H,6AH,20H,0FEH,10H,C8H,25H,34H SUM DW ?

.CODE

START: MOV AX,@DATA

MOV DS,AX MOV CX,10 MOV DX,0 LEA BX,DAT AGAIN: MOV AL,[BX] CBW

MOV DX,AX INC BX LOOP AGAIN MOV SUM,DX MOV AX,4C00H INT 21H END START 4.14答:

.MODEL SMALL .CODE

START: MOV AX,2000H

MOV DS,AX MOV SI,0 MOV DX,0 MOV CX,0FFFFH AGAIN: MOV AL,[SI] CMP AL,20H JNZ NEXT INC DX

NEXT: INC SI LOOP AGAIN MOV AX,4C00H INT 21H END START

4.15. 答:procname PROC [attributes field][USES register list][,parameter field] ┇

Procname ENDP

push和pop的使用是为了保护子程序的调用的现场,比如寄存器的值。本例中要保护的寄存器是ax和dx。

jiafa PROC;用CX,BX传参数――数据的个数和数据的起始地址,结果放在字内存单元SUM和SUM+1

push ax push dx xor ax,ax xor dx,dx

again: add ax, [bx]

adc dx,0 inc bx

inc bx loop again mov sum,ax mov [sum+1],dx pop dx pop ax ret

jiafa ENDP

4.16答:

联系客服:779662525#qq.com(#替换为@) 苏ICP备20003344号-4 ceshi