Add a debug output utility.
This commit is contained in:
parent
c2af2eee97
commit
872e6f3392
|
@ -1,6 +1,12 @@
|
||||||
add_executable(zion
|
add_executable(zion
|
||||||
|
debug/debug.cpp
|
||||||
zion.cpp)
|
zion.cpp)
|
||||||
|
|
||||||
|
target_include_directories(zion
|
||||||
|
PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
# -c -- Don't run the linker.
|
# -c -- Don't run the linker.
|
||||||
# -nostdlib -- Don't include the standard library.
|
# -nostdlib -- Don't include the standard library.
|
||||||
# -mabi=sysv -- Explicitly specify the ABI since we will rely on it.
|
# -mabi=sysv -- Explicitly specify the ABI since we will rely on it.
|
||||||
|
|
|
@ -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');
|
||||||
|
}
|
|
@ -0,0 +1,3 @@
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
void dbgln(const char *str);
|
|
@ -1,11 +1,9 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "common/port.h"
|
#include "debug/debug.h"
|
||||||
|
|
||||||
#define COM1 0x3f8
|
|
||||||
|
|
||||||
extern "C" void zion() {
|
extern "C" void zion() {
|
||||||
outb(COM1, 'a');
|
dbgln("Hello World!");
|
||||||
|
|
||||||
while (1)
|
while (1)
|
||||||
;
|
;
|
||||||
|
|
Loading…
Reference in New Issue