We must understand how data is represented by a computer in a view of MIPS programming language.
Character Representation
A byte we have 8 bits. A character is actually represent one byte. In American Standard code for Information Interchange (ASCII), it offered 8-bit byte to represent character.
Here is a section of an assembly language program to assemble the ASCII bit patterns.
.asciiz "XYZ xyz"
Here are the bit patterns that the assembler will produce in the object module:
58 59 5A 20 78 79 7A 00
|
|
|
Binary | Dec | Hex | Glyph |
---|---|---|---|
110 0000 | 96 | 60 | ` |
110 0001 | 97 | 61 | a |
110 0010 | 98 | 62 | b |
110 0011 | 99 | 63 | c |
110 0100 | 100 | 64 | d |
110 0101 | 101 | 65 | e |
110 0110 | 102 | 66 | f |
110 0111 | 103 | 67 | g |
110 1000 | 104 | 68 | h |
110 1001 | 105 | 69 | i |
110 1010 | 106 | 6A | j |
110 1011 | 107 | 6B | k |
110 1100 | 108 | 6C | l |
110 1101 | 109 | 6D | m |
110 1110 | 110 | 6E | n |
110 1111 | 111 | 6F | o |
111 0000 | 112 | 70 | p |
111 0001 | 113 | 71 | q |
111 0010 | 114 | 72 | r |
111 0011 | 115 | 73 | s |
111 0100 | 116 | 74 | t |
111 0101 | 117 | 75 | u |
111 0110 | 118 | 76 | v |
111 0111 | 119 | 77 | w |
111 1000 | 120 | 78 | x |
111 1001 | 121 | 79 | y |
111 1010 | 122 | 7A | z |
111 1011 | 123 | 7B | { |
111 1100 | 124 | 7C | | |
111 1101 | 125 | 7D | } |
111 1110 | 126 | 7E | ~ |
Number Representation
Although computers operate on binary numbers, in MIPS number is represented in decimal system or hexadecimal system.When you need to insert number into a register, you have to remember what kind of number system that you want to write in the program. For example, to load number 16 into register $5, we have two ways to represent decimal 16 in MIPS:
1. ori $5, $0, 16 #load number 16 into register $5
2. ori $5, $0, 0x10 #load number 16 into register $5
Published by:
SITI NURHASTINI BINTI ROSALI (B031310320)
1 comment:
Here all content so useful and helpful for beginner and experience both.This site is so amazing, This sites gives good knowledge of computer-organization-and-architecture.This is very helpful for me.