Newline in 8086 assembly language: my text prints stair-stepped
Solution 1
You need to print new line and carriage return.
Solution 2
if your using emu80x86 this code should do it
mov dx,13
mov ah,2
int 21h
mov dx,10
mov ah,2
int 21h
Solution 3
This would print a new line:
1) Add in the data segment:
linefeed db 13, 10, "$"
2) And then use this anywhere you need a new line:
; new line
mov ah, 09
mov dx, offset linefeed
int 21h
Solution 4
AS anthony said, Based on your assembler, you need to do a carriage return and line feed to go to next line and place cursor at the beggining of the line. For MASM you can use Call crlf or print values 0dh and 0ah respectively.
Moein Hosseini
I'm Moein who is into GNU/Linux, programming, open source and reading. Currently, I'm at AmirKabir University of Technology (Tehran Polytechnic) for M.S of Information Technology. My search interests are Natural Language Processing, Big Data and Machine Learning. Also, my thesis is about Forecasting the news impact on different aspects of social media users political opinions. Right now I work at BisPhone as Software Engineer. I took up my B.A in Computer Engineering from K.N.Toosi University of Technology and also graduated from Nodets for middle and high school.
Updated on July 05, 2022Comments
-
Moein Hosseini almost 2 years
I'm getting stair-step output like this
My program works correctly, except that when I print a new line, and then print something in the current line, it shows on the next line but with some space before it.
The program is this: (print a table of multiple numbers from 0 to 9):
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
-
Jainam Jhaveri over 7 yearsthis worked for me.. but what does linefeed db 13, 10, "$" exactly do ?