flat assembler
Message board for the users of flat assembler.

Index > Main > cygwin

Author
Thread Post new topic Reply to topic
triglav



Joined: 20 Feb 2004
Posts: 6
Location: Slovakia
triglav
hi, I'm writing a cross-platform (win32, linux) game in C++ (SDL). I'd like to use asm for some optimizations. I'm using GCC compiler. win32 binaries are compiled using Cygwin. I'd like to know whether it is possible (in some way) to use FASM & Cygwin together. thx
Post 06 Aug 2004, 15:10
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
decard



Joined: 11 Sep 2003
Posts: 1092
Location: Poland
decard
just generate your output in COFF format, and link it with your game Smile
Post 06 Aug 2004, 15:34
View user's profile Send private message Visit poster's website Reply with quote
triglav



Joined: 20 Feb 2004
Posts: 6
Location: Slovakia
triglav
decard wrote:
just generate your output in COFF format, and link it with your game Smile


I'm using GNU Auto-tools system for building the whole project (source, scripts, documentation, etc.), have you any idea, how to solve the checking for extern (non Cygwin) application (FASM[W].exe)? is there any common used %FASM% like enviroment variable under win32?
Post 06 Aug 2004, 15:56
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
vid
Verbosity in development


Joined: 05 Sep 2003
Posts: 7105
Location: Slovakia
vid
only FASM's environment variable is %FASMINC% pointing to FASM's include directory. This directory is usually (99%) located inside directiry that contains compiler, so you can use "%FASMINC%\..\fasm.exe". Not general, but usually should work.
Post 08 Aug 2004, 17:33
View user's profile Send private message Visit poster's website AIM Address MSN Messenger ICQ Number Reply with quote
triglav



Joined: 20 Feb 2004
Posts: 6
Location: Slovakia
triglav
"usually" is philosophy of micro$oft, not mine Wink. another idea?
Post 09 Aug 2004, 21:07
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
ShortCoder



Joined: 07 May 2004
Posts: 105
ShortCoder
Shame Cygwin can't run direct Linux binaries. Also, since the fasm assembler is, itself, written in fasm, you are at a sort of "chicken and the egg" case here.

The only solution I can see, if you want fasm to work from within cygwin, is to port the fasm sourcecode to gas syntax, and then assemble the fasm executable from gas. Then you may proceed to code using fasm under cygwin.

Ugly, I know, but it's all I could come up with.

Better yet, once you have done that, then use the fasm executable generated from gas source to assemble another fasm executable, this time from the fasm source, and then use that final executable from then on?Very Happy (and contribute it to these boards, maybe;))

_________________
Boycott Symantec/Norton/PowerQuest whenever possible
Post 28 Aug 2004, 09:37
View user's profile Send private message Reply with quote
proveren



Joined: 24 Jul 2004
Posts: 68
Location: Bulgaria
proveren
Since you would do it only for some optimization, try to find a doc with the right syntax of the gcc _asm() directive(or function how should i name it?). It is very confusing indeed, but there is.

By the way avoid M$ and micro$oft notation. I got laughed at in the GameDev.Net forum when using it in a post.
Post 28 Aug 2004, 10:06
View user's profile Send private message Reply with quote
triglav



Joined: 20 Feb 2004
Posts: 6
Location: Slovakia
triglav
what do you think about NASM? Vid told me that it's dead however on linux platforms it's widely spread.
Post 28 Aug 2004, 10:16
View user's profile Send private message Visit poster's website ICQ Number Reply with quote
crc



Joined: 21 Jun 2003
Posts: 637
Location: Penndel, PA [USA]
crc
Quote:
what do you think about NASM? Vid told me that it's dead however on linux platforms it's widely spread.


It is still a good assembler. I used it for years (I didn't fully switch to FASM until this July). It has bugs, is updated infrequently, but the documentation that exists is good. Personally, I now prefer FASM though. (oh, other than some of the directives, and macro facilities, NASM and FASM are nearly compatible. For example, the FASM source for RetroForth can be converted to NASM by changing the macros and five or six lines of source code. (rb -> resb, file -> incbin, include -> %include, and so on)
Post 28 Aug 2004, 11:12
View user's profile Send private message Visit poster's website Reply with quote
Tomasz Grysztar
Assembly Artist


Joined: 16 Jun 2003
Posts: 7715
Location: Kraków, Poland
Tomasz Grysztar
It would be possible to create some headers allowing FASM to assemble some of the NASM syntax, something like:
Code:
%include fix include
resb equ rb
resw equ rw
resd equ rd
incbin equ file    

You can even try to emulate the simplest variants of NASM macros:
Code:
macro %macro count
 {
   0 fix
   1 fix %1
   2 fix %1,%2
   3 fix %1,%2,%3
   4 fix %1,%2,%3,%4
   5 fix %1,%2,%3,%4,%5
   6 fix %1,%2,%3,%4,%5,%6
   7 fix %1,%2,%3,%4,%5,%6,%7
   8 fix %1,%2,%3,%4,%5,%6,%7,%8
   def fix count
   0 fix _0
   1 fix _1
   2 fix _2
   3 fix _3
   4 fix _4
   5 fix _5
   6 fix _6
   7 fix _7
   8 fix _8
   macro def {
 }

_0 fix 0
_1 fix 1
_2 fix 2
_3 fix 3
_4 fix 4
_5 fix 5
_6 fix 6
_7 fix 7
_8 fix 8

%endmacro fix }

; Now some of the simplest macros from NASM documentation:

%macro  prologue 1

        push    ebp
        mov     ebp,esp
        sub     esp,%1

%endmacro

%macro  silly 2

    %2: db      %1

%endmacro    
Post 28 Aug 2004, 11:24
View user's profile Send private message Visit poster's website 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.