R – way to store part of a 16 bit value in an 8 bit variable in Assembly


I created one variable that stores a 16 bit variable, and I'm tring to store the upper half in an 8 bit variable.
How do I do this?

EDIT: its for the IA-32, and I don't think i can use registers

EDIT2: I am allowed to use registers.

Best Solution

You can do it like this:

mov AX, [var16]
mov [var8], AH