An Emacs major mode for editing Turbo Assembler (TASM) x86 assembly code. Supports both MASM-compatible mode and TASM Ideal mode.
Based on masm-mode by YiGeeker.
- Syntax highlighting for x86 instructions, registers (16-bit and 32-bit), directives, types, labels, macros, structs, and numeric constants
- Support for both MASM-compatible and TASM Ideal mode directives
- Automatic indentation and label handling (typing
:removes indentation when it forms a label) - Context-sensitive comment insertion with mark ring integration for jumping between code and comment gutter
- Built-in compile, link, and build commands via
compilation-mode - Imenu support for navigating labels, procedures, and macros
- Configurable assembler variant (
tasmortasm32), arguments, and paths
- Emacs 25.1 or later
Clone the repository and add it to your load-path:
(add-to-list 'load-path "/path/to/tasm-mode")
(require 'tasm-mode)Or with use-package:
(use-package tasm-mode
:load-path "/path/to/tasm-mode");; Use 16-bit TASM instead of the default TASM32
(setq tasm-program-type 'tasm)
;; Set the path to the TASM executables
(setq tasm-executable-path "/path/to/tasm/bin")
;; Set include and library paths
(setq tasm-include-path '("/path/to/includes"))
(setq tasm-library-path '("/path/to/libs"))
;; Customize assembler arguments (defaults: /ml /m2 /z)
(setq tasm-compile-args '("/ml" "/m2" "/z"))
;; Customize linker arguments
(setq tasm-link-args '("/v"))
;; Customize build command (defaults to make)
(setq tasm-build-executable "make")
(setq tasm-build-args '("-f" "Makefile"))| Key | Command | Description |
|---|---|---|
C-c C-c |
tasm-build |
Build the project |
C-c C-b |
tasm-compile |
Assemble the current file |
C-c C-l |
tasm-link |
Link the object file |
C-c ; |
comment-region |
Comment/uncomment the region |
; |
tasm-comment |
Context-sensitive comment insertion |
: |
tasm-colon |
Insert colon; dedent if it forms a label |
C-j |
tasm-newline-and-indent |
Newline with auto-indentation |
RET |
tasm-newline-and-indent |
Newline with auto-indentation |
All faces can be customized via M-x customize-group RET tasm-mode-faces:
tasm-registers- CPU registerstasm-instructions- x86 instructionstasm-directives- assembler directivestasm-types- data typestasm-labels- code labelstasm-subprogram- procedurestasm-macro- macro definitionstasm-section-name- segment/section namestasm-constant- numeric constantstasm-struct- struct definitionstasm-union- union definitionstasm-prefix- instruction prefixes
MIT