I am having the hardest time gettig started.
16 bit pure asm was so much easier.
And most of the example code I have has so little comments in it to explain what the code is doing.
Could someone tell me how to creat dialog boxes, read input from the boxes, open a file, edit a file, and save a file?
Yes I know that the masm software has help files, but those help files just arn't cutting it for me. The help files leave out the basic information.
From that I should be able to make progress, but as of yet I'm just going in circles.
It's kind of hard to test code when you don't even understand how to output your data to windows, even though the sample code is doing it for you. :-)
I can't just ride the sample software, I need to be able to drive it. :-)
Wayne Sallee
Wayne's Pets
Wayne@WaynesPets.com
You say 16-bit code was easier but you are just getting started? I'm confused. You don't need any windowing code, or windows at all, to learn 32-bit asm. Or are you saying you know asm just not how to interface to Windows? You have to learn asm before you mess with windowing stuff. Or at least you should.
QuoteCould someone tell me how to creat dialog boxes, read input from the boxes, open a file, edit a file, and save a file?
I've found that most Windows programming is knowing the Win32 API - looking up the functions in the SDK/MSDN/win32.hlp will usually tell you a lot
more than any comments would. If a function existed in DOS, chances are that win32 has one similar (or better).
Quote16 bit pure asm was so much easier.
32 bit pure asm is easy too...just add an E to everything (eax,esi,...) :bdg
The combination of MASM32 with the help file opcodes.hlp, the extensive example code,
Quick Editor (qeditor.exe) which gives access to the help files and many of the included tools
also getting the separate win32.hlp file that details the various API calls goes a long way
in writing 32 bit code.
Using some visual resource creating/editing utility will make creating dialogboxes easier.
The alternative is using a text editor on a rsrc.rc source text file but requires a multi step process of
alternately modifing text, compiling the resource, rebuilding the program to see the results.
The various example code covers reading input from editboxes, reading/writing files.
There is also the option of writing console mode 32 bit code, there are also examples for that.
The masm32 forum using search or just scanning posts and google search are quite invaluable.
Quote16 bit pure asm was so much easier.
With the old segmented architecture, 16-bit asm is more difficult than 32-bit asm in my opinion.
I recommend you get started using the GeneSys package - http://x86assembly.zapto.org/GeneSys.zip
It comes complete with a set of tutorials ('Iczelion') which will walk you through the basics of setting up a window, creating dialog boxes, doing text, etc -- after you've gone through about the first 6-7 you should get the hang of it and then be able to pick and choose whichever interest you most.
Just keep at it - it's easy once you know how :wink
Quote from: Tedd on April 28, 2007, 01:14:06 PM
I recommend you get started using the GeneSys package - http://x86assembly.zapto.org/GeneSys.zip
It comes complete with a set of tutorials ('Iczelion') which will walk you through the basics of setting up a window, creating dialog boxes, doing text, etc -- after you've gone through about the first 6-7 you should get the hang of it and then be able to pick and choose whichever interest you most.
Just keep at it - it's easy once you know how :wink
Ok, I'm downloading it right now. Thanks.
Wayne Sallee
Wayne's Pets
Wayne@WaynesPets.com
Quote from: drhowarddrfine on April 28, 2007, 03:36:12 AM
You say 16-bit code was easier but you are just getting started? I'm confused. You don't need any windowing code, or windows at all, to learn 32-bit asm. Or are you saying you know asm just not how to interface to Windows? You have to learn asm before you mess with windowing stuff. Or at least you should.
Some of you may find this to be strange, but I have always found asm to be much easier to understand and work with than high level languages, such as those that are included in the asm32 examples.
And working in dos is different than working in windows, and if one is going to be doing 32 bit code, it only makes sence to do it in windows. It makes no sence to me to code in 32bit code and just stick with a dos style screen.
Wayne Sallee
Wayne's Pets
Wayne@WaynesPets.com
Wayne,
Your last statement is correct. Remember the advice given by dsouza 123. the win32.hlp file goes into great detail for each API that is listed in it. Not all of them are in there, but the major ones that you will use in the beginning are all there. After that, there is us. Everyone here is willing to help. The idea of the examples is to show you how some things are done, but remember to try monkeying with some of the code to observe what happens. If you go too far astray you can always reboot.
Have fun,
Paul
Quote from: PBrennick on April 28, 2007, 11:38:22 PM
Wayne,
Your last statement is correct. Remember the advice given by dsouza 123. the win32.hlp file goes into great detail for each API that is listed in it. Not all of them are in there, but the major ones that you will use in the beginning are all there. After that, there is us. Everyone here is willing to help. The idea of the examples is to show you how some things are done, but remember to try monkeying with some of the code to observe what happens. If you go too far astray you can always reboot.
Have fun,
Paul
Ok, I'm downloading it now.
Wayne Sallee
Wayne's Pets
Wayne@WaynesPets.com
There is much to learn in console mode but if you already know asm then doing Windows is just learning the API and how to interface to it. My concern was getting enamored with the pretty blinking lights over actually learning how to code asm.
.data
MyBox db"This is my box",0
MyText db"This is my text",0
MyData db DWORD
db 0
.code
mov MyData,eax
invoke MessageBox,0,addr MyText, addr MyBox,0
Ok how do I get the "move" statement to work? This mov works in 16 bit. And even the 32 bit examples show it this way.
Wayne Sallee
Wayne's Pets
Wayne@WaynesPets.com
MyData db DWORD
db 0
.code
mov MyData,eax
> This mov works in 16 bit.
No. And if you don't see the - obvious - problem you can't have much experience in ASM, at least not with MASM: "db DWORD" will not define a DWORD variable.
> and if one is going to be doing 32 bit code, it only makes sence to do it in windows
I bet there exist people who don't agree. Me, for example.
Quote from: japheth on April 29, 2007, 05:28:38 AM
MyData db DWORD
db 0
.code
mov MyData,eax
> This mov works in 16 bit.
No. And if you don't see the - obvious - problem you can't have much experience in ASM, at least not with MASM: "db DWORD" will not define a DWORD variable.
> and if one is going to be doing 32 bit code, it only makes sence to do it in windows
I bet there exist people who don't agree. Me, for example.
In masm 16, I used Mydata DW 0
But masm 32 won't take that.
But you still have not answered my question.
And as far as not seeing the obvious, If you have never had a bug in a program that you looked for and looked for for ever finaly to find it and realize that the bug was so obvious, and were suprised that you did not see it, then you have not been doing much programing.
But as for me, it has been a number of years since I was deeply into computer programming. In fact most of my asm programing hours were spent years ago on a TRS 80 collor computer, with memory so small that you had to cut the program in pieces and then put the compiled code together to have the program. Then later I did some coding with masm 16, on windows 31, some on win 98, and some on windows xp, now I'm trying to get going on masm 32.
So why did you not answer my question? Were you affraid that you might give me a wrong answer, and that someone else would tell you that you were wrong?
Wayne Sallee
Wayne's Pets
Wayne@WaynesPets.com
Wayne,
Just get the swing of how data allocation works in either the .DATA or .DATA? sections.
For initialised data (data with a preset value) it looks like this.
.data
mynumber dd 1234
mytext db "zero terminated text in quotes",0
With UNinitialised data its like this.
.data?
mynumber dd ?
mybuffer db 128 dup (?)
The code you posted,
MyData db DWORD
i simply a notation error, you have two (2) conflicting data sizes and the second is being used for what the content should be.
MyData is the data objects name, "db" is the data type and by derivation its unit size but the DWORD is trying to put a data type where the content should be.
A snippet of code that may clear up declaring some common types of variables.
.data
varb0 db 3 ; both db and byte reserve a byte ( 8-bit)
varb1 byte 3
varw0 dw 3000 ; both dw and word reserve a word (16-bit)
varw1 word 3000
vard0 dd 3000000 ; both dd and dword reserve a dword (32-bit)
vard1 dword 3000000
varq0 dq 3000000000000000 ; both dq and qword reserve a dword (64-bit)
varq1 qword 3000000000000000
What's the 32 bit equivilant of the 16 bit "dw 0" statement?
Wayne Sallee
Wayne's Pets
Wayne@WaynesPets.com
dd 0
To initialize a dword in the .data section with 0
hold32 dd 0
To initialize a byte in the .data section with 0
hold8 db 0
To initialize a word in the .data section with 0
hold16 dw 0
To initialize a qword in the .data section with 0
hold64 dq 0
Heading off a point of confusion:
dd means data of type double word, 32 bits
db means data of type byte, 8 bits
dw means data of type word, 16 bits
dq means data of type quad word, 64 bits
When looking at a d? with ? == d,b,w,q ignore the leading d,
just look at the second character as the initial for the type.
Examples:
dd ignore the leading d, leaves d so the type is dword, aka double word, 32 bit
db ignore the leading d, leaves b so the type is byte, 8 bit
dw ignore the leading d, leaves w so the type is word, 16 bit
dq ignore the leading d, leaves q so the type is qword, aka quad word, 64 bit
edit: fixed dq had qw in error
Thanks dsouza123 !
That's what I needed to know.
note: at one point you typed "qw" instead of "dq".
I just though I would point that out in case someone else was wanting to learn from the post.
Thanks,
Wayne Sallee
Wayne's Pets
Wayne@WaynesPets.com
Quote from: WayneSallee on April 29, 2007, 12:56:53 PM
So why did you not answer my question? Were you affraid that you might give me a wrong answer, and that someone else would tell you that you were wrong?
No. I wanted to give you a chance to find the error yourself, which probably would have been more satisfying for you.
Quote from: japheth on April 29, 2007, 07:29:24 PM
No. I wanted to give you a chance to find the error yourself, which probably would have been more satisfying for you.
No it would not have been more satisfying to me. I already have enough self confidence, thank you :-)
Wayne Sallee
Wayne's Pets
Wayne@WaynesPets.com