flat assembler
Message board for the users of flat assembler.

Index > Windows > Simple Win32 E.g. Newbies

Author
Thread Post new topic Reply to topic
art_sands



Joined: 23 Oct 2003
Posts: 55
art_sands
Hi there,

I posted this example at www.vbforums.com to lure some people interested in assembly. May be they'll turn up here. I'm waiting. Privalov has done a lot of work for the FASM macro subsystem, so i've tried to keep this example as simple as possible using his macros. I decided to post this here for newbies so here goes:

Downloading and installing FASM
1. Download FASM for Windows Console and for Windows GUI from http://www.flatassembler.net.
2. First unzip console version into C:\fasm folder.
3. Then unzip GUI version into C:\fasm folder
4. Open all the files in a Multitab editor (e.g. TextPad) and replace in all text (.asm, .inc) files (in the fasm folder) the word "%include%" with "%fasminc%", otherwise egs may not work.

You should have this directory structure:

C:\fasm\
- INCLUDE
- SOURCE
- EXAMPLES

5. Before you start fiddling with the examples or my example, set this "fasminc" environment variable (specifies where the header files will be found):

For Windows 9x at this to autoexec.bat:
set fasminc=C:\fasm\include

(without the ending seperators ';' or '\' )

For Windows 2000/XP set this environment variables dialog:
a. Create new variable named "fasminc"
b. Add this path "C:\fasm\include", without the ending seperators ';' or '\', to this variable.


A bludy simple example
You're now ready to compile and run programs. We will use only the console version of the assembler. Put this into a plain-text file named "showmsg.asm".

A point to be noted is that this is an extremely simple program and there are macros hiding the background stuff that goes on, so this is only a starting point.

Remember Case is sensitive.

Code:
INCLUDE "%fasminc%\win32ax.inc"

.data

    MsgCaption      DB "Hello",0
    MsgBoxText      DB "win32asm is cool",0
    
.code            ; case-sensitive not equal to .CODE or .Code

WIN_START:

    invoke  MessageBox, NULL, MsgBoxText, MsgCaption, MB_OK
    invoke  MessageBox, NULL, "Hello, World!", "M$ Windoze", MB_OK + MB_ICONEXCLAMATION
    invoke  ExitProcess, 0

.end WIN_START
    


Compile this using the following command at the command prompt.

Code:
fasm showmsg.asm showmsg.exe
    


Regards,
Art
Post 01 Dec 2003, 13:42
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria
JohnFound
Quote:
Compile this using the following command at the command prompt.


IMHO, teaching VB users to use console version of FASM is a big mistate. Wink

Regards
Post 01 Dec 2003, 14:09
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
art_sands



Joined: 23 Oct 2003
Posts: 55
art_sands
HI John

That was a simple example. In the later ones i'm using fresh and radasm. Happy?

Regards,
Art
Post 01 Dec 2003, 14:11
View user's profile Send private message Reply with quote
JohnFound



Joined: 16 Jun 2003
Posts: 3500
Location: Bulgaria
JohnFound
Well, Fresh is still too raw and RadAsm too... I don't know.
FASMW will be great.

BTW: The idea to teach VB user to assembly is great. Smile

Regards
Post 01 Dec 2003, 14:52
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
art_sands



Joined: 23 Oct 2003
Posts: 55
art_sands
Thanks,

I dunno, but I hope ya guys can handle the traffic I'm planning to generate.

Regards,
Art
Post 01 Dec 2003, 15:04
View user's profile Send private message Reply with quote
Betov



Joined: 17 Jun 2003
Posts: 98
Betov
Begining this kind of advertising too early is a _BIG_ mistake.


Betov.
Post 01 Dec 2003, 15:45
View user's profile Send private message Visit poster's website Reply with quote
silkodyssey



Joined: 02 Oct 2003
Posts: 205
Location: St.Vincent & the Grenadines
silkodyssey
RadAsm or fasmw is tbe best option for fasm for vb programmers I think. They'll probably like RadAsm better though.

Quote:

I dunno, but I hope ya guys can handle the traffic I'm planning to generate.


art_sands, asm evangelist spreading the good word about asm to the lost souls programming with vb Very Happy Very Happy Very Happy

_________________
silkodyssey
Post 01 Dec 2003, 15:46
View user's profile Send private message MSN Messenger Reply with quote
roticv



Joined: 19 Jun 2003
Posts: 374
Location: Singapore
roticv
Can I say that art and odyessy are having fun at the VB forum?
Post 01 Dec 2003, 15:50
View user's profile Send private message Visit poster's website MSN Messenger Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 875
Location: Colombia
pelaillo
art_sands,
please do not cross-post.
If you have posted here, avoid posting the same content at win32asmcommunity forum. Smile
There is no sense in doing that. Each forum has a particular purpose and I'm sure you will reach your intended audience for each post.

Thanks,
pelaillo
Post 01 Dec 2003, 16:23
View user's profile Send private message Yahoo Messenger Reply with quote
art_sands



Joined: 23 Oct 2003
Posts: 55
art_sands
Sure pellailo. I won't do that.

Regards,
Art
Post 01 Dec 2003, 16:39
View user's profile Send private message Reply with quote
Ralph



Joined: 04 Oct 2003
Posts: 86
Ralph
Sorry to add yet more negative feedback, but I really don't think many if any VB kids will want to learn assembly, especially not using fasm. If the thought of using an IDE that requires more than dragging objects onto a premade GUI applications doesn't scare them off, having to real programming certainly will.
Post 02 Dec 2003, 03:53
View user's profile Send private message Reply with quote
silkodyssey



Joined: 02 Oct 2003
Posts: 205
Location: St.Vincent & the Grenadines
silkodyssey
Maybe you've described a typical vb programmer but there could be some of them who would be interested in asm and learning more about what goes on behind the premade GUIs. Smile

_________________
silkodyssey
Post 02 Dec 2003, 04:00
View user's profile Send private message MSN Messenger Reply with quote
Ralph



Joined: 04 Oct 2003
Posts: 86
Ralph
Why would they code VB in the first place then? :)
Post 02 Dec 2003, 04:17
View user's profile Send private message Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 875
Location: Colombia
pelaillo
Hey friends, a programmer is a programmer, no matter the language used to code and the reasons behind the choose.

