Hey is valid a modification to nasm??

In the last days i was modificating nasm.. and i do ;), now can suport in a more direct way struct and unions, also nested or for exaple if you define some like:

aMember aDataType

you have a valid name, etc. i try add all the functionality that have or i see in C struct/unions, also suport the block of selections inside the sutrct/unions...

I am happy that i can modificate, at less works ok.. and as I spected.

I will not attach here, i send the code to frank.

I don know if is a good implementation.. i dont know much of compilers and such tings.. near to nothing.. i dont understand BNF.. but i see that i can implement this and i do.

If this modification is not used in the normal package of nasm, i will use on my own. ;).

Also i need that i learn some things reading the code.. and modificating sure, and understand ther things. and learn about how to program.

In fact i learn some about the diferent ways.. for example.. i start in a way of two fases.. or steps.. the first, was the definition of the data type, and the second was the insertion for later use. I know that i can skeep this step, and only do one step. But i was in front of a really heavy structure.. in the manipulation.. lol, and the later implementations let me see that really i can skeep this step without problems..

The whole time take me do this modifications was like 20 days:
The days of work that i take was distributed in:

4 days of quake
6 days of do nithing... or think and pass the time

10 days of work:
divided in:

like 6+/- days of work in the point of view one (with two steps)
like 2 +/- days of implementation in the second point of view (skeeping the first step)

uuhh??.. the sume(addition) are not 10... lol the other 2 days.. the ufo capture me.. i think.. dont remember.

Ok, the point here is that i want your feedback about the modification that I do, ok, that is all.. i think.

If the code is not put in the CVS of nasm, then i post here for your feedback.

Also and only this addition is only not to write some like:


now you can do some like:

NOTE: i see that skeep and skeeping is not in your idiom.. the correct word is skip and skiping.. the pronunciation play with me in this word. Thing diferent, almost I done!!!.. :S:confused:

Nice day.:alright:
Posted on 2003-06-30 11:58:56 by rea
Ok, i terminate this but only cover my necessities... i not cover initialized structs/unions but this is a strong part like initialize tables of structs and such things in the code and not in the run time this is the major left thing, but have cualified names for registers.. ok an example of how look like (with a macro for funct and in front of the locals a '.' ;) ).

%include "\lab\vasm\inc\win32n_.inc"
%include "\lab\vasm\inc\F_4_n.inc"

def WinMain, 4
def WndProc, 4
section data class = data use32 align=16
section code class=code use32 aling=16

var hInstance, HINSTANCE
call GetModuleHandle, NULL
mov dword[hInstance], eax
var cmdLine, LPSTR
call GetCommandLine, NULL
mov dword[cmdLine], eax
call WinMain, [hInstance], NULL, [cmdLine], SW_SHOWDEFAULT
call ExitProcess, eax

funct WinMain, hInstance, hPInst, lpCmdL, nCmdShow
sizef 80
local wc, WNDCLASSEX, msg, MSG, hwnd, HWND
%makedata WNDCLASSEX .wc
%makedata MSG .msg

mov dword[.wc.cbSize], WNDCLASSEX_size
mov dword[.wc.style], CS_VREDRAW | CS_HREDRAW
mov dword[.wc.lpfnWndProc], WinProc
mov dword[.wc.cbClsExtra], NULL
mov dword[.wc.cbWndExtra], NULL
mov eax, dword[.hInstance]
mov dword[.wc.hInstance], eax
mov dword[.wc.hbrBackground],COLOR_WINDOW+1
mov dword[.wc.lpszMenuName], NULL
var ClassName, "CLASSNAME"
mov dword[.wc.lpszClassName], ClassName
mov dword[.wc.hIcon], eax
mov dword[.wc.hIconSm], eax
call LoadCursor, NULL, IDC_ARROW
mov dword[.wc.hCursor], eax
lea eax, [.wc]
call RegisterClassEx, eax
var AppName, "AppName:"
call CreateWindowEx, NULL,\
mov dword[.hwnd], eax
call ShowWindow, [.hwnd], [.nCmdShow]
call UpdateWindow, [.hwnd]
lea eax, [.msg]
call GetMessage, eax, NULL, 0, 0
cmp eax, 0
jb .erro
je .fin
lea eax, [.msg]
call TranslateMessage, eax
lea eax, [.msg]
call DispatchMessage, eax
jmp .loop
call MessageBoxA, 0, "ERROR", "Saliendo", MB_OK
mov eax, dword[.msg.wParam]

