shell两个数字相乘
Problem statement:
问题陈述:
Write a program in 8086 microprocessor to multiply two 8-bits numbers, where numbers are stored from offset 500 and store the result into offset 600.
在8086微处理器中编写程序,以将两个8位数字相乘,其中数字从偏移量500开始存储,并将结果存储到偏移量600中。
Algorithm:
算法:
Load data from offset 500 to register AL (first number)
将数据从偏移500加载到寄存器AL(第一个数字)
Load data from offset 501 to register BL (second number)
将数据从偏移量501加载到寄存器BL(第二个数字)
Multiply them (AX=AL*BL)
乘以它们(AX = AL * BL)
Store the result (content of register AX) to offset 600
将结果(寄存器AX的内容)存储到偏移量600
Stop
停止
Program:
程序:
ADDRESS | MNEMONICS | COMMENTS |
---|---|---|
400 | MOV SI, 500 | SI=500 |
403 | MOV DI, 600 | DI=600 |
406 | MOV AL, [SI] | AL |
408 | INC SI | SI=SI+1 |
409 | MOV BL, [SI] | BL |
40B | MUL BL | AX=AL*BL |
40D | MOV [DI], AX | AX->[DI] |
40F | HLT | END |
地址 | 记忆 | 注释 |
---|---|---|
400 | MOV SI,500 | SI = 500 |
403 | MOV DI,600 | DI = 600 |
406 | MOV AL,[SI] | 铝 |
408 | INC SI | SI = SI + 1 |
409 | MOV BL,[SI] | BL |
40B | MUL BL | AX = AL * BL |
40D | MOV [DI],AX | AX-> [DI] |
40楼 | HLT | 结束 |
Explanation:
说明:
MOV SI, 500 set 500 to SI
MOV SI ,500设置为500 SI
MOV DI, 600 set 600 to DI
MOV DI ,600将600设置为DI
MOV AL, [SI] load contents of offset SI to register AL
MOV AL ,[SI]将偏移量SI的内容加载到寄存器AL
INC SI increase value of SI by 1
INC SI将SI的值增加1
MOV BL, [SI] load contents of offset SI to register BL
MOV BL ,[SI]将偏移量SI的内容加载到寄存器BL
MUL BL multiply contents of register AL and BL
MUL BL将寄存器AL和BL的内容相乘
MOV [DI], AX store the result (contents of register AX) to offset DI
MOV [DI] ,AX将结果(寄存器AX的内容)存储到偏移量DI
HLT End.
HLT结束。
翻译自: https://www.includehelp.com/embedded-system/multiply-two-8-bits-number.aspx
shell两个数字相乘