duskos

dusk os fork
git clone git://git.alexwennerberg.com/duskos
Log | Files | Refs | README | LICENSE

commit 85e3d4c688e0a602ea70e1f64b4c5a6b9ed75354
parent 341f8d6de2e4401ec853bb099d120657dfd911ac
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Thu, 26 Jan 2023 14:24:52 -0500

sys/kbd: document unit and remove unused KeyboardIn

Diffstat:
Mfs/doc/dict.txt | 6------
Afs/doc/sys/kbd.txt | 21+++++++++++++++++++++
Mfs/doc/usage.txt | 13+++----------
Mfs/sys/kbd.fs | 4----
4 files changed, 24 insertions(+), 20 deletions(-)

diff --git a/fs/doc/dict.txt b/fs/doc/dict.txt @@ -363,9 +363,3 @@ to@ --> @ to@! --> @! to@+ --> @@+ to!+ --> @!+ - -## sys/kbd - -key? -- c? f Poll system interactive input source for keypress. If - there is one, f=1 and c is set. Otherwise, f=0. -key -- c Read next character from system interactive input source. diff --git a/fs/doc/sys/kbd.txt b/fs/doc/sys/kbd.txt @@ -0,0 +1,21 @@ +# Keyboard subsystem + +The keyboard subsystem lives at /sys/kbd.fs and wraps drivers providing +interactive input. Although the name of the subsystem is "keyboard", it's for +any kind of interactive input, not only keyboards. The name "keyboard" was +chosen because the traditional Forth word for interactive input is "key" and we +wanted to stay consistent with that. Also, "input" is bland and vague. + +## API + +Driver aliases: + +key? ( -- c? f ) + Poll the input for an incoming key. If a key was pressed, f=1 and c is + present. Otherwise, f=0 and c is absent. + +Words: + +key ( -- c ) + Repeatedly poll "key?" until there's a result and return that result. "idle" + is called repeatedly during this loop. diff --git a/fs/doc/usage.txt b/fs/doc/usage.txt @@ -326,15 +326,8 @@ They're used everywhere and you should know about them. ## Input/Output The system interpret loop feeds itself from the Console, a struct extending IO -(see sys/io). A barebone interactive system will have KeyboardIn from sys/kbd -plugged in there. This subsystem implements "key?" ( -- c? f ), a word that -polls the input device for a new key. This is where the driver will plug -generally plug itself into. - -On a regular system, sys/rdln will wrap "key" ( -- c ), a word also defined in -sys/kbd that is the blocking version of "key?", and create RdlnIn, which -replaces KeyboardIn as the Console's readio and reads a full line before -interpreting. +(see sys/io). On a regular system, sys/rdln will wrap sys/kbd's "key" and read +a full line (allowing backspaces) before feeding it to the interpreter. System output happens through the Console as well. On a system with a screen, sys/grid implements the Grid which extends IO and can be plugged into it. A @@ -342,7 +335,7 @@ system with a serial console has no subsystem to handle it and will proceed in more adhoc ways to create a Console structure. You can see an example in xcomp/i386/pc/inittest.fs. -doc/sys/io describes this in more details. +For more details, read sys/io, sys/rdln and sys/kbd. ## Loading files diff --git a/fs/sys/kbd.fs b/fs/sys/kbd.fs @@ -4,7 +4,3 @@ alias abort key? : key begin idle key? until ; -create _buf 1 allot -: _readbuf ( n hdl -- a? read-n ) - 2drop key? if _buf c! _buf 1 else 0 then ; -create KeyboardIn 0 , ' _readbuf , ' _ioerr , ' _ioerr ,