Doing useful programs is more related to creativity and knowledge; data structures, technical specifications and algorithms rather than the tools to produce them.

Any good VB programmer has the ability and the knowledge to take advantage of FASM and become proficient quickly.
Even mixing VB projects with fasm code is easy and flexible.

It is loyable the effort to spread that information. Is a winning way for them but also for us. The larger the community, the greater the contributions.
Post 02 Dec 2003, 09:01
View user's profile Send private message Yahoo Messenger Reply with quote
scientica
Retired moderator


Joined: 16 Jun 2003
Posts: 689
Location: Linköping, Sweden
scientica
Ralph wrote:
Sorry to add yet more negative feedback, but I really don't think many if any VB kids will want to learn assembly, especially not using fasm. If the thought of using an IDE that requires more than dragging objects onto a premade GUI applications doesn't scare them off, having to real programming certainly will.

Laughing
I started wth QBASIC once (old dos version, couldn't compile to com or exe files, the things is created could only be run in qbaisc.exe), then I went to a period where I mixed VB, Pascal (got Delphi via a computer magazine that had a school in pascal - so I just had to try it) and C++. But there was always something that wan't satisfying (like I really hate all these damn (char*)typecasts), and I had this idea that learning asm would be L33T (and I'd get unrestricted access to the CPU, I thought - didn't know about privlieged stuff like ring3), but as I learned it I realised that it was more to it than just beeing cool, beeing "root". Basically why I chose to continue with asm was because I had a controll far beyound the reach of HLLs. I started with nasm, but went rahter quickly to MASM32 (hutch--'s package) becuase nasm apeared to be dead (couldn't find any tuts for win32, the offical homepages were dead, etc, but then I found fasm - and here I am Very Happy (I've learmned and program java now days too (school subject, can't say it's too hard - not to brag but I think I know my mark already, eventhought I/we haven't finished our java project - I'll see if I can put something on the web (gotta ask my class mate first)))

I rember how eay it's to make a game in Vb, just add some comtroll, and moveit on key press, add some buggy collision detection and voila, you have a mega game (in which you contoll a controll and driva round within the borders of a window and, well drive around for ever Smile ).

I don't know how hard it'd be use use oth asm and VB (it's possible - both are exes, one way or another :/), but from what I've heard interfacing with VB apps s a general pain in the 4$$. But using fasm and say C/C++, no problems (or atleast not so very big problems).

Just came to think of the *nnix philosophy, "divide and conquer", fasm is the tool for asm programming (and it does it the best IMO), Gimp is the tool for images, SodoPodi for vectors, I guess VB xor Pascal is good for Q&D (quick & dirty) and C/C++ good for math apps (when testing an algoritm)

_________________
... a professor saying: "use this proprietary software to learn computer science" is the same as English professor handing you a copy of Shakespeare and saying: "use this book to learn Shakespeare without opening the book itself.
- Bradley Kuhn
Post 02 Dec 2003, 09:39
View user's profile Send private message Visit poster's website Reply with quote
pelaillo
Missing in inaction


Joined: 19 Jun 2003
Posts: 875
Location: Colombia
pelaillo
scientica wrote:
... but from what I've heard interfacing with VB apps s a general pain in the 4$$.

When I've needed interfacing assembly to VB such as VBA in Excel (1) I use to send messages or to make a dll to be called from VB. It's a lot of creaming crap, but is easy.
If you want to link code objects, you need to intersect objects produced by VB compiler before the linker deletes them, but I have no reason to do that. It is easier to leave space and add snippets after the exe has been created.
----------
NOTES:
(1) When you are doing something for the office, people are familiar with Excel. IMHO, Excel is the only MS program that deserves the merit to become a world standard.
Post 02 Dec 2003, 10:33
View user's profile Send private message Yahoo Messenger Reply with quote
Blag



Joined: 04 Jul 2003
Posts: 90
Location: Perú
Blag
Well.......My story is kinda similar to Scientica......Long time ago.....almost 6 years.....I started my programming study, with C++ and VB both at the same time......then i moved to some QBasic and Pascal (wanted some roots)....Of course, i looked at Visual C++.
Then i get interested in HTML and Java, some Euphoria.......Later i get to work as a SAP Consultant (Not for SAP AG......just Consultant using SAP)....so i learned Abap and found the great PHP.

Later, when i meet some of my best friends Tommy.....he presented me FASM.......When i first started....ASM was like Scary to me......i was like......"Dude.....that's to hard Crying or Very sad "

But as long as i read the post in this forum, the Privalov's and Vid's Tutorials, the examples made by Tommy, Imagenieer and Scientica, i began to love and understand a little more of FASM......of course, i still a newbie.....and i really think that in the ASM world.....a newbie is always a newbie.....some are better, so are lesser....but the ASM world, never ends. Wink

I still made my programming in all the programming languages i know Twisted Evil and of course i'm still learning FASM as is one of the best and most powerfull of all of them.

Twisted Evil

_________________
Alvaro Tejada Galindo
SinglePath games design
http://www.iespana.es/singlepath
Post 02 Dec 2003, 19:48
View user's profile Send private message MSN Messenger Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar.

Powered by rwasa.