tailieunhanh - MIPS Assembly Language Programming CS50 Discussion and Project Book

In order to understand how a computer is able to manipulate data and perform computations, you must rst understand how data is represented by a computer. At the lowest level, the indivisible unit of data in a computer is a bit. A bit represents a single binary value, which may be either 1 or 0. In di erent contexts, a bit value of 1 and 0 may also be referred to as \true" and \false", \yes" and \no", \high" and \low", \set" and \not set", or \on" and \o ". The decision to use binary values, rather than something larger (such as decimal. | MIPS Assembly Language Programming CS50 Discussion and Project Book Daniel J. Ellard September 1994 Contents 1 Data Representation 1 Representing Integers. 1 Unsigned Binary Numbers. 1 Conversion of Binary to Decimal. 2 Conversion of Decimal to Binary. 4 Addition of Unsigned Binary Numbers. 4 Signed Binary Numbers . 6 Addition and Subtraction of Signed Binary Numbers 8 Shifting Signed Binary Numbers . 9 Hexadecimal Notation. 9 Representing Characters. 10 Representing Programs. 11 Memory Organization . 12 Units of Memory. 13 Historical Perspective . 13 Addresses and Pointers . 13 Summary . 14 Exercises. 15 15 15 15 2 MIPS Tutorial 17 What is Assembly Language . 17 Getting Started . 18 Commenting . 18 Finding the Right Instructions . 19 i ii CONTENTS Completing the Program. 20 Labels and main. 20 Syscalls. 22 Using SPIM . 23 Using syscall . 24 Reading and Printing Integers. 25 Strings the hello Program. 26 Conditional Execution the larger Program. 28 Looping the multiples Program. 31 Loads the Program. 33 The atoi Program. 36 atoi-1. 36 atoi-2. 38 atoi-3. 39 atoi-4. 39 Exercises . 42 . 42 . 42 . 42 3 Advanced MIPS Tutorial 43 Function Environments and Linkage. 43 Computing Fibonacci Numbers. 45 Using Saved Registers . 45 Using Temporary Registers . 47 Optimization . 48 Structures and sbrk the treesort Program . 50 Representing Structures . 51 The sbrk syscall . 52 Exercises . 53 53 53 53 53 .

TỪ KHÓA LIÊN QUAN