Post view

MS-DOS批次指令:ASM.BAT、LIB.BAT、PE.BAT、MASM.BAT、LINK.BAT

ASM.BAT:

@echo off
break off
if "%MASMDIR%" == "" call setup
if "%1" == "/?" goto help
if not "%1" == "" goto save
if "%argv1%" == "" call %masmdir%\savearg
call pop
if not exist %argv1%.asm goto help
if "%argv2%" == "" goto masm
goto asm

:save
if not exist %1.asm goto error
set argv1=%1
set argv2=%2
echo set argv1=%1>%masmdir%\savearg.bat
echo set argv2=%2>>%masmdir%\savearg.bat
call push
if "%argv2%" == "" goto masm
goto asm

:masm
masm /zi /zd %argv1%,object\%argv1%;
if errorlevel 1 goto exit
goto link

:asm
masm /zi /zd %argv1%,object\%argv1%,%argv2%.txt;
if errorlevel 1 goto exit
echo.
echo Listing file = %argv2%.TXT
echo.
goto link

:link
link /co object\%argv1%;
goto exit

:error
echo %1.asm file not found!
goto exit

:help
echo ASM  [ ASSEMBLY(.ASM) ]   [ LISTFILE(.TXT) ]
echo.
echo for example : asm demo1 Enter
echo          or : asm demo1 demo1 Enter
echo          or : asm Enter
echo.
echo ==:   masm /zi /zd demo1,object\demo1,demo1.txt; Enter
echo ==:   link /co object\demo1; Enter
goto exit

:exit

LIB.BAT:

@echo off
e:\masm\bin\lib %1 %2 %3 %4 %5 %6 %7 %8 %9

SETUP.BAT:

@echo off
set masmdir=c:\masm\bin
set include=c:\masm\include
set lib=c:\masm\lib
call %masmdir%\SAVEARG

PE.BAT:

@echo off
if "%MASMDIR%" == "" call setup
if not "%1" == "" goto save
if "%argv1%" == "" call %masmdir%\savearg
pe2 %argv1%.asm
goto exit

:save
set argv1=%1
set argv2=%2
echo set argv1=%1>%masmdir%\savearg.bat
echo set argv2=%2>>%masmdir%\savearg.bat
pe2 %argv1%.asm
goto exit

:exit

MASM.BAT:

@echo off
e:\masm\bin\masm %1 %2 %3 %4 %5 %6 %7 %8 %9

LINK.BAT:

@echo off
e:\masm\bin\link %1 %2 %3 %4 %5 %6 %7 %8 %9

蘇言霖 2013/09/11 0 1868
Comments
Order by: 
Per page:
 
  • There are no comments yet
Rate
0 votes
Post info
蘇言霖
「超級懶貓級」社群網站站長
2013/09/11 (3852 days ago)
Actions