more on assembly n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
More on Assembly PowerPoint Presentation
Download Presentation
More on Assembly

Loading in 2 Seconds...

play fullscreen
1 / 9

More on Assembly - PowerPoint PPT Presentation


  • 53 Views
  • Uploaded on

More on Assembly. CS 210 Tutorial 5 Assignment preparation. Difference between ldiq and ldq. Ldiq is for loading immediate value into register Ldiq $t0, 0x8000; Ldq is for reading memory in specific location For example: Memory has values 0x8000 : 0x1111111111111111

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 'More on Assembly' - claus


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
more on assembly

More on Assembly

CS 210 Tutorial 5

Assignment preparation

difference between ldiq and ldq
Difference between ldiq and ldq
  • Ldiq is for loading immediate value into register
  • Ldiq $t0, 0x8000;
  • Ldq is for reading memory in specific location
  • For example: Memory has values
  • 0x8000 : 0x1111111111111111
  • 0x8004 : 0x2222222222222222
  • Ldq $t1, ($t0); value in $t1 is 0x1111111111111111
  • Ldq $t1, 8($t0); value in $t1 is 0x2222222222222222
getchar
getChar
  • Take char value from keyboard to $v0
putchar
PutChar
  • Take char from $a1 put to screen
printout example
Printout example
  • block main uses proc, CALLSYS {
  • data {
  • align;
  • buffer:
  • asciiz “tide";
  • } data
  • code {
  • public enter:
  • ldiq $s0, buffer;
  • {
  • while:
  • ldbu $a1, ($s0);
  • beq $a1, end;
  • do:
  • ldiq $a0, CALLSYS_PUTCHAR;
  • call_pal CALL_PAL_CALLSYS;
  • addq $s0, 1;
  • br while;
  • end:
  • }
  • clr $a0;
  • bsr Sys.exit.enter;
  • } code
  • } block main
read keys and store in memory
Read keys and store in memory
  • code {
  • public enter:
  • ldiq $t6, 0x01ffe184;//for example using hardcode
  • {
  • loop:
  • ldiq $a0, CALLSYS_GETCHAR;
  • call_pal CALL_PAL_CALLSYS;
  • //blt $v0, end;
  • mov $v0, $a1;
  • mov $v0, $t5;
  • stb $t5, ($t6);
  • addq $t6, 1;
  • ldiq $a0, CALLSYS_PUTCHAR;
  • call_pal CALL_PAL_CALLSYS;
  • br loop;
  • end:
  • }
  • {
  • clr $a1;
  • ldiq $a0, CALLSYS_EXIT;
  • call_pal CALL_PAL_CALLSYS;
  • }
  • } code
reverse example
Reverse example
  • Check the code and try to understand it.
  • Match them together to finish assignment.