Lecture 20, MIPS Programming: Assembler Directives
Lecture 20, MIPS Programming: Assembler Directives
Lecture 20, MIPS Programming: Assembler Directives
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
Image courtesy of http://debsbookbag.blogspot.com/
How is a macro instruction like mul different from aninteger instruction like mult?How is an assembler directive different from an instruction?
TODAY IS ABOUT CODE.data?Pi: .double 3.1415926536897924Rad: .double 12.345678901234567.textmain: l.d $f0, Pi # $f0 = Pil.d $f4, Rad # $f4 = Radmul.d $f12, $f4, $f4 # $f12 = Radius squaredmul.d $f12, $f12, $f0 # Multiply by Pili $v0, 3syscall# Print the areali $v0, 10syscall# Terminate the program
ASSEMBLER DIRECTIVESYou’ve seen directives before in C/C++#include #pragma once
ASSEMBLER DIRECTIVESCommands for the assembler, affecting assembly.
ASSEMBLER DIRECTIVES.align.ascii.asciiz.byte.data.double.extern.float.globl.half.kdata.ktext.space.text.wordEventually, you need to know what all of these do!
.textEach group of instructions should begin with this directive.Machine code in this section is placed in the “user textsegment” of your program.
.dataCode in this section is placed in the“data segment” of your program.
HOMEWORK• Reading 18• Textbook sections B.3 - B.5can hardly wait!