The MASM Forum Archive 2004 to 2012

General Forums => The Workshop => Topic started by: bunnyboi on June 07, 2009, 07:12:49 AM

Title: MASM on Linux
Post by: bunnyboi on June 07, 2009, 07:12:49 AM
Don't really know if this exactly fits in here, but MASM is working on wine. Which should be great news for thoes of you who would like to use it on Linux as well. I got it up and running on my Linux box which is running the latest version of wine on Slackware 12.2. I also added it to the wine app database, and added myself as a maintainer.
Title: Re: MASM on Linux
Post by: ecube on June 07, 2009, 07:18:41 AM
that most likely violates Microsofts copyrights, but goodjob, I guess.
Title: Re: MASM on Linux
Post by: UtillMasm on June 07, 2009, 07:21:08 AM
VMware Workstation for Linux + Windows Vista + Masm32
it is very stable on Linux.
Title: Re: MASM on Linux
Post by: Vortex on June 07, 2009, 07:26:38 AM
Hi bunnyboi,

Have look at Jwasm, a MASM compatible assembler. It can run on Linux :

QuoteJWasm Features:
- JWasm natively supports output formats Intel OMF, MS COFF, ELF and BIN.
- JWasm binaries are available for DOS, Windows and Linux.
- Instructions up to SSSE3 are supported.
- The JWasm source is portable and has successfully been tested with Open Watcom, MS VC and GCC.
- As far as programming for Windows is concerned, JWasm can be used with both Win32Inc and Masm32.
- C header files can be converted to include files for JWasm with h2incX.

http://www.japheth.de/JWasm.html
Title: Re: MASM on Linux
Post by: ookami on February 16, 2011, 12:02:34 AM
Up. :eek

About JWasm :

Are all the MASM32 macros and procedures calls working on it, while running with Linux ?

Thanks.
Title: Re: MASM on Linux
Post by: hutch-- on February 16, 2011, 01:02:24 AM
Read the MASM32 licence.
Title: Re: MASM on Linux
Post by: brethren on February 16, 2011, 06:14:15 AM
yeah that doesn't fly with masm32's license thats why ive been trying to rewrite all the macros and procs, its going pretty well (although slooow) and so far i can compile a fair few simple programs under linux,

btw if anybody wants to donate any macros cfm$, switch or any macro coz i'd rather write code than macros:)
or you could donate code, you don't need to be a linux coder, just pick something from the masm32 docs and write it. doesn't matter how small it could be anything from szRev to the boyer moore algos

heres a small test program that work both under linux and windows (just change the include)
INCLUDE lasm32rt.inc

.data?
buf BYTE 40 DUP(?)

.code
start:
cls
mov ebx, input("a signed 32 bit number: ")

print "address: "
print hex$(ebx), " = "                      ;whats the point of a signed and unsigned hex macro uhex$, lol
print ebx, 13, 10, 13, 10

print "the number you entered is "
print ustr$(len(ebx)), " characters long", 13, 10

mov esi, sval(ebx)
        fn dw2bin_ex, esi, ADDR buf                 ;is there a macro for binary? like bin$ or something

        print ADDR buf, " = binary", 13, 10
print ustr$(esi), " = unsigned", 13, 10
print sstr$(esi), " = signed", 13, 10
print hex$(esi), " = hexadecimal", 13, 10

exit
end start
Title: Re: MASM on Linux
Post by: dedndave on February 16, 2011, 11:37:23 AM
why not use JwAsm - or some other assembler ?
Title: Re: MASM on Linux
Post by: ookami on February 16, 2011, 11:57:28 AM
But you can't use all the procs and macros...
Title: Re: MASM on Linux
Post by: jj2007 on February 16, 2011, 12:31:44 PM
Quote from: ookami on February 16, 2011, 11:57:28 AM
But you can't use all the procs and macros...

