flat assembler
Message board for the users of flat assembler.
![]() |
Author |
|
revolution 23 Jan 2018, 17:21
You have to consider the upper bits of the value.
When you load al the upper bits of eax come from the result of the previous SendDlgItemMessage call. But when you use the dword from the memory location the upper bits come from the timeout value. Try this: Code: movzx eax,[modbus_cfg.bVariant] ;ensure all 32-bits are properly defined |
|||
![]() |
|
fatygant 23 Jan 2018, 19:49
Yes, but
Code: mov al,[modbus_cfg.bVariant] Code: SendDlgItemMessage,[hDlg],IDC_CONNECTION,CB_SETCURSEL,eax,0 Code: SendDlgItemMessage,[hDlg],IDC_CONNECTION,CB_SETCURSEL,dword[modbus_cfg.bVariant],0 I will check the error code - I should have started with that ![]() |
|||
![]() |
|
revolution 23 Jan 2018, 19:54
For the first "working" code, you are sending a full 32-bit value (eax) to SendDlgItemMessage, but only 8 of those bits came from modbus_cfg.bVariant, the other 24 bits came from whatever was in eax before. It is only "working" because the return value from SendDlgItemMessage leaves eax with the higher 24-bits as zero.
The second fails because you load the entire dword from memory, but some of those bits are from outside the single byte you wanted and contain other non-zero values in the higher 24 bits. |
|||
![]() |
|
fatygant 24 Jan 2018, 09:48
revolution, thank you! It looks I still have a problem with very basic concepts...
|
|||
![]() |
|
< Last Thread | Next Thread > |
Forum Rules:
|
Copyright © 1999-2025, Tomasz Grysztar. Also on GitHub, YouTube.
Website powered by rwasa.