1
cseg01:00020DB8                 mov     eax, offset screen_with_height
cseg01:00045704                 mov     dword ptr [eax+0Ah], 0
cseg01:0004570B                 call    sub_466F8 ; call some proc

dseg05:000C2090 screen_with_height dd 0C80140h ;320 by 200 pixels 0x140 by 0xC8

This is C++ WATCOM compiler.

Please explain what means this code, why would be need this code?

I dont understatnd this line:

mov     dword ptr [eax+0Ah], 0

Thanks in advance.

1
  • 3
    The byte at that address is zeroed out the why part is not answerable without context may it is an out parameter and the sub program writes a result ?
    – blabb
    Commented Oct 4, 2023 at 10:22

1 Answer 1

3

It's writing the dword-sized value 0 (which may be an integer or a NULL pointer on x86) to the dword-sized field at +0Ah in some struct. Nobody can tell you any more than that given three lines of context.

2
  • 1
    So, 4 bytes of 00-00-00-00 (zero) writes to eax+0Ah address? I.e. for example eax points to 40h (start of variable in memory) then such: 40 01 C8 00 XX XX XX XX XX XX 00 00 00 00 (4 bytes variable screen_with_height + 6 bytes XX and + then 4 bytes zeros eax+0Ah) Am I right?
    – black4
    Commented Oct 5, 2023 at 6:30
  • 1
    Yes, your interpretation seems correct to me -- although I would note that the variable you're calling screen_with_height is apparently not just a single integer variable by itself, but rather, it's the first field in an unknown struct in the global data section (the one being written to by the line you asked about). Commented Oct 5, 2023 at 9:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.