This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

RE: Assembler


Krzysztof Duleba wrote:
> I wanted to test some of my linux assembler code on my 
> Windows-Cygwin box.
> Is it possible at all?

I don't know about using BIOS calls, etc., but I've
assembled and linked a few NASM assembly functions.
I didn't use ELF format, though. There's a gnuwin32
format that works with Cygwin.

I've only ever linked them as functions called via
the C environment, but if you take the following:

 ; standalone.asm
 section .text
 extern  _printf
 global  _main
 _main:
         push    ebp
         mov     ebp,esp
         push    dword [value]
         push    dword format
         call    _printf
         add     esp, byte 8
         leave
         ret
 
 segment .data
 value           dd 0x87654321
 format          db 'Should be 87654321: %0lx',10,0

and assemble, link, and run it as follows:

 nasm -f gnuwin32 standalone.asm
 gcc standalone.o
 ./a.exe

It does the right thing. :-)

-Jerry

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]