Strings in MIPS. Chapter 2 — Instructions: Language of the Computer — 2 Character Data Byte-encoded character sets – ASCII: 128 characters 95 graphic,

Slides:



Advertisements
Similar presentations
Catch up on previous topics Summary and putting together first four classes.
Advertisements

The University of Adelaide, School of Computer Science
MIPS Assembly Language CPSC 321 Computer Architecture Andreas Klappenecker.
5Z032 Processor Design SPIM, a MIPS simulator Henk Corporaal
SPIM and MIPS programming
Syscall in MIPS Xinhui Hu Yuan Wang.
MIPS Function Continued
MIPS Assembly Language Programming
Ch. 8 Functions.
1 Computer Architecture MIPS Simulator and Assembly language.
IT253: Computer Organization Lecture 6: Assembly Language and MIPS: Programming Tonga Institute of Higher Education.
The University of Adelaide, School of Computer Science
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. Chapter 9: Characters * Character primitives * Character Wrapper class.
Chapter 9 Characters and Strings. Topics Character primitives Character Wrapper class More String Methods String Comparison String Buffer String Tokenizer.
Representing Information as Bit Patterns
Appendix A: MIPS Assembly Language. Instruction Format R-type I-type J-type.
COMPUTER ARCHITECTURE & OPERATIONS I Instructor: Hao Ji.
1 12/08/03SW Abingdon and Witney College Binary Converting to and from decimal.
Unicode, character sets, and a a little history. Historical Perspective First came EBCIDIC (6 Bits?) Then in the early 1960s came ASCII – Most computers.
Introduction to Computing Using Python Chapter 6  Encoding of String Characters  Randomness and Random Sampling.
© The McGraw-Hill Companies, 2006 Chapter 1 The first step.
Computer Organization - Syscalls David Monismith Jan. 28, 2015 Based on notes from Patterson and Hennessy Text and from Dr. Bill Siever.
An Introduction Chapter Chapter 1 Introduction2 Computer Systems  Programmable machines  Hardware + Software (program) HardwareProgram.
Representing text Each of different symbol on the text (alphabet letter) is assigned a unique bit patterns the text is then representing as.
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
Data Representation S2. This unit covers how the computer represents- Numbers Text Graphics Control.
Chapter 9 1 Chapter 9 – Part 1 l Overview of Streams and File I/O l Text File I/O l Binary File I/O l File Objects and File Names Streams and File I/O.
Homework #5 New York University Computer Science Department Data Structures Fall 2008 Eugene Weinstein.
Character Data and 32-bit Constants (Lecture #20) ECE 445 – Computer Organization The slides included herein were taken from the materials accompanying.
SEC (1.4) Representing Information as bit patterns.
Representing Characters in a computer Pressing a key on the computer a code is generated that the computer can convert into a symbol for displaying or.
Chapter 2 CSF 2009 The MIPS Assembly Language: Introduction to Binary System.
Lecture 10: MIPS Simulator Today’s topic –SPIM Simulator Readings –Appendix B 1.
The Information School of the University of Washington Oct 13fit digital1 Digital Representation INFO/CSE 100, Fall 2006 Fluency in Information Technology.
Lecture 161 Lets examine a SPIM program in detail. io.asm This program is a simple routine which demonstrates input/output using assembly code. SPIM.
Text Copyright © Software Carpentry 2010 This work is licensed under the Creative Commons Attribution License See
Sequencing The most simple type of program uses sequencing, a set of instructions carried out one after another. Start End Display “Computer” Display “Science”
CPS3340 COMPUTER ARCHITECTURE Fall Semester, /22/2013 Lecture 12: Character Data Instructor: Ashraf Yaseen DEPARTMENT OF MATH & COMPUTER SCIENCE.
File Input and Output Chapter 14 Java Certification by:Brian Spinnato.
Chapter 2 — Instructions: Language of the Computer — 1 Conditional Operations Branch to a labeled instruction if a condition is true – Otherwise, continue.
Data Representation. How is data stored on a computer? Registers, main memory, etc. consists of grids of transistors Transistors are in one of two states,
The SPIM Trap Handler Syscall Trap handler services String operations File operations Memory allocation Central Connecticut State University, MIPS Tutorial.
MIPS assembly syntax Home Assignment 3 Assigned. Deadline 2016 February 14, Sunday.
Integers/Characters Input/Output Integers and Characters Input/Output System Calls. syscall Trap Handler Services for Integers and Characters Read Integer,
3-Apr-2006cse spim © 2006 DW Johnson and University of Washington1 SPIM simulator CSE 410, Spring 2006 Computer Systems
What is Binary Code? Computers use a special code of their own to express the digital information they process. It's called the binary code because it.
CS 312 Computer Architecture & Organization
1.4 Representation of data in computer systems Character.
1 Non-Numeric Data Representation V1.0 (22/10/2005)
1 Section 1.3 Binary Number Systems Fundamentals of Java: AP Computer Science Essentials, 4th Edition Lambert / Osborne.
System Calls & Arithmetic
Lesson Objectives Aims You should be able to:
Computer Architecture & Operations I
MIPS Assembly Language Programming
Introduction to Lab #1 José Nelson Amaral.
Integers/Characters Input/Output
Lesson 1 An Introduction
Representing Information as bit patterns
Data Encoding Characters.
Week 5 Computers are like Old Testament gods; lots of rules and no mercy. Joseph Campbell.
MIPS Functions.
Digital Encodings.
Компьютерийн зохион байгуулалт, ассемблер CS201
MIPS Functions.
CS 286 Computer Architecture & Organization
Week 5 Computers are like Old Testament gods; lots of rules and no mercy. Joseph Campbell.
Lecture 36 – Unit 6 – Under the Hood Binary Encoding – Part 2
MIPS Functions.
ASCII and Unicode.
PROF. JOHN ABRAHAM UTRGV
Presentation transcript:

Strings in MIPS

Chapter 2 — Instructions: Language of the Computer — 2 Character Data Byte-encoded character sets – ASCII: 128 characters 95 graphic, 33 control – Latin-1: 256 characters ASCII, +96 more graphic characters Unicode: 32-bit character set – Used in Java, C++ wide characters, … – Most of the world’s alphabets, plus symbols – UTF-8, UTF-16: variable-length encodings §2.9 Communicating with People

How NOT to do Strings in MIPS Should we try to output a string by putting ASCII values into $a0? This is not correct. Just as in C, you output a string by passing the MEMORY ADDRESS of the beginning of a sequence of characters (bytes). Similarly, if you do a syscall 8 (read_string), the contents of the string read in are not in $a0. How could, say, a 256 byte string fit into a 4 byte quantity?

A look at syscodes

Hello World # This is a simple program to print hello world.data greet:.asciiz "Hello world\n".text main: li $v0, 4 la $a0, greet syscall# print the string jr $ra# return from main

Another example.data theString:.space 64.text main: li $v0, 8 la $a0, theString li $a1, 64 syscall li $v0,4 syscall

If you run this program and type this in: Hello!