Top LABEL WORD Sta_seg ENDS Code SEGMENT
ASSUME CS:Code,DS:data,SS:sta_seg ORG 1000H Start: MOV AX, data MOV DS, AX MOV AX,Sta_seg MOV SS, AX
MOV SP, OFFSET Top ……
MOV AH, 4CH INT 21H Code ENDS END Start
10.编写一个程序,要求运行时屏幕显示‘BELL’,同时响铃一次(响铃的ASCII码为07)。
答:所求程序为:
Code SEGMENT ASSUME CS:code Start: MOV DL, 42H MOV AH, 2 INT 21H MOV DL, 45H MOV AH, 2 INT 21H MOV DL, 4CH MOV AH, 2 INT 21H MOV DL, 4CH MOV AH, 2 INT 21H MOV DL, 7 MOV AH, 2 INT 21H MOV AH, 4CH
INT 21H Code ENDS END Start
11.假设在数据段X_SEG、附加段Y_SEG和堆栈段Z_SEG中分别定义了字变量X、Y和Z,试编制一完整的程序计算 X+Y+Z,并将结果送X。
答:所求程序为: X_SEG SEGMENT X DW 12eH X_SEG ENDS Y_SEG SEGMENT Y DW 4d2H Y_SEG ENDS
Z_SEG SEGMENT STACK ‘STACK’ Z DW 2CAH Z_SEG ENDS Code SEGMENT
ASSUME CS:Code,DS:X_SEG,ES:Y_SEG,SS:Z_SEG Start: MOV AX, X_SEG
MOV DS, AX MOV AX, Y_SEG MOV ES, AX MOV AX,ES:Y ADD X, AX MOV BP, 0 MOV AX, [BP+Z] ADD X, AX MOV AH, 4CH INT 21H Code ENDS
END Start
12.写一个完整的程序放在代码段C_SEG中,要求把数据段D_SEG中的DADD1和附加段E_SEG中的DADD2相加,并把结果存放在D_SEG段中的SUM中。其中DADD1、DADD2和SUM均为双字类型,DADD1赋值为98765,DADD2赋值为-15893。
答:所求程序为: D_SEG SEGMENT