Prevented zeroing of memory beyond the 8bit input.

This commit is contained in:
neviyn 2017-10-21 16:31:41 +01:00
parent 90eba82c39
commit eee9b56f86

View File

@ -34,11 +34,11 @@ var
proc terminalWriteAtPoint(writeChar: char, colour: int, xPos: int, yPos: int) = proc terminalWriteAtPoint(writeChar: char, colour: int, xPos: int, yPos: int) =
let index = terminalBufferBaseAddress + (yPos * vgaWidth + (xPos * 2)) let index = terminalBufferBaseAddress + (yPos * vgaWidth + (xPos * 2))
cast[ptr int](index)[] = int(writeChar) # Write directly to display memory cast[ptr int8](index)[] = int8(writeChar) # Write directly to display memory
cast[ptr int](index+1)[] = terminalColour cast[ptr int8](index+1)[] = int8(terminalColour)
proc terminalInitialize() = proc terminalInitialize() =
terminalColour = vgaEntryColour(VGA_Colour.white, VGA_Colour.black) terminalColour = vgaEntryColour(VGA_Colour.lightGreen, VGA_Colour.red)
for y in 0..<vgaWidth: for y in 0..<vgaWidth:
for x in 0..<vgaHeight: for x in 0..<vgaHeight:
terminalWriteAtPoint(' ', terminalColour, x, y) terminalWriteAtPoint(' ', terminalColour, x, y)
@ -64,5 +64,5 @@ proc terminalWrite(data: string) =
proc kernelMain() {.exportc: "kernel_main"}= proc kernelMain() {.exportc: "kernel_main"}=
terminalInitialize() terminalInitialize()
terminalWrite("Hello World This is Nim!") terminalWrite("Hello World\LThis is Nim!")