import vga const vgaWidth = 80 vgaHeight = 25 type VGAMemory = ptr array[0..(vgaWidth * vgaHeight - 1), VGADoubleByte] const terminalBufferBaseAddress = 0xB8000 vgaMem = cast[VGAMemory](terminalBufferBaseAddress) var terminalRow, terminalColumn = 0 terminalColour: int proc terminalWriteAtPoint(writeChar: char, colour: int, xPos: int, yPos: int) = let index = yPos * vgaWidth + xPos vgaMem[index] = vga.vgaEntry(writeChar, terminalColour) proc terminalClear*() = for x in 0.. 0: i = i - 1 terminalWrite(parsedData[i]) proc terminalWrite*(data: SomeUnsignedInt) = if(data == 0): terminalWrite('0') return var input = data var i = 0 while(input != 0): let parsedChar: char = char(48'u + (input mod 10)) parsedData[i] = parsedChar i = i + 1 input = input div 10 while i > 0: i = i - 1 terminalWrite(parsedData[i])