diff --git a/kernel/arch/i386/tty.nim b/kernel/arch/i386/tty.nim index 90aee3f..baf7c3f 100644 --- a/kernel/arch/i386/tty.nim +++ b/kernel/arch/i386/tty.nim @@ -1,18 +1,21 @@ import vga +type + VGAMemory = ptr array[0..2000, VGADoubleByte] + const vgaWidth = 80 vgaHeight = 25 terminalBufferBaseAddress = 0xB8000 - bufferWidthSkip = vgaWidth * 2 + vgaMem = cast[VGAMemory](terminalBufferBaseAddress) var terminalRow, terminalColumn = 0 terminalColour: int proc terminalWriteAtPoint(writeChar: char, colour: int, xPos: int, yPos: int) = - let index = terminalBufferBaseAddress + (yPos * bufferWidthSkip + (xPos * 2)) - cast[ptr int16](index)[] = vga.vgaEntry(writeChar, terminalColour) + let index = yPos * vgaWidth + xPos + vgaMem[index] = vga.vgaEntry(writeChar, terminalColour) proc terminalClear*() = for x in 0..