diff --git a/zion/CMakeLists.txt b/zion/CMakeLists.txt index 45734b4..eb74bc5 100644 --- a/zion/CMakeLists.txt +++ b/zion/CMakeLists.txt @@ -1,6 +1,12 @@ add_executable(zion + debug/debug.cpp zion.cpp) +target_include_directories(zion + PRIVATE + ${CMAKE_CURRENT_SOURCE_DIR} + ) + # -c -- Don't run the linker. # -nostdlib -- Don't include the standard library. # -mabi=sysv -- Explicitly specify the ABI since we will rely on it. diff --git a/zion/debug/debug.cpp b/zion/debug/debug.cpp new file mode 100644 index 0000000..856765e --- /dev/null +++ b/zion/debug/debug.cpp @@ -0,0 +1,13 @@ +#include "debug/debug.h" + +#include "common/port.h" + +#define COM1 0x3f8 + +void dbgln(const char* str) { + while (*str != 0) { + outb(COM1, *str); + str++; + } + outb(COM1, '\n'); +} diff --git a/zion/debug/debug.h b/zion/debug/debug.h new file mode 100644 index 0000000..634a3b7 --- /dev/null +++ b/zion/debug/debug.h @@ -0,0 +1,3 @@ +#pragma once + +void dbgln(const char *str); diff --git a/zion/zion.cpp b/zion/zion.cpp index 8e59f54..c4d5aab 100644 --- a/zion/zion.cpp +++ b/zion/zion.cpp @@ -1,11 +1,9 @@ #include -#include "common/port.h" - -#define COM1 0x3f8 +#include "debug/debug.h" extern "C" void zion() { - outb(COM1, 'a'); + dbgln("Hello World!"); while (1) ;