Remove C usage
This commit is contained in:
parent
edbc39cc3b
commit
a03745805b
@ -20,8 +20,8 @@ proc terminalWriteAtPoint(writeChar: char, colour: int, xPos: int, yPos: int) =
|
||||
vgaMem[index] = vga.vgaEntry(writeChar, terminalColour)
|
||||
|
||||
proc terminalClear*() =
|
||||
for x in 0..<vgaWidth:
|
||||
for y in 0..<vgaHeight:
|
||||
for x in 0 .. vgaWidth - 1:
|
||||
for y in 0 .. vgaHeight - 1:
|
||||
terminalWriteAtPoint(' ', terminalColour, x, y)
|
||||
terminalRow = 0
|
||||
terminalColumn = 0
|
||||
@ -31,12 +31,12 @@ proc terminalInitialize*() =
|
||||
terminalClear()
|
||||
|
||||
proc terminalScroll() =
|
||||
for y in 0..< (vgaHeight - 1):
|
||||
for y in 0 .. (vgaHeight - 2):
|
||||
let base1 = y * vgaWidth
|
||||
let base2 = (y + 1) * vgaWidth
|
||||
for x in 0..<vgaWidth:
|
||||
for x in 0 .. vgaWidth - 1:
|
||||
vgaMem[base1 + x] = vgaMem[base2 + x]
|
||||
for x in 0..<vgaWidth: # Blank the "new" bottom line
|
||||
for x in 0 .. vgaWidth - 1: # Blank the "new" bottom line
|
||||
terminalWriteAtPoint(' ', terminalColour, x, vgaHeight - 1)
|
||||
|
||||
proc setTerminalColour(newColour: int) =
|
||||
@ -59,8 +59,8 @@ proc terminalWriteChar(writeChar: char) =
|
||||
scrollCheckAndSet()
|
||||
|
||||
proc terminalWrite*(data: string) =
|
||||
for character in data:
|
||||
terminalWriteChar(character)
|
||||
for i in 0 .. data.len - 1:
|
||||
terminalWriteChar(data[i])
|
||||
|
||||
proc terminalWrite*(data: char) =
|
||||
terminalWriteChar(data)
|
||||
|
@ -1,17 +1,12 @@
|
||||
|
||||
{.push debugger:off, hints:off.}
|
||||
|
||||
proc printf(frmt: cstring) {.varargs, importc, header: "<stdio.h>", cdecl.}
|
||||
proc exit(code: int) {.importc, header: "<stdlib.h>", cdecl.}
|
||||
import tty
|
||||
|
||||
{.push stack_trace: off, profiler:off.}
|
||||
|
||||
proc rawoutput(s: string) =
|
||||
printf("%s\n", s)
|
||||
tty.terminalWrite(s)
|
||||
|
||||
proc panic(s: string) =
|
||||
rawoutput(s)
|
||||
exit(1)
|
||||
|
||||
# Alternatively we also could implement these 2 here:
|
||||
#
|
||||
@ -19,4 +14,3 @@ proc panic(s: string) =
|
||||
# template sysFatal(exceptn: typeDesc, message, arg: string)
|
||||
|
||||
{.pop.}
|
||||
{.pop.}
|
4
nim.cfg
4
nim.cfg
@ -5,6 +5,6 @@
|
||||
--path:"kernel/arch/i386"
|
||||
--cpu:i386
|
||||
--os:standalone
|
||||
--passC:"-ffreestanding -nostdlib --target=i386-pc-none-elf -march=i386 -lc"
|
||||
--passL:"-ffreestanding -target i386 -nostdlib -T ./kernel/arch/i386/linker.ld boot.o -lc"
|
||||
--passC:"-ffreestanding -nostdlib --target=i386-pc-none-elf -march=i386"
|
||||
--passL:"-ffreestanding -target i386 -nostdlib -T ./kernel/arch/i386/linker.ld boot.o"
|
||||
--out:"myos.bin"
|
||||
|
Loading…
Reference in New Issue
Block a user