The MASM Forum Archive 2004 to 2012
Welcome, Guest. Please login or register.
October 23, 2018, 02:40:30 PM

Login with username, password and session length
Search:     Advanced search
128553 Posts in 15254 Topics by 684 Members
Latest Member: mottt
* Home Help Search Login Register
+  The MASM Forum Archive 2004 to 2012
|-+  General Forums
| |-+  The Workshop
| | |-+  MasmBasic
« previous next »
Pages: 1 ... 19 20 [21] Print
Author Topic: MasmBasic  (Read 123518 times)
jj2007
Member
*****
Gender: Male
Posts: 6011



Re: MasmBasic
« Reply #300 on: May 14, 2012, 02:55:21 PM »

Quote from: Antariy
In MbTryCatch you're using EBX and ESI, but not preserving them (there is one path with return of EXCEPTION_CONTINUE_EXECUTION).

Thanks, Alex. It's corrected today (14 May, here).

I also added a "descriptive text" option to SetErrLine:

Try         ; set the start label
   mov ecx, 4
   .Repeat
      Print Str$("44444444/%i = ", ecx)
      mov eax, 44444444
      cdq
      SetErrLine "reason\tdiv ecx"
      div ecx
      PrintLine Str$(eax)
      dec ecx
   .Until Sign?
Catch only   ; "only" signals skip if no problems
   mov eax, 31415926   ; ... otherwise, change your results here...
   PrintLine "undefined"   ; ... or issue a warning, etc.
Finally         ; needed after "only"
   .if LastEx(code)   ; we better give some extra info
       PrintLine CrLf$, "We had an exception at ", CrLf$, "address", Tb$,\
       Hex$(LastEx(addr)), CrLf$, "code", Tb$, Hex$(LastEx(code)), CrLf$, LastEx(info)
   .endif

Code:
We had an exception at
address 00401092
code C0000094
reason div ecx

Full example attached.

* SkelTryCatch.zip (14.4 KB - downloaded 305 times.)
Logged

Antariy
Member
*****
Gender: Male
Posts: 1041


Re: MasmBasic
« Reply #301 on: May 16, 2012, 03:01:01 AM »

Thanks, Alex.

 ThumbsUp

Code:
Incrementing [0] is illegal

44444444/4 = 11111111
44444444/3 = 14814814
44444444/2 = 22222222
44444444/1 = 44444444
44444444/0 = undefined

Ouch, we had an exception at
address 00401092
code C0000094
reason div ecx

Let's try again, outside the Try/Catch block??

Exception (line 35?):
Code C0000005
EIP 00401174
Error inc [0] failed

It is also possible to obtain a line number from a map file, not placing it into exe.
Need to specify /Zd switch to the ML when translating and /MAP /MAPINFO:LINES for LINK when building.
The section in resulting MAP file is named "Line numbers for"... and contains the correspondencies between source lines and code offset relative to start of the section. I.e., if code section (segment) starts at 401000, then just need to add this to offset from MAP to get resulting virtual address.
Logged
jj2007
Member
*****
Gender: Male
Posts: 6011



Re: MasmBasic
« Reply #302 on: May 18, 2012, 10:48:58 AM »

Need to specify /Zd switch to the ML when translating and /MAP /MAPINFO:LINES for LINK when building.

Alex,

You are a source of inspiration ThumbsUp

See \masm32\RichMasm\Res\SkelTryCatch.asc in the 18 May version. Open in RichMasm, hit F6, see the exception messages; quit and see how the editor jumps to the first line that triggered an exception BigGrin

You need ML.exe version 6.15 or JWasm, and the standard linker coming with the Masm32 SDK - see here for more info.

Simple example:

Quote
include \masm32\MasmBasic\MasmBasic.inc   ; download
   Init tc   ; install the try/catch handler
   ErrLines   ; blank or on means use them, off means don't
   xor ecx, ecx   ; you should go to jail for accessing address zero, but we'll be kind
   inc dword ptr [ecx]   ; RichMasm will select this line after exiting the program
   Inkey "Can you see this text?"   ; no, you can't... we have a non-continuable exception before ;-)
   Exit
   TryCatchEnd   ; activate the handler - must be last instruction before "end start"
end start

OPT_Assembler   JWasm         ; only ml.exe 6.15 works ok (Hex$ may not look good in JWasm, ml 8+ don't do /Zd)
OPT_DebugA   /Zd         ; generate info for mapinfo:lines
OPT_DebugL   /map /mapinfo:lines      ; recent ml.exe and link.exe versions can't do that
OPT_Linker   link         ; you need the Masm32 version, i.e. the old 1998 link.exe
Logged

guga
Member
****
Posts: 50



Re: MasmBasic
« Reply #303 on: May 20, 2012, 01:48:20 AM »

Excelent work JJ ThumbsUp


One question...how do you managed to enable the hyperlinked text in a richedit control ? ( i mean the "Hi guga", instead of http://guga.com)
Do you have some small example of this ?

I tried to make a riechedit control works this way but it keeps showing the full url
Logged

jj2007
Member
*****
Gender: Male
Posts: 6011



Re: MasmBasic
« Reply #304 on: May 20, 2012, 02:16:52 AM »

Hi Guga,

The trick is to disable EM_AUTOURLDETECT and then roll your own via CFM_LINK. Warning, it may cost you some sleepless night wink
Logged

guga
Member
****
Posts: 50



Re: MasmBasic
« Reply #305 on: May 20, 2012, 03:14:24 AM »

many tks..ill give a try

hmm...you mean using it with EM_SETEVENTMASK, EM_GETEVENTMASK and EM_AUTOURLDETECT ?
Logged

guga
Member
****
Posts: 50



Re: MasmBasic
« Reply #306 on: May 20, 2012, 05:20:24 AM »

Im confused...It is not working....

is disabling autourldetect realy necessary ?

what about using CFE_HIDDEN ?
I mean, i wonder if it may work if i grab somehow the string memory (the "url" that is surrounding the string), and through EN_LINK i hide only the url string somehow.

Is this c code usefull ?
http://www.tek-tips.com/viewthread.cfm?qid=317950
Logged

dedndave
Member
*****
Posts: 12523


Re: MasmBasic
« Reply #307 on: May 20, 2012, 05:59:59 AM »

this might help...
http://www.codeproject.com/Articles/9196/Links-with-arbitrary-text-in-a-RichTextBox
when i read these code project articles, i find it very helpful to browse through the discussions at the bottom   BigGrin
Logged
jj2007
Member
*****
Gender: Male
Posts: 6011



Re: MasmBasic
« Reply #308 on: May 20, 2012, 09:31:06 AM »

Im confused...It is not working....
What do you expect after only one sleepless night? green

Quote
is disabling autourldetect realy necessary ?

See Dave's link, under "Caveats"

Quote
what about using CFE_HIDDEN ?

Sounds interesting, but you would still have to see the link style for a piece of text, right?

Quote

That was 2005 - judge yourself:
Quote
ok, for my life I have no idea what the problem is. ... I'll probably post this in it's own thread pretty soon here...

By the way, RichMasm supports several types of hyperlinks:


1. plain http (it will ask)
2. open a local file (directly)
3. jump to internal anchor ("you need resources")
4. insert a file replacing the link
5. while hovering over a MB keyword (Print, Init, Recall, ...), the mouse cursor becomes a question mark. Right-click then to see help.

Source attached - it needs the path name.

* LinksInMB.zip (1.12 KB - downloaded 305 times.)
Logged

Pages: 1 ... 19 20 [21] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP The MASM Forum Archive 2004 to 2012 | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.
Valid XHTML 1.0! Valid CSS!