From c3ca04dd5ad55797db342760c46929843e4c1b27 Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Sat, 21 Oct 2017 18:35:13 +0100 Subject: [PATCH] Added x2 multiplication for row placement. Means newlines actually work properly. --- kernel.nim | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/kernel.nim b/kernel.nim index bb1f548..83684c3 100644 --- a/kernel.nim +++ b/kernel.nim @@ -27,19 +27,20 @@ const vgaWidth = 80 vgaHeight = 25 terminalBufferBaseAddress = 0xB8000 + bufferWidthSkip = vgaWidth * 2 var terminalRow, terminalColumn = 0 terminalColour: int proc terminalWriteAtPoint(writeChar: char, colour: int, xPos: int, yPos: int) = - let index = terminalBufferBaseAddress + (yPos * vgaWidth + (xPos * 2)) + let index = terminalBufferBaseAddress + (yPos * bufferWidthSkip + (xPos * 2)) cast[ptr int16](index)[] = vgaEntry(writeChar, terminalColour) # Write directly to display memory proc terminalInitialize() = terminalColour = vgaEntryColour(VGA_Colour.lightGreen, VGA_Colour.red) - for y in 0..