I believe this piece of code works, but it really seems like it shouldn't, unless ax is being compared with 0000 1010 instead of 1010 0000. Isn't it not supposed to matter whether data is stored in little or big endian format?
Here's the relevant bit of code:
mov al, es:100h
mov ah, 0
and ax, 0A0h
cmp ax, 20h
...
Isn't the value is ax something like this:
mov al, es:100h ; ax = ???? ????
mov ah, 0 ; ax = 0000 ????
and ax, 0A0h ; ax = 0000 0000 or ax = 0000 ?0?0
cmp ax, 20h ; only useful if ax = 0000 ?0?0
...
Clearly there's a rule that I don't know here. An explanation would be super helpful.
EDIT: I should mention that I have looked for an answer but could not find one. For instance, this thread only made it seem more like the code must be wrong. But I'm pretty confident it works: Bitwise operators and "endianness"