Post view

DOS批次程式:SETUP.BAT、ASM.BAT、XASM.BAT

SETUP.BAT  :
@echo off
set dosdir=a:\dos
set masmdir=a:\bin
set include=a:\include
set lib=a:\lib
call %masmdir%\SAVEARG

ASM.BAT :
@echo off
break off
if "%MASMDIR%" == "" call a:\dos\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 %dosdir%\push
if "%argv2%" == "" goto masm
goto asm

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

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

:link
link /co %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

XASM.BAT :
@echo off
break off
if "%MASMDIR%" == "" call a:\dos\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 %dosdir%\push
if "%argv2%" == "" goto masm
goto asm

:masm
make FILE=%argv1% %masmdir%\xasm.mak
goto exit

:asm
make FILE=%argv1% LIST=,%argv2%.txt %masmdir%\xasm.mak
echo.
echo Listing file = %argv2%.TXT
echo.
goto exit

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

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

:exit

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