Added integer hash function. Other minor changes.

This commit is contained in:
neviyn 2018-05-01 19:24:29 +01:00
parent d8750b74f8
commit fad439c25e
5 changed files with 13 additions and 18 deletions

View File

@ -0,0 +1,9 @@
const
FNVPrime = 16777619'u32
FNVOffsetBasis = 0x811c9dc5'u32
proc fnv1a*(data: varargs[uint8]): uint32 =
result = FNVOffsetBasis
for i in data:
result = result xor i
result = result * FNVPrime

View File

@ -56,7 +56,7 @@ proc isrCommon(){.asmNoStackFrame,exportc.} =
"""
]#
macro generateISR(code: static[uint8], isError: static[bool]): typed =
macro generateISR(code: static[int], isError: static[bool]): typed =
result = nnkStmtList.newTree(
nnkProcDef.newTree(
newIdentNode("isr" & $code),

View File

@ -1,5 +1,6 @@
/* http://wiki.osdev.org/Bare_Bones#Linking_the_Kernel */
ENTRY(_start)
OUTPUT_FORMAT(elf32-i386)
SECTIONS
{

View File

@ -1,16 +0,0 @@
import io
const keyboardAddress = 0x60
type
KeypressEvent* = tuple
character: char
pressed: bool
proc getScancode(): char =
while true:
let c = io.inb(keyboardAddress)
if(c > 0): return c
proc getChar*(): char =
discard # TODO: Implement lookup to a scan table to get actual character

View File

@ -7,4 +7,5 @@ deadCodeElim=on
boundChecks=on
gc=regions
cpu=i386
os=standalone
os=standalone
verbosity=2