php 随机两位小数数
Problem statement:
问题陈述:
Write a program in 8086 microprocessor to find out the sum of two arrays of 8-bit n numbers, where size “n” is stored at offset 500 and the numbers of first array are stored from offset 501 and the numbers of second array are stored from offset 601 and store the result numbers into first array i.e offset 501.
在8086微处理器中编写程序,以找出两个8位n个数字数组的总和,其中大小“ n”存储在偏移500中,第一个数组的数字从偏移501开始存储,第二个数组的数字被存储从偏移量601开始并将结果编号存储到第一数组,即偏移量501中。
Algorithm:
算法:
Store 500 to SI and 601 to DI and Load data from offset 500 to register CL and set register CH to 00 (for count).
将500存储到SI中,将601存储到DI中,并将数据从偏移量500加载到寄存器CL中,并将寄存器CH设置为00(用于计数)。
Increase the value of SI by 1.
将SI的值增加1。
Load first number (value) from next offset (i.e 501) to register AL.
从下一个偏移量(即501)加载第一个数字(值)到寄存器AL。
Add the value in register AL by value at offset DI.
将寄存器AL中的值与偏移量DI处的值相加。
Store the result (value of register AL ) to memory offset SI.
将结果(寄存器AL的值)存储到存储器偏移SI中。
Increase the value of SI by 1.
将SI的值增加1。
Increase the value of DI by 1.
将DI的值增加1。
Loop above 5 till register CX gets 0.
在5以上循环直到寄存器CX变为0。
Program:
程序:
MEMORY ADDRESS | MNEMONICS | COMMENT |
---|---|---|
400 | MOV SI, 500 | SI←500 |
403 | MOV CL, [SI] | CL←[SI] |
405 | MOV CH, 00 | CH←00 |
407 | INC SI | SI←SI+1 |
408 | MOV DI, 601 | DI←601 |
40B | MOV AL, [SI] | AL←[SI] |
40D | ADD AL, [DI] | AL=AL+[DI] |
40F | MOV [SI], AL | AL->[SI] |
411 | INC SI | SI←SI+1 |
412 | INC DI | DI←DI+1 |
413 | LOOP 40B | JUMP TO 40B IF CX!=0 and CX=CX-1 |
415 | HLT | end |
内存地址 | 记忆 | 评论 |
---|---|---|
400 | MOV SI,500 | SI←500 |
403 | MOV CL,[SI] | CL←[SI] |
405 | MOV CH,00 | CH←00 |
407 | INC SI | SI←SI + 1 |
408 | MOV DI,601 | DI←601 |
40B | MOV AL,[SI] | AL←[SI] |
40D | 添加AL,[DI] | AL = AL + [DI] |
40楼 | MOV [SI],AL | AL-> [SI] |
411 | INC SI | SI←SI + 1 |
412 | INC DI | DI←DI + 1 |
413 | 圈40B | 如果CX!= 0和CX = CX-1则跳至40B |
415 | HLT | 结束 |
Explanation
说明
MOV SI, 500: set the value of SI to 500
MOV SI,500 :将SI的值设置为500
MOV CL, [SI]: load data from offset SI to register CL
MOV CL,[SI] :将数据从偏移SI加载到寄存器CL
MOV CH, 00: set value of register CH to 00
MOV CH,00 :将寄存器CH的值设置为00
INC SI: increase value of SI by 1.
INC SI :将SI的值增加1。
MOV DI, 600: set the value of DI to 600.
MOV DI,600 :将DI的值设置为600。
MOV AL, [SI]: load value from offset SI to register AL
MOV AL,[SI] :从偏移量SI到寄存器AL的加载值
ADD AL, [DI]: Add value of register AL by content at offset DI.
ADD AL,[DI] :将寄存器AL的值与偏移量DI处的内容相加。
MOV [SI], AL: store value of register AL at offset SI.
MOV [SI],AL :将寄存器AL的值存储在偏移SI处。
INC SI: increase value of SI by 1.
INC SI :将SI的值增加1。
INC DI: increase value of DI by 1.
INC DI :DI的值增加1。
LOOP 408: jump to address 408 if CX not 0 and CX=CX-1.
循环408 :如果CX不为0并且CX = CX-1,则跳转到地址408。
HLT: stop
HLT :停止
php 随机两位小数数