当前位置:网站首页>MIPS assembly language learning-01-sum of two numbers, environment configuration and how to run
MIPS assembly language learning-01-sum of two numbers, environment configuration and how to run
2022-06-28 15:11:00 【Sunshine clover lxgzxj】
One 、 Personal understanding
Assembly language is a general term for a class of languages , Can be subdivided into :X86,ARM,MIPS etc. , The portability of this kind of language is compared with C、Python、Java Poor , Because every type of Cpu The corresponding instruction sets are different , We all need to study alone .
Two 、MIPS Simulator download address
(1) Baidu cloud disk
link :https://pan.baidu.com/s/1qCmW0XERz2XxsbzEd2vxMw
Extraction code :nddi
(2) Download from the official website
3、 ... and 、 How to use MARS
(1) install
install JDK, The version installed here is :java version “1.8.0_331”,JDK The specific method of installation can be searched on the Internet , I won't go into more details here .
(2) function MARS
Double click .
(3) The actual effect
Four 、 Source code
mips-Sum.asm
li $t1 ,1
li $t2 ,2
add $t0 ,$t2 ,$t1
move $a0 ,$t0
li $v0 ,1
#$vo 1:Int 4:String
#print $a0
syscall
# No. is a comment
5、 ... and 、 Code interpretation
After installation, you should see a register list on the right
(1) matters needing attention
When storing numeric types , We need to use $t0 to $t7.
When you need to print data , We need to pay attention to the following :
(1)$vo by 1 Print when Int Type data , by 4 When printing String Type data .
(2) The print function only prints $a0 Data in .
(2) Grammar explanation
li $t1 ,1
li $t2 ,2
li It's data 1,2 Put them into registers respectively $t1、$t2 in .
add $t0 ,$t2 ,$t1
add Is a register $t1、$t2 Add and store the data in $t0 in .
move $a0 ,$t0
move The way is to put $t0 Number of moves to $a0
li $v0 ,1
li It's data 1 Put it in the register $v0 in , For subsequent printing Int Type data .
syscall
syscall The method is to print $a0 Data in
6、 ... and 、 Run code
(1) Point to Execute
(2) spot Run->Assemble, Point again Run I/0
(3) Point by step
Now the first line is marked yellow , We click the step by step button .
Now the second line is marked yellow , We found on the right $t1 Turn into 16 It's binary 1, Let's continue to click the step by step button .
Now the third line is marked yellow , We found on the right $t2 Turn into 16 It's binary 2, Let's continue to click the step by step button .
Now the fourth line is marked yellow , We found on the right $t0 Turn into 16 It's binary 3, It is the $t2 and $t1 The value of is put in $t0 in , Let's continue to click the step by step button .
Now the fifth line is marked yellow , We found on the right $a0 Turn into 16 It's binary 3, Let's continue to click the step by step button .
Now the sixth line is marked yellow , We found on the right $v0 Turn into 16 It's binary 1, Let's continue to click the step by step button .
The console printed out 3.
边栏推荐
- 隆重推出 Qodana:您最爱的 CI 的代码质量平台
- R语言ggplot2可视化:使用patchwork包将两个ggplot2可视化结果纵向堆叠起来(stacking)形成组合图、一个可视化结果堆叠在另外一个可视化结果上
- R language ggplot2 visualization: use the patchwork package (directly use the plus sign +) to horizontally combine a ggplot2 visualization result and a plot function visualization result to form a fin
- 【算法篇】刷了两道大厂面试题,含泪 ”重学数组“
- Do not use short circuit logic to write STL sorter multi condition comparison
- How can I get the stock account opening discount link? Is it safe to open a mobile account?
- 一文教你快速生成MySQL数据库关系图
- 叮!Techo Day 腾讯技术开放日如约而至!
- Oracle11g数据库使用expdp每周进行数据备份并上传到备份服务器
- Does Frankfurt currently support SQL?
猜你喜欢
Cross cluster deployment of helm applications using karmada
3. Caller 服务调用 - dapr
After QQ was stolen, a large number of users "died"
Classmate Zhang hasn't learned to be an anchor yet
Construction and management practice of ByteDance buried point data flow
Facebook! Adaptive gradient defeats manual parameter adjustment
美国乔布斯,殁了;中国乔布斯,卖了
Leetcode 705. Design hash collection
DBMS in Oracle_ output. put_ Line output problem solving process
With 120billion yuan, she will ring the bell for IPO again
随机推荐
MongoDB 在腾讯零售优码中的应用
With a return of 5000 times, the South African newspaper invested in Tencent to make a province
一文教你快速生成MySQL数据库关系图
R语言ggplot2可视化:使用patchwork包(直接使用加号+)将一个ggplot2可视化结果和数据表格横向组合起来形成最终结果图
完整的模型训练套路(一)
Combined sum leetcode
【黑马早报】腾讯回应大批用户QQ号被盗;薇娅丈夫公司被罚19万;中国恒大被申请清盘;关晓彤奶茶店回应被加盟商起诉...
Spark SQL generate JSON
5000倍回报,南非报业投资腾讯赚了一个省
324. 摆动排序 II : 不简单的构造题
厨卫电器行业S2B2C系统网站解决方案:打造S2B2C平台全渠道商业系统
Setsql function and risk of using lamdbaupdatewrapper
[C language] how to generate normal or Gaussian random numbers
Cross cluster deployment of helm applications using karmada
DBMS in Oracle_ output. put_ Line output problem solving process
Could you tell me whether the batch addition of Oracle such as insert all was not blocked?
第四大运营商,难成「鲶鱼」
Construction and management practice of ByteDance buried point data flow
PostgreSQL 存储结构浅析
笔试面试算法经典–最长回文子串