CS 120 Lecture 17: Parts of Assembly Code

67 views3 pages

Document Summary

C translates all the code to assembly instructions and then runs it, while python translates one line at a time and runs that line. Write mips assembly and hex machine code to swap registers and without using any temporary or variable registers. Comments: use hashes for comments, like python, no multi-line comments. Labels are optional, and always followed by a colon: the label comes before the opcode and operands, label: opcode operands #comment. Labels are used as a variable, which is a name location in memory that you can call back. text: where the executable code goes: usually starts at 0x40000. data: where the data gets stored: usually starts at 0x10000000. globl (no a): allows us to define a label as a global label: needs to be used for . globl main, because main should be a global label. text, . data, . word, and . globl are all directives.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents