Skip to content

Instantly share code, notes, and snippets.

@nixeagle
Created July 24, 2010 22:29
Show Gist options
  • Save nixeagle/489042 to your computer and use it in GitHub Desktop.
Save nixeagle/489042 to your computer and use it in GitHub Desktop.
;;;; Just copy paste this to the end of your ~/.emacs or ~/.emacs.d/init.el
;;;; These are not really a "library" yet.
;;;;
;;;; Both parts of code in this gist are released into the public domain,
;;;; assuming any parts of it are even copyrightable.
(require 'asm-mode)
(defun my-asm-mode-function ()
(set (make-local-variable 'compile-command)
(concat "make -k -e ASM_FILENAME="
(file-name-sans-extension
(file-name-nondirectory buffer-file-name)))))
(add-hook 'asm-mode-hook 'my-asm-mode-function)
(define-key asm-mode-map (kbd "C-c C-c")
(lambda () (interactive)
(let* ((file buffer-file-name)
(lst (concat (file-name-sans-extension (file-name-nondirectory file)) ".lst")))
;; save all buffers
(save-some-buffers t)
(compile compile-command))))
all:
nasm -f elf -g -l ${ASM_FILENAME}.lst ${ASM_FILENAME}.asm
ld -melf_i386 ${ASM_FILENAME}.o -o ${ASM_FILENAME}
cat ${ASM_FILENAME}.lst
./${ASM_FILENAME}
clean:
rm *.o
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment