delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2004/02/17/11:41:57

Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sources.redhat.com/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sources.redhat.com/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com
content-class: urn:content-classes:message
MIME-Version: 1.0
Subject: RE: Assembler
Date: Tue, 17 Feb 2004 11:41:29 -0500
Message-ID: <AE2AA130827456459AA497E8C9D6EA00412BF3@pauex2ku02.agere.com>
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
From: "Williams, Gerald S (Jerry)" <gsw AT agere DOT com>
To: <cygwin AT cygwin DOT com>
X-OriginalArrivalTime: 17 Feb 2004 16:41:29.0334 (UTC) FILETIME=[E464F960:01C3F574]
X-MIME-Autoconverted: from quoted-printable to 8bit by delorie.com id i1HGfs43013909

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/


- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019