News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

How to prevent funny exceptions?

Started by HSE, May 09, 2021, 02:38:45 AM

Previous topic - Next topic

HSE

Hi Hutch!

There is no problem if function run in a thread.

Removing application messages prevent to run other function using same data, no problem neither.

Some messages from system apparently are also intercepted, then some window drawings only can be updated after thread finish (here I have a random popup that say one disk is full  :biggrin: that sometimes is drawed over the application).  If that become a problem I think is posible to filter what messages are removed, but perhaps don't worth the effort right now.
Equations in Assembly: SmplMath

LiaoMi

Quote from: jj2007 on May 12, 2021, 06:44:22 AM
Quote from: LiaoMi on May 12, 2021, 06:04:18 AM
Example from the old forum  :arrow_down:

What's the purpose of offset flat:ButtonTxt_Stopped? The code generated is identical with or without the flat: :cool:

Hi jj2007,

Microsoft Corporation - Microsoft Macro Assembler 6.11 Reference Manual_Macro Assembler Reference-Microsoft Corporation (1992)

@data
The name of the default data group. Evaluates to DGROUP for all models
except FLAT. Evaluates to FLAT under the FLAT memory model (text
macro).

FLAT as a group override ("mov eax, offset FLAT:<symbol>") <-"OFFSET FLAT:" to reference memory locations in the .data section.

OFFSET FLAT is used when the memory model is flat. OFFSET would have translated to a segment selector (DS) and OFFSET, whereas OFFSET FLAT translates to an absolute address of the label xxx relative to 0 (seeing as that's the base of the DS segment in flat mode), which the linker resolves after it is assembled.

jj2007

Thanks, LiaoMi. That's what I imagined, but it doesn't make much sense in that code, because offset ButtonTxt works fine without the "flat". Where are segment selectors in a flat model anyway? Looks like a relic from the 16-bit world :rolleyes:

Sometimes I declare read-only strings in the code section, and it makes no difference if the string is there or in .data - offset works:
.code
title db "Hello", 0
Sayhi proc arg
  invoke MessageBox, 0, arg, offset title, MB_OK
  ret
Sayhi endp

LiaoMi

@jj2007
QuoteLooks like a relic from the 16-bit world :rolleyes:

I think so  :azn: