x86 partial register usage
assembly, x86
Solution
`DL` is the least significant byte of `DX`, and `DH` is the most significant byte of `DX`. `DX` in turn is the least significant word of `EDX`.
So:
MOV EDX,0x12345678
; Now EDX = 0x12345678, DX = 0x5678, DH = 0x56, DL = 0x78
MOV DL,0x01
; Now EDX = 0x12345601, DX = 0x5601, DH = 0x56, DL = 0x01
MOV DH,0x99
; Now EDX = 0x12349901, DX = 0x9901, DH = 0x99, DL = 0x01
MOV DX,0x1020
; Now EDX = 0x12341020, DX = 0x1020, DH = 0x10, DL = 0x20
As you can see, you can write to `DL` or `DH` without them affecting one another (but you're still affecting `DX` and `EDX`).
Also, can you save the value 7 in `EDX` and `DH` and `DL` would still have their own values or will they now have 7?
As you can deduce from my examples above, `DH` would get the value 0 and`DL` the value 7.
Problem
If I save a value, let's say 10, in 8 bit register `DH` and then another value, 15, in 8 bit register `DL`. Would that work or will they override each other since they are both in 32-bit `EDX` register? ``` mov $10, %DH mov $15, %DL cmp %DL, %DH jle done ``` Basically I'm just confused when I'm using the 8 bit register how will it affect the 32 bit register and vice versa. Thanks. Also, can you save the value 7 in `EDX` and `DH` and `DL` would still have their own values or will they now have 7?