diff --git a/kernel/arch/i386/tty.nim b/kernel/arch/i386/tty.nim index fbbf421..fee3c7a 100644 --- a/kernel/arch/i386/tty.nim +++ b/kernel/arch/i386/tty.nim @@ -43,19 +43,20 @@ proc setTerminalColour(newColour: int) = terminalColour = newColour proc terminalWriteChar(writeChar: char) = - if(writeChar == '\L'): + + proc scrollCheckAndSet() = if(terminalRow < vgaHeight - 1): inc(terminalRow) else: # If we are at the bottom of the screen then scroll the screen. terminalScroll() terminalColumn = 0 + + if(writeChar == '\L'): + scrollCheckAndSet() return terminalWriteAtPoint(writeChar, terminalColour, terminalColumn, terminalRow) inc(terminalColumn) if(terminalColumn == vgaWidth): - terminalColumn = 0 - if(terminalRow < vgaHeight - 1): inc(terminalRow) - else: # If we are at the bottom of the screen then scroll the screen. - terminalScroll() + scrollCheckAndSet() proc terminalWrite*(data: string) = for character in data: