From e871378f8ff6da3bc222508f962067df68a109dc Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Sun, 22 Oct 2017 00:22:32 +0100 Subject: [PATCH] Added printing of ints to the screen. --- kernel/arch/i386/tty.nim | 53 ++++++++++++++++++++++++++++++++++------ kernel/kernel.nim | 4 ++- 2 files changed, 49 insertions(+), 8 deletions(-) diff --git a/kernel/arch/i386/tty.nim b/kernel/arch/i386/tty.nim index c70dc8c..98086e9 100644 --- a/kernel/arch/i386/tty.nim +++ b/kernel/arch/i386/tty.nim @@ -12,30 +12,69 @@ var proc terminalWriteAtPoint(writeChar: char, colour: int, xPos: int, yPos: int) = let index = terminalBufferBaseAddress + (yPos * bufferWidthSkip + (xPos * 2)) - cast[ptr int16](index)[] = vga.vgaEntry(writeChar, terminalColour) # Write directly to display memory + cast[ptr int16](index)[] = vga.vgaEntry(writeChar, terminalColour) -proc terminalInitialize*() = - terminalColour = vgaEntryColour(VGA_Colour.lightGreen, VGA_Colour.red) +proc terminalClear*() = for x in 0.. 0): + let parsedChar: char = char(48 + (input mod 10)) + parsedData[i] = parsedChar + i = i + 1 + input = input div 10 + while i > 0: + i = i - 1 + terminalWrite(parsedData[i]) + diff --git a/kernel/kernel.nim b/kernel/kernel.nim index f444e0c..eb37f8d 100644 --- a/kernel/kernel.nim +++ b/kernel/kernel.nim @@ -2,4 +2,6 @@ import tty proc kernelMain() {.exportc: "kernel_main"}= terminalInitialize() - terminalWrite("Hello World!\LNim here!") + terminalWrite("Hello World!\LNim here!\L") + for i in 0..10: + terminalWrite(i)