I'm totally new to Assembly programming and have no experience in the slightest, except for higher level languages. I've been able to download masm32 and it was all successful, however there are some problems: apparently I need a 16-bit linker to run my assembly code and whenever I try this my PC says it can't download this version.
Now, surely there must be a way to run an x86 assembly program using masm on a 64 bit windows 8. Also, I'm not too sure what I would type in at the command prompt to even compile and run the code. So can someone tell me how to run a masm program on a 64-bit os as well as any useful links. I wouldn't be asking this if I knew how to, so please no derogatory comments
Hi Kenny,
Welcome to the forum.
Windows 8 64-bit cannot run 16-bit applications :
http://answers.microsoft.com/en-us/windows/forum/windows_8-windows_install/how-to-run-16-bit-software-in-windows-8-64-bit/1a4b1493-27ae-488b-911a-ab4f9689b015
The 16-bit linker comes with the Masm32 installation :
\masm32\bin\link16.exe
Quote from: Kenny_007 on September 27, 2013, 05:47:57 AMapparently I need a 16-bit linker to run my assembly code
As Vortex already wrote, 16-bit code won't run on Win8. But 32-bit code will, and often it is very easy to port your source to 32-bit. Perhaps you should simply post it here (zip & attach), so that we see clearer what your options are.
Hi,
You can try DOSBox or Virtual PC to run 16-bit programs.
Search for those in the 16-bit sub-forum.
Regards,
Steve
Hi Kenny_007,
first things first: Welcome to the forum.
Steve aka FORTRANS is right: your only chance to launch 16 bit software under a 64 bit OS is a virtual machine. VirtualBox is another alternative. You may wish to check this thread (http://masm32.com/board/index.php?topic=2150.0) for more details. Good luck.
Gunther
The M$ 16-bit linker is a Win32 program, so it should run in Win64.
Here's a http download URL that should work: http://download.microsoft.com/download/vc15/Update/1/WIN98/EN-US/Lnk563.exe (http://download.microsoft.com/download/vc15/Update/1/WIN98/EN-US/Lnk563.exe)
The executable that the linker might create, however, will need a virtual environment, as it has already been mentioned above.
Looks like lnk563.exe is a DOS SFX but the link.exe contained in it is a PE file.
Alright I've successfully downloaded Dosbox and Virtualbox so how do I run a masm program? I took a simple x86 assembly code from a book i'm reading and I want it to execute it. Is it the same as C where you use gcc example.c -o example.exe or do I do something different? I would show the assembly code but it's quite lengthy although if you gys dont mind i'll happily post it.
you can attach a ZIP file to the reply
under the Reply window is a "link", Attachments and other options - just click on that
however, it isn't necessary - just use a simple example program until you get going
.MODEL Small
.STACK 2048
.DOSSEG
.386
OPTION CaseMap:None
;####################################################################################
.DATA
s$Msg db 'Hello World !',0Dh,0Ah,24h
;************************************************************************************
.DATA?
;####################################################################################
.CODE
;************************************************************************************
_main PROC FAR
mov ax,@data
mov ds,ax
mov dx,offset s$Msg
mov ah,9
int 21h
mov ax,4C00h
int 21h
_main ENDP
;####################################################################################
END _main
thanks guys, but i still don't know how to actually 'run the program' and by run i mean to compile and then execute
1. Copy & paste to MyCode.asm:
include \masm32\include\masm32rt.inc
.code
AppName db "Masm32:", 0
start: MsgBox 0, "Hello World", addr AppName, MB_OK
exit
end start
2. Open a console in the path of MyCode.asm and use these commands:
\masm32\bin\ml.exe /c /coff mycode.asm
\masm32\bin\link.exe /subsystem:console mycode.obj
And before complaining again that "it doesn't work",
- zip your code and attach it here
- provide us with
a) what you have done,
b) detailed error messages,
c) info on your setup
i think he's trying to run 16-bit code
but - the hard part is probably "how do i open a console window" - lol
i can't help you, there, as i don't have much experience with virtual systems under 64-bit
i can help you with the command lines, though
\masm32\bin\ml /c MyFile.asm
\masm32\bin\Link16 MyFile.obj;
Hi Kenny,
another attempt. Attached is the file hello.zip. It contains a simple hello world for testing your virtual machine with a DOS program. It works under DOSBox, VirtualBox and VirtualPC (tested).
Please have a look into b_hello.bat, which builds the running EXE.
A final word: Don't waste your time with 16 bit code. Check out the examples and tutorials inside the MASM32 package. 32 bit and 64 bit is the way to go. Good luck.
Gunther
I think you have me mistaken i'm not trying to write any 16 bit code, but when I wanted to compile an x86 asembly program using masm a website said a 16 bit linker was required. I've attached a simple program I got from a book I'm reading on assembly. So I'm not interested in 16 bit code at all, it's just that I've heard from places that you need a 16 bit linker to write an assembly program and the thing is, is that when I try to compile my program using the following command:
ml /c hello.asm
hello.asm(1) : fatal error A1000: cannot open file : Irvine32.inc
I'm pretty sure the code is x86 and i'm definitely using masm32. I guess i should've mentioned this at the start, my bad
by the way i saved it as an asm file, i just had to convert it to zip to post it here
deleted
Yes, Irvine32.inc must be in the path. In case you can't find it, here is a workaround:
include \masm32\MasmBasic\MasmBasic.inc ; download (http://www.masm32.com/board/index.php?topic=94.0)
include \masm32\MasmBasic\IrvineMb\Irvine32Mb.inc ; needed to build Irvine's (many but not all) 32-bit examples
.data
string_1 BYTE "abcde////",0
...
Works like a charm (except for trim_string, which does not trim anything ::)):
string_1 after trimming: abcde////
string_1 in upper case: ABCDE////
string_2 is less than string_1
Length of string_2 is 5
For the exact commandline, see reply #10. It's 32-bit code.
yes - you need the Irvine libraries, if you want to follow the book
personally, i would put the book back on the shelf, and install the masm32 package - lol
there are plenty of examples, help files, and tutorials
and - the forum members are helpful if you have questions
one problem with Kip's books is that he doesn't follow the intel/ms ABI
(which registers to preserve, how to pass arguments and return results)
II've not actually started delving into the book by Kip Irvine, but I really want a firm foundation for learning assembly. I know of the Art of Assembly but apparently that only teaches you high level assembly, so are there other good books where I can learn x86 assembly programming if the one i'm reading isn't too good?
how did you guys learn it
masm32 package is a good starting point ( see reply #17) :t