You are here:

C/XOR to store byte

Advertisement


Question
    I came across the following code:

         mov al,es:[si PLUS 14]
         xor al,bl
         sub ah,ah
         sub dx,dx
         xor es:[si PLUS 14],ax
         xor es:[si PLUS 16],dx

    It makes sense for the program to be storing BL into ES:[SI plus 14] at this point.

    From the code in the rest of the program (a very old Windows 3.1 game), I believe it was generated by a C compiler.

    Can you imagine what you could say in C to cause a store into a byte in a structure (ES:SI seems to be a pointer to a structure) to produce code that exclusive-OR's a longword with memory to store the byte?


Answer
I am not proficient in assembly coding.
So, it will be wrong for me to answer this question.

If you want an answer, then better ask this in Assembly code section.
I am sure, people with both assembly and C code proficiency will be there in that group.

Again sorry for not able to help out with this.

-Narendra

C

All Answers


Answers by Expert:


Ask Experts

Volunteer


Narendra

Expertise

I can answer questions in C related to programming, data structures, pointers and file manipulation. I use Solaris for doing C code and if you have questions related to C programming on Solaris, I will be able to help better.

Experience

6.5

Organizations belong to
Sun Microsystems

Awards and Honors
Brain Bench Certified Expert C programmer.
Advanced System Software Certified

©2012 About.com, a part of The New York Times Company. All rights reserved.