SPRUI04F july 2015 – april 2023
Assign a Variable to a Register
.map symbol1 /register1 [, symbol2 / register2, ...]
The .map directive assigns symbol names to machine registers. Symbols are stored in the substitution symbol table. The association between symbolic names and actual registers is wiped out at the beginning and end of each linear assembly function. The .map directive can be used in assembly and linear assembly files.
variable | A valid symbol name to be assigned to the register. The substitution symbol is up to 128 characters long and must begin with a letter. Remaining characters of the variable can be a combination of alphanumeric characters, the underscore (_), and the dollar sign ($). | |
register | Name of the actual register to be assigned a variable. |
When a symbol is declared with the .map directive, it is not necessary to declare that symbol with the .reg directive.
Here the .map directive is used to assign x to register A6 and y to register B7. The symbols are used with a move statement.
.map x/A6, y/B7
MV x, y ; equivalent to MV A6, B7