Teletype is the BIOS's "just print it" function. It writes AL at the cursor and advances the cursor, wraps to the next line at the right edge, and scrolls the screen up a line when it goes past the bottom. Four characters are acted on instead of drawn: 07h (bell) beeps, 08h (backspace) moves one column left, without erasing and not past column 0, 0Ah (line feed) moves down a line, and 0Dh (carriage return) goes back to column 0. A new line therefore takes both, CR and then LF.
In text modes it keeps each cell's attribute, and when it scrolls, the new bottom line gets the attribute of the cell the cursor was on. In graphics modes it draws the character in colour BL, the only way to give it a colour. Boot sectors and other code that cannot rely on DOS print with it:
MOV SI, OFFSET TXT1CLDNEXT1:LODSB ; AL = next characterOR AL, AL ; 0 ends the textJZ DONE1MOV AH, 0Eh ; teletype: write AL, move the cursor onMOV BH, 0 ; page 0INT 10hJMP NEXT1DONE1:MOV AH, 09hMOV DX, OFFSET MSG1INT 21hTXT1 DB "Typed by the BIOS", 13, 10, 0MSG1 DB "The line above came from the BIOS", 13, 10, "$"
Pitfalls
Tab (09h) is not expanded: it is drawn as a symbol. DOS expands tabs, the BIOS does not. Backspace does not erase; to rub out a character, print backspace, space, backspace. The original IBM BIOS and DOSBox-X write to the active page whatever BH says, while other BIOSes honour BH, so set BH to the active page and both kinds work. One call per character is slow next to writing video memory, but it is what DOS console output costs too, since DOS ends up here.