nkeck720 / nos

A command-line based OS written in FASM syntax for i386 and above.
GNU General Public License v2.0
9 stars 5 forks source link

FASM board issue 31 #32

Closed nkeck720 closed 8 years ago

nkeck720 commented 8 years ago

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

nkeck720 commented 8 years ago

I will not be creating a print_enter function as mentioned previously. I don't remember where exactly I was going with that.