MASM, TASM, FASM, NASM под Windows и Linux
В данной статье я хочу рассмотреть вопросы, которые могут возникнуть у человека, приступившего к изучению ассемблера, связанные с установкой различных трансляторов и трансляцией программ под Windows и Linux, а также указать ссылки на ресурсы и книги, посвященные изучению данной темы.
Используется для создания драйверов под Windows.
По ссылке переходим на сайт и скачиваем пакет (masm32v11r.zip). После инсталляции программы на диске создается папка с нашим пакетом C:\masm32. Создадим программу prog11.asm, которая ничего не делает.
Произведём ассемблирование (трансляцию) файла prog11.asm, используя ассемблер с сайта masm32.
Ключ /coff используется здесь для трансляции 32-битных программ.
Линковка производится командой link /subsystem:windows prog11.obj (link /subsystem:console prog11.obj)
Как сказано в Википедии
Также ассемблер версии 6. можно взять на сайте Кипа Ирвина kipirvine.com/asm, автора книги «Язык ассемблера для процессоров Intel».
Кстати, вот ссылка на личный сайт Владислава Пирогова, автора книги “Ассемблер для Windows”.
MASM с сайта Microsoft
Далее скачаем MASM (версия 8.0) с сайта Microsoft по ссылке. Загруженный файл носит название «MASMsetup.exe». При запуске этого файла получаем сообщение -«Microsoft Visual C++ Express Edition 2005 required».
Открываем этот файл архиватором (например 7zip). Внутри видим файл setup.exe, извлекаем его, открываем архиватором. Внутри видим два файла vc_masm.msi,vc_masm1.cab. Извлекаем файл vc_masm1.cab, открываем архиватором. Внутри видим файл FL_ml_exe_____X86.3643236F_FC70_11D3_A536_0090278A1BB8. Переименовываем его в файл fl_ml.exe, далее, произведём ассемблирование файла prog11.asm, используя ассемблер fl_ml.exe.

MASM в Visual Studio
Также MASM можно найти в папке с Visual Studio (у меня VS 10) вот здесь: C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\ml.exe.

Для того, чтобы запустить на 32- или 64-разрядной системе и создавать программы, работающие как под 32-, так и под 64-разрядной Windows, подходит MASM32 (ml.exe, fl_ml.exe). Для того, чтобы работать на 32- и 64-разрядных системах и создавать программы, работающие под 64-разрядной Windows, но неработающие под 32-разрядной нужен ассемблер ml64.exe. Лежит в папке C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\amd64 и вот здесь — C:\Program Files\Microsoft Visual Studio 10.0\VC\bin\x86_amd64.
Программный пакет компании Borland, предназначенный для разработки программ на языке ассемблера для архитектуры x86. В настоящее время Borland прекратила распространение своего ассемблера.
Скачать можно, например, здесь. Инсталлятора нет, просто извлекаем программу. Вот исходник из книги Питера Абеля (рис. 3.2) «Язык Ассемблера для IBM PC и программирования».
Выполним ассемблирование (трансляцию) файла abel32.asm.

Корректность работы программы можно проверить, произведя линковку (tlink.exe) объектного файла и запустив полученный файл в отладчике.
Как было сказано выше, MASM можно использовать для работы с 16-битными программами. Выполним ассемблирование (трансляцию) программы abel32.asm с помощью ассемблера MASM:

Ключ /coff здесь не используется.
Линковка производится файлом link16.exe
Вот здесь приводится порядок действий, которые необходимо выполнить для запуска TASM в DOSbox. Для линковки понадобится файл DPMI16BI.OVL
В статье Криса Касперски «Сравнение ассемблерных трансляторов» написано, что «FASM — неординарный и весьма самобытный, но увы, игрушечный ассемблер. Пригоден для мелких задач типа „hello, world“, вирусов, демок и прочих произведений хакерского творчества.»
Скачаем FASM с официального сайта. Инсталлятора нет, просто извлекаем программу. Откроем fasm editor — C:\fasm\fasmw.exe. В папке C:\fasm\EXAMPLES\HELLO есть файл HELLO.asm.
Откроем файл HELLO.asm из fasmw.exe. Изменим строку include ‘win32ax.inc’ на строку include ‘c:\fasm\INCLUDE\WIN32AX.INC’. Запускаем из меню Run → Run.

Вот ссылки на ресурсы, посвященные FASM:
FASM в Linux
Для того, использовать FASM в Linux (у меня Ubuntu), скачаем соответствующий дистрибутив (fasm-1.71.60.tgz), распакуем его, в папке у нас будет бинарный файл fasm, копируем этот файл в /usr/local/bin для того, чтобы можно было запускать его из консоли, как любую другую команду.Выполним ассемблирование программы hello.asm из папки fasm/examples/elfexe/hello.asm.

Корректность работы программы можно проверить в отладчике.
Nasm успешно конкурирует со стандартным в Linux- и многих других UNIX-системах ассемблером Gas.
Nasm в Linux можно установить с помощью менеджера пакетов или из командной строки: в дистрибутиве Debian (Ubuntu) командой apt-get install nasm, в дистрибутивах Fedora, CentOS, RedHat командой yum install nasm.
Создадим программу, которая 5 раз выводит сообщение “Hello”. Пример взят из книги Андрея Викторовича Столярова “Программирование на языке ассемблера NASM для ОС UNIX”. Учебник, а также библиотека “stud_io.inc” есть на личном сайте автора.
Выполним ассемблирование и линковку и запустим файл hello.asm.
Для 64bit необходимо использовать команду nasm -f elf64 hello.asm
NASM для Windows
NASM для Windows можно установить, скачав соответствующий дистрибутив с соответствующего сайта.
Ассемблирование:
nasm -f bin имя_файла.asm -o имя_файла.com
Ссылки на ресурсы, посвященные Nasm:
Стандартный ассемблер практически во всех разновидностях UNIX, в том числе Linux и BSD. Свободная версия этого ассемблера называется GAS (GNU assembler). Позволяет транслировать программы с помощью компилятора GCC.
Из учебников удалось найти только книгу на английском «Programming from the ground up». На русском удалось найти только одну главу из книги С. Зубкова «Assembler для DOS, Windows и UNIX».
Возьмем пример программы, которая ничего не делает, с сайта. Создадим программу gas.s
Выполним ассемблирование (трансляцию), линковку и запуск программы:
Если в данной программе изменить _start на main, то можно выполнить ассемблирование (трансляцию) и линковку компилятором gcc.
Выполним ассемблирование (трансляцию), линковку и запуск программы:
Выводы: если вы изучаете программирование под Windows, то вы можете остановить свой выбор на Masm; Tasm больше не поддерживается, но для обучения по старым классическим учебникам подойдёт.
Под Linux Gas подойдет тем, кто использует GCC, а тем, кому не нравится синтаксис Gas, подойдёт Nasm.
Как установить tasm на windows 10
Copy raw contents
Copy raw contents

Basic support for MASM/TASM v1.x
Basic language support for assembly in DOS environment. may be suitable for studying MASM/TASM in DOSBox or courses like principles& peripheral technology of microprocessor.
- Language Support: Offer grammar,basic outline view,hover,code formate support for DOS assembly language
- Run and debug: Right click on the VSCode editor panel, run and debug your code
- Diagnose: process the output of ASM tools and display them in VSCode
- support all platform including Web, see platform support
- Note: this extension is built for learning assembly in DOS, it can not work with assembly for win32
Demo 1: Language Features
| Formate Codes | Diagnose |
|---|
The extension offers some language features like «hover»,»formate»,»jump to definition» as language id assembly . You can also use other extension for Assembly language Support, for example language ID asm-collection by installing extension ASM Code Lens.
Demo 2: Run and Debug
| using TASM via DOSBox | using MASM via msdos-player |
|---|
when you are editing assembly files ,you can right click at the editor panel,then you will see several choices listed below:
- Open Emulator: Open the dosbox, prepare the environment
- Run ASM code: Assemble,link and Run the program
- Debug ASM code: Assemble,link and Debug the program
- If your code just in a single file, set configuration masmtasm.ASM.mode as single file . The extension will copy your file to a seperate space in your machine to keep your workspace Folder clean.
- If your project is complex and making up with many files, you may set configuration masmtasm.ASM.mode as workspace and keep your files’ names follow the emulator’s limitation.
- take include <filename> for example, the <filename> should be the relative path to your workspace Folder
The extension depend on vscode-dosbox for intergration with DOS emulator. It has packaged all binary files for windows system.
Follow its doc for installing emulator like DOSBox in other system.
About DOSBox ‘s disk
The extension will mount some folder to DOSBox ‘s disk.
in DOSBox real path in the computer C: the path of tools folder D: the path of the work space Compile to .com files
You can change the command to exec in setting masmtasm.ASM.actions . For example, if you want to compile your code to .com , you can add a setting like this. And set masmtasm.ASM.assembler to its key TASM-com
According to VSCode-doc, the extension will be installed in following folder:
Как установить tasm на windows 10
Assembler – Урок 0: Установка компилятора и запуск первой программы через DOSBox

