pseudoinstructions n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
PseudoInstructions PowerPoint Presentation
Download Presentation
PseudoInstructions

Loading in 2 Seconds...

play fullscreen
1 / 23

PseudoInstructions - PowerPoint PPT Presentation


  • 75 Views
  • Uploaded on

PseudoInstructions. 21 - Extended Assembler. Pseudoinstructions Instructions defined at assembly level Assembler translates to machine intsructions. Intent. Intent signaling instructions. Convenience. lw : Load word with label Sets up base address/offset. Convenience.

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

PowerPoint Slideshow about 'PseudoInstructions' - don


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
21 extended assembler
21 - Extended Assembler
  • Pseudoinstructions
    • Instructions defined at assembly level
    • Assembler translates tomachine intsructions
intent
Intent
  • Intent signaling instructions
convenience
Convenience
  • lw : Load word with label
    • Sets up base address/offset
convenience1
Convenience
  • sw : Store register to labeled memory
load address
Load Address
  • la : Load Address
    • Get memory address of labeled item
    • Assembly pointer
other pseudo tricks 23
Other Pseudo Tricks (23)
  • Immediate value impliesimmediate instruction
  • Convenience math/logic
assembler temporary register
Assembler Temporary Register
  • Instructions requiring multiple steps built using $1
registers
Registers
  • Registers have meanings defined by convention
    • Can use memnonic names instead of numbers
registers1
Registers
  • Tips:
    • Avoid $0, $1and $26-$31
    • $8-$25 safe for now :$t0-$t9 and $s0-$s7
24 more pseudo
24 – More Pseudo
  • Whole bunch o' branches and sets:
indexed addressing
Indexed Addressing
  • Arrays last week:
    • Move baseaddress around
unnatural
Unnatural
  • Offset/Base addressing ofteninconvenient
  • Indexed Addressing
    • Label(Offset)Array[i]
arrays now
Arrays Now
  • Arrays now
    • Change offset, uselabel as baseaddress
interrupts
Interrupts
  • Interrupt: signal to CPU that something needs to happen
    • Hardware Interrupts
      • Input/output ready
      • Ctrl-C
    • Code needs help
      • Trap from math overflow
      • Request for OS
interrupt handling
Interrupt Handling
  • OS take over
    • Saves stateof running program
    • Runs interrupt handler
    • Restores state
22 syscalls
22 - Syscalls
  • syscall: program generated interruptOperating System please do something
    • Use registers to send/receive information
syscalls
Syscalls
  • Syscall codes:
mips cin cout
MIPS cin / cout
  • Read and print integer:
more syscalls
More Syscalls
  • Properly end the program:
print string
Print String
  • Strings usually longer than word
    • Live in memory, not registers
  • String syscalls need pointer to string : $a0
    • Prints bytes until null char (00)
read print int 3
Read Print Int 3

Print promptand answermessages:

read string
Read String
  • Read string code needs
    • Location to write to
    • Space available