1
0
Fork 0
forked from AbleOS/ableos
ableos_time/sysdata/programs/a_serial_driver/src/main.hb

33 lines
685 B
Plaintext
Raw Normal View History

stn := @use("../../../libraries/stn/src/lib.hb");
.{log, string, memory, buffer} := stn
2024-05-23 16:59:17 -05:00
serial_print := fn(ptr: ^u8): void {
letter := 0
loop if *ptr == 0 break else {
letter = *ptr
memory.outb(3, 248, letter)
ptr += 1
}
return
}
serial_println := fn(ptr: ^u8): void {
serial_print(ptr)
memory.outb(3, 248, 12)
memory.outb(3, 248, 13)
return
}
main := fn(): int {
// This must be done first and foremost to prevent racing
a := buffer.create("XNumber\0")
serial_println("Starting Serial Driver.\0")
// Note that the first byte is reserved, pad accordingly.
b := buffer.search("XNumber\0")
if a == b {
serial_println("Stopping Serial Driver.\0")
}
return 0
2024-05-23 16:59:17 -05:00
}