Added proc to write characters to terminal.
This commit is contained in:
parent
30c76c17c9
commit
ba0e9982c9
17
kernel.nim
17
kernel.nim
@ -32,8 +32,21 @@ var
|
|||||||
terminalRow, terminalColumn = 0
|
terminalRow, terminalColumn = 0
|
||||||
terminalColour = vgaEntryColour(VGA_Colour.lightGrey, VGA_Colour.black)
|
terminalColour = vgaEntryColour(VGA_Colour.lightGrey, VGA_Colour.black)
|
||||||
|
|
||||||
|
proc terminalWriteAtPoint(writeChar: char, colour: uint8, xPos: int, yPos: int) =
|
||||||
|
let index = terminalBufferBaseAddress + (yPos * vgaWidth + xPos)
|
||||||
|
cast[ptr uint16](index)[] = vgaEntry(' ', terminalColour) # Write directly to display memory
|
||||||
|
|
||||||
proc terminalInitialize() =
|
proc terminalInitialize() =
|
||||||
for y in 0..<vgaWidth:
|
for y in 0..<vgaWidth:
|
||||||
for x in 0..<vgaHeight:
|
for x in 0..<vgaHeight:
|
||||||
let index = terminalBufferBaseAddress + (y * vgaWidth + x)
|
terminalWriteAtPoint(' ', terminalColour, x, y)
|
||||||
cast[ptr uint16](index)[] = vgaEntry(' ', terminalColour) # Write directly to display memory
|
|
||||||
|
proc setTerminalColour(newColour: uint8) =
|
||||||
|
terminalColour = newColour
|
||||||
|
|
||||||
|
proc terminalWriteChar(writeChar: char) =
|
||||||
|
terminalWriteAtPoint(writeChar, terminalColour, terminalColumn, terminalRow)
|
||||||
|
inc(terminalColumn)
|
||||||
|
inc(terminalRow)
|
||||||
|
if(terminalColumn == vgaWidth): terminalColumn = 0
|
||||||
|
if(terminalRow == vgaHeight): terminalRow = 0
|
||||||
|
Loading…
Reference in New Issue
Block a user