News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

MasmBasic

Started by jj2007, October 06, 2009, 08:24:57 PM

Previous topic - Next topic

UtillMasm

 ::)
code nothing in MB, i'll pass.

:toothy
PS.Support release MB source.

jj2007

Quote from: E^cube on December 01, 2009, 08:47:00 AM
uh i've programmed in vb for awhile
Show us some of your code, please. If it's not Masm, VB is fine, too.

Quote
I understand ASM minus sse2 etc which I HIGHLY doubt your code contains that.
If you knew how to use Olly, you could find out.

ecube

Quote from: jj2007 on December 01, 2009, 09:44:16 AM
Quote from: E^cube on December 01, 2009, 08:47:00 AM
uh i've programmed in vb for awhile
Show us some of your code, please. If it's not Masm, VB is fine, too.

Quote
I understand ASM minus sse2 etc which I HIGHLY doubt your code contains that.
If you knew how to use Olly, you could find out.

tired of playing these games with you,i'm not acting like i'm some superior coder like you are, none the less learn how to search
http://www.masm32.com/board/index.php?topic=11103.0

jj2007

Quote from: E^cube on December 01, 2009, 10:14:55 AM
tired of playing these games with you,i'm not acting like i'm some superior coder like you are, none the less learn how to search
http://www.masm32.com/board/index.php?topic=11103.0

Attribute VB_Name = "modPreLoader__"
...'
' - by Libor Blaheta


Thanks, Libor.

ecube

Quote from: jj2007 on December 01, 2009, 10:20:08 AM
Quote from: E^cube on December 01, 2009, 10:14:55 AM
tired of playing these games with you,i'm not acting like i'm some superior coder like you are, none the less learn how to search
http://www.masm32.com/board/index.php?topic=11103.0

Attribute VB_Name = "modPreLoader__"
...'
' - by Libor Blaheta


Thanks, Libor.

Read my topic description, actually don't,you're obviously a slow read, and I don't even know why i'm wasting time on you anymore, go work on your IDE and keep thinking it's anywhere near Radasm. Dillusion must be grande

hutch--

Hey guys,

Keep it friendly, you are both rare species, assembler programmers.  :bg
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

dedndave

E^cube
JJ has spent a lot of hours on this project
the fact that he doesn't want to give it away to everyone doesn't surprise me
there are many projects in here that do not include source - we don't chastise them for that
the fact that he is willing to share the source with us for the cost of a PM seems rather gracious to me
and, if i know Jochen, there is a lot of SSE2 code in there - and a lot of fast and small routines, as well, both SSE and non-SSE
when he said we might not understand it, he wasn't kidding - lol
his code is well known to be full of confusing macros and if/while structures   :bg

ecube

Quote from: dedndave on December 01, 2009, 01:32:45 PM
E^cube
JJ has spent a lot of hours on this project
the fact that he doesn't want to give it away to everyone doesn't surprise me
there are many projects in here that do not include source - we don't chastise them for that
the fact that he is willing to share the source with us for the cost of a PM seems rather gracious to me
and, if i know Jochen, there is a lot of SSE2 code in there - and a lot of fast and small routines, as well, both SSE and non-SSE

it's not about the fact he doesn't want to release the source, it's his delusions of grandeur and arrogance that bothers me. But whatever, out of hutches request I won't post in this thread anymore.

jj2007

Quote from: dedndave on December 01, 2009, 01:32:45 PM
when he said we might not understand it, he wasn't kidding - lol
his code is well known to be full of confusing macros and if/while structures   :bg

Dave, there are many coders here who will understand it, you included, of course :thumbu
It's more a matter of principle: If somebody demonstrates a serious interest, and has contributed a substantial amount of genuine code to this forum, then yes he can have the code. Otherwise not - it's not meant for the trolls.

Next post is back to topic.

jj2007

One of the commands on my "missing" list is a string sort. The proper way of doing this in the Unicode age is probably via CompareStringEx or similar, but why not cheat a little bit and let Windows do the job?

