中国DOS联盟论坛

China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --
Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
Guest | Log in | Register | Members | Search | China DOS Union
中国DOS联盟论坛
The time now is 2026-10-31 15:33
47,815 topics / 349,930 posts / today 0 new / 48,290 members
DOS开发编程 & 发展交流 (开发室) » How does assembly language run?
Printable Version  2,041 / 8
Floor1 jjjjj162118 Posted 2004-04-21 00:00
中级用户 Posts 40 Credits 268
Dear everyone

How to run assembly language under DOS?
Is it directly entered after the command prompt or do you need any program? Please give more advice ah!!!!!!!!!!!!!!!!!
Floor2 Kinglion Posted 2004-04-21 00:00
铂金会员 Posts 1,924 Credits 5,800 From 金獅電腦軟體工作室
Assembly language needs to be assembled and compiled into an executable file before it can run. The following is a batch file I wrote. The required platform is Microsoft MASM version 6.11, installed in the C:\MASM directory.
@ECHO OFF
GOTO TOP

NAME: MASM.BAT
PURPOSE: Macro Assembler Version 6.11 Plus & Segmented Executable Linker Version 5.31.009
COPY: Kinglion Software Warkroom & Dou Jie Hui
VERSION: 1.03 Shareware Version
DATE: 2002.03.24

:TOP
SET HELPFILES=C:\MASM\HELP\*.HLP
SET INCLUDE=C:\MASM\INCLUDE\
SET ASMEX=C:\MASM\SAMPLES\
SET INIT=C:\MASM\INIT\
IF #%1 == # GOTO HELP
IF NOT EXIST %1.ASM GOTO NOFILE
IF EXIST %1.OBJ DEL %1.OBJ
IF EXIST %1.OLD DEL %1.OLD
IF EXIST %1.EXE REN %1.EXE %1.OLD
PATH=C:\PCDOS;C:\DRDOS;C:\TOOLS;C:\MASM\BIN;C:\MASM\BINR;
C:\MASM\BIN\MASM /X /Z %1.ASM,%1.OBJ,NUL.LST,NUL.CRF > NUL
ECHO Assembling: %1.ASM
ECHO.
ECHO Microsoft (R) Segmented Executable Linker Version 5.31.009 Jul 13 1992
ECHO Copyright (C) Microsoft Corp 1984-1992. All rights reserved.
ECHO.
ECHO Linking: %1.OBJ
ECHO.
IF NOT #%2 == # GOTO NOCOMPRESS
:COMPRESS
C:\MASM\LINK /EXEPACK /PACKCODE /DOSSEG %1.OBJ,%1.EXE,NUL.MAP,,NUL.DEF; > NUL
GOTO CONTINUE
:NOCOMPRESS
C:\MASM\LINK /PACKCODE /DOSSEG %1.OBJ,%1.EXE,NUL.MAP,,NUL.DEF; > NUL
ECHO Microsoft (R) Converts .EXE (executable) files to binary format utility
ECHO Copyright (C) Microsoft Corp 1981-1993. All rights reserved.
ECHO.
ECHO Converting: %1.EXE
ECHO.
C:\MASM\EXE2BIN %1.EXE %1.COM > NUL
:CONTINUE
IF EXIST %1.SBR DEL %1.SBR
DEL %1.OBJ
DIR %1.*
GOTO END

:HELP
ECHO.
ECHO Microsoft (R) Macro Assembler Compatibility Driver Version 6.11 Plus
ECHO Copyright (C) Microsoft Corp 1993. All rights reserved.
ECHO.
ECHO Usage:
ECHO MASM { ASM Program source Filename }
ECHO.
GOTO END

:NOFILE
ECHO.
ECHO Microsoft (R) Macro Assembler Compatibility Driver Version 6.11 Plus
ECHO Copyright (C) Microsoft Corp 1993. All rights reserved.
ECHO.
ECHO I''m Sorry, Bad filename or input file not found.
ECHO.
ECHO Usage:
ECHO MASM { ASM Program source Filename }
ECHO.
GOTO END

:END
PATH=C:\PCDOS;C:\DRDOS;C:\NWDOS;C:\DOS;C:\UCDOS;C:\TWAY;C:\TOOLS;C:\AV95;C:\QB45;C:\BC5\BIN;
SET HELPFILES=
SET INCLUDE=
SET ASMEX=
SET INIT=


Corrected specially according to the correction pointed out by friend willsort.
Floor3 jjjjj162118 Posted 2004-04-21 00:00
中级用户 Posts 40 Credits 268
Great expert! Admirable!
Thank you very much!!!!!!!!!!!!
-----------------------------------------------------
Floor4 Tony_luo Posted 2004-04-23 00:00
初级用户 Posts 1 Credits 102
Well written, thank you!!!
Floor5 Kinglion Posted 2004-04-24 00:00
铂金会员 Posts 1,924 Credits 5,800 From 金獅電腦軟體工作室
Thanks for the praise. Everyone, did you notice that there is a flaw in this batch file? Hehe. There's no need to blame me for this problem because this batch file is only used by myself. When I uploaded it to the forum, I forgot to change the relevant issues. I just noticed it today.
Floor6 王明 Posted 2004-04-26 00:00
初级用户 Posts 3 Credits 112
Floor7 willsort Posted 2004-04-26 00:00
元老会员 Posts 1,512 Credits 4,432
Re Kinglion:

A rather routine batch script, but as you mentioned, since it's for personal use only, there are some localization setting issues, and there are quite a few places that need to be modified. Such a program is fine as an example, but not suitable for application.

Additionally, there is a question for your discussion: "Does assembly language need to be compiled before it can run"? Regardless of the distinction between assembly language and assembly code, just in terms of the term "compile", it seems to be a term that emerged after high-level languages, is it appropriate to apply this term to low-level languages? Whether it is more appropriate to change it to "assemble". Of course, MASM itself has a process similar to compiling high-level languages, but this is because MASM is not a pure assembly language, but a macro assembly language, and the macro instructions and pseudo-instructions contained in the code it supports require the existence of this process. Another commonly used assembly instruction environment DEBUG indirectly verifies this problem. The assembly sub-command -A in it supports the 8086/80286 assembly instruction set. The process of handling assembly instructions is "assembling" similar to the "interpretation" process of high-level languages, not "compiling".
Floor8 Kinglion Posted 2004-04-27 00:00
铂金会员 Posts 1,924 Credits 5,800 From 金獅電腦軟體工作室
To willsort:
What you said is right, some of my words indeed have many places worthy of discussion, thank you for your correction. Hope to have more exchanges with you.
Floor9 挑战者 Posted 2004-05-09 00:00
初级用户 Posts 7 Credits 126
Your level is really high.
I don't understand this aspect and haven't studied these before. Now I just discovered this website, so I will follow you all to learn in the future, okay?
I'm still a layman in computers, please give me some support.
Thank you everyone.
[ Contact the Union admin team - 中国DOS联盟 - Standard version ]
Sponsored by ifanr Inc | © 2001–2023