Jump to content

Recommended Posts

Posted

Olá?

Estou criando um comentário com mais de uma linha no NASM (Assembly) e não estou conseguindo!

Como é que consigo?

Principalmente no NASM?

 

; =========================
; Programa Teste
; =========================
; Compilação
; =========================
; nasm -f elf32 teste.asm
; ld -m elf_i386 -s -o teste teste.o
; ./teste
; =========================
; Resultado
; =========================

; =========================
section .data:

section .text:

global _start

_start:

%comment
  Comentários com
  mais de
  uma
  linha
%endcomment

; Saida
   mov eax, 1
   mov ebx, 0
   int 0x80

  • Administrators
Posted

Não existe um suporte nativo, mas tem gambiarras possíveis:

; Opção 1 - Simplesmente um ponto-e-vírgula no início de cada linha (mas essa você já sabe)
; linha1
; linha2
; linha3

; Opção 2 - Começa com ponto-e-vírtugla e protege o caractere de fim de linha com a contra-barra
; linha1\
linha2\
linha3

Opção 3 - Testar se uma macro inexistente existe
%ifdef COMENTARIO ; pode ser qualquer coisa, contanto que não exista - ou seja, não esteja definida
linha1
linha2
linha3
%endif
  
Opção 4 - Avaliar uma expressão numérica que retorne falso sempre
%if 0
linha1
linha2
linha3
%endif

Abraço.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...