Before moving towards coding is necessary to learn the basics of MIPS assembly language. Data type is one of the most important part to learn.
Data types that mips assembly support are given below in detail.
.Ascii
.ASCII is used to store string type data. An Ascii data type donot have a NULL terminator. i.e ‘\0’ , called NUL in ASCII)
.data msg1: .ascii "HELLO ASSEMBLY PROGRAMMERS"
.Asciiz
.ASCIIZ is used to store store string data but it has a Z at end which means it has a null terminator. Z is Ascii code for null terminator.
.data msg1: .asciiz "WELCOME TO ASSEMBLYLANGUAGETUST"
.Byte
Byte (4 Bits) data type is used for single integers without any decimal places. It can also be used to store character. See the example Below:
.data value1: .byte 736 value2: .byte 'a' value3: .byte 'b' value4: .byte 2,3,4,5,5
.Halfword
A Halfword consists of two bytes. It is used to store half of a word. Each four bit is at address divisible by 2. See Example:
.data msg1: .halfword 'A'
.Word
In .word data is stored in the form of 32 Bits. Its double of half word. It can also be used to initialize an Array. You can also use positive or negative sign as its 32 bit. See Example:
.data msg1: .word -20 msg2: .word 30
.data Array1: .word 1,2,3,4,5,6,6,7,7
.Float
Float data type is used to store floating point value with single decimal value. see example:
.data float_value: .float 1.1 float_value1: .float 123.5
.Double
Double data type is used to store double value with more than one decimal places. See Example:
.data double_value: .double 1.10 double_value1: .double 123.55
Data Types And Size in Mips Assembly
Data Type | Size |
---|---|
Halfword | 16 bits |
Word | 32 bits |
Byte | 8 bits |
Integer | 32 bits |
Character | 4 bits |
If there are any questions ask freely in the comment box.