funct WinProc, hWnd, uMsg, wParam, lParam
mov eax, dword[.uMsg]
cmp eax, WM_DESTROY
call DefWindowProc, [.hWnd], [.uMsg], [.wParam],[.lParam]
var hola, "hola mundo"
mov eax, [.wParam]
call PostQuitMessage, 0

and the structs look like:

cbSize resd 1
cbClsExtra resd 1
cbWndExtra resd 1
hIconSm resd 1


emr EMR
ihBrush resd 1

NOTE: things like
hwnd resd 1
hWndInsertAfter resd 1
x resd 1
y resd 1
lx resd 1
ly resd 1
flags resd 1

the member lx is cx and this name can be corrected and used in the normal way of the win 32 api....

OTher note: apparently the time of compile is decreased a little.. i think like a half with a large file like the modified win32n_.inc for compatibility with this "sintaxis".

We need wait more for see this in a Good version of nasm, i have this like a approach objetive ;) i will try for second time.. I for now... i can say only... in the flavour of movies of vogue ....

I'll be back !!!!!

Remember that i start this from scratch in the way that i know only what was a compiler.. in this case a assembler, now i see other posibilible ways.. and sure more rude ;).. that will require more and strong knowledge by my part.

I think maybe in the future we can have a version of nasm that can do this in the correct way, but for now I think that i will keep this version for my.. maybe not...????, but this is for have only one version of nasm... maybe i try to belike a patch.. (diff) for the source code... and only in that way i think will be the correct form...

A sorry for the anterior post.. but i was very happy or some that was my first aproach of do this ;)

Nice day.:alright:
Posted on 2003-08-01 23:14:28 by rea
Nifty :-) I wonder if frank's actually included this yet
Posted on 2004-10-01 20:58:51 by Al_Leitch
No, actually that is not implemented, and should not be implemented (at less in that way), altought like I say without a real mesuring tool can be feeled naturally that the speed is at more the half of assembly time with that modification.

The modification was "reflected"(rechazada) dont know how to say it, because it cant initialize correctly data, it has no suport for initialization of structures in x source code. Also it uses extensively the hash of the macros, also I have the problem that I allocate memory but never free it (bad habit). There where other things, and also I acept that in some way is more "easy" understand the mean of

it show a little more than wnd.cbSize but is normally prefered the second for the ones that come from C/++

I guess will be nice try implement it, or rewrite it ;) is some that I have in mind from time a go... but you see, there are a ton of projects that I whant, let organize me more ;).

Have a nice day or night.
Posted on 2004-10-01 22:40:47 by rea
hi hgb,

I agree with you. Nasm must provide some HLL structs for its users. I don't like primitive assemblers. Todays assembler must include at least the followings.

1) As you said before, there must be a easy way to access structure members. Especially when we encounture nested structres, syntax look horrible.
I prefer this

2) There must be HLL macros inside assembler itself. If users prefer HLL macros (like .if, .elseif, .else, .endif ), assembler must give this opportinity to its users. In this way no one have to invent their own HLL macros again and again.

3) I'm sure I'm not the only one who says such things. Developer says nasm provide very advanced macro capability. Yes they are right. Macro capability must be developed much more. But it is not the same thing: assembler has macro capability doesn't means assembler has standart HLL capability inside it. I also want to code something like below without any include file.

?f eax=5
elseif eax=4||3||1


if eax=xxx&&zzz

best regards
Posted on 2004-10-28 11:02:32 by highenergy