Author Topic: How run a Masm program on a 64-bit Windows 8? (newbie)  (Read 27326 times)

Kenny_007

  • Guest
How run a Masm program on a 64-bit Windows 8? (newbie)
« on: September 27, 2013, 05:47:57 AM »
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

Vortex

  • Member
  • *****
  • Posts: 1993
Re: How run a Masm program on a 64-bit Windows 8? (newbie)
« Reply #1 on: September 27, 2013, 06:06:41 AM »
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 :

Code: [Select]
\masm32\bin\link16.exe

jj2007

  • Member
  • *****
  • Posts: 9684
  • Assembler is fun ;-)
    • MasmBasic
Re: How run a Masm program on a 64-bit Windows 8? (newbie)
« Reply #2 on: September 27, 2013, 06:32:12 AM »
apparently 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.

FORTRANS

  • Member
  • *****
  • Posts: 1056
Re: How run a Masm program on a 64-bit Windows 8? (newbie)
« Reply #3 on: September 27, 2013, 06:42:32 AM »
Hi,

   You can try DOSBox or Virtual PC to run 16-bit programs.
Search for those in the 16-bit sub-forum.

Regards,

Steve

Gunther

  • Member
  • *****
  • Posts: 3585
  • Forgive your enemies, but never forget their names
Re: How run a Masm program on a 64-bit Windows 8? (newbie)
« Reply #4 on: September 27, 2013, 07:27:06 AM »
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 for more details. Good luck.

Gunther
Get your facts first, and then you can distort them.

japheth

  • Guest
Re: How run a Masm program on a 64-bit Windows 8? (newbie)
« Reply #5 on: September 27, 2013, 02:51:34 PM »

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

The executable that the linker might create, however, will need a virtual environment, as it has already been mentioned above.

sinsi

  • Member
  • *****
  • Posts: 1182
Re: How run a Masm program on a 64-bit Windows 8? (newbie)
« Reply #6 on: September 27, 2013, 03:02:19 PM »
Looks like lnk563.exe is a DOS SFX but the link.exe contained in it is a PE file.
I can walk on water but stagger on beer bourbon.

Kenny_007

  • Guest
Re: How run a Masm program on a 64-bit Windows 8? (newbie)
« Reply #7 on: September 27, 2013, 04:29:29 PM »
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.

dedndave

  • Member
  • *****
  • Posts: 8823
  • Still using Abacus 2.0
    • DednDave
Re: How run a Masm program on a 64-bit Windows 8? (newbie)
« Reply #8 on: September 27, 2013, 06:16:25 PM »
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
Code: [Select]
        .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

Kenny_007

  • Guest
Re: How run a Masm program on a 64-bit Windows 8? (newbie)
« Reply #9 on: September 28, 2013, 01:39:18 AM »
thanks guys, but i still don't know how to actually 'run the program' and by run i mean to compile and then execute

jj2007

  • Member
  • *****
  • Posts: 9684
  • Assembler is fun ;-)
    • MasmBasic
Re: How run a Masm program on a 64-bit Windows 8? (newbie)
« Reply #10 on: September 28, 2013, 01:58:56 AM »
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

dedndave

  • Member
  • *****
  • Posts: 8823
  • Still using Abacus 2.0
    • DednDave
Re: How run a Masm program on a 64-bit Windows 8? (newbie)
« Reply #11 on: September 28, 2013, 02:05:24 AM »
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

Code: [Select]
\masm32\bin\ml /c MyFile.asm
\masm32\bin\Link16 MyFile.obj;

Gunther

  • Member
  • *****
  • Posts: 3585
  • Forgive your enemies, but never forget their names
Re: How run a Masm program on a 64-bit Windows 8? (newbie)
« Reply #12 on: September 28, 2013, 03:45:12 AM »
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
Get your facts first, and then you can distort them.

Kenny_007

  • Guest
Re: How run a Masm program on a 64-bit Windows 8? (newbie)
« Reply #13 on: September 28, 2013, 04:05:55 AM »
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:

Code: [Select]
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

Kenny_007

  • Guest
Re: How run a Masm program on a 64-bit Windows 8? (newbie)
« Reply #14 on: September 28, 2013, 04:07:06 AM »
by the way i saved it as an asm file, i just had to convert it to zip to post it here