views:

96

answers:

2

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.

+2  A: 

You can do it like this:

mov AX, [var16]
mov [var8], AH
Nick D
+1  A: 

Alternatively, you could use the SHR, SHL or ROR and ROL to shift of rotate the bits in your register.

m1ke