how to create .com files using masm 5.10?
Asked Answered
M

3

4
.model tiny
.code

org 100h

host:
    mov ah,9
    mov dx,offset hi
    int 21h

    mov ax,4c00h
    int 21h

hi db 'HELLO'
end host

c: masm hello.asm

output of this says operand expected on line 1. Please tell me how to generate com files using this version of masm...

Marquardt answered 23/4, 2011 at 22:21 Comment(0)
N
6

I know this is raising a long dead thread but I thought I'd chime in here as I could not find the answer to this online very easily.

Cannot be done with 5.1, however you can use EXE2BIN (just search on google) to convert it to a com file.

You can also use 6.11 which can be found at http://www.phatcode.net/downloads.php?id=175.

Once you have that running, your hello world app would be:

.MODEL TINY
.DOSSEG     ; Make sure you are using dos segment CODE, DATA + STACK
.DATA
    MSG     DB  "Hello, World!", 0Dh, 0Ah, '$'
.CODE
.STARTUP    ; Setup the starting address otherwise you'll see:
            ; LINK : warning L4055: start address not equal to 0x100 for /TINY
    MOV     AH, 09h
    MOV     DX, OFFSET MSG
    INT     21h
    MOV     AH, 4Ch
    INT     21h
END

To compile: ML /AT HELLO.ASM (the /AT enables .MODEL TINY)

It should compile without warnings or errors tested on MASM 6.11 under MS-DOS 6.22 in DOSBOX.

Hope this helps someone who had the same issue as I.

Nevile answered 27/3, 2014 at 15:3 Comment(0)
L
3

It can be done in MASM 5.1 (or older). From the MASM 5.0 docs, here is the basic shell with your test program.

        TITLE COMFILE
_TEXT   SEGMENT
        ASSUME CS:_TEXT,DS:_TEXT,ES:_TEXT,SS:_TEXT
        ORG     100H

START:

    mov ah,9
    mov dx,offset hi
    int 21h

    mov ax,4c00h
    int 21h

    hi db 'HELLO','$'

_TEXT ENDS
END START

With the above file named COMFILE.ASM, assemble and convert to .com using the following steps:

A>MASM COMFILE;
Microsoft (R) Macro Assembler Version 5.00 
Copyright (C) Microsoft Corp 1981-1985, 1987.  All rights reserved.


  51668 + 464828 Bytes symbol space free

      0 Warning Errors
      0 Severe  Errors

A>LINK COMFILE;

Microsoft (R) Overlay Linker  Version 3.60
Copyright (C) Microsoft Corp 1983-1987.  All rights reserved.

LINK : warning L4021: no stack segment

A>EXE2BIN COMFILE.EXE COMFILE.COM

Which should produce:

A>DIR COMFILE.COM

 Volume in drive A has no label
 Directory of  A:\

COMFILE  COM       18  01-01-80   12:00p
        1 File(s)     30208 bytes free

A>COMFILE.COM
HELLO

A little thread necromancy here, yes. I also wasn't able to find a clear, working example of this elsewhere so hopefully this will help someone in the future.

Leister answered 8/1, 2019 at 18:15 Comment(0)
K
0

MASM 6.0 was the first version of MASM capable of using the tiny memory model and therefore the first version of MASM capable of producing COM files. It's not terribly difficult to find copies of MASM 6.11 around the internet, and MASM 6.11 is still capable of being used under pure DOS if necessary.

Source: http://support.microsoft.com/kb/24954

Kalinin answered 1/7, 2011 at 12:12 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.