From 5b6a4e14421a2702437adc1a4ae7defa815659f8 Mon Sep 17 00:00:00 2001 From: Byron Lathi Date: Tue, 28 Nov 2023 23:52:27 -0800 Subject: [PATCH] Start terminal driver --- sw/kernel/devices/terminal.h | 13 ++++++++++++ sw/kernel/devices/terminal.s | 41 ++++++++++++++++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 sw/kernel/devices/terminal.h create mode 100644 sw/kernel/devices/terminal.s diff --git a/sw/kernel/devices/terminal.h b/sw/kernel/devices/terminal.h new file mode 100644 index 0000000..42a9864 --- /dev/null +++ b/sw/kernel/devices/terminal.h @@ -0,0 +1,13 @@ +#ifndef _TERMINAL_H +#define _TERMINAL_H + +#include + +int8_t terminal_read(uint8_t fd, void* buf, uint8_t nbytes); +int8_t terminal_write(uint8_t fd, const void* buf, uint8_t nbytes); +int8_t terminal_open(const uint8_t* filename); +int8_t terminal_close(uint8_t fd); + + +#endif /* _TERMINAL_H */ + diff --git a/sw/kernel/devices/terminal.s b/sw/kernel/devices/terminal.s new file mode 100644 index 0000000..56351cb --- /dev/null +++ b/sw/kernel/devices/terminal.s @@ -0,0 +1,41 @@ +.MACPACK generic + +.autoimport + +.export _terminal_read, _terminal_write, _terminal_open, _terminal_close + +.data + +terminal_buf: .res 128 + +.code + +.proc _terminal_read + +.endproc + +.proc _terminal_write + +.endproc + +; terminal_open +; open terminal device +; Inputs: uint8_t* filename +; Outputs: none +; Return Value: 0 on success +; Function: none. +.proc _terminal_open + lda #$0 + rts +.endproc + +; terminal_close +; close terminal device +; Inputs: int32_t fd +; Outputs: none +; Return Value: 0 on success (but this always failes) +; Function: none. +.proc _terminal_close + lda #$ff ; -1 + rts +.endproc \ No newline at end of file