1、实验内容
录入并调试完成教材P355例9-2,例9-3,和P358例9-5,掌握8086汇编跳转指令的使用。
2、把调试完成后的例9-2,例9-3,例9-5提交。
9-2.ASM
DATA SEGMENT X DW 135AH Y DW 294CH Z DW ? DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX MOV AX,X CMP AX,Y JBE NEXT SUB AX,Y NEXT: MOV Z,AX MOV AH,4CH INT 21H CODE ENDS END START
9-3.ASM
DATA SEGMENT X DW 0F35AH DATA ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX MOV AX,X SHL AX,1 JC SUB1 MOV DL,2BH JMP SUB2 SUB1: MOV DL,2DH SUB2: MOV AH,2 INT 21H MOV AH,4CH INT 21H CODE ENDS END START
9-5.ASM
DATA SEGMENT NUM DB 5 STRING1 DB 'HELLO WORLD! ',0AH,0DH,'$' STRING2 DB 'I LOVE THIS GAME',0AH,0DH,'$' STRING3 DB 'COMPUTER SIENCE',0AH,0DH,'$' STRING4 DB 'ASSEMBLE LANGUAGE',0AH,0DH,'$' STRING5 DB 'COMPUTER ORGANIZATION',0AH,0DH,'$' DATA ENDS STACK1 SEGMENT PARA STACK DW 20H DUP(0) STACK1 ENDS CODE SEGMENT ASSUME CS:CODE,DS:DATA START: MOV AX,DATA MOV DS,AX MOV AL,NUM CMP AL,1 JZ FLAG1 CMP AL,2 JZ FLAG2 CMP AL,3 JZ FLAG3 CMP AL,4 JZ FLAG4 CMP AL,5 JZ FLAG5 FLAG1: MOV DX,OFFSET STRING1 JMP SHOW FLAG2: MOV DX,OFFSET STRING2 JMP SHOW FLAG3: MOV DX,OFFSET STRING3 JMP SHOW FLAG4: MOV DX,OFFSET STRING4 JMP SHOW FLAG5: MOV DX,OFFSET STRING5 JMP SHOW SHOW: MOV AH,09H INT 21H MOV AH,4CH INT 21H CODE ENDS END START