News:

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

New A16.BAT file

Started by dedndave, March 23, 2012, 05:09:40 PM

Previous topic - Next topic

dedndave

back in the day, we had to use EXE2BIN.EXE to convert tiny model .EXE's to .COM's
the linker didn't do it for us
i used to use a batch file that assembled and linked the program - then tried EXE2BIN
if EXE2BIN successfully created a binary file, i deleted the .EXE, leaving only the .COM
that way, the batch file worked whether you were trying to assemble an .EXE or .COM   :P

more recently, i have been using 2 versions of the batch file - A16 for EXE's and T16 for COM's
i decided to make a new version of the A16 batch file that works like my old one....
@echo off
if "x%1"=="x" goto a16usage
if exist %1.asm goto a16asm

:a16usage
echo Usage: a16 asmfile
echo "asmfile" = asmfile.asm
goto batchexit

:a16asm
if exist %1.obj del %1.obj
\masm32\bin\ml /c /Fl %1.asm >\masm32\bin\asmbla16.txt
if errorlevel 1 goto showtxt
if exist %1.com del %1.com
if exist %1.exe del %1.exe
\masm32\bin\Link16 /TINY %1.obj,%1.com; >\masm32\bin\asmbll6.txt
if exist %1.com goto showtxt
\masm32\bin\Link16 %1.obj; >\masm32\bin\asmbll16.txt

:showtxt
if exist %1.obj del %1.obj
type \masm32\bin\asmbla16.txt
type \masm32\bin\asmbll16.txt

:batchexit
dir %1.* /o-d

dedndave

oddly enough, a .COM file is generated unless you reference the _DATA segment or DGROUP
for example...
        mov     ax,@data
makes the batch file work as it should
if that is absent, a .COM file is generated
i.e., it doesn't seem to follow the old rules of EXE2BIN
presence of a stack or data segment does not prevent the Tiny model build