Hi Theo,
ESI and EDI are 32-bit/DWORD registers that can also be accessed at a 16-bit level via their lower SI/DI WORD "halves". But they cannot be accessed at an 8-bit/BYTE level at all nor is there, to the best of my knowlege, a CMP mnemonic to test 32-bit registers against a 16- or 8-bit immediate value.
So, shouldn't
CMP ESI, BYTE 00
in fact be
CMP ESI, 0
where 0 will be interpreted as DWORD according to the register size?
Then, talking about low level code optimization and assuming ESI is a mere disposable temporary variable, shouldn't we just
OR ESI, ESI
or
AND ESI, ESI
either of which is going to set the zero flag to the same effect if ESI actually is 0, and thus yield a much shorter machine code byte sequence than CMP ESI, 0 where literal 0 alone would occupy 4 bytes?