Home > other >  How do I print a "New Line" in REAL MODE assembly
How do I print a "New Line" in REAL MODE assembly

Time:01-08

I need to make a new line for my OS as the command line needs a new line every time you type but I don't know how.

I've thought about just making a bunch of spaces but that would make the next line too spaced out.

CodePudding user response:

You don't actually get to make a new line.

You can move from the line you're currently on, to the following line by printing these 2 bytes 13 and 10:

mov  bx, 0007h  ; BH is DisplayPage, BL is GraphicsColor
mov  ax, 0E0Dh  ; AH is Teletype, AL is CarriageReturn
int  10h
mov  al, 0Ah    ; AL is Linefeed 
int  10h

What you now could do is clear the line that you've arrived on:

mov  cx, 80     ; Length of the row (assuming screen is 80x25)
mov  bx, 0007h  ; BH is DisplayPage, BL is ColorAttribute
mov  ax, 0920h  ; AH is WriteCharacter, AL is SpaceCharacter
int  10h
  • Related