MIPS instruction and machine code

Actually you have only found the instruction, so it’s not ending there from your spec. Write out the machine code for the MIPS instruction. In order to write the machine code for this instruction you need to look at MIPS reference sheet MIPS Reference sheet If you look at the sheet the lw has opcode 35 and for $1 is 17 , … Read more

What does `dword ptr` mean?

The dword ptr part is called a size directive. This page explains them, but it wasn’t possible to direct-link to the correct section. Basically, it means “the size of the target operand is 32 bits”, so this will bitwise-AND the 32-bit value at the address computed by taking the contents of the ebp register and … Read more

Printing out a number in assembly language?

Have you tried int 21h service 2? DL is the character to print. To print the integer value, you’ll have to write a loop to decompose the integer to individual characters. If you’re okay with printing the value in hex, this is pretty trivial. If you can’t rely on DOS services, you might also be … Read more

Difference between JE/JNE and JZ/JNZ

JE and JZ are just different names for exactly the same thing: a conditional jump when ZF (the “zero” flag) is equal to 1. (Similarly, JNE and JNZ are just different names for a conditional jump when ZF is equal to 0.) You could use them interchangeably, but you should use them depending on what you are doing: JZ/JNZ are more appropriate when you are explicitly testing for something being equal … Read more

sorting array in mips (assembly)

This link explains how to print to the screen in a MIPS simulator like QTSPIM or MARS. As for the code, there were a few bugs. The line li $a0, 0 is overwriting the work done by the initial la $a0, Array instruction because the li is setting the base address of your array to 0. Instead, you should move the la instruction into the loop so … Read more