From 30c76c17c9481bf95df91b9d9974bdd4ccb7098f Mon Sep 17 00:00:00 2001 From: Nathan Cannon Date: Fri, 20 Oct 2017 18:00:17 +0100 Subject: [PATCH] Added terminal init method. --- kernel.nim | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/kernel.nim b/kernel.nim index 26a6afb..f883f1b 100644 --- a/kernel.nim +++ b/kernel.nim @@ -17,12 +17,23 @@ type lightBrown = 14, white = 15 -proc vga_entry_colour(fg: VGA_Colour, bg: VGA_Colour): uint8 = +proc vgaEntryColour(fg: VGA_Colour, bg: VGA_Colour): uint8 = result = uint8(ord(fg) or (ord(bg) shl 4)) -proc vga_entry(c: char, colour: uint8): uint16 = - result = uint8(c) or (colour shl 8) +proc vgaEntry(c: char, colour: uint8): uint16 = + result = uint16(uint8(c) or (colour shl 8)) const vgaWidth = 80 vgaHeight = 25 + terminalBufferBaseAddress = 0xB8000 + +var + terminalRow, terminalColumn = 0 + terminalColour = vgaEntryColour(VGA_Colour.lightGrey, VGA_Colour.black) + +proc terminalInitialize() = + for y in 0..