diff --git a/kernel.nim b/kernel.nim index cab13f5..bb1f548 100644 --- a/kernel.nim +++ b/kernel.nim @@ -20,8 +20,8 @@ type proc vgaEntryColour(fg: VGA_Colour, bg: VGA_Colour): int = result = ord(fg) or (ord(bg) shl 4) -proc vgaEntry(c: char, colour: uint8): uint16 = - result = uint16(c) or (uint16(colour) shl 8) +proc vgaEntry(c: char, colour: int): int16 = + result = int16(int(c) or (colour shl 8)) const vgaWidth = 80 @@ -34,8 +34,7 @@ var proc terminalWriteAtPoint(writeChar: char, colour: int, xPos: int, yPos: int) = let index = terminalBufferBaseAddress + (yPos * vgaWidth + (xPos * 2)) - cast[ptr int8](index)[] = int8(writeChar) # Write directly to display memory - cast[ptr int8](index+1)[] = int8(terminalColour) + cast[ptr int16](index)[] = vgaEntry(writeChar, terminalColour) # Write directly to display memory proc terminalInitialize() = terminalColour = vgaEntryColour(VGA_Colour.lightGreen, VGA_Colour.red)