L05-AssemblySimulato - Adventures in Assembly Land What is an Assembler ASM Directives ASM Syntax Intro to SPIM/MARS Simple examples Comp 411 Fall

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

View Full Document Right Arrow Icon
L5 – Simulator 1 Comp 411 – Fall 2009 9/16/09 Adventures in Assembly Land What is an Assembler ASM Directives ASM Syntax Intro to SPIM/MARS Simple examples
Background image of page 1

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

View Full DocumentRight Arrow Icon
L5 – Simulator 2 Comp 411 – Fall 2009 9/16/09 A Simple Programming Task Add the numbers 0 to 4 … 10 = 0 + 1 + 2 + 3 + 4 In “C”: Now let’s code it in ASSEMBLY int i, sum; main() { sum = 0; for (i=0; i<5; i++) sum = sum + i; }
Background image of page 2
L5 – Simulator 3 Comp 411 – Fall 2009 9/16/09 What IS an Assembler? A program for writing programs Machine Language: 1’s and 0’s loaded into memory. (Did anybody ever really do that?) Assembly Language: Front panel of a classic PDP8e. The toggle switches were used to enter machine language. ASM 01101101 11000110 00101111 10110001 ..... Symbolic SOURCE text file Binary Machine Language ASSEMBLER Translator program STREAM of  bits to be  loaded into memory .globl main main: subu $sp, $sp, 24 sw $ra, 16($sp) li $a0, 18 li $a1, 12 li $a2, 6 jal tak move $a0, $v0 Assembler: 1. A Symbolic LANGUAGE for representing strings of bits 2. A PROGRAM for translating Assembly Source to binary.
Background image of page 3

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

View Full DocumentRight Arrow Icon
L5 – Simulator 4 Comp 411 – Fall 2009 9/16/09 Assembly Source Language An Assembly SOURCE FILE contains, in symbolic text, values of successive bytes to be loaded into memory. .. e.g. Resulting memory dump: .data 0x10000000 .byte 1, 2, 3, 4 .byte 5, 6, 7, 8 .word 1, 2, 3, 4 .asciiz "Comp 411" .align 2 .word 0xfeedbeef Specifies address where following values are loaded First four byte values Second four byte values Four WORD values (each is 4 bytes) A string of 9 ASCII bytes (8 + NULL) Align to next multiple of 4 (2 2 ) Hex encoded WORD Value [0x10000000] 0x04030201 0x08070605 0x00000001 0x00000002 [0x10000010] 0x00000003 0x00000004 0x706d6f43 0x31313420 [0x10000020] 0x00000000 0xfeedbeef 0x00000000 0x00000000 Notice the byte ordering. This MIPS is “little-endian” (The least significant byte of a word or half-word has the lowest address)
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/31/2009 for the course COMPUTER computer 1 taught by Professor Abedauthman during the Spring '08 term at Aarhus Universitet.

Page1 / 18

L05-AssemblySimulato - Adventures in Assembly Land What is an Assembler ASM Directives ASM Syntax Intro to SPIM/MARS Simple examples Comp 411 Fall

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