当前位置:网站首页>MIPS assembly language learning-03-cycle
MIPS assembly language learning-03-cycle
2022-06-28 15:11:00 【Sunshine clover lxgzxj】
One 、 Preface
How to run on a computer MIPS assembly language , I won't repeat it here , Please refer to the previous blog link , There are related installation packages and operation methods :MIPS Assembly language learning -01- Sum of two numbers
Two 、 Source code
# Function realization :
# Realization 1 Add up to 10000, Finally, print the cumulative result
.text
# according to C We define two variables to Sum,i,MaxValue.
# Now let's use $t0 : Sum, $t1 : i, $t2 : MaxValue Three registers for correspondence .
li $t0, 0
li $t1, 1
li $t2, 10000
# Now customize a label WhileLoop To execute the code in the loop body .
# What needs to be implemented is :Sum = Sum + i; i = i + 1;
WhileLoop:
add $t0, $t0, $t1
add $t1, $t1, 1
# This way IF Judge the condition ,i <= 100.
#ble The function of the function is to realize less than or equal to , Three parameters :
# The first parameter value is less than or equal to the second parameter value , Execute the tag of the third parameter .
# The first parameter value is less than or equal to the second parameter value , The third parameter label is not executed , Go straight down .
ble $t1, $t2, WhileLoop
# End of cycle print results
# The method of printing integers was described in the previous chapter , You can look through .
li $v0, 1
move $a0, $t0
syscall
This time the code comments have been written , I will not take out a chapter to explain it , Actually, it's a lazy thief .
3、 ... and 、 Running effect

边栏推荐
猜你喜欢

Fleet |「后台探秘」第 3 期:状态管理

猫狗图像数据集上的深度学习模型性能对比

【算法篇】刷了两道大厂面试题,含泪 ”重学数组“

张同学还没学会当主播

C#/VB. Net to convert PDF to excel

使用Karmada实现Helm应用的跨集群部署

Successful cases of rights protection of open source projects: successful rights protection of SPuG open source operation and maintenance platform

The latest pycharm activation cracking code in 2022 is permanent_ Detailed installation tutorial (applicable to multiple versions)
![Experiment 6 8255 parallel interface experiment [microcomputer principle] [experiment]](/img/70/394ccf6e08a0774acade1eb1b8bf00.png)
Experiment 6 8255 parallel interface experiment [microcomputer principle] [experiment]

【黑马早报】腾讯回应大批用户QQ号被盗;薇娅丈夫公司被罚19万;中国恒大被申请清盘;关晓彤奶茶店回应被加盟商起诉...
随机推荐
Seata数据库中出现以下问题要怎么解决啊?
Summary of technical difficulties of wearable neural signal and behavior data detection and recording system for birds in flight
Cross cluster deployment of helm applications using karmada
code snippet
完整的模型训练套路(一)
成龙和快品牌,谁才是快手的救星?
R language ggplot2 visualization: use the patchwork package to stack two ggplot2 visualization results vertically to form a composite diagram, and stack one visualization result on the other visualiza
Fleet |「后台探秘」第 3 期:状态管理
SAP MTS/ATO/MTO/ETO专题之九:M+M模式前后台操作,策略用50,提前准备原材料和半成品
Performance comparison of deep learning models on cat and dog image data sets
Technical trendsetter
ORACLE中dbms_output.put_line输出问题的解决过程
PostgreSQL实现按年、月、日、周、时、分、秒的分组统计
利用MySqlBulkLoader实现批量插入数据的示例详解
Leike defense: 4D millimeter wave radar products are expected to be mass produced and supplied by the end of the year
R语言ggplot2可视化:使用patchwork包将3个ggplot2可视化结果自定义组合起来构成组合图、两个子图横向组合后和另外一个图纵向组合构成最终组合图
Steve Jobs of the United States, died; China jobs, sold
S2b2c system website solution for kitchen and bathroom electrical appliance industry: create s2b2c platform Omni channel commercial system
ROS知识点——话题消息的定义与使用
雷科防务:4D毫米波雷达产品预计可以在年底量产供货