Как работать с TASM в Windows 10 x64?
Не могу заставить работать LPT-порт в Windows 7 x64
Привет всем. Столкнулся с проблемой, не могу заставить работать LPT порт в Windows 7 64 Bit, до.How to install and configure TASM on Windows 7/8/10.
Before we get started with TASM installation on a Windows machine, let’s get some knowledge about TASM and learn what it will do for us.
Turbo Assembler (TASM) a small 16-bit computer program which enables us to write 16 bit i.e. x86 programming code on 32-bit machine. It can be used with any high level language compliers like GCC compiler set to build object files. So that programmers can use their daily routine machines to write 16-bit code and execute on x86 devices.
So let get started with installation steps. Before we get started to make sure that you have the following software. If not, you can download it by clicking on it.
Requirements.
1. First, install DOSBox software on your system.

2. Just run the downloaded setup file to install as just like other software you install.

3. Then extract the TASM zip file.
4. After that copy that extracted the folder to C drive of your system.

5. Now we have to mount our C drive to DosBox so that we can use our TASM libraries there.
6. To do that go to the following path on your PC
For 32-bit PC
C:\Program Files\DOSBOX-0.74
For 64-bit PC
C:\Program Files (x86) \DOSBOX-0.74
7. Then there you will see a file named “DOSBOX 0.74 Options” click on it to open.

8. It will open a text file in notepad. Then navigate to the last line of that file where it shows “# You can put your MOUNT lines here”.

9. Add the following lines after that.
10. And save that file.

11. And now open DOSBOX. You’re done.
12. To run a TASM program copy your program file into the TASM folder which is under your C: drive.
13. And now open DOSBOX. And navigate to the TASM folder by typing cd TASM and hit enter.

14. Now type tasm <program_name>. Replace <program_name> with your actual program name. in my case, my program name is the timer so I will type tasm timer.asm

15. After you hit enter. You will see an error, warning messages. If there isn’t anything wrong with your program syntactically, you will see none there.

16. And now link your program to that type tlink <program_name> and hit enter. And now execute program by typing <program_name> only.
17. The program will start executing. To stop execution type exit and hit enter.So in this way you can install TASM on your system and execute x86 code on your machine. This tutorial is applicable to Windows 7/8/8.1/10.
If you face any problem while doing this, make sure that you hit the comment below with your problem.
MASM, TASM, FASM, NASM под Windows и Linux

Ключ /coff используется здесь для трансляции 32-битных программ.
Линковка производится командой link /subsystem:windows prog11.obj (link /subsystem:console prog11.obj)How to install and configure TASM on Windows 7/8/10.
Before we get started with TASM installation on a Windows machine, let’s get some knowledge about TASM and learn what it will do for us.
Turbo Assembler (TASM) a small 16-bit computer program which enables us to write 16 bit i.e. x86 programming code on 32-bit machine. It can be used with any high level language compliers like GCC compiler set to build object files. So that programmers can use their daily routine machines to write 16-bit code and execute on x86 devices.
So let get started with installation steps. Before we get started to make sure that you have the following software. If not, you can download it by clicking on it.
Requirements.
1. First, install DOSBox software on your system.

2. Just run the downloaded setup file to install as just like other software you install.

3. Then extract the TASM zip file.
4. After that copy that extracted the folder to C drive of your system.

5. Now we have to mount our C drive to DosBox so that we can use our TASM libraries there.
6. To do that go to the following path on your PC
For 32-bit PC
C:\Program Files\DOSBOX-0.74
For 64-bit PC
C:\Program Files (x86) \DOSBOX-0.74
7. Then there you will see a file named “DOSBOX 0.74 Options” click on it to open.

8. It will open a text file in notepad. Then navigate to the last line of that file where it shows “# You can put your MOUNT lines here”.

9. Add the following lines after that.
10. And save that file.

11. And now open DOSBOX. You’re done.
12. To run a TASM program copy your program file into the TASM folder which is under your C: drive.
13. And now open DOSBOX. And navigate to the TASM folder by typing cd TASM and hit enter.

14. Now type tasm <program_name>. Replace <program_name> with your actual program name. in my case, my program name is the timer so I will type tasm timer.asm

15. After you hit enter. You will see an error, warning messages. If there isn’t anything wrong with your program syntactically, you will see none there.

16. And now link your program to that type tlink <program_name> and hit enter. And now execute program by typing <program_name> only.
17. The program will start executing. To stop execution type exit and hit enter.So in this way you can install TASM on your system and execute x86 code on your machine. This tutorial is applicable to Windows 7/8/8.1/10.
If you face any problem while doing this, make sure that you hit the comment below with your problem.