JWasm is fully (99.5%) compatible with Masm. All Masm32 macros work. Even MasmBasic works fine with JWasm.
Title: Re: MASM on Linux
Post by: jcfuller on February 16, 2011, 12:44:55 PM
Quote from: jj2007 on February 16, 2011, 12:31:44 PM
Quote from: ookami on February 16, 2011, 11:57:28 AM
But you can't use all the procs and macros...

JWasm is fully (99.5%) compatible with Masm. All Masm32 macros work. Even MasmBasic works fine with JWasm.

Yes, but you can't use any macros or code from Hutch's masm32  package on Linux.

James
Title: Re: MASM on Linux
Post by: dedndave on February 16, 2011, 12:59:52 PM
i am not sure if Hutch cares about using the package on linux - or at least, parts of it
he is bound by the ms license for masm, though

but you aren't supposed to use masm on any OS other than windows
E^cube, Erol, Hutch, et al have already said as much - a year and a half ago

i think the effort would be better spent making a legal package that might be widely distributed
otherwise, all the effort is really only of use to you
Title: Re: MASM on Linux
Post by: ookami on February 16, 2011, 01:36:56 PM
Is there a library, i mean complete like the masm32 one, that I can use under Linux ? (even if it's not MASM compatible, I'll use NASM or another assembler).
Title: Re: MASM on Linux
Post by: dedndave on February 16, 2011, 01:44:30 PM
here's a good place to look....
http://sourceforge.net/projects/jwasm/forums/forum/927109
i am sure there are a number of linux/asm forums around, as well

if you don't have any luck, then you have at least defined the goal of a good project   :bg

Hutch's package makes it easy to get started in win32
i try to understand all the pieces of it, though
in other words, if i use the print macro - i know what it does and how it does it
i try not to rely on Hutch or anyone else to carry my ass all the way - lol - just help me out a little
Title: Re: MASM on Linux
Post by: ookami on February 16, 2011, 02:09:37 PM
Thanks :U

Quote from: dedndave on February 16, 2011, 01:44:30 PM
Hutch's package makes it easy to get started in win32
i try to understand all the pieces of it, though
in other words, if i use the print macro - i know what it does and how it does it
i try not to rely on Hutch or anyone else to carry my ass all the way - lol - just help me out a little

