Load low byte of address only in x86 assembly?

Viewed 179

I have some assembly code:

mov eax, varbl

Where varbl is a pointer to .bss and evaluates to 0x6. I want to load it into just the al register:

mov al, varbl

but this causes a truncate error because varbl is 32 bits (dword) and al is byte. I can load the value of varbl in using:

mov al, 0x6

but I want to use the variable, not hardcode so that it updates when I add data to the data section.

The truncate warning is wrong. The value CAN fit in the 8-bit register and it works when I force link the program. How do I turn off this error or use some other syntax to accomplish this?

0 Answers
Related