RaenirSalazar
RaenirSalazar

Reputation: 576

Emacs weirdness when trying to comment in Assembly

Suppose I have a block of code like so:

;;  outut
mov eax, 4          
mov ebx, 1          ; stdout
mov ecx, [ans]      ; move biggest element to accumulator
add ecx, 30h        ; convert to ascii representation
mov [buff], ecx     ; move to memory
mov ecx, buff       ; put pointer in ecx for printing
mov edx, 4          ; size, 4 bytes
int 80h             ; system call.

When I try to put a comment in the front to comment out a line:

;;  outut
;mov eax, 4          
mov ebx, 1          ; stdout
mov ecx, [ans]      ; move biggest element to accumulator
add ecx, 30h        ; convert to ascii representation
mov [buff], ecx     ; move to memory
mov ecx, buff       ; put pointer in ecx for printing
mov edx, 4          ; size, 4 bytes
int 80h             ; system call.

Instead of appearing there where I want it to go, it jumps to here:

;;  outut
mov eax, 4          ;
mov ebx, 1          ; stdout
mov ecx, [ans]      ; move biggest element to accumulator
add ecx, 30h        ; convert to ascii representation
mov [buff], ecx     ; move to memory
mov ecx, buff       ; put pointer in ecx for printing
mov edx, 4          ; size, 4 bytes
int 80h             ; system call.

And no matter what I do, I physically cannot comment out anything.

How can I fix this? It don't remember it always doing this, so i feel like I must have hit some combination of keys and it just happens.

Upvotes: 2

Views: 638

Answers (1)

Dan
Dan

Reputation: 5369

; is bound to asm-comment in assembly mode. You can either do a quoted insert with C-q ; on a case-by-case basis, or remove the binding and just use M-; (comment-dwim) for fancier commenting. If you want to do the latter, set ";" locally to do a self-insert command:

(defun my-hook ()
  (local-set-key ";" 'self-insert-command))

(add-hook 'asm-mode-hook 'my-hook)

Upvotes: 3

Related Questions