duskos

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

commit 04cc8436486a42e870c09a18228fbd31a01e9432
parent 833d27e6cbd20bace681edfc95fdc948e02c12b6
Author: Virgil Dupras <hsoft@hardcoded.net>
Date:   Thu, 19 Jan 2023 16:42:57 -0500

drv/pc/com: add IO interface

This is my first non-cheating commit developed from within Dusk! I don't have a
xmodem implementation, but by having minicom in "capture" mode on the POSIX side
and, on the other side, by doing:

    f" drv/pc/com.fs"
    com1 :self file :spit

then I could transfer the file (using, of course, the IO interface I have just
added).

Doing so, I've hit multiple major irritations which have all bumped xmodem
implementation in priority, so I'll get to that...

Diffstat:
Mfs/drv/pc/com.fs | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/fs/drv/pc/com.fs b/fs/drv/pc/com.fs @@ -16,3 +16,13 @@ $3f8 const COMPORT : com>? ( -- c? f ) COMPORT 5 + pc@ 1 and dup if COMPORT pc@ swap then ; : com> ( -- c ) begin com>? until ; + +extends IO struct[ COM1 + create _buf 0 c, + : _readbuf ( n self -- a? read-n ) + 2drop com>? if _buf tuck c! 1 else 0 then ; + : _writebuf ( a n self -- written-n ) + 2drop c@ >com 1 ; + : :new here 0 , ['] _readbuf , ['] _writebuf , ['] drop dup , , ; +]struct +COM1 :new structbind COM1 com1 +\ No newline at end of file