Lecture 14 - Th The University of Texas at Dallas Erik...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
Erik Jonsson School of Engineering and h U i it f T t D ll Computer Science The University of Texas at Dallas Syscall 8 Syscall 8 allows ASCII character input from the keyboard. Syscall 8 uses three registers : $a0 – starting address in memory to store string $a1 – character length (max. number of characters to be input) v0 – s sual) holds the stem call number (8) $v0 (as usual) holds the system call number (8) To load $a0: Load $a0 with the address of first byte of memory storage area. Example: “la $a0, buffer,” (“buffer” = address label of the first byte of storage space ) Reserve the storage area with “.space” directive: xample: buffer: space 36 (reserves and labels 36 bytes in memory © N. B. Dodge 09/09 Lecture #14: MIPS Shift, Rotate, and Decision-Support Instructions 1 Example: buffer: .space,36 (reserves and labels 36 bytes in memory and clears to 0)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Erik Jonsson School of Engineering and h U i it f T t D ll Computer Science The University of Texas at Dallas Syscall 8 (2) To load $a1: li $a1,number – Desired character length $a1 (e.g., li $a1,36) Warning : If [$a1] > reserved memory area, the program can overwrite ther data declared in the program! other data declared in the program! If less than that number in $a1 is input, the “Enter” key must be pressed. If input number = [$a1], input automatically ends . Note: To assure a null-terminated character string, declare a g, larger reserved area than is actually needed. That is: buffer: .space 37 (if max. character number = 36) A typical complete syscall 8 would look like this: la $a0, buffer li $a1, 36 li $v0, 8 “Buffer” is the label of the reserved space in memory. 36 = max. character number (memory space in buffer). ormal form of a syscall © N. B. Dodge 09/09 Lecture #14: MIPS Shift, Rotate, and Decision-Support Instructions 2 syscall Normal form of a syscall.
Background image of page 2
Erik Jonsson School of Engineering and h U i it f T t D ll Computer Science The University of Texas at Dallas Shift and Rotate Instructions It is often necessary to perform manipulations of data words in the computer other than normal logical or arithmetic operations. Such operations might include: Re-arrangement of bytes in a word “Quick” divide or multiply by 2, 4, or any number = 2 ± n Q pyy,, y “Masking” -- making certain only parts of a word are visible so that they can be examined or tested Elimination of certain bit fields of a word (which can also be done by logical instructions in some cases) Shift and rotate instructions facilitate these sorts of data manipulations. © N. B. Dodge 09/09 Lecture #14: MIPS Shift, Rotate, and Decision-Support Instructions 3
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Erik Jonsson School of Engineering and h U i it f T t D ll Computer Science The University of Texas at Dallas The “Logical” Left Shift (sll) Assume that we wish to multiply a 32-bit number by a power of 2 in a MIPS register, (or perhaps we wish to rearrange bits of the data word): Multiplying by 2 n in binary is similar to multiplying by 10 n in the
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 10/16/2009 for the course EE 2310 taught by Professor Dodge during the Spring '09 term at University of Texas at Dallas, Richardson.

Page1 / 34

Lecture 14 - Th The University of Texas at Dallas Erik...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online