China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-01 07:47
中国DOS联盟论坛 » DOS开发编程 & 发展交流 (开发室) » How does assembly language run? View 1,896 Replies 8
Original Poster Posted 2004-04-21 00:00 ·  中国 辽宁 沈阳 中移铁通
中级用户
Credits 268
Posts 40
Joined 2004-03-06 00:00
22-year member
UID 19388
Gender Male
Status Offline
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!!!!!!!!!!!!!!!!!
Floor 2 Posted 2004-04-21 00:00 ·  中国 辽宁 朝阳 联通
铂金会员
★★★★
痴迷DOS者
Credits 5,798
Posts 1,924
Joined 2003-06-20 00:00
23-year member
UID 5583
Gender Male
From 金獅電腦軟體工作室
Status Offline
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.
熟能生巧,巧能生精,一艺不精,终生无成,精亦求精,始有所成,臻于完美,永无止境!
金狮電腦軟體工作室愿竭诚为您服务!
QQ群:8393170(定期清理不发言者)
个人网站:http://www.520269.cn
电子邮件:doujiehui@vip.qq.com
微信公众号: doujiehui
Floor 3 Posted 2004-04-21 00:00 ·  中国 辽宁 沈阳 中移铁通
中级用户
Credits 268
Posts 40
Joined 2004-03-06 00:00
22-year member
UID 19388
Gender Male
Status Offline
Great expert! Admirable!
Thank you very much!!!!!!!!!!!!
-----------------------------------------------------
Floor 4 Posted 2004-04-23 00:00 ·  新西兰
初级用户
Credits 102
Posts 1
Joined 2004-04-23 00:00
22-year member
UID 23098
Gender Male
Status Offline
Well written, thank you!!!
Floor 5 Posted 2004-04-24 00:00 ·  中国 辽宁 朝阳 联通
铂金会员
★★★★
痴迷DOS者
Credits 5,798
Posts 1,924
Joined 2003-06-20 00:00
23-year member
UID 5583
Gender Male
From 金獅電腦軟體工作室
Status Offline
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.
熟能生巧,巧能生精,一艺不精,终生无成,精亦求精,始有所成,臻于完美,永无止境!
金狮電腦軟體工作室愿竭诚为您服务!
QQ群:8393170(定期清理不发言者)
个人网站:http://www.520269.cn
电子邮件:doujiehui@vip.qq.com
微信公众号: doujiehui
Floor 6 Posted 2004-04-26 00:00 ·  中国 广东 深圳 龙岗区 电信
初级用户
Credits 112
Posts 3
Joined 2004-04-23 00:00
22-year member
UID 23086
Gender Male
Status Offline
Floor 7 Posted 2004-04-26 00:00 ·  中国 山西 运城 联通
元老会员
★★★★
Batchinger
Credits 4,432
Posts 1,512
Joined 2002-10-18 00:00
23-year member
UID 19
Gender Male
Status Offline
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".
※ Batchinger 致 Bat Fans:请访问 批处理编程的异类 ,欢迎交流与共享批处理编程心得!
Floor 8 Posted 2004-04-27 00:00 ·  中国 辽宁 朝阳 联通
铂金会员
★★★★
痴迷DOS者
Credits 5,798
Posts 1,924
Joined 2003-06-20 00:00
23-year member
UID 5583
Gender Male
From 金獅電腦軟體工作室
Status Offline
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.
熟能生巧,巧能生精,一艺不精,终生无成,精亦求精,始有所成,臻于完美,永无止境!
金狮電腦軟體工作室愿竭诚为您服务!
QQ群:8393170(定期清理不发言者)
个人网站:http://www.520269.cn
电子邮件:doujiehui@vip.qq.com
微信公众号: doujiehui
Floor 9 Posted 2004-05-09 00:00 ·  中国 湖南 衡阳 电信
初级用户
Credits 126
Posts 7
Joined 2004-05-09 00:00
22-year member
UID 23937
Gender Male
Status Offline
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.
Forum Jump: