New line in assembly 8086

I want to print a table with several numbers from 0 to 9 in the assembly. so I am programming the code below:

data_seg segment I DB 0D J DB 0D R DB ? DIVER DB 10D data_seg ends stack_seg segment stack_seg ends code_seg segment MAIN proc far assume cs:code_seg, ds:data_seg, ss:stack_seg MOV AX,data_seg MOV DS,AX FOR1: MOV J,0D FOR2: MOV AX,0H MOV AL,I MUL J DIV DIVER MOV R,AH ADD AL,48D MOV AH,0EH INT 10H MOV AL,R ADD AX,48D MOV AH,0EH INT 10H MOV AX,32D MOV AH,0EH INT 10H INC J MOV AX,0 MOV AL,J SUB AX,10D JNZ FOR2 INC I MOV AX,10D MOV AH,0EH INT 10H MOV AX,0 MOV AL,I SUB AX,10D JNZ FOR1 MOV AX,4CH INT 21H MAIN endp code_seg ends end MAIN 

It works correctly, but with a little problem, when I want to print a new line and print something in the current line, it will go to a new line, but with some space before the new line. enter image description here

+6
source share
5 answers

You need to print a new line and carriage return.

+9
source

if you are using emu80x86, this code should do it

 mov dx,13 mov ah,2 int 21h mov dx,10 mov ah,2 int 21h 
+4
source

AS anthony said: based on your assembler, you need to do a carriage return and line feed to go to the next line and place the cursor at the beginning of the line. For MASM, you can use Call crlf or print the values ​​0dh and 0ah respectively.

+3
source

This will print a new line:

1) Add to the data segment:

 linefeed db 13, 10, "$" 

2) And then use this wherever you need a new line:

 ; new line mov ah, 09 mov dx, offset linefeed int 21h 
+2
source

try setting stripes to return the string

 mov ax, 4c00h ; return to ms-dos int 21h 
-1
source

Source: https://habr.com/ru/post/903036/


All Articles