flat assembler
Message board for the users of flat assembler.

Index > Main > My first fasm program

Author
Thread Post new topic Reply to topic
kandamun



Joined: 20 Jul 2005
Posts: 25
kandamun 28 Jul 2005, 12:02
I decided to brush up my rusty asm skills a few months ago.
When I tried to understand what happened to the NASM project, it apeared
to be a big mess. Then I found FASM which reminds me to a86 with how quickly one can throw in some code and have a working program in seconds.
So to get used with FASM I decided to write s.th. simple, and here is the result.
I'll appreciate any comments, brick, beers etc. you throw at me.

PS: Big thanks to Tomasz for the great product he gave us for free.

PS2: My wishlist:
for struc MyStruc { ... }
- auto generated MyStruc.size constant
- anonymous MyStruc objects
- compile time macros w/ parameters like
Code:
%define HIWORD(a) ((a) shl 16)
%define LOWORD(a) ((a) and 0xFFFF)
    


Description:
Download
Filename: cpuid.asm
Filesize: 5.38 KB
Downloaded: 1753 Time(s)

Post 28 Jul 2005, 12:02
View user's profile Send private message ICQ Number Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 02 Aug 2005, 13:49
problem exiting MessageBox on Win98SE
I'll dig into this at home...got to go Smile
Post 02 Aug 2005, 13:49
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 02 Aug 2005, 15:51
Quote:
auto generated MyStruc.size constant

"struc" directive isn't used only for structure declaration, it's use is much wider and thus this wouldn't be possible.

Quote:
anonymous MyStruc objects

again, "struc" is just named "macro", otherwise they are same.

For structure declaration you want, there is "struct" macro somewhere here.... very complex, allows everything and does everything you want. And if not it's possible to add anything you want to it Smile

Quote:
compile time macros w/ parameters like...

impossible, you'll find out later, it would only cause mess. anyway in assembler HIWORD and LOWORD isn't very needed, only on constant values. It can't be used on variables like in C.
Post 02 Aug 2005, 15:51
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
Tomasz Grysztar



Joined: 16 Jun 2003
Posts: 8359
Location: Kraków, Poland
Tomasz Grysztar 02 Aug 2005, 16:36
Quote:
Quote:
auto generated MyStruc.size constant

"struc" directive isn't used only for structure declaration, it's use is much wider and thus this wouldn't be possible.

And even if it was used only for structure declarations, it still wouldn't be possible, since the structures declared with "struc" may be of variable length.
Post 02 Aug 2005, 16:36
View user's profile Send private message Visit poster's website Reply with quote
kandamun



Joined: 20 Jul 2005
Posts: 25
kandamun 04 Aug 2005, 17:12
Madis731 wrote:
problem exiting MessageBox on Win98SE
I'll dig into this at home...got to go Smile

It exits with ret - so the stack is broken. What is your processor?

Quote:

impossible, you'll find out later, it would only cause mess. anyway in assembler HIWORD and LOWORD isn't very needed, only on constant values. It can't be used on variables like in C.

Do you preffer to write every time
Code:
db (A_CONST shr 8) and 0xFF 
mov al, (A_CONST shr 8) and 0xFF 
    
Post 04 Aug 2005, 17:12
View user's profile Send private message ICQ Number Reply with quote
Madis731



Joined: 25 Sep 2003
Posts: 2139
Location: Estonia
Madis731 05 Aug 2005, 19:29
Intel Pentium III E
Coppermine 600MHz. Mobility? - Its in a laptop and has speedstep.
I think that stepping is important - 686
extended family is 0.0.cC0 (reported by the CPUz 1.29).
I checked with OllyDbg and by hand...the rets pops and pushes are balanced and it just should exit with ExitProcess,0 -> then it will be alright.

PS Though, it is alright in NT platforms Smile
Post 05 Aug 2005, 19:29
View user's profile Send private message Visit poster's website Yahoo Messenger MSN Messenger Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid 06 Aug 2005, 08:52
Quote:

impossible, you'll find out later, it would only cause mess. anyway in assembler HIWORD and LOWORD isn't very needed, only on constant values. It can't be used on variables like in C.

Do you preffer to write every time
Code:
db (A_CONST shr 8) and 0xFF 
mov al, (A_CONST shr 8) and 0xFF 
    
[/quote]
yup, since i already have written few larger projects in assembly and never really needed this often. and by the way, what you wrote isn't HIWORD, it's like:
HIWORD(A) = (a shr 16)
LOWORD(A) = (a and 0FFh)
so it isn't lot more typing than typing LOWORD Smile. and is too pretty self-explainative
Post 06 Aug 2005, 08:52
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number 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-2025, Tomasz Grysztar. Also on GitHub, YouTube.

Website powered by rwasa.