Prior Page     Next Page     This Chapter    Prior Chapter    Next Chapter





Hermes Load and Store Operations

The Load operation takes data out of memory and places it in a register. The prior contents of the register that is changed is lost. There are three load operations depending on how much data you want to get in the register. For example: L 3,0x001000  will get the signed 4-byte (32-bit) value that starts in memory location 0x001000 and will put it into general register 3. Whereas, LH 4,0x001010 will get the 2-byte signed (16-bit) value   that starts in memory location 0x001010 and will put it into general 4. The instruction LB 4,0x001010 will get the 1-byte unsigned (8-bit) value in memory location 0x001010 and put it into general register 4.

One special load operation, the Load Address instruction, computes a signed effective address and puts the result into a register.  It does not take anything out of memory. So, LA 4,0x000010 will put 16 in register 4, because 0x000010 is 16 in hexadecimal. Likewise LA 0,0xffffff will put -1 in register 0, because 0xffffff is a 24-bit representation of -1, and the address field is sign extended to 32-bits when the effective address is computed.

The difference between LA and L is often hard for students to understand. It is important to keep playing with the two instructions until the difference is clearly understood, and the dark clouds of doubt have given away to brilliant sunshine. You can play with the instruction on the computer itself and check the answers by examining the trace output.

Understanding the difference between LA and L is important because it is a concept that will recur in all languages and systems that you will encounter in you computer studies.  You might as well get it straight now, it will make things much easier later.

The Store operations move data from registers into memory. The prior contents of memory that is changed are lost. Again there are three operations they allow you to store the low-order byte of a register, the low-order half-word of a register, or the whole register. For example: ST 6,0x002000 will store the value that is register 6 into the 4-bytes of memory that starts in location 0x002000. The instruction STH 4,0x00202c will store the bottom half (the low-order 16-bits) of register 4 into the 2-bytes that starts in memory location 0x00202c. The instruction STB 0,0x000010 will store the low-order 8-bits of register 0 into memory location 0x000010.








Prior Page     Next Page     This Chapter    Prior Chapter    Next Chapter


Copyright © 1995 R. Uzgalis. All rights reserved.
Contact: buz@cs.aukuni.ac.nz