Under BIOS the carriage return (13) brings the cursor to the leftside of the current line and the linefeed (10) brings the cursor one line down but in the same column. So to obtain the newline (\n) that you are accustomed to from LINUX you need to output both these numbers with the BIOS teletype function. I strongly advise you to change the single 13 into the pair 13,10 everywhere you defined a text for displaying.
Your API function 1 that writes a string to the screen has a lot of issues. I wrote this version to remedie all its problems at once:
Code:
print_string:
push ax
push cx
push si
mov ah, 0Eh ;BIOS teletype
mov bh, 0 ;Display page 0, don't care about BL in video mode 3
mov ch, 0 ;Count characters
mov si, dx ;DX can't be used to address memory!!!
print_loop:
mov al, [ds:si]
inc si
cmp al, 0
je print_done
int 10h
inc ch ;Printed a char
jmp print_loop
print_done:
mov bh, ch ;BH is be the number of chars that we wrote
pop si
pop cx
pop ax
iret
Under BIOS the carriage return (13) brings the cursor to the leftside of the current line and the linefeed (10) brings the cursor one line down but in the same column. So to obtain the newline (\n) that you are accustomed to from LINUX you need to output both these numbers with the BIOS teletype function. I strongly advise you to change the single 13 into the pair 13,10 everywhere you defined a text for displaying. Your API function 1 that writes a string to the screen has a lot of issues. I wrote this version to remedie all its problems at once:
Code:
print_string: push ax push cx push si mov ah, 0Eh ;BIOS teletype mov bh, 0 ;Display page 0, don't care about BL in video mode 3 mov ch, 0 ;Count characters mov si, dx ;DX can't be used to address memory!!! print_loop: mov al, [ds:si] inc si cmp al, 0 je print_done int 10h inc ch ;Printed a char jmp print_loop print_done: mov bh, ch ;BH is be the number of chars that we wrote pop si pop cx pop ax iret