That's great, I try to do the same too.
But is it possible to do that with the Windows API itself ? (I mean to look inside the code to know how it's built). I guess it's not...
Title: Re: MASM on Linux
Post by: dedndave on February 16, 2011, 02:42:36 PM
you can with some debuggers
but - you can't change how the API works   :P
you CAN change the code that runs under it
i guess, for linux, you can change how it works - that's why there are a million versions of it
Title: Re: MASM on Linux
Post by: jcfuller on February 16, 2011, 04:08:12 PM
Quote from: dedndave on February 16, 2011, 12:59:52 PM
i am not sure if Hutch cares about using the package on linux - or at least, parts of it

Dave,
  I don't mean to speak for him but you know how he feels about Open source so I think he does care.

James
Title: Re: MASM on Linux
Post by: dedndave on February 16, 2011, 04:26:04 PM
Hutch doesn't have a problem with open source
he does have a problem with the GPL implementation of it - lol
of course, he doesn't want you to stick a different name on it and call it your work, either

Hutch has to abide by the rules set forth by MS regarding the use of masm
because the libraries are created using masm - they probably fall under that catagory

he is a very reasonable person
he doesn't want his stuff "stolen" or used for malicious purposes
he doesn't want the forum to get into trouble, either
beyond that, it seems that he is as liberal as he can be with the material
afterall, you are able to make an application using the resources he provides and call it your own

also - he uses linux for the masm32 site, if i'm not mistaken
i am sure he has written some kind of linux asm code   :bg
Title: Re: MASM on Linux
Post by: brethren on February 16, 2011, 04:44:16 PM
Quote from: dedndave on February 16, 2011, 12:59:52 PM
i am not sure if Hutch cares about using the package on linux - or at least, parts of it
he is bound by the ms license for masm, though


i think he cares a lot about where masm32 is used but just in case i've got the wrong end of the stick i'd like this question cleared up once and for all. could a linux port of the masm32 libs/macros be attempted using jwasm?
Title: Re: MASM on Linux
Post by: jj2007 on February 16, 2011, 04:49:23 PM
Quote from: jcfuller on February 16, 2011, 12:44:55 PM
Yes, but you can't use any macros or code from Hutch's masm32  package on Linux.

That's correct. I can trim MasmBasic so that it does not use \masm32\include\masm32.inc and \masm32\macros\macros.asm, but Windows.inc, gdi32, kernel etc are still needed.
Title: Re: MASM on Linux
Post by: dedndave on February 16, 2011, 04:53:55 PM
Quotecould a linux port of the masm32 libs/macros be attempted using jwasm?

only Hutch can answer that question - or sanction such a project

i would think Windows.inc, gdi32, kernel etc are pretty useless under linux   :P

the real meat for linux, then, is the code in macros and proc functions - much of which would require modification
Title: Re: MASM on Linux
Post by: jj2007 on February 16, 2011, 08:07:29 PM
Quote from: dedndave on February 16, 2011, 04:53:55 PM
Quotecould a linux port of the masm32 libs/macros be attempted using jwasm?
i would think Windows.inc, gdi32, kernel etc are pretty useless under linux   :P

With Wine it should be possible to use Windows.inc, gdi32, kernel etc
Title: Re: MASM on Linux
Post by: brethren on February 17, 2011, 12:10:39 PM
what i'd like to be able to do is assemble simple programs that rely on masm macros, masmlib, and the c library between platforms. obviouslly i'm not talking about any of the windows specific header/libs, i'm talking about simple console programs, like algo demos, timing tests etc. the kind of stuff thats posted to the forum evey day
i think it should be possible with a bit of effort
Title: Re: MASM on Linux
Post by: dedndave on February 17, 2011, 12:23:26 PM
well - that doesn't sound too difficult, actually
it is just a matter of converting a few API's (unless you are using wine <--- qualifier for Jochen   :bg )
you are talking StdOut, keyboard, and a few type conversion routines

print, uhex$, str$, ustr$, inkey would cover most test programs we run
i would think uhex$, str$, ustr$ might work as is
some guys like to go nuts with string conversion macros, but those wouldn't be too hard, either
just have to replace the msvcrt stuff

MichaelW's timing macros should work

now - that applies to most algo testing
some things, like disk i/o tests, would be a job
Title: Re: MASM on Linux
Post by: brethren on February 17, 2011, 01:18:00 PM
yeah its not actually too difficult, just slow. i've done 17 macros and 11 procs (yeah basically i've not even started :P) so far but the hardest problem i see at the moment is the dynamic heap allocation. i may just skip the problem until later and focus on the easy stuff ie file i/o through syscalls
Title: Re: MASM on Linux
Post by: jcfuller on February 17, 2011, 01:43:25 PM
Here is a link with Raymond's fp library attached
http://www.masm32.com/board/index.php?topic=12932.0

I converted a number of macros myself but got side tracked on other things. I'll see if I can find them.

James
Title: Re: MASM on Linux
Post by: hutch-- on February 17, 2011, 01:49:09 PM
I don't see why folks who want to write code in Linux can't use JWASM and write a reliable library for it. Libraries are accumulative things, the more you write the more you can do.
Title: Re: MASM on Linux
Post by: brethren on February 17, 2011, 05:02:39 PM
Quote from: jcfuller on February 17, 2011, 01:43:25 PM
Here is a link with Raymond's fp library attached
http://www.masm32.com/board/index.php?topic=12932.0

I converted a number of macros myself but got side tracked on other things. I'll see if I can find them.

James


thanks:)

QuoteI don't see why folks who want to write code in Linux can't use JWASM and write a reliable library for it. Libraries are accumulative things, the more you write the more you can do.

people like to stick with what they know:)
Title: Re: MASM on Linux
Post by: dedndave on February 17, 2011, 06:23:37 PM
i guess i can understand wanting to compare algo performance between linux and windows
if everything is working the way it should, you ought to get the same result for most algos
well - that's in a perfect world   :P