The good news is its very easy, see below, and fast enough for ordinary human beings. Windows.inc gets sorted in one third of a second - reading, sorting and writing the file (I know that's incredibly slow, but compare it to the 3-4 seconds that Outlook needs to display the insert hyperlink box for the first time...).

The bad news is you must download the archive again from the top thread, because Let L$(n)=esi stumbled over a tiny but very significant bug. Apologies :red

Quoteinclude \masm32\MasmBasic\MasmBasic.inc   ; no further includes needed

FileSort   PROTO: DWORD, :DWORD

.code
start:
;   sort Windows.inc and write the result to SortedWindows.inc:
   fn FileSort, "\Masm32\include\Windows.inc", "\Masm32\RichMasm\SortedWindows.inc"
   Exit

FileSort proc uses esi SrcFile, DestFile
LOCAL hInstance, hListbox
LOCAL ctLines, ctValid, ShowTime$
LOCAL buffer[4096]:BYTE
IdListbox = -123
   push Timer                  ; save the ticks
   invoke GetModuleHandle, NULL
   mov hInstance, eax
   invoke CreateWindowEx, WS_EX_CLIENTEDGE, chr$("listbox"), NULL,
      WS_CHILD or LBS_SORT,
      0, 0, 0, 0,
      rv(GetDesktopWindow), IdListbox, hInstance, NULL
   mov hListbox, eax            ; we have created a hidden listbox as a child of the desktop

   Recall SrcFile, L$()            ; read the strings from file to the L$() array: eax=line count, edx=bytes read
   mov ctLines, eax
   invoke SendMessage, hListbox, LB_INITSTORAGE, eax, edx  ; tell the OS how much space you need
   and ctValid, 0
   For_ n=0 To ctLines-1
         Let esi=Trim$(L$(n))      ; we are not interested in leading spaces and nullstrings
         .if Len(esi)
            invoke SendMessage, hListbox, LB_ADDSTRING, 0, esi
            inc ctValid
         .endif
   Next
   lea esi, buffer
   For_ n=0 To ctValid-1
         invoke SendMessage, hListbox, LB_GETTEXT, n, esi
         Let L$(n)=esi
   Next
   Store
DestFile, L$(), ctValid

   mov esi, Timer                        ; get the end ticks ...
   pop eax
   sub esi, eax                        ; ... and subtract the start ticks
   Let ShowTime$=Str$("%i \tms", esi)+Str$(" for sorting\n%i\tentries in ", ctLines)+SrcFile
   invoke DestroyWindow, hListbox
   MsgBox 0, ShowTime$, "MasmBasic is cute:", MB_OK
   ret
FileSort endp

end start

UtillMasm

 :U
above code is so good, but i can understand it.
PS. you are a MACRO guy.

jj2007

Update #9, downloadable at top of thread. Improves on the Val() function: The conversion of all hex values in Window.inc to decimals works now almost 100%, with the exception of line 17628:
IMAGE_ARCHIVE_START equ "!<arch>",10

When using mov ebx, Val("123h"), the value is returned in eax, while edx returns info about success or failure of the evaluation:
edx==0   ; failure, not a valid format
edx==-127   ; failure, strange format, you better check
edx>0   ; success, edx chars have been used
edx<0   ; success with a hex$ or bin$; use the following to get the correct # of chars used:
Quoteneg edx
         .if dh                        ; if dh is set, it was a binary string
            mov eax, L$(n)
            deb 1, "Found a binary value in Windows.inc", eax$
            movzx edx, dl
         .endif
Here is a list of recognised (and not recognised) formats. Those marked in red will not work.
Quoteinclude \masm32\MasmBasic\MasmBasic.inc

.code   ; Teststrings
asc1   db "100", 9, "3", 0
asc2   db "100b", 9, "-260 (4)", 0
asc3   db "100h", 9, "-4", 0
asc4   db "(100)", 9, "5", 0
asc5   db "(100b)", 9, "-261 (5)", 0
asc6   db "(100h)", 9, "-5", 0
asc7   db "($100)", 9, "-5", 0
asc8   db "(0x100)", 9, "-6", 0
asc9   db "(100)", 9, "5", 0
asc10   db "(1e3)", 9, "5", 0
asc11   db "1e3", 9, "3", 0
asc12   db "(e100)", 9, "0, invalid format", 0
asc13   db "e100", 9, "0, invalid format", 0
asc14   db "(z100)", 9, "0, invalid format", 0
asc15   db "z100", 9, "0, invalid format", 0
asc16   db "-100", 9, "4", 0
asc17   db "-100b", 9, "-261 (5)", 0
asc18   db "(-100b)", 9, "-263 (7)", 0
asc19   db "-100h", 9, "-5", 0
asc20   db "(-100h)", 9, "-7", 0
asc21   db "+100", 9, "4", 0
asc22   db "+100b", 9, "-261 (5)", 0
asc23   db "+100h", 9, "-5", 0
asc24   db "(2e3)", 9, "5", 0
asc25   db "(2345e2)", 9, "8", 0   ; DotPos
asc26   db "(2.34e3)", 9, "8", 0
asc27   db "(2e3)", 9, "5",
13, 10, 0
asc28   db "(+100)", 9, "6 x", 0
asc29   db "(+100
b)", 9, "-263 (7) x", 0
asc30   db "(+100h)", 9, "-7 x", 0
asc31   db "{ 3E7h, 0h }", 0
asc32   db "(", 34, "SeMachineAccountPrivilege", 34, ")", 0
asc33   db 34, "SeMachineAccountPrivilege", 34, 0
asc34   db 34, "!<arch>",34, ", 10 xx this one fails with Windows.inc!", 0

start:
   Print "Result", Tb$, "#chars", Tb$, "Source", Tb$, "exp#chars", CrLf$
   ct=0
   REPEAT 34
      ct=ct+1
      tmp$ CATSTR <Print Str$("%i\t", Val(offset asc>, %ct, <)), Str$("%i\t", edx), offset asc>, %ct, <, CrLf$>
      tmp$
   ENDM
   Exit
end start


oex

I think I found a syntax error.... Shouldnt

Quoteinclude \masm32\MasmBasic\MasmBasic.inc

be

Quoteinclude \masm32\MasmBasic\MasmBasic.inc

?
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv

jj2007

Quote from: oex on December 04, 2009, 01:53:07 AM
Quoteinclude \masm32\MasmBasic\MasmBasic.inc
Would look better indeed, but for assembling the RichMasm editor exports a plain text temporary file, tmp_file.asm, so colours will be ignored anyway. I will change the template as shown below.
Quoteinclude \masm32\MasmBasic\MasmBasic.inc

oex

:lol sorry 2am and still writing code, the distraction was most welcome
We are all of us insane, just to varying degrees and intelligently balanced through networking

http://www.hereford.tv