News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

trying 32-bit in dos help

Started by www.:).com, December 01, 2010, 02:53:59 AM

Previous topic - Next topic

www.:).com

I'm trying to use the 32 bit assembler to assemble my 16 bit code I know it works, but when i try to assemble with the 32 bit assembler it gets errors.
-It is a simple program i wrote for 16 bit and works fine, why will it not work with 32 bit.
.model small
.stack
.data
MsgPrint db "HELLO WORLD!!!", "$"

.code
AppMain:
    mov ax, seg MsgPrint
    mov ds, ax
    mov ah, 09
    lea dx, MsgPrint
    int 21h
    mov ax, 4c00h
    int 21h
end AppMain

A simple print program.

clive

Perhaps you are not using the 16-bit linker?
It could be a random act of randomness. Those happen a lot as well.

japheth

Quote from: www.:).com on December 01, 2010, 02:53:59 AM
I'm trying to use the 32 bit assembler to assemble my 16 bit code I know it works, but when i try to assemble with the 32 bit assembler it gets errors.

Too bad! But that's life!

I hope this helped!




www.:).com

lol, So how do I use the 32-bit assembler, but use the 16 bit linker? -or cant I?
-Is ml.exe a 32 bit assembler or a 16 bit - I thought it was 16 bit, am I correct?
-Usually when i assemble my programs I first assemble it with ml.exe them link it with link16.exe.

redskull

ml can produce either 16 or 32 bit code
link can produce 32-bit Windows EXE files
link16 can produce 16-bit DOS EXE or COM files
no build tools on earth can take 16-bit DOS code and make it into 32-bit Windows code.  That's what programmers are for.

Posting the actual errors you are getting will probably help in getting actual answers, instead of snarky responses. 

Strange women, lying in ponds, distributing swords, is no basis for a system of government

dedndave

you can use 32-bit registers in 16-bit code, however

www.:).com

Quote from: dedndave on December 01, 2010, 05:46:10 PM
you can use 32-bit registers in 16-bit code, however
How would I do that?



Quote from: redskull on December 01, 2010, 05:44:19 PM
ml can produce either 16 or 32 bit code
link can produce 32-bit Windows EXE files
link16 can produce 16-bit DOS EXE or COM files
no build tools on earth can take 16-bit DOS code and make it into 32-bit Windows code.  That's what programmers are for.

Posting the actual errors you are getting will probably help in getting actual answers, instead of snarky responses. 
How do I tell ml.exe to do 32 or 16 bit code or don't I - dose it just know?
-As for showing you the errors here it is:


Microsoft (R) Macro Assembler Version 16.14.8444
Copyright (C) Microsoft Corp 1981-1997.     All rights reserved.

Assembling: C:\masm32\bin\MsgPrint.asm
C:\masm32\bin\MsgPrint.ams(8) : error A2004: symbol type conflict
C:\masm32\bin\MsgPrint.ams(16) : warning A4023: with /coff switch, leading underscore required for start address : AppMain
_
Assembler Error
Press any key to continue . . .

This was assembled by qeditor.exe - tool bar -> Project -> Build All

redskull

the .model directive 'tells' ml which code to build, in your case ".model small" says you are making a DOS exe.  You build it by:

ml /c /omf program.asm
link16 program.obj

if you want to make 32-bit Windows code, you make it '.model flat', remove all the code relating to interrupts and segment registers, and use

ml /c /coff program.asm
link program.obj

-r
Strange women, lying in ponds, distributing swords, is no basis for a system of government

www.:).com

Quote from: redskull on December 01, 2010, 06:11:04 PM
the .model directive 'tells' ml which code to build, in your case ".model small" says you are making a DOS exe.  You build it by:

ml /c /omf program.asm
link16 program.obj

if you want to make 32-bit Windows code, you make it '.model flat', remove all the code relating to interrupts and segment registers, and use

ml /c /coff program.asm
link program.obj

-r
I tried it and got errors that say: invalid command-line option : /omf

redskull

I'm certain that version 16 of MASM you are using supports it!  :toothy

But failing that, if you can find a copy of version 6, just don't use the/omf switch at all; it defaults to omf as long as you don't specify /coff

-r
Strange women, lying in ponds, distributing swords, is no basis for a system of government

MichaelW

Through ML6.15 you can leave off the /omf. In my tests /omf was necessary to assemble 16-bit DOS code with ML7.00 and ML7.11.
eschew obfuscation

www.:).com

Ok, it seems to work without /omf - I put in "ml /c MsgPrint.asm" then "link16 MsgPrint.obj"and it works, but this makes 32-bit code right?
-What does the /c do?

FORTRANS

Hi,

/c Assemble without linking

   Try ML /? to get a help screen.

Steve

dedndave

it makes a 16-bit program
however, you can use 32 bit registers
in the assembler source code, near the top...
        .386
this directive tells the assember that you may use 80386 instructions
after that, you may use EAX, EBX, ECX, EDX, EBP, ESI, EDI
but addresses are still 16-bits long
do not try
        mov     eax,[esi]
it won't fly   :bg

www.:).com