Simplified writing to VGA so as to not use 2 separate 8bit inserts. Now using a single 16bit insert.
This commit is contained in:
parent
7faa974542
commit
4d19433c17
@ -20,8 +20,8 @@ type
|
|||||||
proc vgaEntryColour(fg: VGA_Colour, bg: VGA_Colour): int =
|
proc vgaEntryColour(fg: VGA_Colour, bg: VGA_Colour): int =
|
||||||
result = ord(fg) or (ord(bg) shl 4)
|
result = ord(fg) or (ord(bg) shl 4)
|
||||||
|
|
||||||
proc vgaEntry(c: char, colour: uint8): uint16 =
|
proc vgaEntry(c: char, colour: int): int16 =
|
||||||
result = uint16(c) or (uint16(colour) shl 8)
|
result = int16(int(c) or (colour shl 8))
|
||||||
|
|
||||||
const
|
const
|
||||||
vgaWidth = 80
|
vgaWidth = 80
|
||||||
@ -34,8 +34,7 @@ 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 int8](index)[] = int8(writeChar) # Write directly to display memory
|
cast[ptr int16](index)[] = vgaEntry(writeChar, terminalColour) # Write directly to display memory
|
||||||
cast[ptr int8](index+1)[] = int8(terminalColour)
|
|
||||||
|
|
||||||
proc terminalInitialize() =
|
proc terminalInitialize() =
|
||||||
terminalColour = vgaEntryColour(VGA_Colour.lightGreen, VGA_Colour.red)
|
terminalColour = vgaEntryColour(VGA_Colour.lightGreen, VGA_Colour.red)
|
||||||
|
Loading…
Reference in New Issue
Block a user