Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

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

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.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

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
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading