微机原理上机作业 编写8086汇编程序,将寄存器AX的高8位传送到寄存
上机作业
1、 编写8086汇编程序,将寄存器AX的高8位传送到寄存
器BL,AX的低8位传送到寄存器DL。 CODE SEGMENT
ASSUME CS:CODE
START:
MOV BL,AH;寄存器AX的高8位传送到寄存器BL MOV DL,AL ;AX的低8位传送到寄存器DL INT 20H ;结束
CODE ENDS
END START
2、 将DX寄存器的内容从低位到高位顺序分成4组,且将
各组数分别送到寄存器AL、BL、CL和DL。 MOV AL,0
MOV BL,0
MOV CL,04
ADD AL,DL
ADD BL,DL
AND AL,0FH
AND BL,0F0H
SHL BL,CL
MOV CL,0
ADD CL,DH
ADD DL,DH
AND CL,0FH
AND DL,0F0H
MOV AH,CL
MOV CL,4
SHL DL,CL
administrative leadership of the criticism, resulting in serious consequences, the pursuit of leadership, along with 500-1000 punishment. (5) significant near miss should be attempted as the case of responsible for the accident and construction team injuries accident penalty provisions, mutatis mutandis. Eight, should perform in the construction standards and specifications, serial number a 1 GB3323-2005 steel fusion welded butt joints, welding engineering-Ray lighting and quality rating of 2 GB11345-89 steel welds manual methods of ultrasonic inspection and testing results for grade 3 GB50236-2002 industrial pipe welding engineering code for construction and acceptance of field equipment 4 HGJ222-92 technical specification for welding of aluminium and its alloys 5 low temperature steel welding procedure 6 SH3525-2004 petrochemical JB/ T4708-2000 of welding procedure qualification for steel pressure vessels 7 JB/4709-2000 8 JB4730-2005 pressure vessel welding procedures of steel pressure vessel NDT 9 JB/T4744-2000 steel pressure vessel products mechanical properties test of welded plate II, mechanical equipment installation engineering 1 GB150-98 2 GB50128-2005 vertical cylindrical steel pressure vessel steel welded tank code for construction and acceptance of 3 JB/ T4735-1997 steel welded atmospheric pressure vessel 4 GB50231-2009 mechanical equipment installation engineering construction and acceptance specification for 5 GB50275-98 compressor, fan and pump installation engineering construction and acceptance specification for lifting 6
MOV CL,AH
3、 判断MEN单元的数据,编程将奇数存入MENA单元,将偶数存入MENB单元。
DATAS SEGMENT
MEN DW 11H,12H,13H,14H,15H,16H
MENA DW 5 DUP (?)
MENB DW 5 DUP (?) DATAS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS START:MOV AX,DATAS
MOV DS,AX
MOV CX,6
MOV SI,OFFSET MEN
AA1: MOV BX,[SI]
INC SI
TEST BX,0001H
JZ AA2
MOV MENA,BX
LOOP AA1
AA2:MOV MENB,BX
INC SI
LOOP AA1
MOV AH,4CH
INT 21H
CODES ENDS
END START
4、 试统计9个数中的偶数的个数,并将结果在屏幕上显示。
DATAS SEGMENT
DATA DB 1,4,5,13,16,21,28,35,41;
DATAS ENDS
administrative leadership of the criticism, resulting in serious consequences, the pursuit of leadership, along with 500-1000 punishment. (5) significant near miss should be attempted as the case of responsible for the accident and construction team injuries accident penalty provisions, mutatis mutandis. Eight, should perform in the construction standards and specifications, serial number a 1 GB3323-2005 steel fusion welded butt joints, welding engineering-Ray lighting and quality rating of 2 GB11345-89 steel welds manual methods of ultrasonic inspection and testing results for grade 3 GB50236-2002 industrial pipe welding engineering code for construction and acceptance of field equipment 4 HGJ222-92 technical specification for welding of aluminium and its alloys 5 low temperature steel welding procedure 6 SH3525-2004 petrochemical JB/ T4708-2000 of welding procedure qualification for steel pressure vessels 7 JB/4709-2000 8 JB4730-2005 pressure vessel welding procedures of steel pressure vessel NDT 9 JB/T4744-2000 steel pressure vessel products mechanical properties test of welded plate II, mechanical equipment installation engineering 1 GB150-98 2 GB50128-2005 vertical cylindrical steel pressure vessel steel welded tank code for construction and acceptance of 3 JB/ T4735-1997 steel welded atmospheric pressure vessel 4 GB50231-2009 mechanical equipment installation engineering construction and acceptance specification for 5 GB50275-98 compressor, fan and pump installation engineering construction and acceptance specification for lifting 6
STACKS SEGMENT;
STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START: MOV AX,DATAS
MOV DS,AX
MOV CX,9
MOV DX,0
LEA SI,DATA
PANDUAN:MOV AL,[SI]
SHR AL,1
JC NEXT
INC DL
NEXT:INC SI
LOOP PANDUAN
CMP CX,0
JNZ PANDUAN
MOV AH,02H
ADD DL,30H
INT 21H;
MOV AH,4CH
INT 21H
CODES ENDS
END START
5、 试将一串16位无符号数加密,加密方法是将每个数乘
2。
DATAS SEGMENT
STRING1 DB '1234567891234567$'
STRING2 DB 16 DUP(?) DATAS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS
START: MOV AX,DATAS
MOV DS,AX
MOV ES,AX
administrative leadership of the criticism, resulting in serious consequences, the pursuit of leadership, along with 500-1000 punishment. (5) significant near miss should be attempted as the case of responsible for the accident and construction team injuries accident penalty provisions, mutatis mutandis. Eight, should perform in the construction standards and specifications, serial number a 1 GB3323-2005 steel fusion welded butt joints, welding engineering-Ray lighting and quality rating of 2 GB11345-89 steel welds manual methods of ultrasonic inspection and testing results for grade 3 GB50236-2002 industrial pipe welding engineering code for construction and acceptance of field equipment 4 HGJ222-92 technical specification for welding of aluminium and its alloys 5 low temperature steel welding procedure 6 SH3525-2004 petrochemical JB/ T4708-2000 of welding procedure qualification for steel pressure vessels 7 JB/4709-2000 8 JB4730-2005 pressure vessel welding procedures of steel pressure vessel NDT 9 JB/T4744-2000 steel pressure vessel products mechanical properties test of welded plate II, mechanical equipment installation engineering 1 GB150-98 2 GB50128-2005 vertical cylindrical steel pressure vessel steel welded tank code for construction and acceptance of 3 JB/ T4735-1997 steel welded atmospheric pressure vessel 4 GB50231-2009 mechanical equipment installation engineering construction and acceptance specification for 5 GB50275-98 compressor, fan and pump installation engineering construction and acceptance specification for lifting 6
MOV CX,16
LEA SI,STRING1
LEA DI,STRING2
L:LODSB
SHL AL,1
STOSB
LOOP L
MOV AH,4CH
INT 21H
CODES ENDS
END START
6、 根据DL寄存器的D位,完成两个压缩BCD数X和Y3的加减运算。D=0时,作加法;D=1时,作减法,并将结果存入33寄存器DL。
DATAS SEGMENT
X DB 2
Y DB 1
DATAS ENDS
STACKS SEGMENT STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
MOV AX,DATAS MOV DS,AX
MOV AL,Y
TEST DL,08H
JZ JIA
SBB AL,X
DAS
JMP JIAN
JIA: ADC AL,X
DAA
MOV DL,AL administrative leadership of the criticism, resulting in serious consequences, the pursuit of leadership, along with 500-1000 punishment. (5) significant near miss should be attempted as the case of responsible for the accident and construction team injuries accident penalty provisions, mutatis mutandis. Eight, should perform in the construction standards and specifications, serial number a 1 GB3323-2005 steel fusion welded butt joints, welding engineering-Ray lighting and quality rating of 2 GB11345-89 steel welds manual methods of ultrasonic inspection and testing results for grade 3 GB50236-2002 industrial pipe welding engineering code for construction and acceptance of field equipment 4 HGJ222-92 technical specification for welding of aluminium and its alloys 5 low temperature steel welding procedure 6 SH3525-2004 petrochemical JB/ T4708-2000 of welding procedure qualification for steel pressure vessels 7 JB/4709-2000 8 JB4730-2005 pressure vessel welding procedures of steel pressure vessel NDT 9 JB/T4744-2000 steel pressure vessel products mechanical properties test of welded plate II, mechanical equipment installation engineering 1 GB150-98 2 GB50128-2005 vertical cylindrical steel pressure vessel steel welded tank code for construction and acceptance of 3 JB/ T4735-1997 steel welded atmospheric pressure vessel 4 GB50231-2009 mechanical equipment installation engineering construction and acceptance specification for 5 GB50275-98 compressor, fan and pump installation engineering construction and acceptance specification for lifting 6
JMP LOP
JIAN: MOV DL,AL
JMP LOP
LOP:MOV AH,02H
ADD DL,30H
INT 21H
MOV AH,4CH
INT 21H
CODES ENDS
END START
7、 统计BLOCK1和BLOCK2两个单元数据中,对应位不
同的有多少位,
DATAS SEGMENT
BLOCK1 DB '123456789'
BLOCK2 DB '987456123'
DATAS ENDS
STACKS SEGMENT STACKS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START: MOV AX,DATAS
MOV DS,AX
MOV BX,0
MOV CX,9
LEA SI,BLOCK1
LEA DI,BLOCK2
LOP: LODSB
CMP AL,[DI]
JE NEXT
INC BX
NEXT:INC DI
DEC CL
JNZ LOP
MOV AH,2
ADD BL,30H
administrative leadership of the criticism, resulting in serious consequences, the pursuit of leadership, along with 500-1000 punishment. (5) significant near miss should be attempted as the case of responsible for the accident and construction team injuries accident penalty provisions, mutatis mutandis. Eight, should perform in the construction standards and specifications, serial number a 1 GB3323-2005 steel fusion welded butt joints, welding engineering-Ray lighting and quality rating of 2 GB11345-89 steel welds manual methods of ultrasonic inspection and testing results for grade 3 GB50236-2002 industrial pipe welding engineering code for construction and acceptance of field equipment 4 HGJ222-92 technical specification for welding of aluminium and its alloys 5 low temperature steel welding procedure 6 SH3525-2004 petrochemical JB/ T4708-2000 of welding procedure qualification for steel pressure vessels 7 JB/4709-2000 8 JB4730-2005 pressure vessel welding procedures of steel pressure vessel NDT 9 JB/T4744-2000 steel pressure vessel products mechanical properties test of welded plate II, mechanical equipment installation engineering 1 GB150-98 2 GB50128-2005 vertical cylindrical steel pressure vessel steel welded tank code for construction and acceptance of 3 JB/ T4735-1997 steel welded atmospheric pressure vessel 4 GB50231-2009 mechanical equipment installation engineering construction and acceptance specification for 5 GB50275-98 compressor, fan and pump installation engineering construction and acceptance specification for lifting 6
MOV DL,BL
INT 21H;
MOV AH,4CH
INT 21H
CODES ENDS
END START
8、 完成10个压缩BCD数相加,且将结果显示出来。
DATAS SEGMENT
DATA DB 0,1,2,3,4,5,6,7,8,9;
DATAS ENDS
STACKS SEGMENT STACKS ENDS CODES SEGMENT
ASSUME CS:CODES,DS:DATAS,SS:STACKS
START:
MOV AX,DATAS MOV DS,AX
MOV CX,10
LEA SI,DATA
MOV AL,0
LOP:
ADC AL,[SI]
DAA
JMP NEXT NEXT:INC SI
LOOP LOP
MOV CL,4
MOV BL,AL
SHR AL,CL
MOV AH,02H
ADD AL,30H
MOV DL,AL
INT 21H
AND BL,0FH
MOV AH,02H
ADD BL,30H administrative leadership of the criticism, resulting in serious consequences, the pursuit of leadership, along with 500-1000 punishment. (5) significant near miss should be attempted as the case of responsible for the accident and construction team injuries accident penalty provisions, mutatis mutandis. Eight, should perform in the construction standards and specifications, serial number a 1 GB3323-2005 steel fusion welded butt joints, welding engineering-Ray lighting and quality rating of 2 GB11345-89 steel welds manual methods of ultrasonic inspection and testing results for grade 3 GB50236-2002 industrial pipe welding engineering code for construction and acceptance of field equipment 4 HGJ222-92 technical specification for welding of aluminium and its alloys 5 low temperature steel welding procedure 6 SH3525-2004 petrochemical JB/ T4708-2000 of welding procedure qualification for steel pressure vessels 7 JB/4709-2000 8 JB4730-2005 pressure vessel welding procedures of steel pressure vessel NDT 9 JB/T4744-2000 steel pressure vessel products mechanical properties test of welded plate II, mechanical equipment installation engineering 1 GB150-98 2 GB50128-2005 vertical cylindrical steel pressure vessel steel welded tank code for construction and acceptance of 3 JB/ T4735-1997 steel welded atmospheric pressure vessel 4 GB50231-2009 mechanical equipment installation engineering construction and acceptance specification for 5 GB50275-98 compressor, fan and pump installation engineering construction and acceptance specification for lifting 6
MOV DL,BL
INT 21H
MOV AH,4CH
INT 21H
CODES ENDS
END START
9、 编写程序,将一串凌乱的字母按从小到大的顺序排列。
DATAS SEGMENT
DATA DB 'gfed$'
DATAS ENDS
CODES SEGMENT
ASSUME CS:CODES,DS:DATAS
START:
MOV AX,DATAS
MOV DS,AX
MOV SI,1
LOP1: MOV DI,SI
INC DI
MOV AL,DATA[SI-1] LOP2: CMP AL,DATA[DI-1]
JBE LOP3
XCHG DATA[DI-1],AL
MOV DATA[SI-1],AL LOP3: INC DI
CMP DI,4
JBE LOP2
INC SI
CMP SI,3
JBE LOP1
SHOW:MOV AH,9
MOV DX,OFFSET DATA
INT 21H
MOV AH,4CH
INT 21H
CODES ENDS
administrative leadership of the criticism, resulting in serious consequences, the pursuit of leadership, along with 500-1000 punishment. (5) significant near miss should be attempted as the case of responsible for the accident and construction team injuries accident penalty provisions, mutatis mutandis. Eight, should perform in the construction standards and specifications, serial number a 1 GB3323-2005 steel fusion welded butt joints, welding engineering-Ray lighting and quality rating of 2 GB11345-89 steel welds manual methods of ultrasonic inspection and testing results for grade 3 GB50236-2002 industrial pipe welding engineering code for construction and acceptance of field equipment 4 HGJ222-92 technical specification for welding of aluminium and its alloys 5 low temperature steel welding procedure 6 SH3525-2004 petrochemical JB/ T4708-2000 of welding procedure qualification for steel pressure vessels 7 JB/4709-2000 8 JB4730-2005 pressure vessel welding procedures of steel pressure vessel NDT 9 JB/T4744-2000 steel pressure vessel products mechanical properties test of welded plate II, mechanical equipment installation engineering 1 GB150-98 2 GB50128-2005 vertical cylindrical steel pressure vessel steel welded tank code for construction and acceptance of 3 JB/ T4735-1997 steel welded atmospheric pressure vessel 4 GB50231-2009 mechanical equipment installation engineering construction and acceptance specification for 5 GB50275-98 compressor, fan and pump installation engineering construction and acceptance specification for lifting 6
END START
试编程统计寄存器AX
administrative leadership of the criticism, resulting in serious consequences, the pursuit of leadership, along with 500-1000 punishment. (5) significant near miss should be attempted as the case of responsible for the accident and construction team injuries accident penalty provisions, mutatis mutandis. Eight, should perform in the construction standards and specifications, serial number a 1 GB3323-2005 steel fusion welded butt joints, welding engineering-Ray lighting and quality rating of 2 GB11345-89 steel welds manual methods of ultrasonic inspection and testing results for grade 3 GB50236-2002 industrial pipe welding engineering code for construction and acceptance of field equipment 4 HGJ222-92 technical specification for welding of aluminium and its alloys 5 low temperature steel welding procedure 6 SH3525-2004 petrochemical JB/ T4708-2000 of welding procedure qualification for steel pressure vessels 7 JB/4709-2000 8 JB4730-2005 pressure vessel welding procedures of steel pressure vessel NDT 9 JB/T4744-2000 steel pressure vessel products mechanical properties test of welded plate II, mechanical equipment installation engineering 1 GB150-98 2 GB50128-2005 vertical cylindrical steel pressure vessel steel welded tank code for construction and acceptance of 3 JB/ T4735-1997 steel welded atmospheric pressure vessel 4 GB50231-2009 mechanical equipment installation engineering construction and acceptance specification for 5 GB50275-98 compressor, fan and pump installation engineering construction and acceptance specification for lifting 6