0

today I started learning NASM. I'm using NASM Online compiler.

I want to print simple text in 4 rows like this:

This

Is

Some

Text

I looked up some tutorials but I only managed to print text in one row.

Here's my code:

SECTION .data;
msg: db "Hello World",10
len:    equ $-msg

    SECTION .text
        global main
main:
    
    mov edx,len
    mov ecx,msg
    mov ebx,1
    mov eax,4
    int 0x80
    
    mov ebx,0
    mov eax,1
    int 0x80

And my output looks like this:

Hello World

ld: warning: cannot find entry symbol _start; defaulting to 0000000008049000

I'm a bit confused how to print 4 texts in each separate row.

ecm
  • 2,583
  • 4
  • 21
  • 29
Nikola
  • 3
  • 3
  • 2
    Seems like you could just change it to `msg: db "This",13,10,"Is",13,10,"Some",13,10,"Text"`. Maybe NASM even supports the `\n` escape sequence; I haven't checked that. – Michael Apr 06 '21 at 15:09
  • I'll give it a go – Nikola Apr 06 '21 at 17:31
  • 1
    @Michael: Recent NASM does support escapes like `\n` but only [in backquoted strings](https://www.nasm.us/xdoc/2.15.05/html/nasmdoc3.html#section-3.4.2). – ecm Apr 08 '21 at 20:16

0 Answers0