Docsity

MIPS Assembly Language: CS 5300 - Simple Statements - Prof. Stephen J. Allan, Study notes of Computer Science

Partial preview of the text

Download MIPS Assembly Language: CS 5300 - Simple Statements - Prof. Stephen J. Allan and more Study notes Computer Science in PDF only on Docsity!

Simple Statements

CS 5300 - SJAllan Simple Statements 2

MIPS System Calls

exit 10 print_character 11 $a0=integer read_character 12 character in $v

$a0=buffer $a1=length

read_string 8

read_int 5 integer in $v

print_string 4 $a0=address of string

print_int 1 $a0=integer

Call Arguments Results Code

Service

ƒ The call code is placed in register $v

CS 5300 - SJAllan Simple Statements 3

Write Statement

WriteStatement : WRITESY LEFTPARENSY Expression RIGHTPARENSY {writestatement($3);} | | WRITELNSY {writelnstatement();} ;

ƒ Notice that WriteStatement has no semantic value

CS 5300 - SJAllan Simple Statements 4

Print an Integer

li $v0, 1 # System call code for print_int li $a0, 5 # Integer to print syscall # Print it

CS 5300 - SJAllan Simple Statements 7

Null Statement

NullStatement : /* empty */ ;

ƒ This is a tough one to implement ƒ Can you figure it out?